{"action":"created","comment":{"url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/pulls/comments/176441665","pull_request_review_id":106117556,"id":176441665,"diff_hunk":"@@ -0,0 +1,122 @@\n+\"\"\"Output: TBD.\"\"\"\n+\n+from f8a_worker.base import BaseTask\n+from f8a_worker.graphutils import GREMLIN_SERVER_URL_REST\n+from f8a_worker.utils import MavenCoordinates\n+from f8a_worker.utils import get_session_retry\n+import json\n+import operator\n+from time import gmtime, strftime\n+import semantic_version as sv\n+\n+\n+class ReportGenerationTask(BaseTask):\n+    \"\"\"Generates report containing descriptive data for dependencies.\"\"\"\n+\n+    def parse_version_data(self, data):\n+        \"\"\"\n+        Parse version data extracted from graph for a given dependency.\n+\n+        :param data: version data extracted from graph\n+        :return: parsed version data\n+        \"\"\"\n+        self.log.info(\"Version data received is: {}\".format(data))\n+        version_data = dict()\n+        version = data.get('version')[0]\n+        cve_ids = data.get('cve_ids', [])\n+        licenses = data.get('licenses', [])\n+        cve_list = list()\n+        for cve_id in cve_ids:\n+            cve_name, cvss_score = cve_id.split(\":\")\n+            cve_list.append((cve_name, float(cvss_score)))\n+        cve_list.sort(key=operator.itemgetter(1), reverse=True)\n+        version_data.update({\"version\": version, \"cve_count\": len(cve_ids), \"licenses\": licenses})\n+\n+        if cve_list:\n+            version_data.update({\"cve_id_for_highest_cvss_score\": cve_list[0][0],\n+                                 \"highest_cvss_score\": cve_list[0][1],\n+                                 \"cves\": [x[0] for x in cve_list]})\n+\n+        self.log.info(\"Parsed version data is: {}\".format(version_data))\n+        return version_data\n+\n+    def parse_package_data(self, data):\n+        \"\"\"\n+        Parse package data extracted from graph for a given dependency.\n+\n+        :param data: package data extracted from graph\n+        :return: parsed package data\n+        \"\"\"\n+        self.log.info(\"Package data received is: {}\".format(data))\n+        package_data = dict()\n+        name = data.get('name')[0]\n+        package_data.update({\"name\": name})","path":"f8a_worker/workers/report_generation.py","position":53,"original_position":53,"commit_id":"5d9118e8f5a2fe47c09916bd597d02bf2b123b48","original_commit_id":"5d9118e8f5a2fe47c09916bd597d02bf2b123b48","user":{"login":"jpopelka","id":288686,"avatar_url":"https://avatars0.githubusercontent.com/u/288686?v=4","gravatar_id":"","url":"https://api.github.com/users/jpopelka","html_url":"https://github.com/jpopelka","followers_url":"https://api.github.com/users/jpopelka/followers","following_url":"https://api.github.com/users/jpopelka/following{/other_user}","gists_url":"https://api.github.com/users/jpopelka/gists{/gist_id}","starred_url":"https://api.github.com/users/jpopelka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpopelka/subscriptions","organizations_url":"https://api.github.com/users/jpopelka/orgs","repos_url":"https://api.github.com/users/jpopelka/repos","events_url":"https://api.github.com/users/jpopelka/events{/privacy}","received_events_url":"https://api.github.com/users/jpopelka/received_events","type":"User","site_admin":false},"body":"Merge\r\n```python\r\npackage_data = dict()\r\npackage_data.update({\"name\": name})\r\n```\r\ninto\r\n```python\r\npackage_data = {\"name\": name}\r\n```","created_at":"2018-03-22T14:33:20Z","updated_at":"2018-03-22T14:51:25Z","html_url":"https://github.com/fabric8-analytics/fabric8-analytics-worker/pull/566#discussion_r176441665","pull_request_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/pulls/566","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/pulls/comments/176441665"},"html":{"href":"https://github.com/fabric8-analytics/fabric8-analytics-worker/pull/566#discussion_r176441665"},"pull_request":{"href":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/pulls/566"}}},"pull_request":{"url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/pulls/566","id":174590504,"html_url":"https://github.com/fabric8-analytics/fabric8-analytics-worker/pull/566","diff_url":"https://github.com/fabric8-analytics/fabric8-analytics-worker/pull/566.diff","patch_url":"https://github.com/fabric8-analytics/fabric8-analytics-worker/pull/566.patch","issue_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/issues/566","number":566,"state":"open","locked":false,"title":"Add Unknown Depndency Fetcher Task and Report Generation Task","user":{"login":"abs51295","id":13438222,"avatar_url":"https://avatars2.githubusercontent.com/u/13438222?v=4","gravatar_id":"","url":"https://api.github.com/users/abs51295","html_url":"https://github.com/abs51295","followers_url":"https://api.github.com/users/abs51295/followers","following_url":"https://api.github.com/users/abs51295/following{/other_user}","gists_url":"https://api.github.com/users/abs51295/gists{/gist_id}","starred_url":"https://api.github.com/users/abs51295/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abs51295/subscriptions","organizations_url":"https://api.github.com/users/abs51295/orgs","repos_url":"https://api.github.com/users/abs51295/repos","events_url":"https://api.github.com/users/abs51295/events{/privacy}","received_events_url":"https://api.github.com/users/abs51295/received_events","type":"User","site_admin":false},"body":"Add Report Generation Task to generate report for given github repository\r\n\r\n- Task is responsible for generating report by getting descriptive statistics for dependencies identified by GithubDependencyTreeTask.\r\n\r\nAdd Unknown Dependency Fetcher Task to fetch unknown dependencies from dependencies identified by GithubDependencyTreeTask\r\n\r\n- Task is responsible to identify unknown dependencies and pass them to bayesianApiFlow for ingestion.\r\n\r\n","created_at":"2018-03-13T08:46:11Z","updated_at":"2018-03-22T14:51:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"63e8971e75ba713eea8ab8ffeac228116739bc3d","assignee":{"login":"abs51295","id":13438222,"avatar_url":"https://avatars2.githubusercontent.com/u/13438222?v=4","gravatar_id":"","url":"https://api.github.com/users/abs51295","html_url":"https://github.com/abs51295","followers_url":"https://api.github.com/users/abs51295/followers","following_url":"https://api.github.com/users/abs51295/following{/other_user}","gists_url":"https://api.github.com/users/abs51295/gists{/gist_id}","starred_url":"https://api.github.com/users/abs51295/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abs51295/subscriptions","organizations_url":"https://api.github.com/users/abs51295/orgs","repos_url":"https://api.github.com/users/abs51295/repos","events_url":"https://api.github.com/users/abs51295/events{/privacy}","received_events_url":"https://api.github.com/users/abs51295/received_events","type":"User","site_admin":false},"assignees":[{"login":"abs51295","id":13438222,"avatar_url":"https://avatars2.githubusercontent.com/u/13438222?v=4","gravatar_id":"","url":"https://api.github.com/users/abs51295","html_url":"https://github.com/abs51295","followers_url":"https://api.github.com/users/abs51295/followers","following_url":"https://api.github.com/users/abs51295/following{/other_user}","gists_url":"https://api.github.com/users/abs51295/gists{/gist_id}","starred_url":"https://api.github.com/users/abs51295/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abs51295/subscriptions","organizations_url":"https://api.github.com/users/abs51295/orgs","repos_url":"https://api.github.com/users/abs51295/repos","events_url":"https://api.github.com/users/abs51295/events{/privacy}","received_events_url":"https://api.github.com/users/abs51295/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/pulls/566/commits","review_comments_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/pulls/566/comments","review_comment_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/issues/566/comments","statuses_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/statuses/5d9118e8f5a2fe47c09916bd597d02bf2b123b48","head":{"label":"abs51295:report-generation","ref":"report-generation","sha":"5d9118e8f5a2fe47c09916bd597d02bf2b123b48","user":{"login":"abs51295","id":13438222,"avatar_url":"https://avatars2.githubusercontent.com/u/13438222?v=4","gravatar_id":"","url":"https://api.github.com/users/abs51295","html_url":"https://github.com/abs51295","followers_url":"https://api.github.com/users/abs51295/followers","following_url":"https://api.github.com/users/abs51295/following{/other_user}","gists_url":"https://api.github.com/users/abs51295/gists{/gist_id}","starred_url":"https://api.github.com/users/abs51295/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abs51295/subscriptions","organizations_url":"https://api.github.com/users/abs51295/orgs","repos_url":"https://api.github.com/users/abs51295/repos","events_url":"https://api.github.com/users/abs51295/events{/privacy}","received_events_url":"https://api.github.com/users/abs51295/received_events","type":"User","site_admin":false},"repo":{"id":109939118,"name":"fabric8-analytics-worker","full_name":"abs51295/fabric8-analytics-worker","owner":{"login":"abs51295","id":13438222,"avatar_url":"https://avatars2.githubusercontent.com/u/13438222?v=4","gravatar_id":"","url":"https://api.github.com/users/abs51295","html_url":"https://github.com/abs51295","followers_url":"https://api.github.com/users/abs51295/followers","following_url":"https://api.github.com/users/abs51295/following{/other_user}","gists_url":"https://api.github.com/users/abs51295/gists{/gist_id}","starred_url":"https://api.github.com/users/abs51295/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abs51295/subscriptions","organizations_url":"https://api.github.com/users/abs51295/orgs","repos_url":"https://api.github.com/users/abs51295/repos","events_url":"https://api.github.com/users/abs51295/events{/privacy}","received_events_url":"https://api.github.com/users/abs51295/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/abs51295/fabric8-analytics-worker","description":"fabric8-analytics worker for gathering raw data","fork":true,"url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker","forks_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/forks","keys_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/teams","hooks_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/hooks","issue_events_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/issues/events{/number}","events_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/events","assignees_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/assignees{/user}","branches_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/branches{/branch}","tags_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/tags","blobs_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/git/refs{/sha}","trees_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/statuses/{sha}","languages_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/languages","stargazers_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/stargazers","contributors_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/contributors","subscribers_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/subscribers","subscription_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/subscription","commits_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/commits{/sha}","git_commits_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/git/commits{/sha}","comments_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/comments{/number}","issue_comment_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/issues/comments{/number}","contents_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/contents/{+path}","compare_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/merges","archive_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/downloads","issues_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/issues{/number}","pulls_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/pulls{/number}","milestones_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/milestones{/number}","notifications_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/labels{/name}","releases_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/releases{/id}","deployments_url":"https://api.github.com/repos/abs51295/fabric8-analytics-worker/deployments","created_at":"2017-11-08T06:53:54Z","updated_at":"2017-11-08T06:53:57Z","pushed_at":"2018-03-22T12:04:40Z","git_url":"git://github.com/abs51295/fabric8-analytics-worker.git","ssh_url":"git@github.com:abs51295/fabric8-analytics-worker.git","clone_url":"https://github.com/abs51295/fabric8-analytics-worker.git","svn_url":"https://github.com/abs51295/fabric8-analytics-worker","homepage":"","size":2806,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"fabric8-analytics:master","ref":"master","sha":"0735cfe3357f0d4826dae625e2ab0b0fc26bcbbd","user":{"login":"fabric8-analytics","id":28134954,"avatar_url":"https://avatars3.githubusercontent.com/u/28134954?v=4","gravatar_id":"","url":"https://api.github.com/users/fabric8-analytics","html_url":"https://github.com/fabric8-analytics","followers_url":"https://api.github.com/users/fabric8-analytics/followers","following_url":"https://api.github.com/users/fabric8-analytics/following{/other_user}","gists_url":"https://api.github.com/users/fabric8-analytics/gists{/gist_id}","starred_url":"https://api.github.com/users/fabric8-analytics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabric8-analytics/subscriptions","organizations_url":"https://api.github.com/users/fabric8-analytics/orgs","repos_url":"https://api.github.com/users/fabric8-analytics/repos","events_url":"https://api.github.com/users/fabric8-analytics/events{/privacy}","received_events_url":"https://api.github.com/users/fabric8-analytics/received_events","type":"Organization","site_admin":false},"repo":{"id":89703823,"name":"fabric8-analytics-worker","full_name":"fabric8-analytics/fabric8-analytics-worker","owner":{"login":"fabric8-analytics","id":28134954,"avatar_url":"https://avatars3.githubusercontent.com/u/28134954?v=4","gravatar_id":"","url":"https://api.github.com/users/fabric8-analytics","html_url":"https://github.com/fabric8-analytics","followers_url":"https://api.github.com/users/fabric8-analytics/followers","following_url":"https://api.github.com/users/fabric8-analytics/following{/other_user}","gists_url":"https://api.github.com/users/fabric8-analytics/gists{/gist_id}","starred_url":"https://api.github.com/users/fabric8-analytics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabric8-analytics/subscriptions","organizations_url":"https://api.github.com/users/fabric8-analytics/orgs","repos_url":"https://api.github.com/users/fabric8-analytics/repos","events_url":"https://api.github.com/users/fabric8-analytics/events{/privacy}","received_events_url":"https://api.github.com/users/fabric8-analytics/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fabric8-analytics/fabric8-analytics-worker","description":"fabric8-analytics worker for gathering raw data","fork":false,"url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker","forks_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/forks","keys_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/teams","hooks_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/hooks","issue_events_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/issues/events{/number}","events_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/events","assignees_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/assignees{/user}","branches_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/branches{/branch}","tags_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/tags","blobs_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/git/refs{/sha}","trees_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/statuses/{sha}","languages_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/languages","stargazers_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/stargazers","contributors_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/contributors","subscribers_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/subscribers","subscription_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/subscription","commits_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/commits{/sha}","git_commits_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/git/commits{/sha}","comments_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/comments{/number}","issue_comment_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/issues/comments{/number}","contents_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/contents/{+path}","compare_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/merges","archive_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/downloads","issues_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/issues{/number}","pulls_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/pulls{/number}","milestones_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/milestones{/number}","notifications_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/labels{/name}","releases_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/releases{/id}","deployments_url":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/deployments","created_at":"2017-04-28T12:25:15Z","updated_at":"2018-03-22T11:58:03Z","pushed_at":"2018-03-22T14:35:45Z","git_url":"git://github.com/fabric8-analytics/fabric8-analytics-worker.git","ssh_url":"git@github.com:fabric8-analytics/fabric8-analytics-worker.git","clone_url":"https://github.com/fabric8-analytics/fabric8-analytics-worker.git","svn_url":"https://github.com/fabric8-analytics/fabric8-analytics-worker","homepage":"","size":2791,"stargazers_count":6,"watchers_count":6,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":26,"mirror_url":null,"archived":false,"open_issues_count":34,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0"},"forks":26,"open_issues":34,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/pulls/566"},"html":{"href":"https://github.com/fabric8-analytics/fabric8-analytics-worker/pull/566"},"issue":{"href":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/issues/566"},"comments":{"href":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/issues/566/comments"},"review_comments":{"href":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/pulls/566/comments"},"review_comment":{"href":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/pulls/566/commits"},"statuses":{"href":"https://api.github.com/repos/fabric8-analytics/fabric8-analytics-worker/statuses/5d9118e8f5a2fe47c09916bd597d02bf2b123b48"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"jpopelka"}}