Skip to content

Commit b59a98c

Browse files
committed
Add documentation for resolver endpoint
Closes #1088
1 parent e74183e commit b59a98c

File tree

6 files changed

+186
-0
lines changed

6 files changed

+186
-0
lines changed

api/config.py

+1
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ def apply_env_variables(config):
173173
'project-template.json',
174174
'project-update.json',
175175
'propose-batch.json',
176+
'resolver.json',
176177
'rule-new.json',
177178
'rule-update.json',
178179
'search-query.json',

swagger/index.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ paths:
6969
- paths/analyses.yaml
7070
- paths/site-rules.yaml
7171
- paths/dataexplorer.yaml
72+
- paths/resolver.yaml
7273

7374

7475
securityDefinitions:

swagger/paths/resolver.yaml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/resolve:
2+
post:
3+
summary: Perform path based lookup of nodes in the Flywheel hierarchy
4+
description: |
5+
This will perform a deep lookup of a node (i.e. group/project/session/acquisition) and its children,
6+
including any files. The query path is an array of strings in the following order (by default):
7+
8+
* group id
9+
* project label
10+
* session label
11+
* acquisition label
12+
13+
An ID can be used instead of a label by formatting the string as `<id:project_id>`. The full path
14+
to the node, and the node's children will be included in the response.
15+
operationId: resolve_path
16+
parameters:
17+
- name: body
18+
in: body
19+
required: true
20+
schema:
21+
$ref: schemas/input/resolver.json
22+
responses:
23+
'200':
24+
description: ''
25+
schema:
26+
$ref: schemas/output/resolver.json
+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"definitions": {
4+
"resolver-input": {
5+
"type": "object",
6+
"properties": {
7+
"path": {
8+
"type": "array",
9+
"minLength": 1,
10+
"items": {
11+
"type": "string"
12+
}
13+
}
14+
},
15+
"required": ["path"]
16+
},
17+
"resolver-output": {
18+
"type": "object",
19+
"properties": {
20+
"path": { "$ref": "#/definitions/resolver-node-list" },
21+
"children": { "$ref": "#/definitions/resolver-node-list" }
22+
},
23+
"required": ["path"]
24+
},
25+
"resolver-node": {
26+
"type": "object",
27+
"properties": {
28+
"node_type": {
29+
"type": "string"
30+
}
31+
},
32+
"discriminator": "node_type",
33+
"required": ["node_type"]
34+
},
35+
"resolver-node-list": {
36+
"type": "array",
37+
"items": { "$ref": "#/definitions/resolver-node" }
38+
},
39+
"group-node": {
40+
"allOf": [
41+
{"$ref":"#/definitions/resolver-node"},
42+
{"$ref":"group.json#/definitions/group-output"}
43+
],
44+
"x-discriminator-value": "group"
45+
},
46+
"project-node": {
47+
"allOf": [
48+
{"$ref":"#/definitions/resolver-node"},
49+
{"$ref":"project.json#/definitions/project-output"}
50+
],
51+
"x-discriminator-value": "project"
52+
},
53+
"session-node": {
54+
"allOf": [
55+
{"$ref":"#/definitions/resolver-node"},
56+
{"$ref":"session.json#/definitions/session-output"}
57+
],
58+
"x-discriminator-value": "session"
59+
},
60+
"acquisition-node": {
61+
"allOf": [
62+
{"$ref":"#/definitions/resolver-node"},
63+
{"$ref":"acquisition.json#/definitions/acquisition-output"}
64+
],
65+
"x-discriminator-value": "acquisition"
66+
},
67+
"file-node": {
68+
"allOf": [
69+
{"$ref":"#/definitions/resolver-node"},
70+
{"$ref":"file.json#/definitions/file-output"}
71+
],
72+
"x-discriminator-value": "file"
73+
}
74+
}
75+
}

swagger/schemas/input/resolver.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"type": "object",
4+
"allOf": [{"$ref": "../definitions/resolver.json#/definitions/resolver-input"}],
5+
"example": {
6+
"path": ["scitran", "Neuroscience"]
7+
}
8+
}

swagger/schemas/output/resolver.json

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"type":"object",
4+
"allOf": [{ "$ref": "../definitions/resolver.json#/definitions/resolver-output" }],
5+
"example": {
6+
"path": [
7+
{
8+
"node_type": "group",
9+
"_id": "scitran",
10+
"label": "Scitran",
11+
"permissions": [
12+
{
13+
"access": "admin",
14+
15+
}
16+
],
17+
"created": "2016-08-19T11:41:15.360000+00:00",
18+
"modified": "2016-08-19T11:41:15.360000+00:00"
19+
},
20+
{
21+
"node_type": "project",
22+
"_id": "57e452791cff88b85f9f9c97",
23+
"label": "Neuroscience",
24+
"group": "scitran",
25+
"created": "2016-09-22T21:51:53.151000+00:00",
26+
"modified": "2016-09-22T21:51:53.151000+00:00",
27+
"public": false,
28+
"permissions": [{
29+
"access": "admin",
30+
31+
}]
32+
}
33+
],
34+
"children": [
35+
{
36+
"node_type": "session",
37+
"_id": "57e01cccb1dc04000fb83f03",
38+
"label": "control_1",
39+
"group": "scitran",
40+
"created": "2016-09-19T17:13:48.164000+00:00",
41+
"subject": {
42+
"code": "ex4784",
43+
"_id": "57e01cccb1dc04000fb83f02"
44+
},
45+
"modified": "2016-09-19T17:13:48.164000+00:00",
46+
"project": "57e01cccf6b5d5edbcb4e1cf",
47+
"public": false,
48+
"permissions": [{
49+
"access": "admin",
50+
51+
}]
52+
},
53+
{
54+
"node_type": "file",
55+
"origin": {
56+
"method": "importer",
57+
"type": "device",
58+
"id": "importer_Admin_Import",
59+
"name": "Admin Import"
60+
},
61+
"mimetype": "application/zip",
62+
"measurements": [],
63+
"hash": "v0-sha384-dd3c97bfe0ad1fcba75ae6718c6e81038c59af4f447f5db194d52732efa4f955b28455db02eb64cad3e4e55f11e3679f",
64+
"name": "4784_1_1_localizer_dicom.zip",
65+
"tags": [],
66+
"created": "2016-09-21T14:56:09.943000+00:00",
67+
"modified": "2016-09-21T14:56:09.943000+00:00",
68+
"modality": null,
69+
"info": {},
70+
"type": "dicom",
71+
"size": 989933
72+
}
73+
]
74+
}
75+
}

0 commit comments

Comments
 (0)