Skip to content

Commit fcbbeea

Browse files
authored
Merge branch 'master' into master
2 parents edbdae6 + 0fca4d5 commit fcbbeea

File tree

7 files changed

+164
-4
lines changed

7 files changed

+164
-4
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,22 @@
11
# SPINE-json-schema
22
Public JSON schemas for SPINE
3+
4+
5+
# READ THIS BEFORE MAKING CHANGES
6+
If you make changes and tag this project make sure that the version of the ```package.json``` file is the same as the tagged version of the repository. This will allow the front-end of SPINE to ```npm install``` the correct version.
7+
8+
# For SPINE developers
9+
- We have a version of the schema used in the SPINE project saved in a document in the database. All the documents in the database have to be compliant with this schema.
10+
- The front-end will generate the schema validator in a static way given that all the documents are in the same json schema version.
11+
- We need to provide migration scripts for the database for each change in the schema.
12+
13+
## Procedure after changes
14+
1. Update schema documents
15+
1. Update the version of the ```package.json``` file
16+
1. Commit, Pull Request, and Merge into the master branch
17+
1. Tag this repository according to the version in the ```package.json``` file
18+
1. In the SPINE repository change the version of this repository in the dependences in the ```package.json``` file
19+
1. In SPINE project run ```npm install```
20+
1. Create migration script for the database and save it the SPINE repository in the folder ```src/backedn/migrations_scripts/```. ***The migration script changes at least the document having the version of the json schema used.***
21+
1. Create a release for SPINE project including migration instructions from previous releases. Please refer to the migration script in the commit messages.
22+

examples/annotationWorkflow/roi_notSubmitted.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"properties":{
99
"implicit":{
1010
"implicitRelationWithRoi": "INSIDE",
11-
"implicitGemetryPointer": "POINT",
11+
"implicitGeometryPointer": "POINT",
1212
"roiProperties":{
1313
"worldCoordinates":{
1414
"x": 10.45,

package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "SPINE-json-schema",
3+
"author": "Alfredo Morales Pinzon",
4+
"license": "MIT",
5+
"keywords": ["SPINE", "schema", "model", "json", "Image Processing", "pipelines", "workflow"],
6+
"description": "Set of JSON schemas for the SPINE Virtual Laboratory",
7+
"version": "1.0.0",
8+
"dependencies": {
9+
10+
}
11+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"$id":"https://raw.githubusercontent.com/SPINEProject/SPINE-json-schema/master/schemas/annotationTableDefinition.schema.json",
3+
"$schema": "http://json-schema.org/draft-07/schema#",
4+
"title": "Annotation Table Data",
5+
"description": "Schema an annotation table data",
6+
"type": "object",
7+
"properties": {
8+
"lookAndFeel": {
9+
"description": "References to other objects",
10+
"type": "object",
11+
"properties": {
12+
"activeRoiId": {
13+
"description":"ID of the active annotation",
14+
"type":"string"
15+
}
16+
}
17+
},
18+
"reference": {
19+
"description": "References to other objects",
20+
"type": "object",
21+
"properties": {
22+
"annotationTableDefinitionId": {
23+
"description":"ID of the annotation table definition",
24+
"type":"string"
25+
}
26+
}
27+
},
28+
"data": {
29+
"description": "The list of ROI and their annotations (content of the table)",
30+
"type": "array",
31+
"items": {
32+
"type":"object"
33+
"properties": {
34+
"id": {
35+
"description":"ID of the ROI",
36+
"type":"string"
37+
},
38+
"roi": {
39+
"type":"object",
40+
"properties": {}
41+
},
42+
"annotations": {
43+
"type":"object",
44+
"patternProperties": {
45+
".*": {
46+
"type": "object"
47+
}
48+
}
49+
}
50+
},
51+
"required": ["id", "roi", "annotations"]
52+
}
53+
}
54+
},
55+
"required": ["lookAndFeel", "reference", "data"]
56+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"$id":"https://raw.githubusercontent.com/SPINEProject/SPINE-json-schema/master/schemas/annotationTableDefinition.schema.json",
3+
"$schema": "http://json-schema.org/draft-07/schema#",
4+
"title": "Annotation Table Definition",
5+
"description": "Schema an annotation table definition",
6+
"type": "object",
7+
"properties": {
8+
"columns": {
9+
"description": "Columns of the annotation table",
10+
"type": "object",
11+
"patternProperties" : {
12+
".*" : {
13+
"properties": {
14+
"type":{
15+
"description":"Type of the column",
16+
"type":"string"
17+
},
18+
"name": {
19+
"description":"Name of the column",
20+
"type":"string"
21+
},
22+
"value": {
23+
"description":"Default value for the column",
24+
"type":"string"
25+
}
26+
},
27+
"required":["type", "name", "value"]
28+
}
29+
}
30+
}
31+
},
32+
"required": ["columns"]
33+
}

schemas/core.schema.json

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"type": "string",
4545
"enum": ["String","Number","imageFileInOut","imageEntityInOut",
4646
"auxiliaryImageFile","lookupTableInOut","roiInOut","annotationInOut",
47-
"roiWithAnnotationsInOut"]
47+
"roiWithAnnotationsInOut","annotationTableDefinitionInOut"]
4848
},
4949

5050
"inputOutput": {
@@ -160,6 +160,40 @@
160160
]
161161
},
162162

163+
"annotationTableDefinitionInOut": {
164+
"$id": "#annotationTableDefinitionInOut",
165+
"description": "Schema defining an annotation table definition as input output",
166+
"allOf":[
167+
{"$ref": "#/definitions/inputOutput_spine"},
168+
{
169+
"properties": {
170+
"type":{
171+
"type": "string",
172+
"enum": ["annotationTableDefinitionInOut"]
173+
}
174+
},
175+
"required": ["type"]
176+
}
177+
]
178+
},
179+
180+
"annotationTableDataInOut": {
181+
"$id": "#annotationTableDataInOut",
182+
"description": "Schema defining an annotation table data as input output",
183+
"allOf":[
184+
{"$ref": "#/definitions/inputOutput_spine"},
185+
{
186+
"properties": {
187+
"type":{
188+
"type": "string",
189+
"enum": ["annotationTableDataInOut"]
190+
}
191+
},
192+
"required": ["type"]
193+
}
194+
]
195+
},
196+
163197
"lookupTableInOut_FileFormat": {
164198
"$id" : "#lookupTableInOut_Type",
165199
"description": "File format for lookup tables",
@@ -370,7 +404,9 @@
370404
{"$ref": "#/definitions/String"},
371405
{"$ref": "#/definitions/Number"},
372406
{"$ref": "#/definitions/imageFileInOut"},
373-
{"$ref": "#/definitions/lookupTableInOut"}
407+
{"$ref": "#/definitions/lookupTableInOut"},
408+
{"$ref": "#/definitions/annotationTableDefinitionInOut"},
409+
{"$ref": "#/definitions/annotationTableDataInOut"}
374410
]
375411
}
376412

schemas/roi.schema.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,11 @@
138138
"implicitGeometryPointer": {
139139
"enum": ["POINT"]
140140
},
141-
"roiProperties": {
141+
"
142+
143+
144+
145+
": {
142146
"description": "Properties for a point in implicit pointer. If the implicitGemetryPointer is POINT.",
143147
"type": "object",
144148
"properties": {

0 commit comments

Comments
 (0)