{"action":"created","comment":{"url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/pulls/comments/215027002","pull_request_review_id":152204021,"id":215027002,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNTAyNzAwMg==","diff_hunk":"@@ -879,6 +879,93 @@ export class StudyViewPageStore {\n             default: {}\n         });\n     }\n+\n+    public async getClinicalData(chartMeta: ChartMeta) {\n+        if (chartMeta.clinicalAttribute && this.samples.result) {\n+            const clinicalDataList = await defaultClient.fetchClinicalDataUsingPOST({\n+                clinicalDataType: chartMeta.clinicalAttribute.patientAttribute ? 'PATIENT' : 'SAMPLE',\n+                clinicalDataMultiStudyFilter: {\n+                    attributeIds: [chartMeta.clinicalAttribute.clinicalAttributeId],\n+                    identifiers: this.samples.result.map(sample => ({\n+                        entityId: chartMeta.clinicalAttribute!.patientAttribute ? sample.patientId : sample.sampleId,\n+                        studyId: sample.studyId\n+                    }))\n+                }\n+            });\n+\n+            const header: string[] = [\"Study ID\", \"Patient ID\"];\n+\n+            if (!chartMeta.clinicalAttribute!.patientAttribute) {\n+                header.push(\"Sample ID\");\n+            }\n+\n+            header.push(chartMeta.clinicalAttribute.displayName);\n+\n+            let data = [header.join(\"\\t\")];\n+\n+            data = data.concat(clinicalDataList.map(clinicalData => {\n+                const row = [clinicalData.studyId || NA_DATA, clinicalData.patientId || NA_DATA];\n+\n+                if (!chartMeta.clinicalAttribute!.patientAttribute) {\n+                    row.push(clinicalData.sampleId || NA_DATA);\n+                }\n+\n+                row.push(clinicalData.value || NA_DATA);\n+\n+                return row.join(\"\\t\");\n+            }));\n+\n+            return data.join(\"\\n\");\n+        }\n+        else {\n+            return \"\";\n+        }\n+    }\n+\n+    public async getSurvivalDownloadData(chartMeta: ChartMeta)\n+    {\n+        if (this.survivalData.result)\n+        {\n+            const data: string[] = [];\n+\n+            const uniqueClinicalAttributeIds: {[clinicalAttributeId: string]: string} = {};","path":"src/pages/studyView/StudyViewPageStore.ts","position":62,"original_position":62,"commit_id":"5a5e4a1c1381914c7a8cb5cacbb32716cf1f9276","original_commit_id":"5a5e4a1c1381914c7a8cb5cacbb32716cf1f9276","user":{"login":"alisman","id":186521,"node_id":"MDQ6VXNlcjE4NjUyMQ==","avatar_url":"https://avatars2.githubusercontent.com/u/186521?v=4","gravatar_id":"","url":"https://api.github.com/users/alisman","html_url":"https://github.com/alisman","followers_url":"https://api.github.com/users/alisman/followers","following_url":"https://api.github.com/users/alisman/following{/other_user}","gists_url":"https://api.github.com/users/alisman/gists{/gist_id}","starred_url":"https://api.github.com/users/alisman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alisman/subscriptions","organizations_url":"https://api.github.com/users/alisman/orgs","repos_url":"https://api.github.com/users/alisman/repos","events_url":"https://api.github.com/users/alisman/events{/privacy}","received_events_url":"https://api.github.com/users/alisman/received_events","type":"User","site_admin":false},"body":"use map or reduce for this so can assign directly to the variable.","created_at":"2018-09-04T18:48:44Z","updated_at":"2018-09-04T18:48:45Z","html_url":"https://github.com/cBioPortal/cbioportal-frontend/pull/1426#discussion_r215027002","pull_request_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/pulls/1426","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/pulls/comments/215027002"},"html":{"href":"https://github.com/cBioPortal/cbioportal-frontend/pull/1426#discussion_r215027002"},"pull_request":{"href":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/pulls/1426"}}},"pull_request":{"url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/pulls/1426","id":212193016,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEyMTkzMDE2","html_url":"https://github.com/cBioPortal/cbioportal-frontend/pull/1426","diff_url":"https://github.com/cBioPortal/cbioportal-frontend/pull/1426.diff","patch_url":"https://github.com/cBioPortal/cbioportal-frontend/pull/1426.patch","issue_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/issues/1426","number":1426,"state":"open","locked":false,"title":"Added download controls for study view charts","user":{"login":"onursumer","id":3604198,"node_id":"MDQ6VXNlcjM2MDQxOTg=","avatar_url":"https://avatars2.githubusercontent.com/u/3604198?v=4","gravatar_id":"","url":"https://api.github.com/users/onursumer","html_url":"https://github.com/onursumer","followers_url":"https://api.github.com/users/onursumer/followers","following_url":"https://api.github.com/users/onursumer/following{/other_user}","gists_url":"https://api.github.com/users/onursumer/gists{/gist_id}","starred_url":"https://api.github.com/users/onursumer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onursumer/subscriptions","organizations_url":"https://api.github.com/users/onursumer/orgs","repos_url":"https://api.github.com/users/onursumer/repos","events_url":"https://api.github.com/users/onursumer/events{/privacy}","received_events_url":"https://api.github.com/users/onursumer/received_events","type":"User","site_admin":false},"body":"# What? Why?\r\nPartially addressed download functionality for the study view components.\r\n\r\nChanges proposed in this pull request:\r\n- Added download icon into `ChartHeader` (related to https://github.com/cBioPortal/cbioportal/issues/4155)\r\n- Added full download functionality for `PieChart` (related to https://github.com/cBioPortal/cbioportal/issues/4156)\r\n- Added data download functionality for `SurvivalChart` (related to https://github.com/cBioPortal/cbioportal/issues/4159)\r\n\r\n# Checks\r\n- [ ] Is this PR adding logic based on one or more **clinical** attributes? If yes, please make sure validation for this attribute is also present in the data validation / data loading layers (in backend repo) and documented in [File-Formats Clinical data section](https://github.com/cBioPortal/cbioportal/blob/master/docs/File-Formats.md#clinical-data)!\r\n- [ ] Follows [7 rules of great commit messages](http://chris.beams.io/posts/git-commit/). For most PRs a single commit should suffice, in some cases multiple topical commits can be useful. During review it is ok to see tiny commits (e.g. Fix reviewer comments), but right before the code gets merged to master or rc branch, any such commits should be squashed since they are useless to the other developers. Definitely avoid [merge commits, use rebase instead.](http://nathanleclaire.com/blog/2014/09/14/dont-be-scared-of-git-rebase/)\r\n- [ ] Follows the [Airbnb React/JSX Style guide](https://github.com/airbnb/javascript/tree/master/react).\r\n- [ ] Make sure your commit messages end with a Signed-off-by string (this line\r\n  can be automatically added by git if you run the `git-commit` command with\r\n  the `-s` option)","created_at":"2018-08-30T19:55:46Z","updated_at":"2018-09-04T18:48:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dc425c204a2a0655862a49c6d0b964af123b734e","assignee":null,"assignees":[],"requested_reviewers":[{"login":"kalletlak","id":12956870,"node_id":"MDQ6VXNlcjEyOTU2ODcw","avatar_url":"https://avatars3.githubusercontent.com/u/12956870?v=4","gravatar_id":"","url":"https://api.github.com/users/kalletlak","html_url":"https://github.com/kalletlak","followers_url":"https://api.github.com/users/kalletlak/followers","following_url":"https://api.github.com/users/kalletlak/following{/other_user}","gists_url":"https://api.github.com/users/kalletlak/gists{/gist_id}","starred_url":"https://api.github.com/users/kalletlak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kalletlak/subscriptions","organizations_url":"https://api.github.com/users/kalletlak/orgs","repos_url":"https://api.github.com/users/kalletlak/repos","events_url":"https://api.github.com/users/kalletlak/events{/privacy}","received_events_url":"https://api.github.com/users/kalletlak/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/pulls/1426/commits","review_comments_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/pulls/1426/comments","review_comment_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/issues/1426/comments","statuses_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/statuses/5a5e4a1c1381914c7a8cb5cacbb32716cf1f9276","head":{"label":"onursumer:study-view-chart-download","ref":"study-view-chart-download","sha":"5a5e4a1c1381914c7a8cb5cacbb32716cf1f9276","user":{"login":"onursumer","id":3604198,"node_id":"MDQ6VXNlcjM2MDQxOTg=","avatar_url":"https://avatars2.githubusercontent.com/u/3604198?v=4","gravatar_id":"","url":"https://api.github.com/users/onursumer","html_url":"https://github.com/onursumer","followers_url":"https://api.github.com/users/onursumer/followers","following_url":"https://api.github.com/users/onursumer/following{/other_user}","gists_url":"https://api.github.com/users/onursumer/gists{/gist_id}","starred_url":"https://api.github.com/users/onursumer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onursumer/subscriptions","organizations_url":"https://api.github.com/users/onursumer/orgs","repos_url":"https://api.github.com/users/onursumer/repos","events_url":"https://api.github.com/users/onursumer/events{/privacy}","received_events_url":"https://api.github.com/users/onursumer/received_events","type":"User","site_admin":false},"repo":{"id":70088922,"node_id":"MDEwOlJlcG9zaXRvcnk3MDA4ODkyMg==","name":"cbioportal-frontend","full_name":"onursumer/cbioportal-frontend","owner":{"login":"onursumer","id":3604198,"node_id":"MDQ6VXNlcjM2MDQxOTg=","avatar_url":"https://avatars2.githubusercontent.com/u/3604198?v=4","gravatar_id":"","url":"https://api.github.com/users/onursumer","html_url":"https://github.com/onursumer","followers_url":"https://api.github.com/users/onursumer/followers","following_url":"https://api.github.com/users/onursumer/following{/other_user}","gists_url":"https://api.github.com/users/onursumer/gists{/gist_id}","starred_url":"https://api.github.com/users/onursumer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onursumer/subscriptions","organizations_url":"https://api.github.com/users/onursumer/orgs","repos_url":"https://api.github.com/users/onursumer/repos","events_url":"https://api.github.com/users/onursumer/events{/privacy}","received_events_url":"https://api.github.com/users/onursumer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/onursumer/cbioportal-frontend","description":"React Frontend of cBioPortal :tada:","fork":true,"url":"https://api.github.com/repos/onursumer/cbioportal-frontend","forks_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/forks","keys_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/teams","hooks_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/hooks","issue_events_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/events","assignees_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/tags","blobs_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/languages","stargazers_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/stargazers","contributors_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/contributors","subscribers_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/subscribers","subscription_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/subscription","commits_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/merges","archive_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/downloads","issues_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/labels{/name}","releases_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/onursumer/cbioportal-frontend/deployments","created_at":"2016-10-05T18:46:54Z","updated_at":"2017-06-26T17:22:41Z","pushed_at":"2018-09-04T16:48:40Z","git_url":"git://github.com/onursumer/cbioportal-frontend.git","ssh_url":"git@github.com:onursumer/cbioportal-frontend.git","clone_url":"https://github.com/onursumer/cbioportal-frontend.git","svn_url":"https://github.com/onursumer/cbioportal-frontend","homepage":"http://cbioportal.org","size":98265,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","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":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cBioPortal:study-view-refactoring","ref":"study-view-refactoring","sha":"aa62b78b2459aa98759ccf44fdd96d949aa9165c","user":{"login":"cBioPortal","id":9876251,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk4NzYyNTE=","avatar_url":"https://avatars2.githubusercontent.com/u/9876251?v=4","gravatar_id":"","url":"https://api.github.com/users/cBioPortal","html_url":"https://github.com/cBioPortal","followers_url":"https://api.github.com/users/cBioPortal/followers","following_url":"https://api.github.com/users/cBioPortal/following{/other_user}","gists_url":"https://api.github.com/users/cBioPortal/gists{/gist_id}","starred_url":"https://api.github.com/users/cBioPortal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cBioPortal/subscriptions","organizations_url":"https://api.github.com/users/cBioPortal/orgs","repos_url":"https://api.github.com/users/cBioPortal/repos","events_url":"https://api.github.com/users/cBioPortal/events{/privacy}","received_events_url":"https://api.github.com/users/cBioPortal/received_events","type":"Organization","site_admin":false},"repo":{"id":66571349,"node_id":"MDEwOlJlcG9zaXRvcnk2NjU3MTM0OQ==","name":"cbioportal-frontend","full_name":"cBioPortal/cbioportal-frontend","owner":{"login":"cBioPortal","id":9876251,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk4NzYyNTE=","avatar_url":"https://avatars2.githubusercontent.com/u/9876251?v=4","gravatar_id":"","url":"https://api.github.com/users/cBioPortal","html_url":"https://github.com/cBioPortal","followers_url":"https://api.github.com/users/cBioPortal/followers","following_url":"https://api.github.com/users/cBioPortal/following{/other_user}","gists_url":"https://api.github.com/users/cBioPortal/gists{/gist_id}","starred_url":"https://api.github.com/users/cBioPortal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cBioPortal/subscriptions","organizations_url":"https://api.github.com/users/cBioPortal/orgs","repos_url":"https://api.github.com/users/cBioPortal/repos","events_url":"https://api.github.com/users/cBioPortal/events{/privacy}","received_events_url":"https://api.github.com/users/cBioPortal/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cBioPortal/cbioportal-frontend","description":"React Frontend of cBioPortal :tada:","fork":false,"url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend","forks_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/forks","keys_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/teams","hooks_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/hooks","issue_events_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/events","assignees_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/tags","blobs_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/languages","stargazers_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/stargazers","contributors_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/contributors","subscribers_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/subscribers","subscription_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/subscription","commits_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/merges","archive_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/downloads","issues_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/labels{/name}","releases_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/deployments","created_at":"2016-08-25T15:41:44Z","updated_at":"2018-09-04T18:10:36Z","pushed_at":"2018-09-04T18:11:24Z","git_url":"git://github.com/cBioPortal/cbioportal-frontend.git","ssh_url":"git@github.com:cBioPortal/cbioportal-frontend.git","clone_url":"https://github.com/cBioPortal/cbioportal-frontend.git","svn_url":"https://github.com/cBioPortal/cbioportal-frontend","homepage":"http://cbioportal.org","size":101788,"stargazers_count":15,"watchers_count":15,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":49,"mirror_url":null,"archived":false,"open_issues_count":42,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":49,"open_issues":42,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/pulls/1426"},"html":{"href":"https://github.com/cBioPortal/cbioportal-frontend/pull/1426"},"issue":{"href":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/issues/1426"},"comments":{"href":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/issues/1426/comments"},"review_comments":{"href":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/pulls/1426/comments"},"review_comment":{"href":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/pulls/1426/commits"},"statuses":{"href":"https://api.github.com/repos/cBioPortal/cbioportal-frontend/statuses/5a5e4a1c1381914c7a8cb5cacbb32716cf1f9276"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"alisman"}}