uds_plus_test_kit 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/uds_plus_test_kit/examples/manifest.json +4 -0
- data/lib/uds_plus_test_kit/examples/observation.ndjson +1 -1
- data/lib/uds_plus_test_kit/examples/patient.ndjson +2 -2
- data/lib/uds_plus_test_kit/input_resource_tests/read_adverse_event_test.rb +54 -0
- data/lib/uds_plus_test_kit/input_resource_tests/read_allergy_intolerance_test.rb +54 -0
- data/lib/uds_plus_test_kit/input_resource_tests/read_clinical_result_test.rb +54 -0
- data/lib/uds_plus_test_kit/input_resource_tests/read_location_test.rb +54 -0
- data/lib/uds_plus_test_kit/input_resource_tests/resource_group.rb +16 -0
- data/lib/uds_plus_test_kit/manifest_tests/invalid_type_test.rb +2 -1
- data/lib/uds_plus_test_kit/manifest_tests/uds_plus_test_group.rb +8 -0
- data/lib/uds_plus_test_kit/post_tests/post_group.rb +8 -0
- data/lib/uds_plus_test_kit/uds_plus_test_suite.rb +2 -2
- data/lib/uds_plus_test_kit/validate_adverse_event_test.rb +33 -0
- data/lib/uds_plus_test_kit/validate_allergy_intolerance_test.rb +33 -0
- data/lib/uds_plus_test_kit/validate_clinical_result_test.rb +65 -0
- data/lib/uds_plus_test_kit/validate_location_test.rb +33 -0
- data/lib/uds_plus_test_kit/validate_special_observation_test.rb +8 -1
- data/lib/uds_plus_test_kit/version.rb +2 -2
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc8a90d49751a9e2af4c9c4d5df0cf86f953ef0753751e1a49fa3a110e8c0508
|
4
|
+
data.tar.gz: 386594bb67cba437ade8694f0ca9f91cf8fac2b4939680aa7633a76c0ba50536
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd607758776abef43ef2360650381b445da7bb845abf15e89f6e448827f12e389808ea2b9d546096fa7792e318fa86c5827f6c5d1c5806a0a45a37236686239d
|
7
|
+
data.tar.gz: 30340f6684aac5f01472e2104d6ca32596a3a9e605ee67709728bccf1067f0216f3b1e4b169fae89dea9e5c2fbc3f5f34f51438888654dd01ad701996a3e3163
|
@@ -1,3 +1,3 @@
|
|
1
1
|
{ "resourceType": "Observation", "id": "de-identified-example", "meta": { "profile": [ "http://hl7.org/fhir/us/uds-plus/StructureDefinition/uds-plus-lab-observation" ] }, "status": "final", "category": [ { "coding": [ { "system" : "http://terminology.hl7.org/CodeSystem/observation-category", "code" : "laboratory", "display" : "Laboratory" } ] } ], "code": { "coding": [ { "system" : "http://loinc.org", "code" : "718-7", "display" : "Hemoglobin [Mass/volume] in Blood" } ] }, "subject": { "reference": "Patient/de-identified-example" }, "encounter": { "reference": "Encounter/de-identified-example" }, "effectiveDateTime" : "2005", "issued": "2005-04-03T15:30:10+01:00", "performer": [ { "reference": "Practitioner/example" } ], "valueQuantity" : { "value" : 17, "unit" : "g/dL", "system" : "http://unitsofmeasure.org" }, "bodySite": { "coding": [ { "system": "http://snomed.info/sct", "code": "368208006", "display": "Left upper arm structure" } ] }}
|
2
2
|
{ "resourceType": "Observation", "id": "de-identified-income-example", "meta": { "profile": [ "http://hl7.org/fhir/us/uds-plus/StructureDefinition/de-identified-uds-plus-income-observation" ] }, "status": "final", "code": { "coding": [ { "system": "http://loinc.org", "code": "63058-2" } ] }, "subject": { "reference": "Patient/de-identified-example" }, "effectiveDateTime": "2016-03-28", "valueRange": { "low": { "value": 101 }, "high": { "value": 150 } }}
|
3
|
-
{ "resourceType": "Observation", "id": "de-identified-sexual-orientation-example", "meta": { "profile": [ "http://hl7.org/fhir/us/uds-plus/StructureDefinition/uds-plus-sexual-orientation-observation" ] }, "status": "final", "code": { "coding": [ { "system": "http://loinc.org", "code": "76690-7" } ] }, "subject": { "reference": "Patient/example" }, "effectiveDateTime": "2007", "valueCodeableConcept": { "coding": [ { "system": "http://
|
3
|
+
{ "resourceType": "Observation", "id": "de-identified-sexual-orientation-example", "meta": { "profile": [ "http://hl7.org/fhir/us/uds-plus/StructureDefinition/uds-plus-sexual-orientation-observation" ] }, "status": "final", "code": { "coding": [ { "system": "http://loinc.org", "code": "76690-7" } ] }, "subject": { "reference": "Patient/example" }, "effectiveDateTime": "2007", "valueCodeableConcept": { "coding": [ { "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor", "code": "NASK", "display": "not asked" } ] }}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
{ "resourceType": "Patient", "id": "de-identified-example", "meta": { "extension": [ { "url": "http://hl7.org/fhir/StructureDefinition/instance-name", "valueString": "De-identified Patient Example" }, { "url": "http://hl7.org/fhir/StructureDefinition/instance-description", "valueMarkdown": "This is a patient example for the *UDS+ Patient Profile*." } ], "profile": [ "http://hl7.org/fhir/us/uds-plus/StructureDefinition/de-identified-uds-plus-patient" ] }, "extension": [ { "extension": [ { "url": "ombCategory", "valueCoding": { "system": "urn:oid:2.16.840.1.113883.6.238", "code": "2106-3", "display": "White" } }, { "url": "text", "valueString": "White" } ], "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race" }, { "extension": [ { "url": "ombCategory", "valueCoding": { "system": "urn:oid:2.16.840.1.113883.6.238", "code": "2135-2", "display": "Hispanic or Latino" } }, { "url": "text", "valueString": "Hispanic or Latino" } ], "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity" }, { "url": "http://hl7.org/fhir/us/
|
2
|
-
{ "resourceType": "Patient", "id": "de-identified-
|
1
|
+
{ "resourceType": "Patient", "id": "de-identified-smallpop-example", "meta": { "extension": [ { "url": "http://hl7.org/fhir/StructureDefinition/instance-name", "valueString": "De-identified Patient Example" }, { "url": "http://hl7.org/fhir/StructureDefinition/instance-description", "valueMarkdown": "This is a patient example for the *UDS+ Patient Profile*." } ], "profile": [ "http://hl7.org/fhir/us/uds-plus/StructureDefinition/de-identified-uds-plus-patient" ] }, "extension": [ { "extension": [ { "url": "ombCategory", "valueCoding": { "system": "urn:oid:2.16.840.1.113883.6.238", "code": "2106-3", "display": "White" } }, { "url" : "detailed", "valueCoding" : { "system" : "urn:oid:2.16.840.1.113883.6.238", "code" : "2108-9", "display" : "European" } }, { "url": "text", "valueString": "White" } ], "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race" }, { "extension": [ { "url": "ombCategory", "valueCoding": { "system": "urn:oid:2.16.840.1.113883.6.238", "code": "2135-2", "display": "Hispanic or Latino" } }, { "url" : "detailed", "valueCoding" : { "system" : "urn:oid:2.16.840.1.113883.6.238", "code" : "2184-0", "display" : "Dominican" } }, { "url": "text", "valueString": "Hispanic or Latino" } ], "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity" }, { "url": "http://hl7.org/fhir/us/uds-plus/StructureDefinition/uds-plus-birthsex-extension", "valueCode": "F" }, { "url": "http://hl7.org/fhir/us/uds-plus/StructureDefinition/uds-plus-age-extension", "valueQuantity": { "value" : 36, "unit" : "yr", "system" : "http://unitsofmeasure.org", "code" : "a" } }, { "url": "http://hl7.org/fhir/us/uds-plus/StructureDefinition/uds-plus-gender-identity-extension", "valueCodeableConcept": { "coding": [ { "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor", "code": "NASK", "display": "Not Asked" } ], "text": "Not Asked" } } ], "active": true, "gender": "female", "address": [ { "postalCode": "00000", "_postalCode": { "extension" : [ { "url" : "http://hl7.org/fhir/StructureDefinition/data-absent-reason", "valueCode" : "masked" }] } } ]}
|
2
|
+
{ "resourceType": "Patient", "id": "de-identified-example", "meta": { "extension": [ { "url": "http://hl7.org/fhir/StructureDefinition/instance-name", "valueString": "De-identified Patient Example" }, { "url": "http://hl7.org/fhir/StructureDefinition/instance-description", "valueMarkdown": "This is a patient example for the *UDS+ Patient Profile*." } ], "profile": [ "http://hl7.org/fhir/us/uds-plus/StructureDefinition/de-identified-uds-plus-patient" ] }, "extension": [ { "extension": [ { "url": "ombCategory", "valueCoding": { "system": "urn:oid:2.16.840.1.113883.6.238", "code": "2106-3", "display": "White" } }, { "url" : "detailed", "valueCoding" : { "system" : "urn:oid:2.16.840.1.113883.6.238", "code" : "2108-9", "display" : "European" } }, { "url": "text", "valueString": "White" } ], "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race" }, { "extension": [ { "url": "ombCategory", "valueCoding": { "system": "urn:oid:2.16.840.1.113883.6.238", "code": "2135-2", "display": "Hispanic or Latino" } }, { "url" : "detailed", "valueCoding" : { "system" : "urn:oid:2.16.840.1.113883.6.238", "code" : "2184-0", "display" : "Dominican" } }, { "url": "text", "valueString": "Hispanic or Latino" } ], "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity" }, { "url": "http://hl7.org/fhir/us/uds-plus/StructureDefinition/uds-plus-birthsex-extension", "valueCode": "F" }, { "url": "http://hl7.org/fhir/us/uds-plus/StructureDefinition/uds-plus-age-extension", "valueQuantity": { "value" : 36, "unit" : "yr", "system" : "http://unitsofmeasure.org", "code" : "a" } }, { "url": "http://hl7.org/fhir/us/uds-plus/StructureDefinition/uds-plus-gender-identity-extension", "valueCodeableConcept": { "coding": [ { "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor", "code": "ASKU", "display": "asked but unknown" } ], "text": "asked but unknown" } }, { "url": "http://hl7.org/fhir/us/uds-plus/StructureDefinition/udsplus-agriculture-worker-status", "valueCode": "migratory" }, { "url": "http://hl7.org/fhir/us/uds-plus/StructureDefinition/uds-plus-housing-status-extension", "valueCode": "permanent-supportive-housing" }, { "url": "http://hl7.org/fhir/us/uds-plus/StructureDefinition/uds-plus-veteran-status-extension", "valueBoolean": false } ], "active": true, "gender": "female", "address": [ { "postalCode": "03600" } ]}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module UDSPlusTestKit
|
4
|
+
class ReadAdverseEventTest < Inferno::Test
|
5
|
+
id :uds_plus_read_adverse_event_test
|
6
|
+
title 'Receive UDS+ Adverse Event Data'
|
7
|
+
description %(
|
8
|
+
Test takes from the user either: the http location of adverse event data
|
9
|
+
or the raw JSON of the data itself.
|
10
|
+
It attempts to GET the data stored at the given location if a link is provided,
|
11
|
+
then validates whether a FHIR resource can be generated from the input data.
|
12
|
+
)
|
13
|
+
|
14
|
+
input :adverse_event_data,
|
15
|
+
title: 'Adverse Event Data',
|
16
|
+
optional: true,
|
17
|
+
description: %q(
|
18
|
+
User can input the data as:
|
19
|
+
a URL link to the location of the data (ex: http://www.example.com/adverse_event_data.json)
|
20
|
+
OR a JSON string that composes the data. Leaving this blank will skip the test.
|
21
|
+
)
|
22
|
+
|
23
|
+
def data_scratch
|
24
|
+
scratch[:data_resources] ||= {}
|
25
|
+
end
|
26
|
+
|
27
|
+
def data_to_test
|
28
|
+
data_scratch['AdverseEvent'] ||= []
|
29
|
+
end
|
30
|
+
|
31
|
+
run do
|
32
|
+
omit_if !adverse_event_data.present?, "No data provided; skipping test."
|
33
|
+
|
34
|
+
# if the input is a url, else it is a json
|
35
|
+
if adverse_event_data.strip[0] != '{'
|
36
|
+
assert_valid_http_uri(adverse_event_data, "Adverse Event provided is not a valid http uri.")
|
37
|
+
get adverse_event_data
|
38
|
+
assert_response_status(200)
|
39
|
+
assert_valid_json(request.response_body, "Data received from request is not a valid JSON")
|
40
|
+
data = request.response_body
|
41
|
+
else
|
42
|
+
assert_valid_json(adverse_event_data, "JSON inputted was not in a valid format")
|
43
|
+
data = adverse_event_data
|
44
|
+
end
|
45
|
+
|
46
|
+
resource = FHIR::Json.from_json(data)
|
47
|
+
assert resource.is_a?(FHIR::Model), "Could not generate a valid resource from the input provided"
|
48
|
+
|
49
|
+
if resource.is_a?(FHIR::Model)
|
50
|
+
data_to_test << resource
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module UDSPlusTestKit
|
4
|
+
class ReadAllergyIntoleranceTest < Inferno::Test
|
5
|
+
id :uds_plus_read_allergy_intolerance_test
|
6
|
+
title 'Receive UDS+ Allergy Intolerance Data'
|
7
|
+
description %(
|
8
|
+
Test takes from the user either: the http location of allergy intolerance data
|
9
|
+
or the raw JSON of the data itself.
|
10
|
+
It attempts to GET the data stored at the given location if a link is provided,
|
11
|
+
then validates whether a FHIR resource can be generated from the input data.
|
12
|
+
)
|
13
|
+
|
14
|
+
input :allergy_intolerance_data,
|
15
|
+
title: 'Allergy Intolerance Data',
|
16
|
+
optional: true,
|
17
|
+
description: %q(
|
18
|
+
User can input the data as:
|
19
|
+
a URL link to the location of the data (ex: http://www.example.com/allergy_intolerance_data.json)
|
20
|
+
OR a JSON string that composes the data. Leaving this blank will skip the test.
|
21
|
+
)
|
22
|
+
|
23
|
+
def data_scratch
|
24
|
+
scratch[:data_resources] ||= {}
|
25
|
+
end
|
26
|
+
|
27
|
+
def data_to_test
|
28
|
+
data_scratch['AllergyIntolerance'] ||= []
|
29
|
+
end
|
30
|
+
|
31
|
+
run do
|
32
|
+
omit_if !allergy_intolerance_data.present?, "No data provided; skipping test."
|
33
|
+
|
34
|
+
# if the input is a url, else it is a json
|
35
|
+
if allergy_intolerance_data.strip[0] != '{'
|
36
|
+
assert_valid_http_uri(allergy_intolerance_data, "Allergy Intolerance provided is not a valid http uri.")
|
37
|
+
get allergy_intolerance_data
|
38
|
+
assert_response_status(200)
|
39
|
+
assert_valid_json(request.response_body, "Data received from request is not a valid JSON")
|
40
|
+
data = request.response_body
|
41
|
+
else
|
42
|
+
assert_valid_json(allergy_intolerance_data, "JSON inputted was not in a valid format")
|
43
|
+
data = allergy_intolerance_data
|
44
|
+
end
|
45
|
+
|
46
|
+
resource = FHIR::Json.from_json(data)
|
47
|
+
assert resource.is_a?(FHIR::Model), "Could not generate a valid resource from the input provided"
|
48
|
+
|
49
|
+
if resource.is_a?(FHIR::Model)
|
50
|
+
data_to_test << resource
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module UDSPlusTestKit
|
4
|
+
class ReadClinicalResultTest < Inferno::Test
|
5
|
+
id :uds_plus_read_clinical_result_test
|
6
|
+
title 'Receive UDS+ Clinical Result Data'
|
7
|
+
description %(
|
8
|
+
Test takes from the user either: the http location of clinical result data
|
9
|
+
or the raw JSON of the data itself.
|
10
|
+
It attempts to GET the data stored at the given location if a link is provided,
|
11
|
+
then validates whether a FHIR resource can be generated from the input data.
|
12
|
+
)
|
13
|
+
|
14
|
+
input :clinical_result_data,
|
15
|
+
title: 'Clinical Result Data',
|
16
|
+
optional: true,
|
17
|
+
description: %q(
|
18
|
+
User can input the data as:
|
19
|
+
a URL link to the location of the data (ex: http://www.example.com/clinical_result_data.json)
|
20
|
+
OR a JSON string that composes the data. Leaving this blank will skip the test.
|
21
|
+
)
|
22
|
+
|
23
|
+
def data_scratch
|
24
|
+
scratch[:data_resources] ||= {}
|
25
|
+
end
|
26
|
+
|
27
|
+
def data_to_test
|
28
|
+
data_scratch['Observation'] ||= []
|
29
|
+
end
|
30
|
+
|
31
|
+
run do
|
32
|
+
omit_if !clinical_result_data.present?, "No data provided; skipping test."
|
33
|
+
|
34
|
+
# if the input is a url, else it is a json
|
35
|
+
if clinical_result_data.strip[0] != '{'
|
36
|
+
assert_valid_http_uri(clinical_result_data, "Location provided is not a valid http uri.")
|
37
|
+
get clinical_result_data
|
38
|
+
assert_response_status(200)
|
39
|
+
assert_valid_json(request.response_body, "Data received from request is not a valid JSON")
|
40
|
+
data = request.response_body
|
41
|
+
else
|
42
|
+
assert_valid_json(clinical_result_data, "JSON inputted was not in a valid format")
|
43
|
+
data = clinical_result_data
|
44
|
+
end
|
45
|
+
|
46
|
+
resource = FHIR::Json.from_json(data)
|
47
|
+
assert resource.is_a?(FHIR::Model), "Could not generate a valid resource from the input provided"
|
48
|
+
|
49
|
+
if resource.is_a?(FHIR::Model)
|
50
|
+
data_to_test << resource
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module UDSPlusTestKit
|
4
|
+
class ReadLocationTest < Inferno::Test
|
5
|
+
id :uds_plus_read_location_test
|
6
|
+
title 'Receive UDS+ Location Data'
|
7
|
+
description %(
|
8
|
+
Test takes from the user either: the http location of location data
|
9
|
+
or the raw JSON of the data itself.
|
10
|
+
It attempts to GET the data stored at the given location if a link is provided,
|
11
|
+
then validates whether a FHIR resource can be generated from the input data.
|
12
|
+
)
|
13
|
+
|
14
|
+
input :location_data,
|
15
|
+
title: 'Location Data',
|
16
|
+
optional: true,
|
17
|
+
description: %q(
|
18
|
+
User can input the data as:
|
19
|
+
a URL link to the location of the data (ex: http://www.example.com/location_data.json)
|
20
|
+
OR a JSON string that composes the data. Leaving this blank will skip the test.
|
21
|
+
)
|
22
|
+
|
23
|
+
def data_scratch
|
24
|
+
scratch[:data_resources] ||= {}
|
25
|
+
end
|
26
|
+
|
27
|
+
def data_to_test
|
28
|
+
data_scratch['Location'] ||= []
|
29
|
+
end
|
30
|
+
|
31
|
+
run do
|
32
|
+
omit_if !location_data.present?, "No data provided; skipping test."
|
33
|
+
|
34
|
+
# if the input is a url, else it is a json
|
35
|
+
if location_data.strip[0] != '{'
|
36
|
+
assert_valid_http_uri(location_data, "Location provided is not a valid http uri.")
|
37
|
+
get location_data
|
38
|
+
assert_response_status(200)
|
39
|
+
assert_valid_json(request.response_body, "Data received from request is not a valid JSON")
|
40
|
+
data = request.response_body
|
41
|
+
else
|
42
|
+
assert_valid_json(location_data, "JSON inputted was not in a valid format")
|
43
|
+
data = location_data
|
44
|
+
end
|
45
|
+
|
46
|
+
resource = FHIR::Json.from_json(data)
|
47
|
+
assert resource.is_a?(FHIR::Model), "Could not generate a valid resource from the input provided"
|
48
|
+
|
49
|
+
if resource.is_a?(FHIR::Model)
|
50
|
+
data_to_test << resource
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -29,6 +29,14 @@ require_relative './read_med_statement_test'
|
|
29
29
|
require_relative '../validate_med_statement_test'
|
30
30
|
require_relative './read_service_request_test'
|
31
31
|
require_relative '../validate_service_request_test'
|
32
|
+
require_relative './read_location_test'
|
33
|
+
require_relative '../validate_location_test'
|
34
|
+
require_relative './read_allergy_intolerance_test'
|
35
|
+
require_relative '../validate_allergy_intolerance_test'
|
36
|
+
require_relative './read_adverse_event_test'
|
37
|
+
require_relative '../validate_adverse_event_test'
|
38
|
+
require_relative './read_clinical_result_test'
|
39
|
+
require_relative '../validate_clinical_result_test'
|
32
40
|
|
33
41
|
module UDSPlusTestKit
|
34
42
|
class UDSPlusResourceTestGroup < Inferno::TestGroup
|
@@ -61,12 +69,20 @@ module UDSPlusTestKit
|
|
61
69
|
test from: :uds_plus_validate_related_person_test
|
62
70
|
test from: :uds_plus_read_immunization_test
|
63
71
|
test from: :uds_plus_validate_immunization_test
|
72
|
+
test from: :uds_plus_read_location_test
|
73
|
+
test from: :uds_plus_validate_location_test
|
74
|
+
test from: :uds_plus_read_allergy_intolerance_test
|
75
|
+
test from: :uds_plus_validate_allergy_intolerance_test
|
76
|
+
test from: :uds_plus_read_adverse_event_test
|
77
|
+
test from: :uds_plus_validate_adverse_event_test
|
64
78
|
test from: :uds_plus_read_income_test
|
65
79
|
test from: :uds_plus_validate_income_test
|
66
80
|
test from: :uds_plus_read_sexual_orientation_test
|
67
81
|
test from: :uds_plus_validate_sexual_orientation_test
|
68
82
|
test from: :uds_plus_read_lab_test
|
69
83
|
test from: :uds_plus_validate_lab_test
|
84
|
+
test from: :uds_plus_read_clinical_result_test
|
85
|
+
test from: :uds_plus_validate_clinical_result_test
|
70
86
|
test from: :uds_plus_read_special_observation_test
|
71
87
|
test from: :uds_plus_validate_special_observation_test
|
72
88
|
test from: :uds_plus_read_medication_request_test
|
@@ -20,7 +20,8 @@ module UDSPlusTestKit
|
|
20
20
|
'Observation', 'Patient', 'Procedure',
|
21
21
|
'RelatedPerson', 'Immunization',
|
22
22
|
'ServiceRequest', 'MedicationRequest',
|
23
|
-
'MedicationStatement'
|
23
|
+
'MedicationStatement', 'Location',
|
24
|
+
'AdverseEvent', 'AllergyIntolerance'
|
24
25
|
]
|
25
26
|
end
|
26
27
|
|
@@ -17,6 +17,10 @@ require_relative '../validate_lab_test'
|
|
17
17
|
require_relative '../validate_med_request_test'
|
18
18
|
require_relative '../validate_med_statement_test'
|
19
19
|
require_relative '../validate_service_request_test'
|
20
|
+
require_relative '../validate_location_test'
|
21
|
+
require_relative '../validate_allergy_intolerance_test'
|
22
|
+
require_relative '../validate_adverse_event_test'
|
23
|
+
require_relative '../validate_clinical_result_test'
|
20
24
|
|
21
25
|
module UDSPlusTestKit
|
22
26
|
class UDSPlusTestGroup < Inferno::TestGroup
|
@@ -41,9 +45,13 @@ module UDSPlusTestKit
|
|
41
45
|
test from: :uds_plus_validate_procedure_test
|
42
46
|
test from: :uds_plus_validate_related_person_test
|
43
47
|
test from: :uds_plus_validate_immunization_test
|
48
|
+
test from: :uds_plus_validate_location_test
|
49
|
+
test from: :uds_plus_validate_allergy_intolerance_test
|
50
|
+
test from: :uds_plus_validate_adverse_event_test
|
44
51
|
test from: :uds_plus_validate_income_test
|
45
52
|
test from: :uds_plus_validate_sexual_orientation_test
|
46
53
|
test from: :uds_plus_validate_lab_test
|
54
|
+
test from: :uds_plus_validate_clinical_result_test
|
47
55
|
test from: :uds_plus_validate_special_observation_test
|
48
56
|
test from: :uds_plus_validate_medication_request_test
|
49
57
|
test from: :uds_plus_validate_medication_statement_test
|
@@ -22,6 +22,10 @@ require_relative '../validate_lab_test'
|
|
22
22
|
require_relative '../validate_med_request_test'
|
23
23
|
require_relative '../validate_med_statement_test'
|
24
24
|
require_relative '../validate_service_request_test'
|
25
|
+
require_relative '../validate_location_test'
|
26
|
+
require_relative '../validate_allergy_intolerance_test'
|
27
|
+
require_relative '../validate_adverse_event_test'
|
28
|
+
require_relative '../validate_clinical_result_test'
|
25
29
|
|
26
30
|
module UDSPlusTestKit
|
27
31
|
class UDSPlusPostGroup < Inferno::TestGroup
|
@@ -47,9 +51,13 @@ module UDSPlusTestKit
|
|
47
51
|
test from: :uds_plus_validate_procedure_test
|
48
52
|
test from: :uds_plus_validate_related_person_test
|
49
53
|
test from: :uds_plus_validate_immunization_test
|
54
|
+
test from: :uds_plus_validate_location_test
|
55
|
+
test from: :uds_plus_validate_allergy_intolerance_test
|
56
|
+
test from: :uds_plus_validate_adverse_event_test
|
50
57
|
test from: :uds_plus_validate_income_test
|
51
58
|
test from: :uds_plus_validate_sexual_orientation_test
|
52
59
|
test from: :uds_plus_validate_lab_test
|
60
|
+
test from: :uds_plus_validate_clinical_result_test
|
53
61
|
test from: :uds_plus_validate_special_observation_test
|
54
62
|
test from: :uds_plus_validate_medication_request_test
|
55
63
|
test from: :uds_plus_validate_medication_statement_test
|
@@ -9,7 +9,7 @@ module UDSPlusTestKit
|
|
9
9
|
title 'UDS+ Test Kit'
|
10
10
|
description %(
|
11
11
|
The UDS+ Test Kit tests systems for their conformance to the [UDS+
|
12
|
-
Implementation Guide
|
12
|
+
Implementation Guide v1.0.0](http://udsplus.drajer.com).
|
13
13
|
The included tests function as a rudimentary data receiver. This receiver will
|
14
14
|
take a provided Import Manifest, either as an HTTP location or as a raw json,
|
15
15
|
and validate its contents. This includes validating the structure of the manifest,
|
@@ -78,7 +78,7 @@ module UDSPlusTestKit
|
|
78
78
|
url: 'https://github.com/inferno-framework/uds-plus-test-kit/'
|
79
79
|
},
|
80
80
|
{
|
81
|
-
label: 'UDS+ Implementation Guide
|
81
|
+
label: 'UDS+ Implementation Guide v1.0.0',
|
82
82
|
url: 'http://udsplus.drajer.com'
|
83
83
|
}
|
84
84
|
]
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'json'
|
2
|
+
require_relative './version'
|
3
|
+
|
4
|
+
module UDSPlusTestKit
|
5
|
+
class ValidateAdverseEventTest < Inferno::Test
|
6
|
+
id :uds_plus_validate_adverse_event_test
|
7
|
+
title 'Validate UDS+ Adverse Event Data'
|
8
|
+
description %(
|
9
|
+
Test takes the Adverse Event resources identified
|
10
|
+
by the import manifest, and validates whether they conform
|
11
|
+
to their UDS+ Structure Definitions.
|
12
|
+
)
|
13
|
+
|
14
|
+
def data_scratch
|
15
|
+
scratch[:data_resources] ||= {}
|
16
|
+
end
|
17
|
+
|
18
|
+
def data_to_test
|
19
|
+
data_scratch['AdverseEvent'] ||= []
|
20
|
+
end
|
21
|
+
|
22
|
+
run do
|
23
|
+
omit_if data_to_test.empty?, "No data of this type was identified."
|
24
|
+
|
25
|
+
profile_definition = 'http://hl7.org/fhir/us/uds-plus/StructureDefinition/uds-plus-adverseevent'
|
26
|
+
profile_with_version = "#{profile_definition}|#{UDS_PLUS_VERSION}"
|
27
|
+
|
28
|
+
data_to_test.each do |resource|
|
29
|
+
assert_valid_resource(resource: resource, profile_url: profile_with_version)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'json'
|
2
|
+
require_relative './version'
|
3
|
+
|
4
|
+
module UDSPlusTestKit
|
5
|
+
class ValidateAllergyIntoleranceTest < Inferno::Test
|
6
|
+
id :uds_plus_validate_allergy_intolerance_test
|
7
|
+
title 'Validate UDS+ Allergy Intolerance Data'
|
8
|
+
description %(
|
9
|
+
Test takes the Allergy Intolerance resources identified
|
10
|
+
by the import manifest, and validates whether they conform
|
11
|
+
to their UDS+ Structure Definitions.
|
12
|
+
)
|
13
|
+
|
14
|
+
def data_scratch
|
15
|
+
scratch[:data_resources] ||= {}
|
16
|
+
end
|
17
|
+
|
18
|
+
def data_to_test
|
19
|
+
data_scratch['AllergyIntolerance'] ||= []
|
20
|
+
end
|
21
|
+
|
22
|
+
run do
|
23
|
+
omit_if data_to_test.empty?, "No data of this type was identified."
|
24
|
+
|
25
|
+
profile_definition = 'http://hl7.org/fhir/us/uds-plus/StructureDefinition/uds-plus-allergyintolerance'
|
26
|
+
profile_with_version = "#{profile_definition}|#{UDS_PLUS_VERSION}"
|
27
|
+
|
28
|
+
data_to_test.each do |resource|
|
29
|
+
assert_valid_resource(resource: resource, profile_url: profile_with_version)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'json'
|
2
|
+
require_relative './version'
|
3
|
+
|
4
|
+
module UDSPlusTestKit
|
5
|
+
class ValidateClinicalResultTest < Inferno::Test
|
6
|
+
id :uds_plus_validate_clinical_result_test
|
7
|
+
title 'Validate UDS+ Clinical Result Data'
|
8
|
+
description %(
|
9
|
+
Test takes the Clinical Result resources identified
|
10
|
+
by the import manifest, and validates whether they conform
|
11
|
+
to their UDS+ Structure Definitions.
|
12
|
+
)
|
13
|
+
|
14
|
+
def data_scratch
|
15
|
+
scratch[:data_resources] ||= {}
|
16
|
+
end
|
17
|
+
|
18
|
+
def data_to_test
|
19
|
+
data_scratch['Observation'] ||= []
|
20
|
+
end
|
21
|
+
|
22
|
+
run do
|
23
|
+
omit_if data_to_test.empty?, "No data of this type was identified."
|
24
|
+
|
25
|
+
profile_definition = 'http://hl7.org/fhir/us/uds-plus/StructureDefinition/de-identified-uds-plus-clinical-result-observation'
|
26
|
+
profile_with_version = "#{profile_definition}|#{UDS_PLUS_VERSION}"
|
27
|
+
|
28
|
+
no_resource_of_this_type = true
|
29
|
+
identifier_fail_message = %(Resource.meta.profile should contain the HTTP location of the
|
30
|
+
resource's Structure Definition. Resource.meta.profile either does
|
31
|
+
not exist in this resource, or its contents do not point to a valid
|
32
|
+
location for type Observation. **NOTE:**
|
33
|
+
If this error occurs, it can trigger a fail for all observation-type tests,
|
34
|
+
regardless of whether both tests were meant to run.)
|
35
|
+
|
36
|
+
data_to_test.each do |resource|
|
37
|
+
# All these assertions are to differentaite Observation data between orientation types.
|
38
|
+
# A resource is skipped if it cannot be identified as an clinical result resource.
|
39
|
+
type_identifier = resource.to_hash
|
40
|
+
assert type_identifier['meta'].present?, identifier_fail_message
|
41
|
+
|
42
|
+
type_identifier = type_identifier['meta']
|
43
|
+
assert type_identifier.is_a?(Hash), identifier_fail_message
|
44
|
+
assert type_identifier['profile'].present?, identifier_fail_message
|
45
|
+
|
46
|
+
type_identifier = type_identifier['profile']
|
47
|
+
assert type_identifier.is_a?(Array), identifier_fail_message
|
48
|
+
assert !type_identifier.empty?, identifier_fail_message
|
49
|
+
|
50
|
+
|
51
|
+
type_identifier = type_identifier.first
|
52
|
+
assert type_identifier.is_a?(String), identifier_fail_message
|
53
|
+
if !type_identifier.include?("clinical-result")
|
54
|
+
next
|
55
|
+
end
|
56
|
+
|
57
|
+
no_resource_of_this_type = false
|
58
|
+
|
59
|
+
assert_valid_resource(resource: resource, profile_url: profile_with_version)
|
60
|
+
end
|
61
|
+
|
62
|
+
omit_if no_resource_of_this_type, "No data of this type was identified."
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'json'
|
2
|
+
require_relative './version'
|
3
|
+
|
4
|
+
module UDSPlusTestKit
|
5
|
+
class ValidateLocationTest < Inferno::Test
|
6
|
+
id :uds_plus_validate_location_test
|
7
|
+
title 'Validate UDS+ Location Data'
|
8
|
+
description %(
|
9
|
+
Test takes the Location resources identified
|
10
|
+
by the import manifest, and validates whether they conform
|
11
|
+
to their UDS+ Structure Definitions.
|
12
|
+
)
|
13
|
+
|
14
|
+
def data_scratch
|
15
|
+
scratch[:data_resources] ||= {}
|
16
|
+
end
|
17
|
+
|
18
|
+
def data_to_test
|
19
|
+
data_scratch['Location'] ||= []
|
20
|
+
end
|
21
|
+
|
22
|
+
run do
|
23
|
+
omit_if data_to_test.empty?, "No data of this type was identified."
|
24
|
+
|
25
|
+
profile_definition = 'http://hl7.org/fhir/us/uds-plus/StructureDefinition/uds-plus-location'
|
26
|
+
profile_with_version = "#{profile_definition}|#{UDS_PLUS_VERSION}"
|
27
|
+
|
28
|
+
data_to_test.each do |resource|
|
29
|
+
assert_valid_resource(resource: resource, profile_url: profile_with_version)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -48,7 +48,14 @@ module UDSPlusTestKit
|
|
48
48
|
|
49
49
|
type_identifier = type_identifier.first
|
50
50
|
assert type_identifier.is_a?(String), identifier_fail_message
|
51
|
-
|
51
|
+
|
52
|
+
known_observations = ["income", "sexual-orientation", "-lab-", "clinical-result"]
|
53
|
+
is_known_observation = false
|
54
|
+
known_observations.each do |cur|
|
55
|
+
is_known_observation = (is_known_observation || type_identifier.include?(cur))
|
56
|
+
end
|
57
|
+
|
58
|
+
if is_known_observation
|
52
59
|
next
|
53
60
|
else
|
54
61
|
assert type_identifier.downcase.include?("observation"), identifier_fail_message
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uds_plus_test_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leap Orbit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08
|
11
|
+
date: 2023-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inferno_core
|
@@ -97,12 +97,16 @@ files:
|
|
97
97
|
- lib/uds_plus_test_kit/examples/manifest.json
|
98
98
|
- lib/uds_plus_test_kit/examples/observation.ndjson
|
99
99
|
- lib/uds_plus_test_kit/examples/patient.ndjson
|
100
|
+
- lib/uds_plus_test_kit/input_resource_tests/read_adverse_event_test.rb
|
101
|
+
- lib/uds_plus_test_kit/input_resource_tests/read_allergy_intolerance_test.rb
|
102
|
+
- lib/uds_plus_test_kit/input_resource_tests/read_clinical_result_test.rb
|
100
103
|
- lib/uds_plus_test_kit/input_resource_tests/read_coverage_test.rb
|
101
104
|
- lib/uds_plus_test_kit/input_resource_tests/read_diagnosis_test.rb
|
102
105
|
- lib/uds_plus_test_kit/input_resource_tests/read_encounter_test.rb
|
103
106
|
- lib/uds_plus_test_kit/input_resource_tests/read_immunization_test.rb
|
104
107
|
- lib/uds_plus_test_kit/input_resource_tests/read_income_test.rb
|
105
108
|
- lib/uds_plus_test_kit/input_resource_tests/read_lab_test.rb
|
109
|
+
- lib/uds_plus_test_kit/input_resource_tests/read_location_test.rb
|
106
110
|
- lib/uds_plus_test_kit/input_resource_tests/read_manifest_ind_test.rb
|
107
111
|
- lib/uds_plus_test_kit/input_resource_tests/read_med_request_test.rb
|
108
112
|
- lib/uds_plus_test_kit/input_resource_tests/read_med_statement_test.rb
|
@@ -122,12 +126,16 @@ files:
|
|
122
126
|
- lib/uds_plus_test_kit/post_tests/post_manifest_test.rb
|
123
127
|
- lib/uds_plus_test_kit/post_tests/read_post_test.rb
|
124
128
|
- lib/uds_plus_test_kit/uds_plus_test_suite.rb
|
129
|
+
- lib/uds_plus_test_kit/validate_adverse_event_test.rb
|
130
|
+
- lib/uds_plus_test_kit/validate_allergy_intolerance_test.rb
|
131
|
+
- lib/uds_plus_test_kit/validate_clinical_result_test.rb
|
125
132
|
- lib/uds_plus_test_kit/validate_coverage_test.rb
|
126
133
|
- lib/uds_plus_test_kit/validate_diagnosis_test.rb
|
127
134
|
- lib/uds_plus_test_kit/validate_encounter_test.rb
|
128
135
|
- lib/uds_plus_test_kit/validate_immunization_test.rb
|
129
136
|
- lib/uds_plus_test_kit/validate_income_test.rb
|
130
137
|
- lib/uds_plus_test_kit/validate_lab_test.rb
|
138
|
+
- lib/uds_plus_test_kit/validate_location_test.rb
|
131
139
|
- lib/uds_plus_test_kit/validate_med_request_test.rb
|
132
140
|
- lib/uds_plus_test_kit/validate_med_statement_test.rb
|
133
141
|
- lib/uds_plus_test_kit/validate_patient_test.rb
|