-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[API] New directory for jupyter notebooks #6854
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you provide markdown files as well?
@spell00 Remove the outputs of the notebooks before sending to github please. |
@xlecours I provided the markdowns, but now that I cleared the outputs from the notebooks before sending to Github, the content of the notebooks that I see is very similar to the markdowns. I wonder if it is still necessary? Before clearing the output, I could not see part2 as a notebook in Github, so I understood the necessity of the markdowns, but it seems redundant now. Does it serve another purpose I am not seeing? |
Maybe @christinerogers can clarify if the markdown can be useful in our readthedoc. Otherwise, it can be removed so we don't have to make sure it is synchronized whit the actual notebook. |
@xlecours @christinerogers I think everyone agrees the markdowns are redundant, so I removed them. If anyone thinks of a good reason to include them, it can be added again very easily. I added links to the notebooks in Google colab, so that it can be tried directly in the browser. This way, anyone can test the notebooks even if they don't have Jupyter or Loris installed. |
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"colab": {}, | ||
"colab_type": "code", | ||
"id": "ZJhfo1iB_PqE" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# The flag is used to break the loops once an example that contains a \n", | ||
"# Dicom file is found\n", | ||
"flag = 0\n", | ||
"\n", | ||
"for candidate in allCandidates['Candidates']:\n", | ||
" candid = candidate['CandID']\n", | ||
" visit_labels = GET('/'.join([baseurl, 'candidates', candid]))['Visits']\n", | ||
" if flag == 1:\n", | ||
" break\n", | ||
" candid = candidate['CandID']\n", | ||
" visit_labels = GET('/'.join([baseurl, 'candidates', candid]))['Visits']\n", | ||
" for visit_label in visit_labels:\n", | ||
" dicoms = GET('/'.join([baseurl, 'candidates', candid, \n", | ||
" visit_label, 'dicoms']))\n", | ||
" # We only want to get a single valid example of a candidate and visit that\n", | ||
" # has Dicom files that can be used to test the Dicoms endpoints \n", | ||
" if len(dicoms['DicomTars']) > 0:\n", | ||
" flag = 1\n", | ||
" break\n" | ||
] | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block won't be necessary when PR #6775 will be merged. It will add an endpoint listing all Dicoms in a project. It will then be possible to get a complete list of candidates and for which visits there is a Dicom file for a given project. For the moment, it is the only way to get these informations without hardcoding them in the notebook, which is problematic when not executed with raisinbread...
f16c232
to
d8a2de1
Compare
"source": [ | ||
"### Scripting and parsing json \n", | ||
" \n", | ||
"see: [part2 - Python script](https://github.com/aces/Loris/blob/main/docs/notebooks/LORIS-API_Part2-Python-script.ipynb)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This link will be valid when the PR is merged to aces/main
Some commands will fail until PR #6780 is merged. I tested using the branch containing the changes and there is no error. |
4526194
to
5dbe25b
Compare
"source": [ | ||
"url = '/'.join([baseurl, 'projects', projectNames[0]])\n", | ||
"project = GET(url)\n", | ||
"prettyPrint(projects)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"prettyPrint(projects)" | |
"prettyPrint(project)" |
" \"PSCID\" : PSCID, # only if config is set to prompt \n", | ||
" \"EDC\" : \"YYYY-MM-DD\", # optional\n", | ||
" \"DoB\" : \"YYYY-MM-DD\",\n", | ||
" \"Gender\" : \"Male|Female\",\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
" \"Gender\" : \"Male|Female\",\n", | |
" \"Sex\" : \"Male|Female\",\n", |
}, | ||
"outputs": [], | ||
"source": [ | ||
"battery = candidateVisits['Meta']['Battery']\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This variable is not used
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "V0Clu1dSCHvJ" | ||
}, | ||
"source": [] | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shows as Type Markdown and LaTeX: 𝛼2
a0dfa88
to
8fe4135
Compare
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"#LORIS API Tour 1/2\nThis tutorial is also available as a Google colab notebook so you can run it directly from your browser. To access it, click on the button below: <a href=\"https://colab.research.google.com/github/aces/Loris/blob/main/docs/notebooks/LORIS-API_Part1-HTTP.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The link https://colab.research.google.com/github/aces/Loris/blob/main/docs/notebooks/LORIS-API_Part1-HTTP.ipynb won't work until the PR is merged. For now, for testing purposes, one has to use the notebook in this Pr on this branch : https://colab.research.google.com/github/spell00/Loris/blob/2020-07-20-jupyterApiPart2/docs/notebooks/LORIS-API_Part1-HTTP.ipynb
"\n", | ||
"This tutorial contains basic examples in Python to demonstrate how to interact with the API.\n", | ||
"To run this tutorial, click on `Runtime -> Run all`", | ||
"This tutorial is also available as a Google colab notebook so you can run it directly from your browser. To access it, click on the button below: <a href=\"https://colab.research.google.com/github/aces/Loris/blob/main/docs/notebooks/LORIS_API_Part2_Python-script.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the link https://colab.research.google.com/github/aces/Loris/blob/main/docs/notebooks/LORIS_API_Part2_Python-script.ipynb won't work until the PR is merged. For testing, use https://colab.research.google.com/github/spell00/Loris/blob/2020-07-20-jupyterApiPart2/docs/notebooks/LORIS_API_Part2_Python-script.ipynb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know enough about jupyter notebooks to really review this, I'll merge it based on @xlecours approval..
New Jupyter notebooks to demonstrate how the REST API works.
Brief summary of changes
New Jupyter notebooks to display how the api works.