This repository was archived by the owner on Mar 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathjson_schema_sqv2.json
More file actions
201 lines (193 loc) · 5.56 KB
/
json_schema_sqv2.json
File metadata and controls
201 lines (193 loc) · 5.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
{
"$schema": "http://to_be_decided.com/draft-2/schema#",
"definitions": {
"termCode": {
"type": "object",
"description": "The termCode defines a concept based on a coding system (i.e. LOINC). The triplet of code, system and version identify the concept.",
"properties": {
"code": { "type": "string" },
"system": { "type": "string"},
"version": { "type": "string"},
"display": { "type": "string"}
},
"required": ["code", "system", "display"]
},
"criterion": {
"type": "object",
"properties": {
"termCodes": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#/definitions/termCode" }
},
"valueFilter": { "$ref": "#/definitions/valueFilter"},
"attributeFilters": { "$ref": "#/definitions/attributeFilters"},
"timeRestriction": { "$ref": "#/definitions/timeRestriction"}
},
"required": ["termCodes"]
},
"timeRestriction": {
"type": "object",
"description": "TimeRestirction specify the interval within the critiera has to be fullfilled. An intersection of the criterias interval with the interval defined in this timeRestriction is sufficient",
"properties": {
"beforeDate": { "type": "string", "format": "date"},
"afterDate": { "type": "string", "format": "date"}
},
"anyOf": [ {"required": ["beforeDate"]}, {"required": ["afterDate"]}]
},
"unit": {
"type": "object",
"title": "UCUM Unit",
"description": "The unit is a ucum unit (https://ucum.org/trac)",
"properties": {
"code": { "type": "string" },
"display": {"type": "string"}
},
"required": ["code", "display"]
},
"attributeFilters": {
"type": "array",
"items": {"$ref": "#/definitions/attributeFilter"}
},
"valueFilter": {
"type": "object",
"properties": {
"type": { "enum": ["concept", "quantity-comparator", "quantity-range"]}
},
"required": ["type"],
"allOf": [
{
"if": {
"properties": {"type": {"const": "concept"}}
},
"then": {
"properties": {
"type": {"const": "concept"},
"selectedConcepts": {
"type": "array",
"minItems": 1,
"items": {"$ref": "#/definitions/termCode"}
}
},
"required": ["type", "selectedConcepts"]
}
},
{
"if": {
"properties": {"type": {"const": "quantity-comperator"}}
},
"then": {
"properties": {
"type": {"const": "quantity-comperator"},
"comparator": { "enum": ["gt", "ge", "lt", "le", "eq", "ne"] },
"value": { "type": "number" },
"unit" : {"$ref": "#/definitions/unit" }
},
"required": ["type", "comparator", "value"]
}
},
{
"if" : {
"properties": {"type": {"const": "quantity-range"}}
},
"then" : {
"properties": {
"type": {"const": "quantity-range"},
"minValue": { "type": "number" },
"maxValue": { "type": "number" },
"unit" : {"$ref": "#/definitions/unit" }
},
"required": ["type", "minValue", "maxValue"]
}
}
]
},
"attributeFilter": {
"type": "object",
"properties": {
"type": { "enum": ["concept", "quantity-comparator", "quantity-range"]}
},
"required": ["type"],
"allOf": [
{
"if": {
"properties": {"type": {"const": "concept"}}
},
"then": {
"properties": {
"attributeCode": {"$ref": "#/definitions/termCode"},
"type": {"const": "concept"},
"selectedConcepts": {
"type": "array",
"minItems": 1,
"items": {"$ref": "#/definitions/termCode"}
}
},
"required": ["type", "selectedConcepts", "attributeCode"]
}
},
{
"if": {
"properties": {"type": {"const": "quantity-comperator"}}
},
"then": {
"properties": {
"attributeCode": {"$ref": "#/definitions/termCode"},
"type": {"const": "quantity-comperator"},
"comparator": { "enum": ["gt", "ge", "lt", "le", "eq", "ne"] },
"value": { "type": "number" },
"unit" : {"$ref": "#/definitions/unit" }
},
"required": ["type", "comparator", "value", "attributeCode"]
}
},
{
"if" : {
"properties": {"type": {"const": "quantity-range"}}
},
"then" : {
"properties": {
"attributeCode": {"$ref": "#/definitions/termCode"},
"type": {"const": "quantity-range"},
"minValue": { "type": "number" },
"maxValue": { "type": "number" },
"unit" : {"$ref": "#/definitions/unit" }
},
"required": ["type", "minValue", "maxValue", "attributeCode"]
}
}
]
}
},
"$id": "http://to_be_decided.com/query.schema.json",
"title": "queryDefinition",
"description": "Within a query the inclusion and exclusion criteria are conjuncted with AND NOT",
"type": "object",
"properties": {
"version": {"type": "string", "format": "uri"},
"inclusionCriteria": {
"type": "array",
"minItems": 1,
"description": "All elements within the array are conjuncted with an AND operator",
"items": {
"type": "array",
"minItems": 1,
"description": "All elements within the array are conjuncted with an OR operator",
"items": { "$ref": "#/definitions/criterion" }
}
},
"exclusionCriteria": {
"type": "array",
"minItems": 1,
"description": "All elements within the array are conjuncted with an OR operator",
"items": {
"type": "array",
"minItems": 1,
"description": "All elements within the array are conjuncted with an AND operator",
"items": { "$ref": "#/definitions/criterion" }
}
},
"display" : {"type": "string"}
},
"required": ["version", "inclusionCriteria" ]
}