Skip to content

Commit 0fca4d5

Browse files
authored
Merge pull request #27 from alfredomp/fixAnnotation
Fix annotation
2 parents aaacc12 + 20e5001 commit 0fca4d5

File tree

9 files changed

+350
-28
lines changed

9 files changed

+350
-28
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"status": "SAVED",
3+
"reference": {
4+
"roiId": "7ba82ae63c95754352706fcca5039e1b",
5+
"materializedTaskId": "7ba82ae63c95754352706fcca5037a66",
6+
"taskId": "7ba82ae63c95754352706fcca5039e1b",
7+
"workflowId": "7ba82ae63c95754352706fcca5037a66",
8+
"questionId": "7ba82ae63c95754352706fcca5037a66"
9+
},
10+
"typeQuestion":"MULTIPLE_CHOICE_MULTIPLE_ANSWER",
11+
"typeAnnotation": "TEXT",
12+
"properties": {
13+
"values": [
14+
"Identification uncertain"
15+
],
16+
"isOntologyBased": false
17+
}
18+
}

examples/annotation/openEnded.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"status": "SAVED",
3+
"reference": {
4+
"roiId": "7ba82ae63c95754352706fcca5039e1b",
5+
"materializedTaskId": "7ba82ae63c95754352706fcca5037a66",
6+
"taskId": "7ba82ae63c95754352706fcca5039e1b",
7+
"workflowId": "7ba82ae63c95754352706fcca5037a66",
8+
"questionId": "7ba82ae63c95754352706fcca5037a66"
9+
},
10+
"typeQuestion":"OPEN_ENDED",
11+
"typeAnnotation": "NUMBER",
12+
"properties": {
13+
"value": 3,
14+
"concept": "volume",
15+
"isOntologyBased": false
16+
}
17+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"typeQuestion":"MULTIPLE_CHOICE_SINGLE_ANSWER",
3+
"status": "SAVED",
4+
"reference": {
5+
"roiId": "7ba82ae63c95754352706fcca5039e1b",
6+
"materializedTaskId": "7ba82ae63c95754352706fcca5037a66",
7+
"taskId": "7ba82ae63c95754352706fcca5039e1b",
8+
"workflowId": "7ba82ae63c95754352706fcca5037a66",
9+
"questionId": "7ba82ae63c95754352706fcca5037a66"
10+
},
11+
"typeAnnotation": "TEXT",
12+
"properties": {
13+
"value": "Identification uncertain",
14+
"isOntologyBased": false
15+
}
16+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"typeQuestion":"MULTIPLE_CHOICE_MULTIPLE_ANSWER",
3+
"propertiesAnnotation": {
4+
"typeAnnotationOptions":"TEXT",
5+
"isOntologyBased": false
6+
},
7+
"options": [
8+
{
9+
"value": "Cerebrum"
10+
},
11+
{
12+
"value": "Cerebellum"
13+
},
14+
{
15+
"value": "Brainstem"
16+
}
17+
]
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"typeQuestion":"MULTIPLE_CHOICE_SINGLE_ANSWER",
3+
"propertiesAnnotation": {
4+
"typeAnnotationOptions":"TEXT",
5+
"isOntologyBased": false
6+
},
7+
"options": [
8+
{
9+
"value": "Cerebrum"
10+
},
11+
{
12+
"value": "Cerebellum"
13+
},
14+
{
15+
"value": "Brainstem"
16+
}
17+
]
18+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"typeQuestion":"OPEN_ENDED",
3+
"propertiesAnnotation": {
4+
"typeAnnotationOptions":"TEXT",
5+
"isOntologyBased": false
6+
},
7+
"options": "Comments"
8+
}

schemas/annotation.schema.json

Lines changed: 58 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,53 +4,85 @@
44
"title": "Annotation Schema",
55
"type": "object",
66
"TODOS": [
7-
"Usually an annotation is a simple comment. In the future an annotation can be an image, for instance a probability mask."
7+
"Usually an annotation is a simple comment. In the future an annotation can be an image, for instance a probability mask. This can be the answer to the question, what is the probability for every voxel to be part of the corpus callosum."
88
],
99
"definitions": {
1010

1111
"annotationBasic":{
1212
"$id": "#annotationBasic",
1313
"description": "Basic description of an annotation",
1414
"properties":{
15-
"typeAnnotationForm":{
16-
"$ref": "annotationForm.schema.json#/definitions/typeAnnotationForm"
15+
"typeQuestion":{
16+
"$ref": "question.schema.json#/definitions/typeQuestion"
1717
},
1818
"typeAnnotation": {
19-
"description": "",
20-
"type": "string",
21-
"enum": ["TEXT","IMAGE","NUMBER","BOOLEAN"]
19+
"$ref": "question.schema.json#/definitions/typeAnnotationOptions"
2220
},
2321
"status": {
2422
"description": "Status of the annotation: saved or submitted",
2523
"type": "string",
2624
"enum": ["SAVED","SUBMITTED"]
2725
},
2826
"reference": {
29-
"roiId": {
30-
"description": "Id of the ROI annotated by this annotation",
31-
"type": "string"
27+
"description": "References to main documents",
28+
"type": "object",
29+
"properties": {
30+
"roiId": {
31+
"description": "Id of the ROI annotated by this annotation",
32+
"type": "string"
33+
},
34+
"taskId": {
35+
"description": "Id of the task used to produce this annotation",
36+
"type": "string"
37+
},
38+
"workflowId": {
39+
"description": "Id of the workflow used to produce this annotation",
40+
"type": "string"
41+
},
42+
"materializedTaskId": {
43+
"description": "Id of the materialized task used to created the ROI. If not set then the materialized task has not been submitted.",
44+
"type": "string"
45+
},
46+
"questionId":{
47+
"description": "Id of the question related to this annotation. An annotation is an answer to a question.",
48+
"type": "string"
49+
}
3250
},
33-
"materializedTaskId":{
34-
"description": "Id of the materialized task used to created the ROI. If not set then the materialized task has not been submitted.",
35-
"type": "string"
36-
}
51+
"required": ["roiId", "materializedTaskId", "questionId"],
52+
"additionalProperties": false
3753
},
3854
"properties": {
3955
"description": "Properties of the annotation. The list of properties depends in the type of annotation.",
4056
"type": "object",
41-
"properties": {
42-
"isOntologyBased":{
43-
"description": "True if the annotation and its options are based on an ontology",
44-
"type": "boolean"
57+
"oneOf":[
58+
{
59+
"properties": {
60+
"isOntologyBased": {
61+
"description": "True if the annotation and its options are based on an ontology",
62+
"type": "boolean",
63+
"enum": [true]
64+
},
65+
"ontologyId": {
66+
"description": "Id of the ontology where the value of the annotation is retrieved.",
67+
"type": "string"
68+
}
69+
},
70+
"required": ["isOntologyBased", "ontologyId"]
4571
},
46-
"ontologyId": {
47-
"description": "Id of the ontology where the value of the annotation is retrieved.",
48-
"type": "string"
72+
{
73+
"properties": {
74+
"isOntologyBased": {
75+
"description": "True if the annotation and its options are based on an ontology",
76+
"type": "boolean",
77+
"enum": [false]
78+
}
79+
},
80+
"required": ["isOntologyBased"]
4981
}
50-
}
82+
]
5183
}
5284
},
53-
"required": ["typeAnnotationForm", "typeAnnotation", "status", "reference", "properties"]
85+
"required": ["typeQuestion", "typeAnnotation", "status", "reference", "properties"]
5486
},
5587

5688
"annotationMultipleChoiceMultipleAnswer":{
@@ -60,7 +92,7 @@
6092
{ "$ref": "#/definitions/annotationBasic" },
6193
{
6294
"properties":{
63-
"typeAnnotationForm": {
95+
"typeQuestion": {
6496
"enum": ["MULTIPLE_CHOICE_MULTIPLE_ANSWER"]
6597
},
6698
"properties":{
@@ -84,7 +116,7 @@
84116
{ "$ref": "#/definitions/annotationBasic" },
85117
{
86118
"properties":{
87-
"typeAnnotationForm": {
119+
"typeQuestion": {
88120
"enum": ["MULTIPLE_CHOICE_SINGLE_ANSWER"]
89121
},
90122
"properties":{
@@ -109,7 +141,7 @@
109141
{ "$ref": "#/definitions/annotationBasic" },
110142
{
111143
"properties":{
112-
"typeAnnotationForm": {
144+
"typeQuestion": {
113145
"enum": ["OPEN_ENDED"]
114146
},
115147
"properties":{
@@ -132,6 +164,5 @@
132164
{ "$ref": "#/definitions/annotationMultipleChoiceMultipleAnswer" },
133165
{ "$ref": "#/definitions/annotationMultipleChoiceSingleAnswer" },
134166
{ "$ref": "#/definitions/annotationOpenEnded" }
135-
136167
]
137-
}
168+
}

schemas/annotationForm.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$id":"https://raw.githubusercontent.com/SPINEProject/SPINE-json-schema/master/schemas/annotationForm.schema.json",
2+
"$id":"https://raw.githubusercontent.com/SPINEProject/SPINE-json-schema/master/schemas/question.schema.json",
33
"$schema": "http://json-schema.org/draft-07/schema#",
44
"title": "Annotation Forms that describes the options for an annotation",
55
"type": "object",

0 commit comments

Comments
 (0)