uds_plus_test_kit 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +201 -0
- data/lib/uds_plus_test_kit/examples/manifest.json +84 -0
- data/lib/uds_plus_test_kit/examples/manifest_2.json +101 -0
- data/lib/uds_plus_test_kit/examples/manifest_not_deidentified.json +67 -0
- data/lib/uds_plus_test_kit/igs/package/CapabilityStatement-uds-plus-data-receiver-server.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/CapabilityStatement-uds-plus-data-source.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/CapabilityStatement-uds-plus-data-submitter-client.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/CapabilityStatement-uds-plus-trust-service-provider.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/CodeSystem-udsplus-agriculture-worker-status-codes.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/CodeSystem-udsplus-housing-status-codes.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/CodeSystem-udsplus-insurance-codes.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/ImplementationGuide-udsplus.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/OperationDefinition-import.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/OperationDefinition-udsplus-de-identify.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/StructureDefinition-de-identified-uds-plus-patient.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-age-extension.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-agriculture-worker-status-extension.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-coverage.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-deidentify-data.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-diagnosis.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-encounter.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-housing-status-extension.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-import-manifest.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-income-observation.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-procedure.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-sexual-orientation-observation.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/StructureDefinition-udsplus-agriculture-worker-status.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/example/Condition-de-identified-example.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/example/Condition-example.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/example/Encounter-de-identified-example.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/example/Encounter-example.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/example/Parameters-example.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/example/Patient-de-identified-example.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/example/Patient-de-identified-smallpop-example.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/example/Patient-example.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/example/Patient-smallpop-example.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/openapi/uds-plus-data-receiver-server.openapi.json +152 -0
- data/lib/uds_plus_test_kit/igs/package/openapi/uds-plus-data-source.openapi.json +152 -0
- data/lib/uds_plus_test_kit/igs/package/openapi/uds-plus-data-submitter-client.openapi.json +106 -0
- data/lib/uds_plus_test_kit/igs/package/openapi/uds-plus-trust-service-provider.openapi.json +152 -0
- data/lib/uds_plus_test_kit/igs/package/other/ig-r4.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/other/validation-oo.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/other/validation-summary.json +1 -0
- data/lib/uds_plus_test_kit/igs/package/package.json +27 -0
- data/lib/uds_plus_test_kit/input_resource_tests/read_coverage_test.rb +54 -0
- data/lib/uds_plus_test_kit/input_resource_tests/read_diagnosis_test.rb +54 -0
- data/lib/uds_plus_test_kit/input_resource_tests/read_encounter_test.rb +54 -0
- data/lib/uds_plus_test_kit/input_resource_tests/read_income_test.rb +54 -0
- data/lib/uds_plus_test_kit/input_resource_tests/read_patient_test.rb +54 -0
- data/lib/uds_plus_test_kit/input_resource_tests/read_procedure_test.rb +54 -0
- data/lib/uds_plus_test_kit/input_resource_tests/read_sexual_orientation_test.rb +54 -0
- data/lib/uds_plus_test_kit/input_resource_tests/resource_group.rb +51 -0
- data/lib/uds_plus_test_kit/manifest_tests/invalid_type_test.rb +40 -0
- data/lib/uds_plus_test_kit/manifest_tests/read_data_test.rb +75 -0
- data/lib/uds_plus_test_kit/manifest_tests/read_manifest_test.rb +51 -0
- data/lib/uds_plus_test_kit/manifest_tests/uds_plus_test_group.rb +39 -0
- data/lib/uds_plus_test_kit/manifest_tests/validate_manifest_test.rb +28 -0
- data/lib/uds_plus_test_kit/uds_plus_test_suite.rb +50 -0
- data/lib/uds_plus_test_kit/validate_coverage_test.rb +33 -0
- data/lib/uds_plus_test_kit/validate_diagnosis_test.rb +33 -0
- data/lib/uds_plus_test_kit/validate_encounter_test.rb +33 -0
- data/lib/uds_plus_test_kit/validate_income_test.rb +68 -0
- data/lib/uds_plus_test_kit/validate_patient_test.rb +33 -0
- data/lib/uds_plus_test_kit/validate_procedure_test.rb +33 -0
- data/lib/uds_plus_test_kit/validate_sexual_orientation_test.rb +68 -0
- data/lib/uds_plus_test_kit/version.rb +6 -0
- data/lib/uds_plus_test_kit.rb +1 -0
- metadata +182 -0
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module UDSPlusTestKit
|
4
|
+
class ReadManifestTest < Inferno::Test
|
5
|
+
id :uds_plus_read_manifest_test
|
6
|
+
title 'Receive UDS+ Import Manifest'
|
7
|
+
description %(
|
8
|
+
Test takes from the user either: the http location of the import manifest
|
9
|
+
or the raw JSON of the import manifest 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 :import_manifest,
|
15
|
+
title: 'Import Manifest',
|
16
|
+
description: %q(
|
17
|
+
User can input the Import manifest as:
|
18
|
+
a URL link to the location of the manifest (ex: http://www.example.com/import_manifest.json) OR
|
19
|
+
a JSON string that composes the manifest (ex: {manifest_contents})
|
20
|
+
)
|
21
|
+
|
22
|
+
def manifest_scratch
|
23
|
+
scratch[:manifest_resources] ||= {}
|
24
|
+
end
|
25
|
+
|
26
|
+
def manifest_resources
|
27
|
+
manifest_scratch[:all] ||= []
|
28
|
+
end
|
29
|
+
|
30
|
+
run do
|
31
|
+
# if the input is a url, else it is a json
|
32
|
+
if import_manifest.strip[0] != '{'
|
33
|
+
assert_valid_http_uri(import_manifest, "Import manifest uri location is not a valid http uri.")
|
34
|
+
get import_manifest
|
35
|
+
assert_response_status(200)
|
36
|
+
assert_valid_json(request.response_body, "Data received from request is not a valid JSON")
|
37
|
+
manifest = request.response_body
|
38
|
+
else
|
39
|
+
assert_valid_json(import_manifest, "JSON inputted was not in a valid format")
|
40
|
+
manifest = import_manifest
|
41
|
+
end
|
42
|
+
|
43
|
+
resource = FHIR::Json.from_json(manifest)
|
44
|
+
assert resource.is_a?(FHIR::Model), "Could not generate a valid resource from the input provided"
|
45
|
+
|
46
|
+
if resource.is_a?(FHIR::Model)
|
47
|
+
manifest_resources << resource
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require_relative '../version'
|
2
|
+
require_relative './invalid_type_test'
|
3
|
+
require_relative './read_data_test'
|
4
|
+
require_relative './read_manifest_test'
|
5
|
+
require_relative '../validate_coverage_test'
|
6
|
+
require_relative '../validate_diagnosis_test'
|
7
|
+
require_relative '../validate_encounter_test'
|
8
|
+
require_relative '../validate_income_test'
|
9
|
+
require_relative './validate_manifest_test'
|
10
|
+
require_relative '../validate_patient_test'
|
11
|
+
require_relative '../validate_procedure_test'
|
12
|
+
require_relative '../validate_sexual_orientation_test'
|
13
|
+
|
14
|
+
module UDSPlusTestKit
|
15
|
+
class UDSPlusTestGroup < Inferno::TestGroup
|
16
|
+
title 'Data Submitter Tests'
|
17
|
+
id :uds_plus_test_group
|
18
|
+
description %(
|
19
|
+
The tests below validate the import manifest produced by a UDS+ Data Submitter.
|
20
|
+
This receiver will take a provided Import Manifest, either as an HTTP location or
|
21
|
+
as a raw json, and validate its contents. This includes validating the structure
|
22
|
+
of the manifest, as well as the structure of the data the manifest points to.
|
23
|
+
)
|
24
|
+
|
25
|
+
run_as_group
|
26
|
+
|
27
|
+
test from: :uds_plus_read_manifest_test
|
28
|
+
test from: :uds_plus_validate_manifest_test
|
29
|
+
test from: :uds_plus_read_data_test
|
30
|
+
test from: :uds_plus_validate_coverage_test
|
31
|
+
test from: :uds_plus_validate_diagnosis_test
|
32
|
+
test from: :uds_plus_validate_encounter_test
|
33
|
+
test from: :uds_plus_validate_income_test
|
34
|
+
test from: :uds_plus_validate_patient_test
|
35
|
+
test from: :uds_plus_validate_procedure_test
|
36
|
+
test from: :uds_plus_validate_sexual_orientation_test
|
37
|
+
test from: :uds_plus_invalid_type_test
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'json'
|
2
|
+
require_relative '../version'
|
3
|
+
|
4
|
+
module UDSPlusTestKit
|
5
|
+
class ValidateManifestTest < Inferno::Test
|
6
|
+
id :uds_plus_validate_manifest_test
|
7
|
+
title 'Validate UDS+ Import Manifest'
|
8
|
+
description %(
|
9
|
+
Test takes the resource generated by the prior test,
|
10
|
+
and validates whether the resource conforms to the
|
11
|
+
UDS+ Import Manifest Structure Definition.
|
12
|
+
)
|
13
|
+
|
14
|
+
def manifest_scratch
|
15
|
+
scratch[:manifest_resources] ||= {}
|
16
|
+
end
|
17
|
+
|
18
|
+
def manifest_resources
|
19
|
+
manifest_scratch[:all] ||= []
|
20
|
+
end
|
21
|
+
|
22
|
+
run do
|
23
|
+
profile_definition = "http://hl7.org/fhir/us/uds-plus/StructureDefinition/uds-plus-import-manifest"
|
24
|
+
profile_with_version = "#{profile_definition}|#{UDS_PLUS_VERSION}"
|
25
|
+
assert_valid_resource(resource: manifest_resources.first, profile_url: profile_with_version)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'inferno/dsl/oauth_credentials'
|
2
|
+
require_relative './version'
|
3
|
+
require_relative './manifest_tests/uds_plus_test_group'
|
4
|
+
require_relative './input_resource_tests/resource_group'
|
5
|
+
|
6
|
+
module UDSPlusTestKit
|
7
|
+
class UDSPlusTestSuite < Inferno::TestSuite
|
8
|
+
title 'UDS+ Test Kit'
|
9
|
+
description %(
|
10
|
+
The UDS+ Test Kit tests systems for their conformance to the [UDS+
|
11
|
+
Implementation Guide](http://fhir.drajer.com/site/index.html#uds-plus-home-page).
|
12
|
+
The included tests function as a rudimentary data receiver. This receiver will
|
13
|
+
take a provided Import Manifest, either as an HTTP location or as a raw json,
|
14
|
+
and validate its contents. This includes validating the structure of the manifest,
|
15
|
+
as well as the structure of the data the manifest points to.
|
16
|
+
)
|
17
|
+
|
18
|
+
version VERSION
|
19
|
+
|
20
|
+
validator do
|
21
|
+
url ENV.fetch('VALIDATOR_URL', 'http://validator_service:4567')
|
22
|
+
|
23
|
+
# Messages will be excluded if the block evaluates to a truthy value
|
24
|
+
exclude_message do |message|
|
25
|
+
message.type == 'warning' &&
|
26
|
+
message.message.match?(/Global Profile reference .* could not be resolved, so has not been checked/)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
id :uds_plus
|
31
|
+
|
32
|
+
links [
|
33
|
+
{
|
34
|
+
label: 'Report Issue',
|
35
|
+
url: 'https://github.com/inferno-framework/uds-plus-test-kit/issues'
|
36
|
+
},
|
37
|
+
{
|
38
|
+
label: 'Open Source',
|
39
|
+
url: 'https://github.com/inferno-framework/uds-plus-test-kit/'
|
40
|
+
},
|
41
|
+
{
|
42
|
+
label: 'UDS+ Implementation Guide',
|
43
|
+
url: 'http://fhir.drajer.com/site/index.html'
|
44
|
+
}
|
45
|
+
]
|
46
|
+
|
47
|
+
group from: :uds_plus_test_group
|
48
|
+
group from: :uds_plus_resource_test_group
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'json'
|
2
|
+
require_relative './version'
|
3
|
+
|
4
|
+
module UDSPlusTestKit
|
5
|
+
class ValidateCoverageTest < Inferno::Test
|
6
|
+
id :uds_plus_validate_coverage_test
|
7
|
+
title 'Validate UDS+ Coverage Data'
|
8
|
+
description %(
|
9
|
+
Test takes the Coverage 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['Coverage'] ||= []
|
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-coverage'
|
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 ValidateDiagnosisTest < Inferno::Test
|
6
|
+
id :uds_plus_validate_diagnosis_test
|
7
|
+
title 'Validate UDS+ Diagnosis Data'
|
8
|
+
description %(
|
9
|
+
Test takes the Diagnosis 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['Condition'] ||= []
|
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-diagnosis'
|
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 ValidateEncounterTest < Inferno::Test
|
6
|
+
id :uds_plus_validate_encounter_test
|
7
|
+
title 'Validate UDS+ Encounter Data'
|
8
|
+
description %(
|
9
|
+
Test takes the Encounter 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['Encounter'] ||= []
|
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-encounter'
|
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,68 @@
|
|
1
|
+
require 'json'
|
2
|
+
require_relative './version'
|
3
|
+
|
4
|
+
module UDSPlusTestKit
|
5
|
+
class ValidateIncomeTest < Inferno::Test
|
6
|
+
id :uds_plus_validate_income_test
|
7
|
+
title 'Validate UDS+ Income Data'
|
8
|
+
description %(
|
9
|
+
Test takes the Income 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-income-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 (Income/Sexual Orientation). **NOTE:**
|
33
|
+
If this error occurs, it will trigger a fail for both the Income and
|
34
|
+
Sexual Orientation tests, regardless of whether both tests were meant
|
35
|
+
to run.)
|
36
|
+
|
37
|
+
data_to_test.each do |resource|
|
38
|
+
# All these assertions are to differentaite Observation data between Income Data and Sexual Orientation data.
|
39
|
+
# A resource is skipped if it is a sexual orientation resource and fails if it cannot be identified as an income resource.
|
40
|
+
type_identifier = resource.to_hash
|
41
|
+
assert type_identifier['meta'].present?, identifier_fail_message
|
42
|
+
|
43
|
+
type_identifier = type_identifier['meta']
|
44
|
+
assert type_identifier.is_a?(Hash), identifier_fail_message
|
45
|
+
assert type_identifier['profile'].present?, identifier_fail_message
|
46
|
+
|
47
|
+
type_identifier = type_identifier['profile']
|
48
|
+
assert type_identifier.is_a?(Array), identifier_fail_message
|
49
|
+
assert !type_identifier.empty?, identifier_fail_message
|
50
|
+
|
51
|
+
|
52
|
+
type_identifier = type_identifier.first
|
53
|
+
assert type_identifier.is_a?(String), identifier_fail_message
|
54
|
+
if type_identifier.include?("sexual-orientation")
|
55
|
+
next
|
56
|
+
else
|
57
|
+
assert type_identifier.include?("income"), identifier_fail_message
|
58
|
+
end
|
59
|
+
|
60
|
+
no_resource_of_this_type = false
|
61
|
+
|
62
|
+
assert_valid_resource(resource: resource, profile_url: profile_with_version)
|
63
|
+
end
|
64
|
+
|
65
|
+
omit_if no_resource_of_this_type, "No data of this type was identified."
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'json'
|
2
|
+
require_relative './version'
|
3
|
+
|
4
|
+
module UDSPlusTestKit
|
5
|
+
class ValidatePatientTest < Inferno::Test
|
6
|
+
id :uds_plus_validate_patient_test
|
7
|
+
title 'Validate UDS+ Patient Data'
|
8
|
+
description %(
|
9
|
+
Test takes the Patient 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['Patient'] ||= []
|
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-patient'
|
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 ValidateProcedureTest < Inferno::Test
|
6
|
+
id :uds_plus_validate_procedure_test
|
7
|
+
title 'Validate UDS+ Procedure Data'
|
8
|
+
description %(
|
9
|
+
Test takes the Procedure 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['Procedure'] ||= []
|
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-procedure'
|
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,68 @@
|
|
1
|
+
require 'json'
|
2
|
+
require_relative './version'
|
3
|
+
|
4
|
+
module UDSPlusTestKit
|
5
|
+
class ValidateSexualOrientationTest < Inferno::Test
|
6
|
+
id :uds_plus_validate_sexual_orientation_test
|
7
|
+
title 'Validate UDS+ Sexual Orientation Data'
|
8
|
+
description %(
|
9
|
+
Test takes the Sexual Orientation 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-sexual-orientation-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 (Income/Sexual Orientation). **NOTE:**
|
33
|
+
If this error occurs, it will trigger a fail for both the Income and
|
34
|
+
Sexual Orientation tests, regardless of whether both tests were meant
|
35
|
+
to run.)
|
36
|
+
|
37
|
+
data_to_test.each do |resource|
|
38
|
+
# All these assertions are to differentaite Observation data between Income Data and Sexual Orientation data.
|
39
|
+
# A resource is skipped if it is an income resource and fails if it cannot be identified as a sexual orientation resource.
|
40
|
+
type_identifier = resource.to_hash
|
41
|
+
assert type_identifier['meta'].present?, identifier_fail_message
|
42
|
+
|
43
|
+
type_identifier = type_identifier['meta']
|
44
|
+
assert type_identifier.is_a?(Hash), identifier_fail_message
|
45
|
+
assert type_identifier['profile'].present?, identifier_fail_message
|
46
|
+
|
47
|
+
type_identifier = type_identifier['profile']
|
48
|
+
assert type_identifier.is_a?(Array), identifier_fail_message
|
49
|
+
assert !type_identifier.empty?, identifier_fail_message
|
50
|
+
|
51
|
+
|
52
|
+
type_identifier = type_identifier.first
|
53
|
+
assert type_identifier.is_a?(String), identifier_fail_message
|
54
|
+
if type_identifier.include?("income")
|
55
|
+
next
|
56
|
+
else
|
57
|
+
assert type_identifier.include?("sexual-orientation"), identifier_fail_message
|
58
|
+
end
|
59
|
+
|
60
|
+
no_resource_of_this_type = false
|
61
|
+
|
62
|
+
assert_valid_resource(resource: resource, profile_url: profile_with_version)
|
63
|
+
end
|
64
|
+
|
65
|
+
omit_if no_resource_of_this_type, "No data of this type was identified."
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require_relative 'uds_plus_test_kit/uds_plus_test_suite'
|
metadata
ADDED
@@ -0,0 +1,182 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: uds_plus_test_kit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Leap Orbit
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-05-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: inferno_core
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.4.4
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.4.4
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: database_cleaner-sequel
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.8'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.8'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: factory_bot
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '6.1'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '6.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.10'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.10'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: webmock
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.11'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.11'
|
83
|
+
description: UDS Plus Test Kit
|
84
|
+
email:
|
85
|
+
- inferno@groups.mitre.org
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- LICENSE
|
91
|
+
- lib/uds_plus_test_kit.rb
|
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
|
+
- lib/uds_plus_test_kit/igs/package/CapabilityStatement-uds-plus-data-receiver-server.json
|
96
|
+
- lib/uds_plus_test_kit/igs/package/CapabilityStatement-uds-plus-data-source.json
|
97
|
+
- lib/uds_plus_test_kit/igs/package/CapabilityStatement-uds-plus-data-submitter-client.json
|
98
|
+
- lib/uds_plus_test_kit/igs/package/CapabilityStatement-uds-plus-trust-service-provider.json
|
99
|
+
- lib/uds_plus_test_kit/igs/package/CodeSystem-udsplus-agriculture-worker-status-codes.json
|
100
|
+
- lib/uds_plus_test_kit/igs/package/CodeSystem-udsplus-housing-status-codes.json
|
101
|
+
- lib/uds_plus_test_kit/igs/package/CodeSystem-udsplus-insurance-codes.json
|
102
|
+
- lib/uds_plus_test_kit/igs/package/ImplementationGuide-udsplus.json
|
103
|
+
- lib/uds_plus_test_kit/igs/package/OperationDefinition-import.json
|
104
|
+
- lib/uds_plus_test_kit/igs/package/OperationDefinition-udsplus-de-identify.json
|
105
|
+
- lib/uds_plus_test_kit/igs/package/StructureDefinition-de-identified-uds-plus-patient.json
|
106
|
+
- lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-age-extension.json
|
107
|
+
- lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-agriculture-worker-status-extension.json
|
108
|
+
- lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-coverage.json
|
109
|
+
- lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-deidentify-data.json
|
110
|
+
- lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-diagnosis.json
|
111
|
+
- lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-encounter.json
|
112
|
+
- lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-housing-status-extension.json
|
113
|
+
- lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-import-manifest.json
|
114
|
+
- lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-income-observation.json
|
115
|
+
- lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-procedure.json
|
116
|
+
- lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-sexual-orientation-observation.json
|
117
|
+
- lib/uds_plus_test_kit/igs/package/StructureDefinition-udsplus-agriculture-worker-status.json
|
118
|
+
- lib/uds_plus_test_kit/igs/package/example/Condition-de-identified-example.json
|
119
|
+
- lib/uds_plus_test_kit/igs/package/example/Condition-example.json
|
120
|
+
- lib/uds_plus_test_kit/igs/package/example/Encounter-de-identified-example.json
|
121
|
+
- lib/uds_plus_test_kit/igs/package/example/Encounter-example.json
|
122
|
+
- lib/uds_plus_test_kit/igs/package/example/Parameters-example.json
|
123
|
+
- lib/uds_plus_test_kit/igs/package/example/Patient-de-identified-example.json
|
124
|
+
- lib/uds_plus_test_kit/igs/package/example/Patient-de-identified-smallpop-example.json
|
125
|
+
- lib/uds_plus_test_kit/igs/package/example/Patient-example.json
|
126
|
+
- lib/uds_plus_test_kit/igs/package/example/Patient-smallpop-example.json
|
127
|
+
- lib/uds_plus_test_kit/igs/package/openapi/uds-plus-data-receiver-server.openapi.json
|
128
|
+
- lib/uds_plus_test_kit/igs/package/openapi/uds-plus-data-source.openapi.json
|
129
|
+
- lib/uds_plus_test_kit/igs/package/openapi/uds-plus-data-submitter-client.openapi.json
|
130
|
+
- lib/uds_plus_test_kit/igs/package/openapi/uds-plus-trust-service-provider.openapi.json
|
131
|
+
- lib/uds_plus_test_kit/igs/package/other/ig-r4.json
|
132
|
+
- lib/uds_plus_test_kit/igs/package/other/validation-oo.json
|
133
|
+
- lib/uds_plus_test_kit/igs/package/other/validation-summary.json
|
134
|
+
- lib/uds_plus_test_kit/igs/package/package.json
|
135
|
+
- lib/uds_plus_test_kit/input_resource_tests/read_coverage_test.rb
|
136
|
+
- lib/uds_plus_test_kit/input_resource_tests/read_diagnosis_test.rb
|
137
|
+
- lib/uds_plus_test_kit/input_resource_tests/read_encounter_test.rb
|
138
|
+
- lib/uds_plus_test_kit/input_resource_tests/read_income_test.rb
|
139
|
+
- lib/uds_plus_test_kit/input_resource_tests/read_patient_test.rb
|
140
|
+
- lib/uds_plus_test_kit/input_resource_tests/read_procedure_test.rb
|
141
|
+
- lib/uds_plus_test_kit/input_resource_tests/read_sexual_orientation_test.rb
|
142
|
+
- lib/uds_plus_test_kit/input_resource_tests/resource_group.rb
|
143
|
+
- lib/uds_plus_test_kit/manifest_tests/invalid_type_test.rb
|
144
|
+
- lib/uds_plus_test_kit/manifest_tests/read_data_test.rb
|
145
|
+
- lib/uds_plus_test_kit/manifest_tests/read_manifest_test.rb
|
146
|
+
- lib/uds_plus_test_kit/manifest_tests/uds_plus_test_group.rb
|
147
|
+
- lib/uds_plus_test_kit/manifest_tests/validate_manifest_test.rb
|
148
|
+
- lib/uds_plus_test_kit/uds_plus_test_suite.rb
|
149
|
+
- lib/uds_plus_test_kit/validate_coverage_test.rb
|
150
|
+
- lib/uds_plus_test_kit/validate_diagnosis_test.rb
|
151
|
+
- lib/uds_plus_test_kit/validate_encounter_test.rb
|
152
|
+
- lib/uds_plus_test_kit/validate_income_test.rb
|
153
|
+
- lib/uds_plus_test_kit/validate_patient_test.rb
|
154
|
+
- lib/uds_plus_test_kit/validate_procedure_test.rb
|
155
|
+
- lib/uds_plus_test_kit/validate_sexual_orientation_test.rb
|
156
|
+
- lib/uds_plus_test_kit/version.rb
|
157
|
+
homepage: https://github.com/inferno-framework/uds-plus-test-kit
|
158
|
+
licenses:
|
159
|
+
- Apache-2.0
|
160
|
+
metadata:
|
161
|
+
homepage_uri: https://github.com/inferno-framework/uds-plus-test-kit
|
162
|
+
source_code_uri: https://github.com/inferno-framework/uds-plus-test-kit
|
163
|
+
post_install_message:
|
164
|
+
rdoc_options: []
|
165
|
+
require_paths:
|
166
|
+
- lib
|
167
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
168
|
+
requirements:
|
169
|
+
- - ">="
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: 3.1.2
|
172
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
|
+
requirements:
|
174
|
+
- - ">="
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: '0'
|
177
|
+
requirements: []
|
178
|
+
rubygems_version: 3.3.7
|
179
|
+
signing_key:
|
180
|
+
specification_version: 4
|
181
|
+
summary: UDS Plus Test Kit
|
182
|
+
test_files: []
|