Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-apply referencing IEEE schemas #28

Merged
merged 3 commits into from
Jul 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/validator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests "jsonschema[format]"
pip install -r requirements.txt

- name: Run validator
run: |
Expand Down
39 changes: 39 additions & 0 deletions schema/omh/area-unit-value-1.1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://w3id.org/openmhealth/schemas/omh/area-unit-value-1.1.json",
"type": "object",
"description": "This schema represents an area (measure of a surface)",
"references": [
{
"description": "The SNOMED code represents Area",
"url": "http://purl.bioontology.org/ontology/SNOMEDCT/42798000"
}
],
"allOf": [
{
"$ref": "https://w3id.org/ieee/ieee-1752-schema/unit-value-1.0.json"
},
{
"properties": {
"unit": {
"references": [
{
"description": "The unit of measure of the element. Basic unit is meter (m). Allowed values are drawn from the SI Area Units and English Area Units Common Synonyms (non-UCUM). The valid UCUM code is different for square inch ([sin_i]), square foot ([sft_i]), square yard ([syd_i]).",
"url": "http://download.hl7.de/documents/ucum/ucumdata.html"
}
],
"enum": [
"mm^2",
"cm^2",
"m^2",
"km^2",
"in^2",
"ft^2",
"yd^2",
"mi^2"
]
}
}
}
]
}
66 changes: 66 additions & 0 deletions schema/omh/blood-pressure-4.0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://w3id.org/openmhealth/schemas/omh/blood-pressure-4.0.json",
"description": "This schema represents a person's blood pressure as a combination of systolic and diastolic blood pressure.",
"type": "object",
"references": [
{
"description": "The SNOMED codes represents Blood pressure (observable entity)",
"url": "http://purl.bioontology.org/ontology/SNOMEDCT/75367002"
}
],
"definitions": {
"systolic_blood_pressure": {
"$ref": "systolic-blood-pressure-1.x.json"
},
"diastolic_blood_pressure": {
"$ref": "diastolic-blood-pressure-1.x.json"
},
"time_frame": {
"$ref": "https://w3id.org/ieee/ieee-1752-schema/time-frame-1.0.json"
},
"body_posture": {
"$ref": "https://w3id.org/ieee/ieee-1752-schema/body-posture-1.0.json"
},
"body_location": {
"$ref": "body-location-1.x.json"
},
"temporal_relationship_to_physical_activity": {
"$ref": "temporal-relationship-to-physical-activity-1.x.json"
},
"descriptive_statistic": {
"$ref": "https://w3id.org/ieee/ieee-1752-schema/descriptive-statistic-1.0.json"
}
},

"properties": {
"systolic_blood_pressure": {
"$ref": "#/definitions/systolic_blood_pressure"
},
"diastolic_blood_pressure": {
"$ref": "#/definitions/diastolic_blood_pressure"
},
"effective_time_frame": {
"$ref": "#/definitions/time_frame"
},
"body_posture": {
"$ref": "#/definitions/body_posture"
},
"descriptive_statistic": {
"$ref": "#/definitions/descriptive_statistic"
},
"measurement_location": {
"description": "The location on the body where the blood pressure measuring device is placed for measurement.",
"$ref": "#/definitions/body_location"
},
"temporal_relationship_to_physical_activity": {
"$ref": "#/definitions/temporal_relationship_to_physical_activity"
}
},

"required": [
"systolic_blood_pressure",
"diastolic_blood_pressure",
"effective_time_frame"
]
}
1 change: 1 addition & 0 deletions schema/omh/blood-pressure-4.x.json
6 changes: 5 additions & 1 deletion schema/omh/body-posture-1.0.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",

"deprecation": {
"reason": "This schema is now deprecated, in favor of the IEEE 1752.1 schema of the same name.",
"supersededBy": "https://w3id.org/ieee/ieee-1752-schema/body-posture.json",
"date": "2022-12-01"
},
"type": "string",
"description": "The posture of the subject (for example, during a clinical measurement). This value set is not exhaustive.",
"references": [
Expand Down
6 changes: 5 additions & 1 deletion schema/omh/physical-activity-1.2.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",

"deprecation": {
"reason": "This schema is now deprecated, in favor of the IEEE 1752.1 schema with the same name.",
"supersededBy": "https://w3id.org/ieee/ieee-1752-schema/physical-activity.json",
"date": "2022-12-01"
},
"description": "This schema represents a single episode of physical activity.",
"type": "object",
"references": [
Expand Down
6 changes: 5 additions & 1 deletion schema/omh/step-count-3.0.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",

"deprecation": {
"reason": "This schema is now deprecated, in favor of the IEEE 1752.1 physical-activity schema which models also number of steps.",
"supersededBy": "https://w3id.org/ieee/ieee-1752-schema/physical-activity.json",
"date": "2022-12-01"
},
"description": "This schema represents number of steps.",

"type": "object",
Expand Down
6 changes: 5 additions & 1 deletion schema/omh/time-frame-1.0.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",

"deprecation": {
"reason": "This schema is now deprecated, in favor of the IEEE 1752.1 schema of the same name.",
"supersededBy": "https://w3id.org/ieee/ieee-1752-schema/time-frame.json",
"date": "2022-12-01"
},
"description": "This schema describes a time frame as a point in time or a time interval.",

"type": "object",
Expand Down
6 changes: 5 additions & 1 deletion schema/omh/time-interval-1.0.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",

"deprecation": {
"reason": "This schema is now deprecated, in favor of the IEEE 1752.1 schema of the same name.",
"supersededBy": "https://w3id.org/ieee/ieee-1752-schema/time-interval.json",
"date": "2022-12-01"
},
"description": "This schema describes an interval of time. In the absence of a precise start and/or end time, the time interval can be described as a date + a part of the day (morning, afternoon, evening, night). No commitments are made as to whether the start or end time point itself is included in the interval (i.e., whether the defined interval includes the boundary point(s) or not).",
"type": "object",

Expand Down
3 changes: 1 addition & 2 deletions test-data-validator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ You'll need [Python 3.7](https://www.python.org/downloads/) or later.
You'll also need the [requests](https://pypi.org/project/requests/) and [jsonschema](https://pypi.org/project/jsonschema/) Python packages. Note that `jsonschema` depends on [format checkers](https://python-jsonschema.readthedocs.io/en/stable/validate/#validating-formats). You can install the format checkers with `jsonschema` by using the following commands:

```sh
pip install requests
pip install "jsonschema[format]"
pip install -r requirements.txt
```

> If you have both Python 2 and Python 3, your Python 3 command may be called `python3` and your Python 3 package installer command may be called `pip3`. Please use the appropriate Python 3 commands for your system.
Expand Down
2 changes: 2 additions & 0 deletions test-data-validator/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
jsonschema[format]==4.17.3
requests==2.31.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"ambient_sound": {
"value": 75,
"unit": "deciB"
},
"effective_time_frame": {
"date_time": "2019-02-05T06:00:00Z"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"stnding"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"semi-recumbent"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"date_time": "2013-02-05T07:25:00.123Z",
"time_interval": {
"duration": {
"value": 10,
"unit": "d"
},
"end_date_time": "2013-02-05T07:35:00Z"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"duration": {
"unit": "h",
"value": 7.6
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"end_date_time": "2013-02-05T07:25:00Z"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"start_date_time": "2013-02-05T07:25:00Z"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"unit": "foo",
"value": 7.6
}
3 changes: 3 additions & 0 deletions test-data/omh/area-unit-value/1.1/shouldFail/unit-only.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"unit": "m^2"
}
3 changes: 3 additions & 0 deletions test-data/omh/area-unit-value/1.1/shouldFail/value-only.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"value": 10
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"unit": "m^2",
"value": 7.6
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
14 changes: 14 additions & 0 deletions test-data/omh/blood-pressure/4.0/shouldFail/invalid-pa-value.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"systolic_blood_pressure": {
"value": 115,
"unit": "mmHg"
},
"diastolic_blood_pressure": {
"value": 60,
"unit": "mmHg"
},
"effective_time_frame": {
"date_time": "2020-02-05T07:25:00-08:00"
},
"temporal_relationship_to_physical_activity": "rest"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"systolic_blood_pressure": {
"value": 115,
"unit": "mmHg"
},
"diastolic_blood_pressure": {
"value": 60,
"unit": "mmHg"
},
"effective_time_frame": {
"time_interval": {
"date": "2013-02-05",
"part_of_day": "morning"
}
},
"temporal_relationship_to_physical_activity": "at rest"
}
13 changes: 13 additions & 0 deletions test-data/omh/blood-pressure/4.0/shouldFail/invalid-unit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"systolic_blood_pressure": {
"value": 115,
"unit": "mmH"
},
"diastolic_blood_pressure": {
"value": 60,
"unit": "mmHg"
},
"effective_time_frame": {
"date_time": "2020-02-05T07:25:00-08:00"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"systolic_blood_pressure": {
"value": 115,
"unit": "mmHg"
},
"diastolic_blood_pressure": {
"value": 60,
"unit": "mmHg"
},
"effective_time_frame": {
"date_time": "2020-02-05T07:25:00-08:00"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"systolic_blood_pressure": {
"value": 160,
"unit": "mmHg"
},
"diastolic_blood_pressure": {
"value": 60,
"unit": "mmHg"
},
"effective_time_frame": {
"time_interval": {
"start_date_time": "2020-02-05T07:00:00-08:00",
"end_date_time": "2020-02-12T07:00:00-08:00"
}
},
"body_posture": "sitting",
"measurement_location": "left wrist",
"descriptive_statistic": "maximum"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"systolic_blood_pressure": {
"value": 140,
"unit": "mmHg"
},
"diastolic_blood_pressure": {
"value": 60,
"unit": "mmHg"
},
"body_posture": "sitting",
"measurement_location": "left upper arm",
"effective_time_frame": {
"date_time": "2020-02-05T07:25:00-08:00"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"systolic_blood_pressure": {
"value": 125,
"unit": "mmHg"
},
"diastolic_blood_pressure": {
"value": 60,
"unit": "mmHg"
},
"body_posture": "sitting",
"measurement_location": "left wrist",
"temporal_relationship_to_physical_activity": "at rest",
"effective_time_frame": {
"date_time": "2020-02-05T07:25:00-08:00"
}
}