us_core_test_kit 0.2.2 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/us_core_test_kit/fhir_resource_navigation.rb +11 -3
- data/lib/us_core_test_kit/generated/v3.1.1/allergy_intolerance/allergy_intolerance_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/allergy_intolerance/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/bodyheight/bodyheight_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/bodyheight/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/bodytemp/bodytemp_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/bodytemp/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/bodyweight/bodyweight_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/bodyweight/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/bp/bp_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/bp/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/care_plan/care_plan_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/care_plan/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/care_team/care_team_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/care_team/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/condition/condition_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/condition/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/device/device_must_support_test.rb +1 -2
- data/lib/us_core_test_kit/generated/v3.1.1/device/device_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/device/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/diagnostic_report_lab/diagnostic_report_lab_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/diagnostic_report_lab/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/diagnostic_report_note/diagnostic_report_note_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/diagnostic_report_note/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/document_reference/document_reference_must_support_test.rb +1 -2
- data/lib/us_core_test_kit/generated/v3.1.1/document_reference/document_reference_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/document_reference/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/encounter/encounter_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/encounter/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/goal/goal_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/goal/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/head_circumference/head_circumference_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/head_circumference/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/heartrate/heartrate_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/heartrate/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/immunization/immunization_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/immunization/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/medication_request/medication_request_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/medication_request/medication_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/medication_request/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/metadata.yml +32 -0
- data/lib/us_core_test_kit/generated/v3.1.1/observation_lab/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/observation_lab/observation_lab_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/organization/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/organization/organization_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/patient/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/patient/patient_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/pediatric_bmi_for_age/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/pediatric_bmi_for_age/pediatric_bmi_for_age_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/pediatric_weight_for_height/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/pediatric_weight_for_height/pediatric_weight_for_height_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/practitioner/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/practitioner/practitioner_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/procedure/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/procedure/procedure_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/provenance/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/provenance/provenance_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/pulse_oximetry/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/pulse_oximetry/pulse_oximetry_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/resprate/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/resprate/resprate_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/smokingstatus/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/smokingstatus/smokingstatus_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v3.1.1/us_core_test_suite.rb +2 -2
- data/lib/us_core_test_kit/generated/v4.0.0/allergy_intolerance/allergy_intolerance_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/allergy_intolerance/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/blood_pressure/blood_pressure_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/blood_pressure/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/bmi/bmi_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/bmi/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/body_height/body_height_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/body_height/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/body_temperature/body_temperature_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/body_temperature/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/body_weight/body_weight_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/body_weight/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/care_plan/care_plan_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/care_plan/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/care_team/care_team_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/care_team/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/condition/condition_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/condition/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/device/device_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/device/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/diagnostic_report_lab/diagnostic_report_lab_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/diagnostic_report_lab/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/diagnostic_report_note/diagnostic_report_note_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/diagnostic_report_note/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/document_reference/document_reference_must_support_test.rb +1 -2
- data/lib/us_core_test_kit/generated/v4.0.0/document_reference/document_reference_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/document_reference/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/encounter/encounter_must_support_test.rb +2 -4
- data/lib/us_core_test_kit/generated/v4.0.0/encounter/encounter_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/encounter/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/goal/goal_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/goal/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/head_circumference/head_circumference_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/head_circumference/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/head_circumference_percentile/head_circumference_percentile_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/head_circumference_percentile/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/heart_rate/heart_rate_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/heart_rate/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/immunization/immunization_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/immunization/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/medication_request/medication_request_must_support_test.rb +1 -2
- data/lib/us_core_test_kit/generated/v4.0.0/medication_request/medication_request_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/medication_request/medication_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/medication_request/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/metadata.yml +47 -2
- data/lib/us_core_test_kit/generated/v4.0.0/observation_lab/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/observation_lab/observation_lab_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/organization/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/organization/organization_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/patient/metadata.yml +13 -1
- data/lib/us_core_test_kit/generated/v4.0.0/patient/patient_must_support_test.rb +8 -6
- data/lib/us_core_test_kit/generated/v4.0.0/patient/patient_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/pediatric_bmi_for_age/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/pediatric_bmi_for_age/pediatric_bmi_for_age_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/pediatric_weight_for_height/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/pediatric_weight_for_height/pediatric_weight_for_height_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/practitioner/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/practitioner/practitioner_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/procedure/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/procedure/procedure_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/provenance/metadata.yml +1 -1
- data/lib/us_core_test_kit/generated/v4.0.0/provenance/provenance_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/pulse_oximetry/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/pulse_oximetry/pulse_oximetry_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/respiratory_rate/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/respiratory_rate/respiratory_rate_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/smokingstatus/metadata.yml +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/smokingstatus/smokingstatus_validation_test.rb +1 -0
- data/lib/us_core_test_kit/generated/v4.0.0/us_core_test_suite.rb +2 -2
- data/lib/us_core_test_kit/generator/group_metadata.rb +1 -0
- data/lib/us_core_test_kit/generator/group_metadata_extractor.rb +5 -0
- data/lib/us_core_test_kit/generator/ig_loader.rb +12 -5
- data/lib/us_core_test_kit/generator/must_support_metadata_extractor.rb +23 -22
- data/lib/us_core_test_kit/generator/must_support_test_generator.rb +26 -3
- data/lib/us_core_test_kit/generator/validation_test_generator.rb +4 -0
- data/lib/us_core_test_kit/generator.rb +9 -14
- data/lib/us_core_test_kit/igs/{v311 → us_core_311}/StructureDefinition-bodyheight.json +0 -0
- data/lib/us_core_test_kit/igs/{v311 → us_core_311}/StructureDefinition-bodytemp.json +0 -0
- data/lib/us_core_test_kit/igs/{v311 → us_core_311}/StructureDefinition-bodyweight.json +0 -0
- data/lib/us_core_test_kit/igs/{v311 → us_core_311}/StructureDefinition-bp.json +0 -0
- data/lib/us_core_test_kit/igs/{v311 → us_core_311}/StructureDefinition-heartrate.json +0 -0
- data/lib/us_core_test_kit/igs/{v311 → us_core_311}/StructureDefinition-resprate.json +0 -0
- data/lib/us_core_test_kit/igs/{v311/package.tgz → us_core_311.tgz} +0 -0
- data/lib/us_core_test_kit/igs/{v400/package.tgz → us_core_400.tgz} +0 -0
- data/lib/us_core_test_kit/must_support_test.rb +25 -3
- data/lib/us_core_test_kit/search_test.rb +107 -48
- data/lib/us_core_test_kit/validation_test.rb +4 -2
- data/lib/us_core_test_kit/version.rb +3 -1
- metadata +13 -13
@@ -20,9 +20,6 @@ module USCoreTestKit
|
|
20
20
|
* Patient.address.state
|
21
21
|
* Patient.birthDate
|
22
22
|
* Patient.communication.language
|
23
|
-
* Patient.extension:birthsex
|
24
|
-
* Patient.extension:ethnicity
|
25
|
-
* Patient.extension:race
|
26
23
|
* Patient.gender
|
27
24
|
* Patient.identifier
|
28
25
|
* Patient.identifier.system
|
@@ -30,12 +27,17 @@ module USCoreTestKit
|
|
30
27
|
* Patient.name
|
31
28
|
* Patient.name.family
|
32
29
|
* Patient.name.given
|
33
|
-
* Patient.name.suffix
|
34
|
-
* Patient.name.use
|
35
|
-
* Patient.telecom
|
36
30
|
* Patient.telecom.system
|
37
31
|
* Patient.telecom.use
|
38
32
|
* Patient.telecom.value
|
33
|
+
|
34
|
+
For ONC USCDI requirements, each Patient must support the following additional elements:
|
35
|
+
|
36
|
+
* Patient.extension:birthsex
|
37
|
+
* Patient.extension:ethnicity
|
38
|
+
* Patient.extension:race
|
39
|
+
* Patient.name.period.end or Patient.name.use
|
40
|
+
* Patient.name.suffix
|
39
41
|
)
|
40
42
|
|
41
43
|
id :us_core_v400_patient_must_support_test
|
@@ -6,6 +6,7 @@
|
|
6
6
|
:resource: Observation
|
7
7
|
:profile_url: http://hl7.org/fhir/us/core/StructureDefinition/pediatric-bmi-for-age
|
8
8
|
:profile_name: US Core Pediatric BMI for Age Observation Profile
|
9
|
+
:profile_version: 4.0.0
|
9
10
|
:title: Pediatric BMI for Age Observation
|
10
11
|
:short_description: Verify support for the server capabilities required by the US
|
11
12
|
Core Pediatric BMI for Age Observation Profile.
|
@@ -6,6 +6,7 @@
|
|
6
6
|
:resource: Observation
|
7
7
|
:profile_url: http://hl7.org/fhir/us/core/StructureDefinition/pediatric-weight-for-height
|
8
8
|
:profile_name: US Core Pediatric Weight for Height Observation Profile
|
9
|
+
:profile_version: 4.0.0
|
9
10
|
:title: Pediatric Weight for Height Observation
|
10
11
|
:short_description: Verify support for the server capabilities required by the US
|
11
12
|
Core Pediatric Weight for Height Observation Profile.
|
@@ -6,6 +6,7 @@
|
|
6
6
|
:resource: Practitioner
|
7
7
|
:profile_url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner
|
8
8
|
:profile_name: US Core Practitioner Profile
|
9
|
+
:profile_version: 4.0.0
|
9
10
|
:title: Practitioner
|
10
11
|
:short_description: Verify support for the server capabilities required by the US
|
11
12
|
Core Practitioner Profile.
|
@@ -6,6 +6,7 @@
|
|
6
6
|
:resource: Procedure
|
7
7
|
:profile_url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-procedure
|
8
8
|
:profile_name: US Core Procedure Profile
|
9
|
+
:profile_version: 4.0.0
|
9
10
|
:title: Procedure
|
10
11
|
:short_description: Verify support for the server capabilities required by the US
|
11
12
|
Core Procedure Profile.
|
@@ -6,6 +6,7 @@
|
|
6
6
|
:resource: Provenance
|
7
7
|
:profile_url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-provenance
|
8
8
|
:profile_name: US Core Provenance Profile
|
9
|
+
:profile_version: 4.0.0
|
9
10
|
:title: Provenance
|
10
11
|
:short_description: Verify support for the server capabilities required by the US
|
11
12
|
Core Provenance Profile.
|
@@ -64,7 +65,6 @@
|
|
64
65
|
- Reference
|
65
66
|
:target_profiles:
|
66
67
|
- http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner
|
67
|
-
- http://hl7.org/fhir/us/core/StructureDefinition/us-core-organization
|
68
68
|
- :path: agent.onBehalfOf
|
69
69
|
:types:
|
70
70
|
- Reference
|
@@ -6,6 +6,7 @@
|
|
6
6
|
:resource: Observation
|
7
7
|
:profile_url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-pulse-oximetry
|
8
8
|
:profile_name: US Core Pulse Oximetry Profile
|
9
|
+
:profile_version: 4.0.0
|
9
10
|
:title: Pulse Oximetry
|
10
11
|
:short_description: Verify support for the server capabilities required by the US
|
11
12
|
Core Pulse Oximetry Profile.
|
@@ -6,6 +6,7 @@
|
|
6
6
|
:resource: Observation
|
7
7
|
:profile_url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-respiratory-rate
|
8
8
|
:profile_name: US Core Respiratory Rate Profile
|
9
|
+
:profile_version: 4.0.0
|
9
10
|
:title: Respiratory Rate
|
10
11
|
:short_description: Verify support for the server capabilities required by the US
|
11
12
|
Core Respiratory Rate Profile.
|
@@ -6,6 +6,7 @@
|
|
6
6
|
:resource: Observation
|
7
7
|
:profile_url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-smokingstatus
|
8
8
|
:profile_name: US Core Smoking Status Observation Profile
|
9
|
+
:profile_version: 4.0.0
|
9
10
|
:title: Smoking Status Observation
|
10
11
|
:short_description: Verify support for the server capabilities required by the US
|
11
12
|
Core Smoking Status Observation Profile.
|
@@ -44,8 +44,8 @@ module USCoreTestKit
|
|
44
44
|
VALIDATION_MESSAGE_FILTERS = [
|
45
45
|
%r{Sub-extension url 'introspect' is not defined by the Extension http://fhir-registry\.smarthealthit\.org/StructureDefinition/oauth-uris$},
|
46
46
|
%r{Sub-extension url 'revoke' is not defined by the Extension http://fhir-registry\.smarthealthit\.org/StructureDefinition/oauth-uris$},
|
47
|
-
|
48
|
-
|
47
|
+
/Observation\.effective\.ofType\(Period\): vs-1:/, # Invalid invariant in FHIR v4.0.1
|
48
|
+
/Observation\.effective\.ofType\(Period\): us-core-1:/ # Invalid invariant in US Core v3.1.1
|
49
49
|
].freeze
|
50
50
|
|
51
51
|
def self.metadata
|
@@ -32,6 +32,7 @@ module USCoreTestKit
|
|
32
32
|
resource: resource,
|
33
33
|
profile_url: profile_url,
|
34
34
|
profile_name: profile_name,
|
35
|
+
profile_version: profile_version,
|
35
36
|
title: title,
|
36
37
|
short_description: short_description,
|
37
38
|
interactions: interactions,
|
@@ -169,6 +170,10 @@ module USCoreTestKit
|
|
169
170
|
profile.title.gsub(' ', ' ')
|
170
171
|
end
|
171
172
|
|
173
|
+
def profile_version
|
174
|
+
profile.version
|
175
|
+
end
|
176
|
+
|
172
177
|
def title
|
173
178
|
profile.title.gsub(/US\s*Core\s*/, '').gsub(/\s*Profile/, '').strip
|
174
179
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'active_support/all'
|
2
2
|
require 'fhir_models'
|
3
|
+
require 'pathname'
|
3
4
|
require 'rubygems/package'
|
4
5
|
require 'zlib'
|
5
6
|
require_relative 'ig_resources'
|
@@ -7,10 +8,10 @@ require_relative 'ig_resources'
|
|
7
8
|
module USCoreTestKit
|
8
9
|
class Generator
|
9
10
|
class IGLoader
|
10
|
-
attr_accessor :
|
11
|
+
attr_accessor :ig_file_name
|
11
12
|
|
12
|
-
def initialize(
|
13
|
-
self.
|
13
|
+
def initialize(ig_file_name)
|
14
|
+
self.ig_file_name = ig_file_name
|
14
15
|
end
|
15
16
|
|
16
17
|
def ig_resources
|
@@ -23,7 +24,9 @@ module USCoreTestKit
|
|
23
24
|
end
|
24
25
|
|
25
26
|
def load_ig
|
26
|
-
tar = Gem::Package::TarReader.new(
|
27
|
+
tar = Gem::Package::TarReader.new(
|
28
|
+
Zlib::GzipReader.open(ig_file_name)
|
29
|
+
)
|
27
30
|
|
28
31
|
tar.each do |entry|
|
29
32
|
next if entry.directory?
|
@@ -49,7 +52,11 @@ module USCoreTestKit
|
|
49
52
|
end
|
50
53
|
|
51
54
|
def load_standalone_resources
|
52
|
-
|
55
|
+
ig_directory = ig_file_name.chomp('.tgz')
|
56
|
+
|
57
|
+
return ig_resources unless File.exist? ig_directory
|
58
|
+
|
59
|
+
Dir.glob(File.join(ig_directory, '*.json')).each do |file_path|
|
53
60
|
begin
|
54
61
|
resource = FHIR.from_contents(File.read(file_path))
|
55
62
|
next if resource.nil?
|
@@ -277,7 +277,6 @@ module USCoreTestKit
|
|
277
277
|
when '4.0.0'
|
278
278
|
add_device_distinct_identifier
|
279
279
|
add_patient_uscdi_elements
|
280
|
-
add_provenance_agent_who
|
281
280
|
end
|
282
281
|
end
|
283
282
|
|
@@ -344,18 +343,23 @@ module USCoreTestKit
|
|
344
343
|
def add_must_support_choices
|
345
344
|
choices = []
|
346
345
|
|
347
|
-
choices << {paths: ['content.attachment.data', 'content.attachment.url']} if profile.type == 'DocumentReference'
|
346
|
+
choices << { paths: ['content.attachment.data', 'content.attachment.url'] } if profile.type == 'DocumentReference'
|
348
347
|
|
349
348
|
case profile.version
|
350
349
|
when '3.1.1'
|
351
|
-
choices << {paths: ['udiCarrier.carrierAIDC', 'udiCarrier.carrierHRF']} if profile.type == 'Device'
|
350
|
+
choices << { paths: ['udiCarrier.carrierAIDC', 'udiCarrier.carrierHRF'] } if profile.type == 'Device'
|
352
351
|
when '4.0.0'
|
353
352
|
case profile.type
|
354
353
|
when 'Encounter'
|
355
|
-
choices << {paths: ['reasonCode', 'reasonReference']}
|
356
|
-
choices << {paths: ['location.location', 'serviceProvider']}
|
354
|
+
choices << { paths: ['reasonCode', 'reasonReference'] }
|
355
|
+
choices << { paths: ['location.location', 'serviceProvider'] }
|
357
356
|
when 'MedicationRequest'
|
358
|
-
choices << {paths: ['reportedBoolean', 'reportedReference']}
|
357
|
+
choices << { paths: ['reportedBoolean', 'reportedReference'] }
|
358
|
+
when 'Patient'
|
359
|
+
choices << {
|
360
|
+
paths: ['name.period.end', 'name.use'],
|
361
|
+
uscdi_only: true
|
362
|
+
}
|
359
363
|
end
|
360
364
|
end
|
361
365
|
|
@@ -377,37 +381,34 @@ module USCoreTestKit
|
|
377
381
|
#US Core 4.0.0 Section 10.112.1.1 Additional USCDI v1 Requirement:
|
378
382
|
@must_supports[:extensions] << {
|
379
383
|
id: 'Patient.extension:race',
|
380
|
-
url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-race'
|
384
|
+
url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-race',
|
385
|
+
uscdi_only: true
|
381
386
|
}
|
382
387
|
@must_supports[:extensions] << {
|
383
388
|
id: 'Patient.extension:ethnicity',
|
384
|
-
url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity'
|
389
|
+
url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity',
|
390
|
+
uscdi_only: true
|
385
391
|
}
|
386
392
|
@must_supports[:extensions] << {
|
387
393
|
id: 'Patient.extension:birthsex',
|
388
|
-
url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex'
|
394
|
+
url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex',
|
395
|
+
uscdi_only: true
|
389
396
|
}
|
390
397
|
@must_supports[:elements] << {
|
391
|
-
path: '
|
398
|
+
path: 'name.suffix',
|
399
|
+
uscdi_only: true
|
392
400
|
}
|
393
401
|
@must_supports[:elements] << {
|
394
|
-
path: 'name.
|
402
|
+
path: 'name.use',
|
403
|
+
fixed_value: 'old',
|
404
|
+
uscdi_only: true
|
395
405
|
}
|
396
406
|
@must_supports[:elements] << {
|
397
|
-
path: 'name.
|
398
|
-
|
407
|
+
path: 'name.period.end',
|
408
|
+
uscdi_only: true
|
399
409
|
}
|
400
410
|
end
|
401
411
|
end
|
402
|
-
|
403
|
-
def add_provenance_agent_who
|
404
|
-
# FHIR-36344 US Core 4.0.0 mistakenly not lable us-core-organization as MS for Provenance.agent.who
|
405
|
-
# This will be fixed in US Core 5.0.0
|
406
|
-
if profile.type == 'Provenance'
|
407
|
-
target_element = @must_supports[:elements].find { |element| element[:path] == 'agent.who'}
|
408
|
-
target_element[:target_profiles] << 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-organization'
|
409
|
-
end
|
410
|
-
end
|
411
412
|
end
|
412
413
|
end
|
413
414
|
end
|
@@ -68,9 +68,32 @@ module USCoreTestKit
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def must_support_list_string
|
71
|
-
|
72
|
-
|
73
|
-
|
71
|
+
build_must_support_list_string(false)
|
72
|
+
end
|
73
|
+
|
74
|
+
def uscdi_list_string
|
75
|
+
build_must_support_list_string(true)
|
76
|
+
end
|
77
|
+
|
78
|
+
def build_must_support_list_string(uscdi_only)
|
79
|
+
slice_names = group_metadata.must_supports[:slices]
|
80
|
+
.select { |slice| slice[:uscdi_only].presence == uscdi_only.presence }
|
81
|
+
.map { |slice| slice[:name] }
|
82
|
+
|
83
|
+
element_names = group_metadata.must_supports[:elements]
|
84
|
+
.select { |element| element[:uscdi_only].presence == uscdi_only.presence }
|
85
|
+
.map { |element| "#{resource_type}.#{element[:path]}" }
|
86
|
+
|
87
|
+
extension_names = group_metadata.must_supports[:extensions]
|
88
|
+
.select { |extension| extension[:uscdi_only].presence == uscdi_only.presence }
|
89
|
+
.map { |extension| extension[:id] }
|
90
|
+
|
91
|
+
group_metadata.must_supports[:choices]&.each do |choice|
|
92
|
+
next unless choice[:uscdi_only].presence == uscdi_only.presence
|
93
|
+
choice[:paths].each { |path| element_names.delete("#{resource_type}.#{path}") }
|
94
|
+
element_names << choice[:paths].map { |path| "#{resource_type}.#{path}" }.join(' or ')
|
95
|
+
end
|
96
|
+
|
74
97
|
(slice_names + element_names + extension_names)
|
75
98
|
.uniq
|
76
99
|
.sort
|
@@ -16,26 +16,21 @@ require_relative 'generator/validation_test_generator'
|
|
16
16
|
module USCoreTestKit
|
17
17
|
class Generator
|
18
18
|
def self.generate
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
.map { |path| File.join(base_ig_directory, path) }
|
24
|
-
.select { |path| File.directory? path }
|
25
|
-
|
26
|
-
ig_directories.each do |ig_directory|
|
27
|
-
new(ig_directory).generate
|
19
|
+
ig_packages = Dir.glob(File.join(Dir.pwd, 'lib', 'us_core_test_kit', 'igs', '*.tgz'))
|
20
|
+
|
21
|
+
ig_packages.each do |ig_package|
|
22
|
+
new(ig_package).generate
|
28
23
|
end
|
29
24
|
end
|
30
25
|
|
31
|
-
attr_accessor :ig_resources, :ig_metadata, :
|
26
|
+
attr_accessor :ig_resources, :ig_metadata, :ig_file_name
|
32
27
|
|
33
|
-
def initialize(
|
34
|
-
self.
|
28
|
+
def initialize(ig_file_name)
|
29
|
+
self.ig_file_name = ig_file_name
|
35
30
|
end
|
36
31
|
|
37
32
|
def generate
|
38
|
-
puts "Generating tests for IG
|
33
|
+
puts "Generating tests for IG #{File.basename(ig_file_name)}"
|
39
34
|
load_ig_package
|
40
35
|
extract_metadata
|
41
36
|
generate_resource_list
|
@@ -68,7 +63,7 @@ module USCoreTestKit
|
|
68
63
|
|
69
64
|
def load_ig_package
|
70
65
|
FHIR.logger = Logger.new('/dev/null')
|
71
|
-
self.ig_resources = IGLoader.new(
|
66
|
+
self.ig_resources = IGLoader.new(ig_file_name).load
|
72
67
|
end
|
73
68
|
|
74
69
|
def generate_resource_list
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -36,8 +36,16 @@ module USCoreTestKit
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
+
def include_uscdi_only_test?
|
40
|
+
config.options[:include_uscdi_only_test] == true
|
41
|
+
end
|
42
|
+
|
39
43
|
def must_support_extensions
|
40
|
-
|
44
|
+
if include_uscdi_only_test?
|
45
|
+
metadata.must_supports[:extensions]
|
46
|
+
else
|
47
|
+
metadata.must_supports[:extensions].reject{ |extension| extension[:uscdi_only] }
|
48
|
+
end
|
41
49
|
end
|
42
50
|
|
43
51
|
def missing_extensions(resources = [])
|
@@ -50,7 +58,11 @@ module USCoreTestKit
|
|
50
58
|
end
|
51
59
|
|
52
60
|
def must_support_elements
|
53
|
-
|
61
|
+
if include_uscdi_only_test?
|
62
|
+
metadata.must_supports[:elements]
|
63
|
+
else
|
64
|
+
metadata.must_supports[:elements].reject{ |element| element[:uscdi_only] }
|
65
|
+
end
|
54
66
|
end
|
55
67
|
|
56
68
|
def missing_elements(resources = [])
|
@@ -85,7 +97,11 @@ module USCoreTestKit
|
|
85
97
|
end
|
86
98
|
|
87
99
|
def must_support_slices
|
88
|
-
|
100
|
+
if include_uscdi_only_test?
|
101
|
+
metadata.must_supports[:slices]
|
102
|
+
else
|
103
|
+
metadata.must_supports[:slices].reject{ |slice| slice[:uscdi_only] }
|
104
|
+
end
|
89
105
|
end
|
90
106
|
|
91
107
|
def missing_slices(resources = [])
|
@@ -124,6 +140,12 @@ module USCoreTestKit
|
|
124
140
|
rescue ArgumentError
|
125
141
|
false
|
126
142
|
end
|
143
|
+
when 'DateTime'
|
144
|
+
begin
|
145
|
+
DateTime.parse(element)
|
146
|
+
rescue ArgumentError
|
147
|
+
false
|
148
|
+
end
|
127
149
|
when 'String'
|
128
150
|
element.is_a? String
|
129
151
|
else
|