{"action":"created","comment":{"url":"https://api.github.com/repos/juttle/juttle-engine/pulls/comments/55776961","id":55776961,"diff_hunk":"@@ -1,6 +1,55 @@\n-input npm_package: text -default \"juttle\";\n+input npm_package: text -default \"juttle\" -label \"NPM Package\";\n+input start: date -default :today: - :2 years: -label \"Start Date\";\n+input end:   date -default :today: -label \"End Date\";\n \n-read http -url 'https://api.npmjs.org/downloads/range/last-month/${npm_package}' -timeField \"day\" -rootPath \"downloads\"\n-    | put package=npm_package\n-    | view timechart -keyField \"package\" -series [{name: npm_package, geom: 'bars'}] -yScales.primary.label \"Number of NPM Downloads\"\n+function dayof(date) {\n+    return Date.format(date, \"YYYY-MM-DD\");\n+}\n \n+// fetch the data\n+sub fetch() {\n+    read http -url 'https://api.npmjs.org/downloads/range/${dayof(start)}:${dayof(end)}/${npm_package}' -timeField \"day\" -rootPath \"downloads\"\n+}\n+\n+// add a simple title using markdown\n+sub title() {\n+    emit -points [{title: '## Download Counts for ${npm_package}'}]\n+    | view markdown\n+}\n+\n+// Sum up the data by the given interval\n+sub rollup(interval) {\n+    reduce -every interval value=sum(downloads)\n+    | put name='downloads'\n+}\n+\n+// Add a rolling average series\n+sub trend(window, label) {\n+    (pass; reduce -every :1d: -over window value=Math.floor(avg(value)), name=label)\n+    | (pass; view text)","path":"examples/core-juttle/npm_download_counts.juttle","position":33,"original_position":33,"commit_id":"fd946e62c804c616dd8dbdcae0eb7b69a51c01b1","original_commit_id":"fd946e62c804c616dd8dbdcae0eb7b69a51c01b1","user":{"login":"dmehra","id":5817365,"avatar_url":"https://avatars.githubusercontent.com/u/5817365?v=3","gravatar_id":"","url":"https://api.github.com/users/dmehra","html_url":"https://github.com/dmehra","followers_url":"https://api.github.com/users/dmehra/followers","following_url":"https://api.github.com/users/dmehra/following{/other_user}","gists_url":"https://api.github.com/users/dmehra/gists{/gist_id}","starred_url":"https://api.github.com/users/dmehra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmehra/subscriptions","organizations_url":"https://api.github.com/users/dmehra/orgs","repos_url":"https://api.github.com/users/dmehra/repos","events_url":"https://api.github.com/users/dmehra/events{/privacy}","received_events_url":"https://api.github.com/users/dmehra/received_events","type":"User","site_admin":false},"body":"is that a debug line?","created_at":"2016-03-11T01:12:29Z","updated_at":"2016-03-11T01:12:29Z","html_url":"https://github.com/juttle/juttle-engine/pull/84#discussion_r55776961","pull_request_url":"https://api.github.com/repos/juttle/juttle-engine/pulls/84","_links":{"self":{"href":"https://api.github.com/repos/juttle/juttle-engine/pulls/comments/55776961"},"html":{"href":"https://github.com/juttle/juttle-engine/pull/84#discussion_r55776961"},"pull_request":{"href":"https://api.github.com/repos/juttle/juttle-engine/pulls/84"}}},"pull_request":{"url":"https://api.github.com/repos/juttle/juttle-engine/pulls/84","id":62481727,"html_url":"https://github.com/juttle/juttle-engine/pull/84","diff_url":"https://github.com/juttle/juttle-engine/pull/84.diff","patch_url":"https://github.com/juttle/juttle-engine/pull/84.patch","issue_url":"https://api.github.com/repos/juttle/juttle-engine/issues/84","number":84,"state":"open","locked":false,"title":"examples: beef up the npm download counts example","user":{"login":"demmer","id":3308504,"avatar_url":"https://avatars.githubusercontent.com/u/3308504?v=3","gravatar_id":"","url":"https://api.github.com/users/demmer","html_url":"https://github.com/demmer","followers_url":"https://api.github.com/users/demmer/followers","following_url":"https://api.github.com/users/demmer/following{/other_user}","gists_url":"https://api.github.com/users/demmer/gists{/gist_id}","starred_url":"https://api.github.com/users/demmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/demmer/subscriptions","organizations_url":"https://api.github.com/users/demmer/orgs","repos_url":"https://api.github.com/users/demmer/repos","events_url":"https://api.github.com/users/demmer/events{/privacy}","received_events_url":"https://api.github.com/users/demmer/received_events","type":"User","site_admin":false},"body":"Instead of showing a single chart, update it to show one per interval and a moving average trendline.\r\n","created_at":"2016-03-11T00:48:38Z","updated_at":"2016-03-11T01:12:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4cbe1617645a024e49b096c9f4b5d157cff5d355","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/juttle/juttle-engine/pulls/84/commits","review_comments_url":"https://api.github.com/repos/juttle/juttle-engine/pulls/84/comments","review_comment_url":"https://api.github.com/repos/juttle/juttle-engine/pulls/comments{/number}","comments_url":"https://api.github.com/repos/juttle/juttle-engine/issues/84/comments","statuses_url":"https://api.github.com/repos/juttle/juttle-engine/statuses/fd946e62c804c616dd8dbdcae0eb7b69a51c01b1","head":{"label":"juttle:enhance-npm-download-counts-example","ref":"enhance-npm-download-counts-example","sha":"fd946e62c804c616dd8dbdcae0eb7b69a51c01b1","user":{"login":"juttle","id":8988633,"avatar_url":"https://avatars.githubusercontent.com/u/8988633?v=3","gravatar_id":"","url":"https://api.github.com/users/juttle","html_url":"https://github.com/juttle","followers_url":"https://api.github.com/users/juttle/followers","following_url":"https://api.github.com/users/juttle/following{/other_user}","gists_url":"https://api.github.com/users/juttle/gists{/gist_id}","starred_url":"https://api.github.com/users/juttle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juttle/subscriptions","organizations_url":"https://api.github.com/users/juttle/orgs","repos_url":"https://api.github.com/users/juttle/repos","events_url":"https://api.github.com/users/juttle/events{/privacy}","received_events_url":"https://api.github.com/users/juttle/received_events","type":"Organization","site_admin":false},"repo":{"id":51180780,"name":"juttle-engine","full_name":"juttle/juttle-engine","owner":{"login":"juttle","id":8988633,"avatar_url":"https://avatars.githubusercontent.com/u/8988633?v=3","gravatar_id":"","url":"https://api.github.com/users/juttle","html_url":"https://github.com/juttle","followers_url":"https://api.github.com/users/juttle/followers","following_url":"https://api.github.com/users/juttle/following{/other_user}","gists_url":"https://api.github.com/users/juttle/gists{/gist_id}","starred_url":"https://api.github.com/users/juttle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juttle/subscriptions","organizations_url":"https://api.github.com/users/juttle/orgs","repos_url":"https://api.github.com/users/juttle/repos","events_url":"https://api.github.com/users/juttle/events{/privacy}","received_events_url":"https://api.github.com/users/juttle/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/juttle/juttle-engine","description":"juttle execution engine","fork":false,"url":"https://api.github.com/repos/juttle/juttle-engine","forks_url":"https://api.github.com/repos/juttle/juttle-engine/forks","keys_url":"https://api.github.com/repos/juttle/juttle-engine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/juttle/juttle-engine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/juttle/juttle-engine/teams","hooks_url":"https://api.github.com/repos/juttle/juttle-engine/hooks","issue_events_url":"https://api.github.com/repos/juttle/juttle-engine/issues/events{/number}","events_url":"https://api.github.com/repos/juttle/juttle-engine/events","assignees_url":"https://api.github.com/repos/juttle/juttle-engine/assignees{/user}","branches_url":"https://api.github.com/repos/juttle/juttle-engine/branches{/branch}","tags_url":"https://api.github.com/repos/juttle/juttle-engine/tags","blobs_url":"https://api.github.com/repos/juttle/juttle-engine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/juttle/juttle-engine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/juttle/juttle-engine/git/refs{/sha}","trees_url":"https://api.github.com/repos/juttle/juttle-engine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/juttle/juttle-engine/statuses/{sha}","languages_url":"https://api.github.com/repos/juttle/juttle-engine/languages","stargazers_url":"https://api.github.com/repos/juttle/juttle-engine/stargazers","contributors_url":"https://api.github.com/repos/juttle/juttle-engine/contributors","subscribers_url":"https://api.github.com/repos/juttle/juttle-engine/subscribers","subscription_url":"https://api.github.com/repos/juttle/juttle-engine/subscription","commits_url":"https://api.github.com/repos/juttle/juttle-engine/commits{/sha}","git_commits_url":"https://api.github.com/repos/juttle/juttle-engine/git/commits{/sha}","comments_url":"https://api.github.com/repos/juttle/juttle-engine/comments{/number}","issue_comment_url":"https://api.github.com/repos/juttle/juttle-engine/issues/comments{/number}","contents_url":"https://api.github.com/repos/juttle/juttle-engine/contents/{+path}","compare_url":"https://api.github.com/repos/juttle/juttle-engine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/juttle/juttle-engine/merges","archive_url":"https://api.github.com/repos/juttle/juttle-engine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/juttle/juttle-engine/downloads","issues_url":"https://api.github.com/repos/juttle/juttle-engine/issues{/number}","pulls_url":"https://api.github.com/repos/juttle/juttle-engine/pulls{/number}","milestones_url":"https://api.github.com/repos/juttle/juttle-engine/milestones{/number}","notifications_url":"https://api.github.com/repos/juttle/juttle-engine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/juttle/juttle-engine/labels{/name}","releases_url":"https://api.github.com/repos/juttle/juttle-engine/releases{/id}","deployments_url":"https://api.github.com/repos/juttle/juttle-engine/deployments","created_at":"2016-02-05T23:29:37Z","updated_at":"2016-03-09T19:43:11Z","pushed_at":"2016-03-11T00:48:39Z","git_url":"git://github.com/juttle/juttle-engine.git","ssh_url":"git@github.com:juttle/juttle-engine.git","clone_url":"https://github.com/juttle/juttle-engine.git","svn_url":"https://github.com/juttle/juttle-engine","homepage":null,"size":46565,"stargazers_count":5,"watchers_count":5,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":22,"forks":0,"open_issues":22,"watchers":5,"default_branch":"master"}},"base":{"label":"juttle:master","ref":"master","sha":"952be2e4384d8d7d55fc66e4c0684126df869516","user":{"login":"juttle","id":8988633,"avatar_url":"https://avatars.githubusercontent.com/u/8988633?v=3","gravatar_id":"","url":"https://api.github.com/users/juttle","html_url":"https://github.com/juttle","followers_url":"https://api.github.com/users/juttle/followers","following_url":"https://api.github.com/users/juttle/following{/other_user}","gists_url":"https://api.github.com/users/juttle/gists{/gist_id}","starred_url":"https://api.github.com/users/juttle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juttle/subscriptions","organizations_url":"https://api.github.com/users/juttle/orgs","repos_url":"https://api.github.com/users/juttle/repos","events_url":"https://api.github.com/users/juttle/events{/privacy}","received_events_url":"https://api.github.com/users/juttle/received_events","type":"Organization","site_admin":false},"repo":{"id":51180780,"name":"juttle-engine","full_name":"juttle/juttle-engine","owner":{"login":"juttle","id":8988633,"avatar_url":"https://avatars.githubusercontent.com/u/8988633?v=3","gravatar_id":"","url":"https://api.github.com/users/juttle","html_url":"https://github.com/juttle","followers_url":"https://api.github.com/users/juttle/followers","following_url":"https://api.github.com/users/juttle/following{/other_user}","gists_url":"https://api.github.com/users/juttle/gists{/gist_id}","starred_url":"https://api.github.com/users/juttle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juttle/subscriptions","organizations_url":"https://api.github.com/users/juttle/orgs","repos_url":"https://api.github.com/users/juttle/repos","events_url":"https://api.github.com/users/juttle/events{/privacy}","received_events_url":"https://api.github.com/users/juttle/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/juttle/juttle-engine","description":"juttle execution engine","fork":false,"url":"https://api.github.com/repos/juttle/juttle-engine","forks_url":"https://api.github.com/repos/juttle/juttle-engine/forks","keys_url":"https://api.github.com/repos/juttle/juttle-engine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/juttle/juttle-engine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/juttle/juttle-engine/teams","hooks_url":"https://api.github.com/repos/juttle/juttle-engine/hooks","issue_events_url":"https://api.github.com/repos/juttle/juttle-engine/issues/events{/number}","events_url":"https://api.github.com/repos/juttle/juttle-engine/events","assignees_url":"https://api.github.com/repos/juttle/juttle-engine/assignees{/user}","branches_url":"https://api.github.com/repos/juttle/juttle-engine/branches{/branch}","tags_url":"https://api.github.com/repos/juttle/juttle-engine/tags","blobs_url":"https://api.github.com/repos/juttle/juttle-engine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/juttle/juttle-engine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/juttle/juttle-engine/git/refs{/sha}","trees_url":"https://api.github.com/repos/juttle/juttle-engine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/juttle/juttle-engine/statuses/{sha}","languages_url":"https://api.github.com/repos/juttle/juttle-engine/languages","stargazers_url":"https://api.github.com/repos/juttle/juttle-engine/stargazers","contributors_url":"https://api.github.com/repos/juttle/juttle-engine/contributors","subscribers_url":"https://api.github.com/repos/juttle/juttle-engine/subscribers","subscription_url":"https://api.github.com/repos/juttle/juttle-engine/subscription","commits_url":"https://api.github.com/repos/juttle/juttle-engine/commits{/sha}","git_commits_url":"https://api.github.com/repos/juttle/juttle-engine/git/commits{/sha}","comments_url":"https://api.github.com/repos/juttle/juttle-engine/comments{/number}","issue_comment_url":"https://api.github.com/repos/juttle/juttle-engine/issues/comments{/number}","contents_url":"https://api.github.com/repos/juttle/juttle-engine/contents/{+path}","compare_url":"https://api.github.com/repos/juttle/juttle-engine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/juttle/juttle-engine/merges","archive_url":"https://api.github.com/repos/juttle/juttle-engine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/juttle/juttle-engine/downloads","issues_url":"https://api.github.com/repos/juttle/juttle-engine/issues{/number}","pulls_url":"https://api.github.com/repos/juttle/juttle-engine/pulls{/number}","milestones_url":"https://api.github.com/repos/juttle/juttle-engine/milestones{/number}","notifications_url":"https://api.github.com/repos/juttle/juttle-engine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/juttle/juttle-engine/labels{/name}","releases_url":"https://api.github.com/repos/juttle/juttle-engine/releases{/id}","deployments_url":"https://api.github.com/repos/juttle/juttle-engine/deployments","created_at":"2016-02-05T23:29:37Z","updated_at":"2016-03-09T19:43:11Z","pushed_at":"2016-03-11T00:48:39Z","git_url":"git://github.com/juttle/juttle-engine.git","ssh_url":"git@github.com:juttle/juttle-engine.git","clone_url":"https://github.com/juttle/juttle-engine.git","svn_url":"https://github.com/juttle/juttle-engine","homepage":null,"size":46565,"stargazers_count":5,"watchers_count":5,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":22,"forks":0,"open_issues":22,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/juttle/juttle-engine/pulls/84"},"html":{"href":"https://github.com/juttle/juttle-engine/pull/84"},"issue":{"href":"https://api.github.com/repos/juttle/juttle-engine/issues/84"},"comments":{"href":"https://api.github.com/repos/juttle/juttle-engine/issues/84/comments"},"review_comments":{"href":"https://api.github.com/repos/juttle/juttle-engine/pulls/84/comments"},"review_comment":{"href":"https://api.github.com/repos/juttle/juttle-engine/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/juttle/juttle-engine/pulls/84/commits"},"statuses":{"href":"https://api.github.com/repos/juttle/juttle-engine/statuses/fd946e62c804c616dd8dbdcae0eb7b69a51c01b1"}}}}