uds_plus_test_kit 0.9.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/uds_plus_test_kit/examples/manifest.json +76 -14
- data/lib/uds_plus_test_kit/input_resource_tests/read_immunization_test.rb +54 -0
- data/lib/uds_plus_test_kit/input_resource_tests/read_lab_test.rb +54 -0
- data/lib/uds_plus_test_kit/input_resource_tests/read_med_request_test.rb +54 -0
- data/lib/uds_plus_test_kit/input_resource_tests/read_med_statement_test.rb +54 -0
- data/lib/uds_plus_test_kit/input_resource_tests/read_related_person_test.rb +54 -0
- data/lib/uds_plus_test_kit/input_resource_tests/read_service_request_test.rb +54 -0
- data/lib/uds_plus_test_kit/input_resource_tests/read_special_observation_test.rb +54 -0
- data/lib/uds_plus_test_kit/input_resource_tests/resource_group.rb +30 -2
- data/lib/uds_plus_test_kit/manifest_tests/invalid_type_test.rb +4 -1
- data/lib/uds_plus_test_kit/manifest_tests/uds_plus_test_group.rb +16 -2
- data/lib/uds_plus_test_kit/post_tests/post_group.rb +59 -0
- data/lib/uds_plus_test_kit/post_tests/post_manifest_test.rb +41 -0
- data/lib/uds_plus_test_kit/post_tests/read_post_test.rb +32 -0
- data/lib/uds_plus_test_kit/uds_plus_test_suite.rb +40 -0
- data/lib/uds_plus_test_kit/validate_immunization_test.rb +33 -0
- data/lib/uds_plus_test_kit/validate_income_test.rb +7 -10
- data/lib/uds_plus_test_kit/validate_lab_test.rb +65 -0
- data/lib/uds_plus_test_kit/validate_med_request_test.rb +33 -0
- data/lib/uds_plus_test_kit/validate_med_statement_test.rb +33 -0
- data/lib/uds_plus_test_kit/validate_related_person_test.rb +33 -0
- data/lib/uds_plus_test_kit/validate_service_request_test.rb +33 -0
- data/lib/uds_plus_test_kit/validate_sexual_orientation_test.rb +6 -9
- data/lib/uds_plus_test_kit/validate_special_observation_test.rb +65 -0
- data/lib/uds_plus_test_kit/version.rb +2 -2
- metadata +19 -4
- data/lib/uds_plus_test_kit/examples/manifest_2.json +0 -101
- data/lib/uds_plus_test_kit/examples/manifest_not_deidentified.json +0 -67
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
|
4
|
+
module UDSPlusTestKit
|
5
|
+
class PostManifestTest < Inferno::Test
|
6
|
+
id :uds_plus_post_manifest_test
|
7
|
+
title 'Receive UDS+ Import Manifest via POST request'
|
8
|
+
description %(
|
9
|
+
Test waits for an import manifest to be posted at the
|
10
|
+
provided location. Test passes if it recieves a post
|
11
|
+
request within 3 mins of test start.
|
12
|
+
)
|
13
|
+
|
14
|
+
receives_request :import_manifest
|
15
|
+
|
16
|
+
def id_gen
|
17
|
+
output = ''
|
18
|
+
ranNum = Random.new
|
19
|
+
for _ in 1..10
|
20
|
+
output += ranNum.rand(10).to_s
|
21
|
+
end
|
22
|
+
output
|
23
|
+
end
|
24
|
+
|
25
|
+
run do
|
26
|
+
session_id = id_gen
|
27
|
+
wait(
|
28
|
+
identifier: session_id,
|
29
|
+
timeout: 300,
|
30
|
+
message: %(
|
31
|
+
Post your Import Manifest JSON to the following URL:
|
32
|
+
#{Inferno::Application['base_url']}/custom/uds_plus/postHere?id=#{session_id}
|
33
|
+
|
34
|
+
If the test times out or is cancelled for any reason, rerunning the test group will restart the timeout.
|
35
|
+
|
36
|
+
Your request body MUST be your Import Manifest in raw json format. Testing will resume automatically after a valid POST is received.
|
37
|
+
)
|
38
|
+
)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
|
4
|
+
module UDSPlusTestKit
|
5
|
+
class ReadPostTest < Inferno::Test
|
6
|
+
id :uds_plus_read_post_test
|
7
|
+
title 'Read Input from POST Request'
|
8
|
+
description %(
|
9
|
+
Test takes the file POSTed in the previous test,
|
10
|
+
and validates whether a FHIR resource can be generated from the input data.
|
11
|
+
)
|
12
|
+
|
13
|
+
uses_request :import_manifest
|
14
|
+
|
15
|
+
def manifest_scratch
|
16
|
+
scratch[:manifest_resources] ||= {}
|
17
|
+
end
|
18
|
+
|
19
|
+
def manifest_resources
|
20
|
+
manifest_scratch[:all] ||= []
|
21
|
+
end
|
22
|
+
|
23
|
+
run do
|
24
|
+
found_resource = FHIR::Json.from_json(request.request_body)
|
25
|
+
assert found_resource.is_a?(FHIR::Model), "Could not generate a valid resource from the input provided"
|
26
|
+
|
27
|
+
if found_resource.is_a?(FHIR::Model)
|
28
|
+
manifest_resources << found_resource
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -2,6 +2,7 @@ require 'inferno/dsl/oauth_credentials'
|
|
2
2
|
require_relative './version'
|
3
3
|
require_relative './manifest_tests/uds_plus_test_group'
|
4
4
|
require_relative './input_resource_tests/resource_group'
|
5
|
+
require_relative './post_tests/post_group'
|
5
6
|
|
6
7
|
module UDSPlusTestKit
|
7
8
|
class UDSPlusTestSuite < Inferno::TestSuite
|
@@ -29,6 +30,44 @@ module UDSPlusTestKit
|
|
29
30
|
|
30
31
|
id :uds_plus
|
31
32
|
|
33
|
+
# Example urls generated here
|
34
|
+
patient_ex = File.read(File.join(__dir__, 'examples/patient.ndjson'))
|
35
|
+
patient_ex_route_handler = proc { [200, { 'Content-Type' => 'application/ndjson' }, [patient_ex]] }
|
36
|
+
route(:get, "/examples/patient", patient_ex_route_handler)
|
37
|
+
|
38
|
+
condition_ex = File.read(File.join(__dir__, 'examples/condition.ndjson'))
|
39
|
+
condition_ex_route_handler = proc { [200, { 'Content-Type' => 'application/ndjson' }, [condition_ex]] }
|
40
|
+
route(:get, "/examples/condition", condition_ex_route_handler)
|
41
|
+
|
42
|
+
encounter_ex = File.read(File.join(__dir__, 'examples/encounter.ndjson'))
|
43
|
+
encounter_ex_route_handler = proc { [200, { 'Content-Type' => 'application/ndjson' }, [encounter_ex]] }
|
44
|
+
route(:get, "/examples/encounter", encounter_ex_route_handler)
|
45
|
+
|
46
|
+
manifest_ex = File.read(File.join(__dir__, 'examples/manifest.json'))
|
47
|
+
manifest_ex_route_handler = proc { [200, { 'Content-Type' => 'application/json' }, [manifest_ex]] }
|
48
|
+
route(:get, "/examples/manifest", manifest_ex_route_handler)
|
49
|
+
|
50
|
+
bad_condition_ex = File.read(File.join(__dir__, 'examples/invalid_condition.ndjson'))
|
51
|
+
bad_condition_ex_route_handler = proc { [200, { 'Content-Type' => 'application/ndjson' }, [bad_condition_ex]] }
|
52
|
+
route(:get, "/examples/invalid_condition", bad_condition_ex_route_handler)
|
53
|
+
|
54
|
+
bad_patient_ex = File.read(File.join(__dir__, 'examples/invalid_patient.ndjson'))
|
55
|
+
bad_patient_ex_route_handler = proc { [200, { 'Content-Type' => 'application/ndjson' }, [bad_patient_ex]] }
|
56
|
+
route(:get, "/examples/invalid_patient", bad_patient_ex_route_handler)
|
57
|
+
|
58
|
+
bad_encounter_ex = File.read(File.join(__dir__, 'examples/invalid_encounter.ndjson'))
|
59
|
+
bad_encounter_ex_route_handler = proc { [200, { 'Content-Type' => 'application/ndjson' }, [bad_encounter_ex]] }
|
60
|
+
route(:get, "/examples/invalid_encounter", bad_encounter_ex_route_handler)
|
61
|
+
|
62
|
+
observation_ex = File.read(File.join(__dir__, 'examples/observation.ndjson'))
|
63
|
+
observation_ex_route_handler = proc { [200, { 'Content-Type' => 'application/ndjson' }, [observation_ex]] }
|
64
|
+
route(:get, "/examples/observation", observation_ex_route_handler)
|
65
|
+
|
66
|
+
# Receive Manifest via POST set-up
|
67
|
+
resume_test_route :post, '/postHere' do |request|
|
68
|
+
request.query_parameters["id"]
|
69
|
+
end
|
70
|
+
|
32
71
|
links [
|
33
72
|
{
|
34
73
|
label: 'Report Issue',
|
@@ -45,6 +84,7 @@ module UDSPlusTestKit
|
|
45
84
|
]
|
46
85
|
|
47
86
|
group from: :uds_plus_test_group
|
87
|
+
group from: :uds_plus_manifest_post_group
|
48
88
|
group from: :uds_plus_resource_test_group
|
49
89
|
end
|
50
90
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'json'
|
2
|
+
require_relative './version'
|
3
|
+
|
4
|
+
module UDSPlusTestKit
|
5
|
+
class ValidateImmunizationTest < Inferno::Test
|
6
|
+
id :uds_plus_validate_immunization_test
|
7
|
+
title 'Validate UDS+ Immunization Data'
|
8
|
+
description %(
|
9
|
+
Test takes the Immunization 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['Immunization'] ||= []
|
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-immunization'
|
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
|
@@ -22,21 +22,20 @@ module UDSPlusTestKit
|
|
22
22
|
run do
|
23
23
|
omit_if data_to_test.empty?, "No data of this type was identified."
|
24
24
|
|
25
|
-
profile_definition = 'http://hl7.org/fhir/us/uds-plus/StructureDefinition/uds-plus-income-observation'
|
25
|
+
profile_definition = 'http://hl7.org/fhir/us/uds-plus/StructureDefinition/de-identified-uds-plus-income-observation'
|
26
26
|
profile_with_version = "#{profile_definition}|#{UDS_PLUS_VERSION}"
|
27
27
|
|
28
28
|
no_resource_of_this_type = true
|
29
29
|
identifier_fail_message = %(Resource.meta.profile should contain the HTTP location of the
|
30
30
|
resource's Structure Definition. Resource.meta.profile either does
|
31
31
|
not exist in this resource, or its contents do not point to a valid
|
32
|
-
location for type Observation
|
33
|
-
If this error occurs, it
|
34
|
-
|
35
|
-
to run.)
|
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.)
|
36
35
|
|
37
36
|
data_to_test.each do |resource|
|
38
|
-
# All these assertions are to differentaite Observation data between
|
39
|
-
# A resource is skipped if it
|
37
|
+
# All these assertions are to differentaite Observation data between orientation types.
|
38
|
+
# A resource is skipped if it cannot be identified as an income resource.
|
40
39
|
type_identifier = resource.to_hash
|
41
40
|
assert type_identifier['meta'].present?, identifier_fail_message
|
42
41
|
|
@@ -51,10 +50,8 @@ module UDSPlusTestKit
|
|
51
50
|
|
52
51
|
type_identifier = type_identifier.first
|
53
52
|
assert type_identifier.is_a?(String), identifier_fail_message
|
54
|
-
if type_identifier.include?("
|
53
|
+
if !type_identifier.include?("income")
|
55
54
|
next
|
56
|
-
else
|
57
|
-
assert type_identifier.include?("income"), identifier_fail_message
|
58
55
|
end
|
59
56
|
|
60
57
|
no_resource_of_this_type = false
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'json'
|
2
|
+
require_relative './version'
|
3
|
+
|
4
|
+
module UDSPlusTestKit
|
5
|
+
class ValidateLabTest < Inferno::Test
|
6
|
+
id :uds_plus_validate_lab_test
|
7
|
+
title 'Validate UDS+ Lab Observation Data'
|
8
|
+
description %(
|
9
|
+
Test takes the Lab Observation 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/uds-plus-lab-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 Income Data and Sexual Orientation data.
|
38
|
+
# A resource is skipped if it is a sexual orientation resource and fails if it cannot be identified as an income 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?("-lab-")
|
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 ValidateMedicationRequestTest < Inferno::Test
|
6
|
+
id :uds_plus_validate_medication_request_test
|
7
|
+
title 'Validate UDS+ Medication Request Data'
|
8
|
+
description %(
|
9
|
+
Test takes the Medication Request 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['MedicationRequest'] ||= []
|
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-medicationrequest'
|
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 ValidateMedicationStatementTest < Inferno::Test
|
6
|
+
id :uds_plus_validate_medication_statement_test
|
7
|
+
title 'Validate UDS+ Medication Statement Data'
|
8
|
+
description %(
|
9
|
+
Test takes the Medication Statement 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['MedicationStatement'] ||= []
|
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-medicationstatement'
|
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 ValidateRelatedPersonTest < Inferno::Test
|
6
|
+
id :uds_plus_validate_related_person_test
|
7
|
+
title 'Validate UDS+ Related Person Data'
|
8
|
+
description %(
|
9
|
+
Test takes the Related Person 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['RelatedPerson'] ||= []
|
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-relatedperson'
|
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 ValidateServiceRequestTest < Inferno::Test
|
6
|
+
id :uds_plus_validate_service_request_test
|
7
|
+
title 'Validate UDS+ Service Request Data'
|
8
|
+
description %(
|
9
|
+
Test takes the Service Request 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['ServiceRequest'] ||= []
|
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-servicerequest'
|
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
|
@@ -29,14 +29,13 @@ module UDSPlusTestKit
|
|
29
29
|
identifier_fail_message = %(Resource.meta.profile should contain the HTTP location of the
|
30
30
|
resource's Structure Definition. Resource.meta.profile either does
|
31
31
|
not exist in this resource, or its contents do not point to a valid
|
32
|
-
location for type Observation
|
33
|
-
If this error occurs, it
|
34
|
-
|
35
|
-
to run.)
|
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.)
|
36
35
|
|
37
36
|
data_to_test.each do |resource|
|
38
|
-
# All these assertions are to differentaite Observation data between
|
39
|
-
# A resource is skipped if it
|
37
|
+
# All these assertions are to differentaite Observation data between orientation types.
|
38
|
+
# A resource is skipped if it cannot be identified as a sexual orientation resource.
|
40
39
|
type_identifier = resource.to_hash
|
41
40
|
assert type_identifier['meta'].present?, identifier_fail_message
|
42
41
|
|
@@ -51,10 +50,8 @@ module UDSPlusTestKit
|
|
51
50
|
|
52
51
|
type_identifier = type_identifier.first
|
53
52
|
assert type_identifier.is_a?(String), identifier_fail_message
|
54
|
-
if type_identifier.include?("
|
53
|
+
if !type_identifier.include?("sexual-orientation")
|
55
54
|
next
|
56
|
-
else
|
57
|
-
assert type_identifier.include?("sexual-orientation"), identifier_fail_message
|
58
55
|
end
|
59
56
|
|
60
57
|
no_resource_of_this_type = false
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'json'
|
2
|
+
require_relative './version'
|
3
|
+
|
4
|
+
module UDSPlusTestKit
|
5
|
+
class ValidateSpecialObservationTest < Inferno::Test
|
6
|
+
id :uds_plus_validate_special_observation_test
|
7
|
+
title 'Validate UDS+ Special Observation Data'
|
8
|
+
description %(
|
9
|
+
Test takes the Special Observation resources identified
|
10
|
+
(such as uds-special-population-observation) by the import
|
11
|
+
manifest, and validates whether they conform to their
|
12
|
+
UDS+ Structure Definitions.
|
13
|
+
)
|
14
|
+
|
15
|
+
def data_scratch
|
16
|
+
scratch[:data_resources] ||= {}
|
17
|
+
end
|
18
|
+
|
19
|
+
def data_to_test
|
20
|
+
data_scratch['Observation'] ||= []
|
21
|
+
end
|
22
|
+
|
23
|
+
run do
|
24
|
+
omit_if data_to_test.empty?, "No data of this type was identified."
|
25
|
+
|
26
|
+
no_resource_of_this_type = true
|
27
|
+
identifier_fail_message = %(Resource.meta.profile should contain the HTTP location of the
|
28
|
+
resource's Structure Definition. Resource.meta.profile either does
|
29
|
+
not exist in this resource, or its contents do not point to a valid
|
30
|
+
location for type Observation. **NOTE:**
|
31
|
+
If this error occurs, it can trigger a fail for all observation-type tests,
|
32
|
+
regardless of whether both tests were meant to run.)
|
33
|
+
|
34
|
+
data_to_test.each do |resource|
|
35
|
+
# All these assertions are to differentaite Observation data between orientation types.
|
36
|
+
# A resource is skipped if it is one of the observation types with their own tests.
|
37
|
+
type_identifier = resource.to_hash
|
38
|
+
assert type_identifier['meta'].present?, identifier_fail_message
|
39
|
+
|
40
|
+
type_identifier = type_identifier['meta']
|
41
|
+
assert type_identifier.is_a?(Hash), identifier_fail_message
|
42
|
+
assert type_identifier['profile'].present?, identifier_fail_message
|
43
|
+
|
44
|
+
type_identifier = type_identifier['profile']
|
45
|
+
assert type_identifier.is_a?(Array), identifier_fail_message
|
46
|
+
assert !type_identifier.empty?, identifier_fail_message
|
47
|
+
|
48
|
+
|
49
|
+
type_identifier = type_identifier.first
|
50
|
+
assert type_identifier.is_a?(String), identifier_fail_message
|
51
|
+
if type_identifier.include?("income") || type_identifier.include?("sexual-orientation") || type_identifier.include?("-lab-")
|
52
|
+
next
|
53
|
+
else
|
54
|
+
assert type_identifier.downcase.include?("observation"), identifier_fail_message
|
55
|
+
end
|
56
|
+
|
57
|
+
no_resource_of_this_type = false
|
58
|
+
|
59
|
+
assert_valid_resource(resource: resource)
|
60
|
+
end
|
61
|
+
|
62
|
+
omit_if no_resource_of_this_type, "No data of this type was identified."
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
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: 0.
|
4
|
+
version: 1.0.0
|
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-
|
11
|
+
date: 2023-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inferno_core
|
@@ -90,30 +90,45 @@ files:
|
|
90
90
|
- LICENSE
|
91
91
|
- lib/uds_plus_test_kit.rb
|
92
92
|
- lib/uds_plus_test_kit/examples/manifest.json
|
93
|
-
- lib/uds_plus_test_kit/examples/manifest_2.json
|
94
|
-
- lib/uds_plus_test_kit/examples/manifest_not_deidentified.json
|
95
93
|
- lib/uds_plus_test_kit/input_resource_tests/read_coverage_test.rb
|
96
94
|
- lib/uds_plus_test_kit/input_resource_tests/read_diagnosis_test.rb
|
97
95
|
- lib/uds_plus_test_kit/input_resource_tests/read_encounter_test.rb
|
96
|
+
- lib/uds_plus_test_kit/input_resource_tests/read_immunization_test.rb
|
98
97
|
- lib/uds_plus_test_kit/input_resource_tests/read_income_test.rb
|
98
|
+
- lib/uds_plus_test_kit/input_resource_tests/read_lab_test.rb
|
99
99
|
- lib/uds_plus_test_kit/input_resource_tests/read_manifest_ind_test.rb
|
100
|
+
- lib/uds_plus_test_kit/input_resource_tests/read_med_request_test.rb
|
101
|
+
- lib/uds_plus_test_kit/input_resource_tests/read_med_statement_test.rb
|
100
102
|
- lib/uds_plus_test_kit/input_resource_tests/read_patient_test.rb
|
101
103
|
- lib/uds_plus_test_kit/input_resource_tests/read_procedure_test.rb
|
104
|
+
- lib/uds_plus_test_kit/input_resource_tests/read_related_person_test.rb
|
105
|
+
- lib/uds_plus_test_kit/input_resource_tests/read_service_request_test.rb
|
102
106
|
- lib/uds_plus_test_kit/input_resource_tests/read_sexual_orientation_test.rb
|
107
|
+
- lib/uds_plus_test_kit/input_resource_tests/read_special_observation_test.rb
|
103
108
|
- lib/uds_plus_test_kit/input_resource_tests/resource_group.rb
|
104
109
|
- lib/uds_plus_test_kit/manifest_tests/invalid_type_test.rb
|
105
110
|
- lib/uds_plus_test_kit/manifest_tests/read_data_test.rb
|
106
111
|
- lib/uds_plus_test_kit/manifest_tests/read_manifest_test.rb
|
107
112
|
- lib/uds_plus_test_kit/manifest_tests/uds_plus_test_group.rb
|
108
113
|
- lib/uds_plus_test_kit/manifest_tests/validate_manifest_test.rb
|
114
|
+
- lib/uds_plus_test_kit/post_tests/post_group.rb
|
115
|
+
- lib/uds_plus_test_kit/post_tests/post_manifest_test.rb
|
116
|
+
- lib/uds_plus_test_kit/post_tests/read_post_test.rb
|
109
117
|
- lib/uds_plus_test_kit/uds_plus_test_suite.rb
|
110
118
|
- lib/uds_plus_test_kit/validate_coverage_test.rb
|
111
119
|
- lib/uds_plus_test_kit/validate_diagnosis_test.rb
|
112
120
|
- lib/uds_plus_test_kit/validate_encounter_test.rb
|
121
|
+
- lib/uds_plus_test_kit/validate_immunization_test.rb
|
113
122
|
- lib/uds_plus_test_kit/validate_income_test.rb
|
123
|
+
- lib/uds_plus_test_kit/validate_lab_test.rb
|
124
|
+
- lib/uds_plus_test_kit/validate_med_request_test.rb
|
125
|
+
- lib/uds_plus_test_kit/validate_med_statement_test.rb
|
114
126
|
- lib/uds_plus_test_kit/validate_patient_test.rb
|
115
127
|
- lib/uds_plus_test_kit/validate_procedure_test.rb
|
128
|
+
- lib/uds_plus_test_kit/validate_related_person_test.rb
|
129
|
+
- lib/uds_plus_test_kit/validate_service_request_test.rb
|
116
130
|
- lib/uds_plus_test_kit/validate_sexual_orientation_test.rb
|
131
|
+
- lib/uds_plus_test_kit/validate_special_observation_test.rb
|
117
132
|
- lib/uds_plus_test_kit/version.rb
|
118
133
|
homepage: https://github.com/inferno-framework/uds-plus-test-kit
|
119
134
|
licenses:
|