onc_certification_g10_test_kit 3.8.1 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/lib/inferno/terminology/expected_manifest.yml +58 -53
  3. data/lib/inferno/terminology/fhir_package_manager.rb +2 -1
  4. data/lib/inferno/terminology/loader.rb +7 -3
  5. data/lib/inferno/terminology/tasks/check_built_terminology.rb +17 -1
  6. data/lib/inferno/terminology/tasks/download_fhir_terminology.rb +2 -1
  7. data/lib/inferno/terminology/tasks/download_umls.rb +2 -1
  8. data/lib/inferno/terminology/tasks/expand_value_set_to_file.rb +1 -1
  9. data/lib/inferno/terminology/tasks/run_umls_jar.rb +2 -1
  10. data/lib/onc_certification_g10_test_kit/bulk_data_group_export_validation.rb +185 -0
  11. data/lib/onc_certification_g10_test_kit/bulk_export_validation_tester.rb +4 -0
  12. data/lib/onc_certification_g10_test_kit/g10_options.rb +8 -0
  13. data/lib/onc_certification_g10_test_kit/igs/CodeSystem-observation-category.json +83 -0
  14. data/lib/onc_certification_g10_test_kit/igs/StructureDefinition-condition-assertedDate.json +280 -0
  15. data/lib/onc_certification_g10_test_kit/igs/ValueSet-observation-category.json +48 -0
  16. data/lib/onc_certification_g10_test_kit/igs/ValueSet-servicerequest-category.json +69 -0
  17. data/lib/onc_certification_g10_test_kit/limited_scope_grant_test.rb +5 -0
  18. data/lib/onc_certification_g10_test_kit/multi_patient_api_stu1.rb +10 -9
  19. data/lib/onc_certification_g10_test_kit/multi_patient_api_stu2.rb +10 -9
  20. data/lib/onc_certification_g10_test_kit/profile_selector.rb +72 -46
  21. data/lib/onc_certification_g10_test_kit/restricted_resource_type_access_group.rb +118 -21
  22. data/lib/onc_certification_g10_test_kit/short_id_manager.rb +2 -0
  23. data/lib/onc_certification_g10_test_kit/short_id_map.yml +579 -0
  24. data/lib/onc_certification_g10_test_kit/single_patient_api_group.rb +2 -1
  25. data/lib/onc_certification_g10_test_kit/single_patient_us_core_4_api_group.rb +33 -18
  26. data/lib/onc_certification_g10_test_kit/single_patient_us_core_5_api_group.rb +46 -24
  27. data/lib/onc_certification_g10_test_kit/single_patient_us_core_6_api_group.rb +203 -0
  28. data/lib/onc_certification_g10_test_kit/smart_scopes_test.rb +14 -4
  29. data/lib/onc_certification_g10_test_kit/unrestricted_resource_type_access_group.rb +106 -31
  30. data/lib/onc_certification_g10_test_kit/version.rb +1 -1
  31. data/lib/onc_certification_g10_test_kit/well_known_capabilities_test.rb +1 -1
  32. data/lib/onc_certification_g10_test_kit.rb +14 -1
  33. metadata +13 -8
@@ -3,7 +3,8 @@ require_relative 'incorrectly_permitted_tls_versions_messages_setup_test'
3
3
  module ONCCertificationG10TestKit
4
4
  class SinglePatientAPIGroup < Inferno::TestGroup
5
5
  id :g10_single_patient_api
6
- title 'Single Patient API'
6
+ title 'Single Patient API (US Core 3.1.1)'
7
+ short_title 'Single Patient API'
7
8
  description %(
8
9
  For each of the relevant USCDI data elements provided in the
9
10
  CapabilityStatement, this test executes the [required supported
@@ -4,6 +4,7 @@ module ONCCertificationG10TestKit
4
4
  class SinglePatientUSCore4APIGroup < Inferno::TestGroup
5
5
  id :g10_single_patient_us_core_4_api
6
6
  title 'Single Patient API (US Core 4.0.0)'
7
+ short_title 'Single Patient API'
7
8
  description %(
8
9
  For each of the relevant USCDI data elements provided in the
9
10
  CapabilityStatement, this test executes the [required supported
@@ -55,24 +56,38 @@ module ONCCertificationG10TestKit
55
56
 
56
57
  config(
57
58
  options: {
58
- required_resources: [
59
- 'Patient',
60
- 'AllergyIntolerance',
61
- 'CarePlan',
62
- 'CareTeam',
63
- 'Condition',
64
- 'Device',
65
- 'DiagnosticReport',
66
- 'DocumentReference',
67
- 'Goal',
68
- 'Immunization',
69
- 'MedicationRequest',
70
- 'Observation',
71
- 'Procedure',
72
- 'Encounter',
73
- 'Organization',
74
- 'Practitioner',
75
- 'Provenance'
59
+ required_profiles: [
60
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-allergyintolerance',
61
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-careplan',
62
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-careteam',
63
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-condition',
64
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-implantable-device',
65
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-diagnosticreport-lab',
66
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-diagnosticreport-note',
67
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-documentreference',
68
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-encounter',
69
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-goal',
70
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-immunization',
71
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-medicationrequest',
72
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-lab',
73
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-blood-pressure',
74
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-bmi',
75
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-head-circumference',
76
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-body-height',
77
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-body-weight',
78
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-body-temperature',
79
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-heart-rate',
80
+ 'http://hl7.org/fhir/us/core/StructureDefinition/pediatric-bmi-for-age',
81
+ 'http://hl7.org/fhir/us/core/StructureDefinition/head-occipital-frontal-circumference-percentile',
82
+ 'http://hl7.org/fhir/us/core/StructureDefinition/pediatric-weight-for-height',
83
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-pulse-oximetry',
84
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-respiratory-rate',
85
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-smokingstatus',
86
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-organization',
87
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient',
88
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner',
89
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-procedure',
90
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-provenance'
76
91
  ]
77
92
  }
78
93
  )
@@ -4,6 +4,7 @@ module ONCCertificationG10TestKit
4
4
  class SinglePatientUSCore5APIGroup < Inferno::TestGroup
5
5
  id :g10_single_patient_us_core_5_api
6
6
  title 'Single Patient API (US Core 5.0.1)'
7
+ short_title 'Single Patient API'
7
8
  description %(
8
9
  For each of the relevant USCDI data elements provided in the
9
10
  CapabilityStatement, this test executes the [required supported
@@ -21,10 +22,11 @@ module ONCCertificationG10TestKit
21
22
 
22
23
  All MUST SUPPORT elements must be seen before the test can pass, as well
23
24
  as Data Absent Reason to demonstrate that the server can properly handle
24
- missing data. Note that Encounter, Organization and Practitioner resources
25
- must be accessible as references in some US Core profiles to satisfy must
26
- support requirements, and those references will be validated to their US
27
- Core profile. These resources will not be tested for FHIR search support.
25
+ missing data. Note that Organization, Practitioner, and RelatedPerson
26
+ resources must be accessible as references in some US Core profiles to
27
+ satisfy must support requirements, and those references will be validated
28
+ to their US Core profile. These resources will not be tested for FHIR
29
+ search support.
28
30
  )
29
31
  run_as_group
30
32
 
@@ -55,26 +57,46 @@ module ONCCertificationG10TestKit
55
57
 
56
58
  config(
57
59
  options: {
58
- required_resources: [
59
- 'Patient',
60
- 'AllergyIntolerance',
61
- 'CarePlan',
62
- 'CareTeam',
63
- 'Condition',
64
- 'Device',
65
- 'DiagnosticReport',
66
- 'DocumentReference',
67
- 'Encounter',
68
- 'Goal',
69
- 'Immunization',
70
- 'MedicationRequest',
71
- 'Observation',
72
- 'Procedure',
73
- 'ServiceRequest',
74
- 'Organization',
75
- 'Practitioner',
76
- 'Provenance',
77
- 'RelatedPerson'
60
+ required_profiles: [
61
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-allergyintolerance',
62
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-careplan',
63
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-careteam',
64
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-condition-encounter-diagnosis',
65
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-condition-problems-health-concerns',
66
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-implantable-device',
67
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-diagnosticreport-lab',
68
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-diagnosticreport-note',
69
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-documentreference',
70
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-encounter',
71
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-goal',
72
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-immunization',
73
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-medicationrequest',
74
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-lab',
75
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-blood-pressure',
76
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-bmi',
77
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-head-circumference',
78
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-body-height',
79
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-body-weight',
80
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-body-temperature',
81
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-heart-rate',
82
+ 'http://hl7.org/fhir/us/core/StructureDefinition/pediatric-bmi-for-age',
83
+ 'http://hl7.org/fhir/us/core/StructureDefinition/head-occipital-frontal-circumference-percentile',
84
+ 'http://hl7.org/fhir/us/core/StructureDefinition/pediatric-weight-for-height',
85
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-pulse-oximetry',
86
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-respiratory-rate',
87
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-smokingstatus',
88
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-clinical-test',
89
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-imaging',
90
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-sexual-orientation',
91
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-social-history',
92
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-sdoh-assessment',
93
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-organization',
94
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient',
95
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner',
96
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-procedure',
97
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-provenance',
98
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-relatedperson',
99
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-servicerequest'
78
100
  ]
79
101
  }
80
102
  )
@@ -0,0 +1,203 @@
1
+ require_relative 'incorrectly_permitted_tls_versions_messages_setup_test'
2
+
3
+ module ONCCertificationG10TestKit
4
+ class SinglePatientUSCore6APIGroup < Inferno::TestGroup
5
+ id :g10_single_patient_us_core_6_api
6
+ title 'Single Patient API (US Core 6.1.0)'
7
+ short_title 'Single Patient API'
8
+ description %(
9
+ For each of the relevant USCDI data elements provided in the
10
+ CapabilityStatement, this test executes the [required supported
11
+ searches](http://hl7.org/fhir/us/core/STU6.1/CapabilityStatement-us-core-server.html)
12
+ as defined by the US Core Implementation Guide v6.1.0.
13
+
14
+ The test begins by searching by one or more patients, with the expectation
15
+ that the Bearer token provided to the test grants access to all USCDI
16
+ resources. It uses results returned from that query to generate other
17
+ queries and checks that the results are consistent with the provided
18
+ search parameters. It then performs a read on each Resource returned and
19
+ validates the response against the relevant
20
+ [profile](http://hl7.org/fhir/us/core/STU6.1/profiles-and-extensions.html)
21
+ as currently defined in the US Core Implementation Guide.
22
+
23
+ All MUST SUPPORT elements must be seen before the test can pass, as well
24
+ as Data Absent Reason to demonstrate that the server can properly handle
25
+ missing data. Note that Organization, Practitioner, and RelatedPerson
26
+ resources must be accessible as references in some US Core profiles to
27
+ satisfy must support requirements, and those references will be validated
28
+ to their US Core profile. These resources will not be tested for FHIR
29
+ search support.
30
+ )
31
+ run_as_group
32
+
33
+ input :url,
34
+ title: 'FHIR Endpoint',
35
+ description: 'URL of the FHIR endpoint used by SMART applications'
36
+ input :patient_id,
37
+ title: 'Patient ID from SMART App Launch',
38
+ locked: true
39
+ input :additional_patient_ids,
40
+ title: 'Additional Patient IDs',
41
+ description: <<~DESCRIPTION,
42
+ Comma separated list of Patient IDs that together with the Patient
43
+ ID from the SMART App Launch contain all MUST SUPPORT elements.
44
+ DESCRIPTION
45
+ optional: true
46
+ input :smart_credentials,
47
+ title: 'SMART App Launch Credentials',
48
+ type: :oauth_credentials,
49
+ locked: true
50
+
51
+ fhir_client do
52
+ url :url
53
+ oauth_credentials :smart_credentials
54
+ end
55
+
56
+ input_order :url, :patient_id, :additional_patient_ids, :implantable_device_codes, :smart_credentials
57
+
58
+ config(
59
+ options: {
60
+ required_profiles: [
61
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-allergyintolerance',
62
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-careplan',
63
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-careteam',
64
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-condition-encounter-diagnosis',
65
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-condition-problems-health-concerns',
66
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-coverage',
67
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-implantable-device',
68
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-diagnosticreport-lab',
69
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-diagnosticreport-note',
70
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-documentreference',
71
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-encounter',
72
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-goal',
73
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-immunization',
74
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-medicationdispense',
75
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-medicationrequest',
76
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-lab',
77
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-blood-pressure',
78
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-bmi',
79
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-head-circumference',
80
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-body-height',
81
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-body-weight',
82
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-body-temperature',
83
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-heart-rate',
84
+ 'http://hl7.org/fhir/us/core/StructureDefinition/pediatric-bmi-for-age',
85
+ 'http://hl7.org/fhir/us/core/StructureDefinition/head-occipital-frontal-circumference-percentile',
86
+ 'http://hl7.org/fhir/us/core/StructureDefinition/pediatric-weight-for-height',
87
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-pulse-oximetry',
88
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-respiratory-rate',
89
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-smokingstatus',
90
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-clinical-result',
91
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-occupation',
92
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-pregnancyintent',
93
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-pregnancystatus',
94
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-screening-assessment',
95
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-sexual-orientation',
96
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-organization',
97
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient',
98
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner',
99
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-procedure',
100
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-provenance',
101
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-relatedperson',
102
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-servicerequest',
103
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-specimen'
104
+ ]
105
+ }
106
+ )
107
+
108
+ config(
109
+ options: {
110
+ required_resources: [
111
+ 'Patient',
112
+ 'AllergyIntolerance',
113
+ 'CarePlan',
114
+ 'CareTeam',
115
+ 'Condition',
116
+ 'Coverage',
117
+ 'Device',
118
+ 'DiagnosticReport',
119
+ 'DocumentReference',
120
+ 'Encounter',
121
+ 'Goal',
122
+ 'Immunization',
123
+ 'MedicationDispense',
124
+ 'MedicationRequest',
125
+ 'Observation',
126
+ 'Procedure',
127
+ 'ServiceRequest',
128
+ 'Specimen',
129
+ 'Organization',
130
+ 'Practitioner',
131
+ 'Provenance',
132
+ 'RelatedPerson'
133
+ ]
134
+ }
135
+ )
136
+
137
+ test do
138
+ id :g10_patient_id_setup
139
+ title 'Manage patient id list'
140
+
141
+ input :patient_id, :additional_patient_ids
142
+ output :patient_ids
143
+
144
+ run do
145
+ smart_app_launch_patient_id = patient_id.presence
146
+ additional_patient_ids_list =
147
+ if additional_patient_ids.present?
148
+ additional_patient_ids
149
+ .split(',')
150
+ .map(&:strip)
151
+ .map(&:presence)
152
+ .compact
153
+ else
154
+ []
155
+ end
156
+
157
+ all_patient_ids = ([smart_app_launch_patient_id] + additional_patient_ids_list).compact.uniq
158
+
159
+ output patient_ids: all_patient_ids.join(',')
160
+ end
161
+ end
162
+
163
+ USCoreTestKit::USCoreV610::USCoreTestSuite.groups.each do |group|
164
+ test_group = group.ancestors[1]
165
+
166
+ next if test_group.optional?
167
+
168
+ id = test_group.id
169
+
170
+ group_config = {}
171
+ if test_group.respond_to?(:metadata) && test_group.metadata.resource != 'Specimen' && test_group.metadata.delayed?
172
+ test_group.children.reject! { |child| child.include? USCoreTestKit::SearchTest }
173
+ group_config[:options] = { read_all_resources: true }
174
+ end
175
+
176
+ group(from: id, exclude_optional: true, config: group_config)
177
+ end
178
+
179
+ groups.first.description %(
180
+ The Capability Statement test verifies a FHIR server's ability support the
181
+ [capabilities
182
+ operation](https://www.hl7.org/fhir/R4/capabilitystatement.html#instance)
183
+ to formally describe features supported by the API as a [Capability
184
+ Statement](https://www.hl7.org/fhir/R4/capabilitystatement.html) resource.
185
+ The capabilities described in the Capability Statement must be consistent with
186
+ the required capabilities of a US Core server. This test also expects that
187
+ APIs state support for all resources types applicable to USCDI v3, as is
188
+ expected by the ONC (g)(10) Standardized API for Patient and Populations
189
+ Services certification criterion.
190
+
191
+ This test sequence accesses the server endpoint at `/metadata` using a
192
+ `GET` request. It parses the Capability Statement and verifies that:
193
+
194
+ * The endpoint is secured by an appropriate cryptographic protocol
195
+ * The resource matches the expected FHIR version defined by the tests
196
+ * The resource is a valid FHIR resource
197
+ * The server claims support for JSON encoding of resources
198
+ * The server claims support for all required USCDI resource types
199
+ )
200
+
201
+ test from: :g10_incorrectly_permitted_tls_versions_messages_setup
202
+ end
203
+ end
@@ -43,6 +43,9 @@ module ONCCertificationG10TestKit
43
43
  V5_VALID_RESOURCE_TYPES =
44
44
  (VALID_RESOURCE_TYPES + ['ServiceRequest', 'QuestionnaireResponse', 'Media']).freeze
45
45
 
46
+ V6_VALID_RESOURCE_TYPES =
47
+ (V5_VALID_RESOURCE_TYPES + ['Coverage', 'MedicationDispense', 'RelatedPerson', 'Specimen']).freeze
48
+
46
49
  PATIENT_COMPARTMENT_RESOURCE_TYPES = [
47
50
  '*',
48
51
  'Patient',
@@ -63,16 +66,23 @@ module ONCCertificationG10TestKit
63
66
  V5_PATIENT_COMPARTMENT_RESOURCE_TYPES =
64
67
  (PATIENT_COMPARTMENT_RESOURCE_TYPES + ['ServiceRequest']).freeze
65
68
 
69
+ V6_PATIENT_COMPARTMENT_RESOURCE_TYPES =
70
+ (V5_PATIENT_COMPARTMENT_RESOURCE_TYPES + ['Coverage', 'MedicationDispense', 'Specimen']).freeze
71
+
66
72
  def patient_compartment_resource_types
67
- return PATIENT_COMPARTMENT_RESOURCE_TYPES unless using_us_core_5?
73
+ return V5_PATIENT_COMPARTMENT_RESOURCE_TYPES if using_us_core_5?
68
74
 
69
- V5_PATIENT_COMPARTMENT_RESOURCE_TYPES
75
+ return V6_PATIENT_COMPARTMENT_RESOURCE_TYPES if using_us_core_6?
76
+
77
+ PATIENT_COMPARTMENT_RESOURCE_TYPES
70
78
  end
71
79
 
72
80
  def valid_resource_types
73
- return VALID_RESOURCE_TYPES unless using_us_core_5?
81
+ return V5_VALID_RESOURCE_TYPES if using_us_core_5?
82
+
83
+ return V6_VALID_RESOURCE_TYPES if using_us_core_6?
74
84
 
75
- V5_VALID_RESOURCE_TYPES
85
+ VALID_RESOURCE_TYPES
76
86
  end
77
87
 
78
88
  def required_scope_type
@@ -10,25 +10,28 @@ module ONCCertificationG10TestKit
10
10
  resources during the SMART Launch process, and this test ensures they all
11
11
  can be accessed:
12
12
 
13
- * AllergyIntolerance
14
- * CarePlan
15
- * CareTeam
16
- * Condition
17
- * Device
18
- * DiagnosticReport
19
- * DocumentReference
20
- * Goal
21
- * Immunization
22
- * MedicationRequest
23
- * Observation
24
- * Procedure
25
- * Patient
26
- * Provenance
27
- * Encounter
28
- * Practitioner
29
- * Organization
30
-
31
- If testing against USCDI v2, ServiceRequest is also checked.
13
+ * AllergyIntolerance
14
+ * CarePlan
15
+ * CareTeam
16
+ * Condition
17
+ * Device
18
+ * DiagnosticReport
19
+ * DocumentReference
20
+ * Goal
21
+ * Immunization
22
+ * MedicationRequest
23
+ * Observation
24
+ * Procedure
25
+ * Patient
26
+ * Encounter
27
+ * Practitioner
28
+ * Organization
29
+
30
+ If testing against USCDI v2, Encounter and ServiceRequest are also
31
+ checked.
32
+
33
+ If testing against USCDI v3, Encounter, ServiceRequest, Coverage,
34
+ and MedicationDispense are also checked.
32
35
 
33
36
  For each of the resource types that can be mapped to USCDI data class or
34
37
  elements, this set of tests performs a minimum number of requests to
@@ -43,25 +46,33 @@ module ONCCertificationG10TestKit
43
46
  This set of tests does not attempt to access resources that do not
44
47
  directly map to USCDI. For USCDI v1 this includes:
45
48
 
46
- * Encounter
47
- * Location
48
- * Organization
49
- * Practitioner
49
+ * Encounter
50
+ * Location
51
+ * Organization
52
+ * Practitioner
50
53
 
51
54
  For USCDI v2 this includes:
52
55
 
53
- * Location
54
- * Organization
55
- * Practitioner
56
+ * Location
57
+ * Organization
58
+ * Practitioner
59
+
60
+ For USCDI v3 this includes:
61
+
62
+ * Location
63
+ * Organization
64
+ * Practitioner
65
+ * RelatedPerson
56
66
 
57
67
  It also does not test Provenance, as this resource type is accessed by
58
- queries through other resource types. These resources types are accessed
59
- in the more comprehensive Single Patient Query tests.
68
+ queries through other resource types, or Specimen in USCDI v3 which only
69
+ requires support for read and search by id. These resources types are
70
+ accessed in the more comprehensive Single Patient Query tests.
60
71
 
61
72
  However, the authorization system must indicate that access is granted to
62
- the Encounter, Practitioner and Organization resource types by providing
63
- them in the returned scopes because they are required to support the read
64
- interaction.
73
+ the Encounter, Practitioner and Organization (and RelatedPerson and
74
+ Specimen for USCDI v3) resource types by providing them in the returned
75
+ scopes because they are required to support the read interaction.
65
76
  )
66
77
  id :g10_unrestricted_resource_type_access
67
78
 
@@ -96,6 +107,8 @@ module ONCCertificationG10TestKit
96
107
 
97
108
  V5_ALL_RESOURCES = (ALL_RESOURCES + ['ServiceRequest']).freeze
98
109
 
110
+ V6_ALL_RESOURCES = (V5_ALL_RESOURCES + ['Coverage', 'MedicationDispense']).freeze
111
+
99
112
  NON_PATIENT_COMPARTMENT_RESOURCES =
100
113
  [
101
114
  'Encounter',
@@ -111,6 +124,8 @@ module ONCCertificationG10TestKit
111
124
  V5_NON_PATIENT_COMPARTMENT_RESOURCES =
112
125
  (NON_PATIENT_COMPARTMENT_RESOURCES - ['Encounter'] + ['ServiceRequest']).freeze
113
126
 
127
+ V6_NON_PATIENT_COMPARTMENT_RESOURCES = V5_NON_PATIENT_COMPARTMENT_RESOURCES
128
+
114
129
  test do
115
130
  include G10Options
116
131
 
@@ -123,12 +138,16 @@ module ONCCertificationG10TestKit
123
138
  def all_resources
124
139
  return V5_ALL_RESOURCES if using_us_core_5?
125
140
 
141
+ return V6_ALL_RESOURCES if using_us_core_6?
142
+
126
143
  ALL_RESOURCES
127
144
  end
128
145
 
129
146
  def non_patient_compartment_resources
130
147
  return V5_NON_PATIENT_COMPARTMENT_RESOURCES if using_us_core_5?
131
148
 
149
+ return V6_NON_PATIENT_COMPARTMENT_RESOURCES if using_us_core_6?
150
+
132
151
  NON_PATIENT_COMPARTMENT_RESOURCES
133
152
  end
134
153
 
@@ -358,5 +377,61 @@ module ONCCertificationG10TestKit
358
377
  USCoreTestKit::USCoreV501::ServiceRequestGroup
359
378
  end
360
379
  end
380
+
381
+ test from: :g10_resource_access_test do
382
+ title 'Access to Encounter resources granted'
383
+ description %(
384
+ This test ensures that access to the Encounter is granted.
385
+ )
386
+ id :g10_us_core_6_encounter_unrestricted_access
387
+
388
+ required_suite_options G10Options::US_CORE_6_REQUIREMENT
389
+
390
+ def resource_group
391
+ USCoreTestKit::USCoreV610::EncounterGroup
392
+ end
393
+ end
394
+
395
+ test from: :g10_resource_access_test do
396
+ title 'Access to ServiceRequest resources granted'
397
+ description %(
398
+ This test ensures that access to the ServiceRequest is granted.
399
+ )
400
+ id :g10_us_core_6_service_request_unrestricted_access
401
+
402
+ required_suite_options G10Options::US_CORE_6_REQUIREMENT
403
+
404
+ def resource_group
405
+ USCoreTestKit::USCoreV610::ServiceRequestGroup
406
+ end
407
+ end
408
+
409
+ test from: :g10_resource_access_test do
410
+ title 'Access to Coverage resources granted'
411
+ description %(
412
+ This test ensures that access to the Coverage is granted.
413
+ )
414
+ id :g10_us_core_6_coverage_unrestricted_access
415
+
416
+ required_suite_options G10Options::US_CORE_6_REQUIREMENT
417
+
418
+ def resource_group
419
+ USCoreTestKit::USCoreV610::CoverageGroup
420
+ end
421
+ end
422
+
423
+ test from: :g10_resource_access_test do
424
+ title 'Access to MedicationDispense resources granted'
425
+ description %(
426
+ This test ensures that access to the MedicationDispense is granted.
427
+ )
428
+ id :g10_us_core_6_medication_dispense_unrestricted_access
429
+
430
+ required_suite_options G10Options::US_CORE_6_REQUIREMENT
431
+
432
+ def resource_group
433
+ USCoreTestKit::USCoreV610::MedicationDispenseGroup
434
+ end
435
+ end
361
436
  end
362
437
  end
@@ -1,3 +1,3 @@
1
1
  module ONCCertificationG10TestKit
2
- VERSION = '3.8.1'.freeze
2
+ VERSION = '4.0.0'.freeze
3
3
  end
@@ -23,7 +23,7 @@ module ONCCertificationG10TestKit
23
23
 
24
24
  required_capabilities = config.options[:required_capabilities] || []
25
25
 
26
- if using_us_core_5? && required_capabilities.include?('launch-ehr')
26
+ if (using_us_core_5? || using_us_core_6?) && required_capabilities.include?('launch-ehr')
27
27
  required_capabilities += ['context-ehr-encounter']
28
28
  end
29
29