Closed peterwu19881230 closed 2 years ago
@bcli4d should be able to help with this.
If you tell me what you are actually trying to do, there may be a better way to do it.
Yes, sure!
I am trying to used the generated credential from my local machine (.idc_credentials) to authorize and get the cohort_id.
Long term goal is to analyze the IDC data on my webpage without downloading them.
Thanks~
Sorry for the delay in responding, I reached out to @bcli4d via other channels.
When you say "analyze the IDC data on my webpage" - what do you mean?
Did you look at the example notebooks that we have in https://github.com/ImagingDataCommons/IDC-Examples/tree/master/notebooks and for example specifically https://colab.research.google.com/github/ImagingDataCommons/IDC-Examples/blob/master/notebooks/IDC_segmentation_primer.ipynb? If you want to subset IDC data, BigQuery interface gives you a lot more capabilities than IDC API.
@peterwu19881230, I hope to have a revised version of idc_auth.py available later today. Apologies for the delay andl ack of communication.
@peterwu19881230 Please try the this revised version of idc_auth.py. Thanks.
Hi, @bcli4d ! I just saw it and tested it. Works perfectly fine. Thank you very much @bcli4d @fedorov
Hi, dear @pieper:
I was able to generate .idc_credentials but got the error of "Request failed: Forbidden" (403 error) when running the following cell. May I get some help from you? Thanks~
filters = { "collection_id": [ "TCGA-LUAD", "TCGA-KIRC" ], "Modality": ["CT", "MR"], "race": ["ASIAN"] }
cohortSpec = {"name": "testcohort", "description": "Test description", "filters": filters}
response = requests.post(f'{idc_api_preamble}/cohorts/', json=cohortSpec, headers = head)
Check that there wasn't an error with the request
if response.status_code != 200:
Print the error code and message if something went wrong
else: print(json.dumps(response.json(), sort_keys=True, indent=1))
cohort_id = response.json()['cohort_properties']['cohort_id']