Skip to content
Snippets Groups Projects
Commit 8507f2fa authored by Colton Leekley-Winslow's avatar Colton Leekley-Winslow
Browse files

Add RAML for listhandler and other remaining endpoints

parent 5367c5d2
No related branches found
No related tags found
No related merge requests found
Showing
with 387 additions and 74 deletions
......@@ -120,6 +120,7 @@ expected_input_schemas = set([
'acquisition.json',
'acquisition-update.json',
'analysis.json',
'analysis-job.json',
'avatars.json',
'collection.json',
'collection-update.json',
......
......@@ -610,62 +610,13 @@ class AnalysesHandler(ListHandler):
def post(self, cont_name, list_name, **kwargs):
"""
.. http:post:: /api/(cont_name)/(cid)/analyses
Default behavior:
Creates an analysis object and uploads supplied input
and output files.
When param ``job`` is true:
Creates an analysis object and job object that reference
each other via ``job`` and ``destination`` fields. Job based
analyses are only allowed at the session level.
:param cont_name: one of ``projects``, ``sessions``, ``collections``
:type cont_name: string
:param cid: Container ID
:type cid: string
:query boolean job: a flag specifying the type of analysis
:statuscode 200: no error
:statuscode 400: Job-based analyses must be at the session level
:statuscode 400: Job-based analyses must have ``job`` and ``analysis`` maps in JSON body
**Example request**:
.. sourcecode:: http
POST /api/sessions/57081d06b386a6dc79ca383c/analyses HTTP/1.1
{
"analysis": {
"label": "Test Analysis 1"
},
"job" : {
"gear": "dcm_convert",
"inputs": {
"dicom": {
"type": "acquisition",
"id": "57081d06b386a6dc79ca386b",
"name" : "test_acquisition_dicom.zip"
}
},
"tags": ["example"]
}
}
**Example response**:
.. sourcecode:: http
HTTP/1.1 200 OK
Vary: Accept-Encoding
Content-Type: application/json; charset=utf-8
{
"_id": "573cb66b135d87002660597c"
}
Default behavior:
Creates an analysis object and uploads supplied input
and output files.
When param ``job`` is true:
Creates an analysis object and job object that reference
each other via ``job`` and ``destination`` fields. Job based
analyses are only allowed at the session level.
"""
_id = kwargs.pop('cid')
permchecker, storage, _, payload_validator, _ = self._initialize_request(cont_name, list_name, _id)
......
......@@ -58,7 +58,7 @@ def _get_result_list(output):
throws APIReportException
"""
if output.get('ok', 0) is not 1.0:
if output.get('ok') == 1.0:
result = output.get('result')
if result is not None and len(result) > 0:
return result
......
......@@ -14,6 +14,25 @@ traits:
resourceTypes:
- container: !include resourceTypes/container.raml
- container-item: !include resourceTypes/container-item.raml
- container-item-list-property: !include resourceTypes/container-item-list-property.raml
- container-item-list-property-append: !include resourceTypes/container-item-list-property-append.raml
- tags-list: !include resourceTypes/tags-list.raml
- tags-append: !include resourceTypes/tags-append.raml
- packfile-start: !include resourceTypes/packfile-start.raml
- packfile: !include resourceTypes/packfile.raml
- packfile-end: !include resourceTypes/packfile-end.raml
- file-list-upload: !include resourceTypes/file-list-upload.raml
- file-item: !include resourceTypes/file-item.raml
- permissions-list: !include resourceTypes/permissions-list.raml
- permissions-item: !include resourceTypes/permissions-item.raml
- notes-list: !include resourceTypes/notes-list.raml
- notes-item: !include resourceTypes/notes-item.raml
- analyses-list: !include resourceTypes/analyses-list.raml
- analysis-item: !include resourceTypes/analysis-item.raml
- analysis-files: !include resourceTypes/analysis-files.raml
- analysis-files-create-ticket-filename: !include resourceTypes/analysis-files-create-ticket-filename.raml
- analysis-notes-list: !include resourceTypes/analysis-notes-list.raml
- analysis-notes-item: !include resourceTypes/analysis-notes-item.raml
/download: !include resources/download.raml
/upload/label: !include resources/upload-by-label.raml
......@@ -34,3 +53,4 @@ resourceTypes:
/sessions: !include resources/sessions.raml
/acquisitions: !include resources/acquisitions.raml
/projects: !include resources/projects.raml
/report: !include resources/report.raml
[
{
"name":"results.dcm.zip",
"modified":"2016-08-01T09:07:27.681792+00:00",
"size":7364859,
"mimetype":"application/octet-stream",
"hash":"v0-sha384-768412320f7b0aa5812fce428dc4706b3cae50e02a64caa16a782249bfe8efc4b7ef1ccb126255d196047dfedf17a0a9",
"origin":{
"name":"user1",
"uid":"579f5a4f8120be0c0828d777"
},
"type":"dicom",
"tags":[],
"metadata":{},
"instrument":"instrument1",
"measurements":[]
"origin": {
"type": "job",
"id": "58063f24e5dc5b001657a87f"
},
"mimetype": "application/octet-stream",
"hash": "v0-sha384-12188e00a26650b2baa3f0195337dcf504f4362bb2136eef0cdbefb57159356b1355a0402fca0ab5ab081f21c305e5c2",
"name": "cortical_surface_right_hemisphere.obj",
"tags": [],
"measurements": [],
"modified": "2016-10-18T15:26:35.701000+00:00",
"instrument": null,
"size": 21804112,
"type": "None",
"metadata": {}
}, {
"origin": {
"type": "job",
"id": "58065fa7e5dc5b001457a882"
},
"mimetype": "application/octet-stream",
"hash": "v0-sha384-12188e00a26650b2baa3f0195337dcf504f4362bb2136eef0cdbefb57159356b1355a0402fca0ab5ab081f21c305e5c2",
"name": "cortical_surface_right_hemisphere.obj",
"tags": [],
"measurements": [],
"modified": "2016-10-18T17:45:17.776000+00:00",
"instrument": null,
"metadata": {},
"type": "None",
"size": 21804112
}
]
\ No newline at end of file
]
{
"analysis": {
"label": "Test Analysis 1"
},
"job" : {
"gear": "dcm_convert",
"inputs": {
"dicom": {
"type": "acquisition",
"id": "57081d06b386a6dc79ca386b",
"name" : "test_acquisition_dicom.zip"
}
},
"tags": ["example"]
}
}
{"access": "admin", "_id": "coltonlw@flywheel.io", "site":"local"}
{
"name": "Test Group",
"_id": "test_group"
"name": "Example Group",
"_id": "example_group"
}
{
"text":"Scitran core!"
}
{"access":"ro", "_id": "coltonlw@flywheel.io", "site":"local"}
{
"_id":"coltonlw@flywheel.io",
"site":"local",
"access":"admin"
}
{
"value":"example-tag"
}
{
"ticket": "57f2af23-a94c-426d-8521-11b2e8782020",
"filename": "exampledicom.zip",
"file_cnt": 1,
"size": 4525137
}
{
"files": [{
"origin": {
"type": "job",
"id": "58063f24e5dc5b001657a87f"
},
"mimetype": "application/octet-stream",
"hash": "v0-sha384-12188e00a26650b2baa3f0195337dcf504f4362bb2136eef0cdbefb57159356b1355a0402fca0ab5ab081f21c305e5c2",
"name": "cortical_surface_right_hemisphere.obj",
"tags": [],
"measurements": [],
"modified": "2016-10-18T15:26:35.701000+00:00",
"instrument": null,
"input": true,
"size": 21804112,
"type": "None",
"metadata": {}
}, {
"origin": {
"type": "job",
"id": "58065fa7e5dc5b001457a882"
},
"mimetype": "application/octet-stream",
"hash": "v0-sha384-12188e00a26650b2baa3f0195337dcf504f4362bb2136eef0cdbefb57159356b1355a0402fca0ab5ab081f21c305e5c2",
"name": "cortical_surface_right_hemisphere.obj",
"tags": [],
"measurements": [],
"modified": "2016-10-18T17:45:17.776000+00:00",
"instrument": null,
"output": true,
"metadata": {},
"type": "None",
"size": 21804112
}],
"created": "2016-10-18T17:45:11.778000+00:00",
"modified": "2016-10-18T17:45:11.778000+00:00",
"label": "cortex-demo 10/18/2016 13:45:5",
"job": {
"inputs": {
"anatomy": {
"type": "analysis",
"id": "58063f24e5dc5b001657a87e",
"name": "cortical_surface_right_hemisphere.obj"
}
},
"attempt": 1,
"name": "cortex-demo",
"tags": ["ad-hoc", "cortex-demo", "analysis"],
"destination": {
"type": "analysis",
"id": "58065fa7e5dc5b001457a881"
},
"request": {
"inputs": [{
"location": "/",
"type": "http",
"uri": "https://storage.googleapis.com/flywheel/gears/v1/scitran/cortex-demo/cortex-demo_manifest-labels_20160725T031837.331720Z.tar.gz",
"vu": "vu0:sha384:ssx5VWyFg7r8IBoOIphq7GaB_CymInQ1NxTV2WTDzglJLJ1-ktEbjLIHVABRzesV"
}, {
"type": "scitran",
"uri": "/jobs/58065fa7e5dc5b001457a882/config.json",
"location": "/flywheel/v0"
}, {
"type": "scitran",
"uri": "/sessions/58063e7ed213ed776045b320/analyses/58063f24e5dc5b001657a87e/files/cortical_surface_right_hemisphere.obj",
"location": "/flywheel/v0/input/anatomy"
}],
"target": {
"command": ["bash", "-c", "rm -rf output; mkdir -p output; ./run; echo \"Exit was $?\""],
"env": {
"PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
},
"dir": "/flywheel/v0"
},
"outputs": [{
"type": "scitran",
"uri": "/engine?level=analysis&id=58065fa7e5dc5b001457a881&job=58065fa7e5dc5b001457a882",
"location": "/flywheel/v0/output"
}]
},
"modified": "2016-10-18T17:45:21.344000+00:00",
"created": "2016-10-18T17:45:11.816000+00:00",
"state": "complete",
"config": {},
"id": "58065fa7e5dc5b001457a882"
},
"user": "canakgun@flywheel.io",
"_id": "58065fa7e5dc5b001457a881"
}
{"ticket": "1e975e3d-21e9-41f4-bb97-261f03d35ba1"}
{
"_id":"580925ce9e512c57dc8a103b",
"text":"some text",
"created": "2016-10-21T17:19:40.899000+00:00",
"modified": "2016-10-21T17:19:40.899000+00:00",
"user": "coltonlw@flywheel.io"
}
{
"token":"57fe88cc9e512c5d2b5dcb0b"
}
{"access": "admin", "_id": "coltonlw@flywheel.io", "site": "local"}
{
"projects": [
{
"demographics_grid": {
"Black or African American": {
"Not Hispanic or Latino": {
"Male": 0,
"Unknown or Not Reported": 0,
"Female": 0
},
"Total": 0,
"Unknown or Not Reported": {
"Male": 0,
"Unknown or Not Reported": 0,
"Female": 0
},
"Hispanic or Latino": {
"Male": 0,
"Unknown or Not Reported": 0,
"Female": 0
}
},
"Unknown or Not Reported": {
"Not Hispanic or Latino": {
"Male": 0,
"Unknown or Not Reported": 0,
"Female": 0
},
"Total": 1,
"Unknown or Not Reported": {
"Male": 1,
"Unknown or Not Reported": 0,
"Female": 0
},
"Hispanic or Latino": {
"Male": 0,
"Unknown or Not Reported": 0,
"Female": 0
}
},
"American Indian or Alaska Native": {
"Not Hispanic or Latino": {
"Male": 0,
"Unknown or Not Reported": 0,
"Female": 0
},
"Total": 0,
"Unknown or Not Reported": {
"Male": 0,
"Unknown or Not Reported": 0,
"Female": 0
},
"Hispanic or Latino": {
"Male": 0,
"Unknown or Not Reported": 0,
"Female": 0
}
},
"Asian": {
"Not Hispanic or Latino": {
"Male": 0,
"Unknown or Not Reported": 0,
"Female": 0
},
"Total": 0,
"Unknown or Not Reported": {
"Male": 0,
"Unknown or Not Reported": 0,
"Female": 0
},
"Hispanic or Latino": {
"Male": 0,
"Unknown or Not Reported": 0,
"Female": 0
}
},
"White": {
"Not Hispanic or Latino": {
"Male": 0,
"Unknown or Not Reported": 0,
"Female": 0
},
"Total": 0,
"Unknown or Not Reported": {
"Male": 0,
"Unknown or Not Reported": 0,
"Female": 0
},
"Hispanic or Latino": {
"Male": 0,
"Unknown or Not Reported": 0,
"Female": 0
}
},
"Total": {
"Not Hispanic or Latino": {
"Male": 0,
"Unknown or Not Reported": 0,
"Female": 0
},
"Total": 0,
"Unknown or Not Reported": {
"Male": 1,
"Unknown or Not Reported": 0,
"Female": 0
},
"Hispanic or Latino": {
"Male": 0,
"Unknown or Not Reported": 0,
"Female": 0
}
},
"Native Hawaiian or Other Pacific Islander": {
"Not Hispanic or Latino": {
"Male": 0,
"Unknown or Not Reported": 0,
"Female": 0
},
"Total": 0,
"Unknown or Not Reported": {
"Male": 0,
"Unknown or Not Reported": 0,
"Female": 0
},
"Hispanic or Latino": {
"Male": 0,
"Unknown or Not Reported": 0,
"Female": 0
}
},
"More Than One Race": {
"Not Hispanic or Latino": {
"Male": 0,
"Unknown or Not Reported": 0,
"Female": 0
},
"Total": 0,
"Unknown or Not Reported": {
"Male": 0,
"Unknown or Not Reported": 0,
"Female": 0
},
"Hispanic or Latino": {
"Male": 0,
"Unknown or Not Reported": 0,
"Female": 0
}
}
},
"male_count": 1,
"group_name": "test-group",
"over_18_count": 1,
"under_18_count": 0,
"female_count": 0,
"subjects_count": 1,
"other_count": 0,
"name": "test-project-1",
"session_count": 1,
"admins": [
"Colton LW"
],
"demographics_total": 1
}
]
}
{
"group_count": 4,
"groups": [
{
"project_count": 0,
"name": "Unknown",
"session_count": 0
},
{
"project_count": 0,
"name": "Scientific Transparency",
"session_count": 0
},
{
"project_count": 0,
"name": "Test Group",
"session_count": 0
},
{
"project_count": 1,
"name": null,
"session_count": 1
}
]
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment