onc_certification_g10_test_kit 6.0.3 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/lib/inferno/repositiories/validators.rb +0 -6
  3. data/lib/inferno/repositiories/value_sets.rb +1 -7
  4. data/lib/inferno/terminology/expected_manifest.yml +5 -5
  5. data/lib/inferno/terminology/fhir_package_manager.rb +13 -4
  6. data/lib/inferno/terminology/loader.rb +2 -1
  7. data/lib/inferno/terminology/tasks/download_fhir_terminology.rb +2 -1
  8. data/lib/inferno/terminology/tasks/download_umls.rb +2 -1
  9. data/lib/inferno/terminology/tasks/expand_value_set_to_file.rb +1 -1
  10. data/lib/inferno/terminology/tasks/run_umls_jar.rb +2 -1
  11. data/lib/inferno/terminology/validator.rb +1 -0
  12. data/lib/inferno/terminology/value_set.rb +2 -0
  13. data/lib/onc_certification_g10_test_kit/all_resources.rb +74 -0
  14. data/lib/onc_certification_g10_test_kit/bulk_data_group_export_validation.rb +361 -59
  15. data/lib/onc_certification_g10_test_kit/bulk_export_validation_tester.rb +4 -3
  16. data/lib/onc_certification_g10_test_kit/g10_options.rb +20 -1
  17. data/lib/onc_certification_g10_test_kit/limited_scope_grant_test.rb +4 -0
  18. data/lib/onc_certification_g10_test_kit/multi_patient_api_stu1.rb +2 -1
  19. data/lib/onc_certification_g10_test_kit/multi_patient_api_stu2.rb +2 -1
  20. data/lib/onc_certification_g10_test_kit/patient_scope_test.rb +1 -1
  21. data/lib/onc_certification_g10_test_kit/profile_selector.rb +40 -15
  22. data/lib/onc_certification_g10_test_kit/restricted_resource_type_access_group.rb +89 -2
  23. data/lib/onc_certification_g10_test_kit/short_id_map.yml +1417 -12
  24. data/lib/onc_certification_g10_test_kit/single_patient_us_core_7_api_group.rb +219 -0
  25. data/lib/onc_certification_g10_test_kit/smart_app_launch_invalid_aud_group.rb +41 -1
  26. data/lib/onc_certification_g10_test_kit/smart_asymmetric_launch_group.rb +33 -1
  27. data/lib/onc_certification_g10_test_kit/smart_ehr_patient_launch_group_stu2_2.rb +128 -0
  28. data/lib/onc_certification_g10_test_kit/smart_ehr_practitioner_app_group.rb +234 -0
  29. data/lib/onc_certification_g10_test_kit/smart_fine_grained_scopes_group_stu2_2.rb +188 -0
  30. data/lib/onc_certification_g10_test_kit/smart_fine_grained_scopes_us_core_7_group.rb +188 -0
  31. data/lib/onc_certification_g10_test_kit/smart_fine_grained_scopes_us_core_7_group_stu2_2.rb +188 -0
  32. data/lib/onc_certification_g10_test_kit/smart_granular_scope_selection_group.rb +67 -1
  33. data/lib/onc_certification_g10_test_kit/smart_limited_app_group.rb +128 -1
  34. data/lib/onc_certification_g10_test_kit/smart_public_standalone_launch_group_stu2_2.rb +162 -0
  35. data/lib/onc_certification_g10_test_kit/smart_scopes_test.rb +10 -2
  36. data/lib/onc_certification_g10_test_kit/smart_standalone_patient_app_group.rb +159 -0
  37. data/lib/onc_certification_g10_test_kit/smart_v1_scopes_group.rb +117 -0
  38. data/lib/onc_certification_g10_test_kit/terminology_binding_validator.rb +5 -1
  39. data/lib/onc_certification_g10_test_kit/token_introspection_group_stu2_2.rb +97 -0
  40. data/lib/onc_certification_g10_test_kit/unrestricted_resource_type_access_group.rb +85 -31
  41. data/lib/onc_certification_g10_test_kit/version.rb +1 -1
  42. data/lib/onc_certification_g10_test_kit/visual_inspection_and_attestations_group.rb +171 -0
  43. data/lib/onc_certification_g10_test_kit/well_known_capabilities_test.rb +1 -1
  44. data/lib/onc_certification_g10_test_kit.rb +72 -5
  45. metadata +18 -10
@@ -5,15 +5,20 @@ module ONCCertificationG10TestKit
5
5
  include G10Options
6
6
 
7
7
  def extract_profile(resource_type)
8
- case resource_type
9
- when 'Medication'
10
- return versioned_us_core_module.const_get('USCoreTestSuite').metadata.find do |meta|
11
- meta.resource == resource_type
12
- end.profile_url
13
- when 'Location'
14
- return 'http://hl7.org/fhir/StructureDefinition/Location'
8
+ if resource_type == 'Medication'
9
+ versioned_us_core_module.const_get('USCoreTestSuite').metadata.find do |meta|
10
+ meta.resource == resource_type
11
+ end.profile_url
12
+ elsif resource_type == 'Location' && location_use_base_fhir?
13
+ 'http://hl7.org/fhir/StructureDefinition/Location'
14
+ else
15
+ versioned_us_core_module.const_get("#{resource_type}Group").metadata.profile_url
15
16
  end
16
- versioned_us_core_module.const_get("#{resource_type}Group").metadata.profile_url
17
+ end
18
+
19
+ def location_use_base_fhir?
20
+ using_us_core_3? || using_us_core_4? || using_us_core_5? ||
21
+ using_us_core_6?
17
22
  end
18
23
 
19
24
  def observation_contains_code?(observation_resource, code)
@@ -35,7 +40,7 @@ module ONCCertificationG10TestKit
35
40
  case resource.resourceType
36
41
  when 'Condition'
37
42
  case us_core_version
38
- when US_CORE_5, US_CORE_6
43
+ when US_CORE_5, US_CORE_6, US_CORE_7
39
44
  if resource_contains_category?(resource, 'encounter-diagnosis', 'http://terminology.hl7.org/CodeSystem/condition-category')
40
45
  profiles << extract_profile('ConditionEncounterDiagnosis')
41
46
  elsif resource_contains_category?(resource, 'problem-list-item',
@@ -55,6 +60,14 @@ module ONCCertificationG10TestKit
55
60
  when 'Observation'
56
61
  profiles << extract_profile('Smokingstatus') if observation_contains_code?(resource, '72166-2')
57
62
 
63
+ if us_core_7_and_above? && (
64
+ observation_contains_code?(resource, '11367-0') ||
65
+ observation_contains_code?(resource, '401201003') ||
66
+ observation_contains_code?(resource, '782516008')
67
+ )
68
+ profiles << extract_profile('Smokingstatus')
69
+ end
70
+
58
71
  profiles << extract_profile('ObservationLab') if resource_contains_category?(resource, 'laboratory', 'http://terminology.hl7.org/CodeSystem/observation-category')
59
72
 
60
73
  profiles << extract_profile('PediatricBmiForAge') if observation_contains_code?(resource, '59576-9')
@@ -144,7 +157,7 @@ module ONCCertificationG10TestKit
144
157
  profiles << extract_profile('ObservationClinicalTest')
145
158
  end
146
159
 
147
- if (using_us_core_5? || using_us_core_6?) && observation_contains_code?(resource, '76690-7')
160
+ if (using_us_core_5? || using_us_core_6? || using_us_core_7?) && observation_contains_code?(resource, '76690-7')
148
161
  profiles << extract_profile('ObservationSexualOrientation')
149
162
  end
150
163
 
@@ -175,20 +188,20 @@ module ONCCertificationG10TestKit
175
188
  # 'http://terminology.hl7.org/CodeSystem/observation-category') &&`
176
189
  # along with a specific extract_profile('ObservationSurvey') to catch non-sdoh.
177
190
  profiles << extract_profile('ObservationSdohAssessment')
178
- elsif using_us_core_6?
191
+ elsif using_us_core_6? || using_us_core_7?
179
192
  profiles << extract_profile('ObservationScreeningAssessment')
180
193
  end
181
194
  end
182
195
 
183
- if using_us_core_6? && observation_contains_code?(resource, '11341-5')
196
+ if (using_us_core_6? || using_us_core_7?) && observation_contains_code?(resource, '11341-5')
184
197
  profiles << extract_profile('ObservationOccupation')
185
198
  end
186
199
 
187
- if using_us_core_6? && observation_contains_code?(resource, '86645-9')
200
+ if (using_us_core_6? || using_us_core_7?) && observation_contains_code?(resource, '86645-9')
188
201
  profiles << extract_profile('ObservationPregnancyintent')
189
202
  end
190
203
 
191
- if using_us_core_6? && observation_contains_code?(resource, '82810-3')
204
+ if (using_us_core_6? || using_us_core_7?) && observation_contains_code?(resource, '82810-3')
192
205
  profiles << extract_profile('ObservationPregnancystatus')
193
206
  end
194
207
 
@@ -196,7 +209,7 @@ module ONCCertificationG10TestKit
196
209
  'laboratory', 'exam', 'therpay', 'imaging', 'procedure', 'vital-signs', 'activity'
197
210
  ]
198
211
 
199
- if using_us_core_6? && clinical_result_categories.any? do |category|
212
+ if (using_us_core_6? || using_us_core_7?) && clinical_result_categories.any? do |category|
200
213
  resource_contains_category?(
201
214
  resource, category, 'http://terminology.hl7.org/CodeSystem/observation-category'
202
215
  )
@@ -204,6 +217,18 @@ module ONCCertificationG10TestKit
204
217
  profiles << extract_profile('ObservationClinicalResult')
205
218
  end
206
219
 
220
+ if using_us_core_7? && observation_contains_code?(resource, '75773-2')
221
+ profiles << extract_profile('TreatmentInterventionPreference')
222
+ end
223
+
224
+ if using_us_core_7? && observation_contains_code?(resource, '95541-9')
225
+ profiles << extract_profile('CareExperiencePreference')
226
+ end
227
+
228
+ if using_us_core_7? && observation_contains_code?(resource, '96607-7')
229
+ profiles << extract_profile('AverageBloodPressure')
230
+ end
231
+
207
232
  nil
208
233
  else
209
234
  profiles << extract_profile(resource.resourceType)
@@ -31,7 +31,7 @@ module ONCCertificationG10TestKit
31
31
  If testing against USCDI v2, Encounter and ServiceRequest are also
32
32
  checked.
33
33
 
34
- If testing against USCDI v3, Encounter, ServiceRequest, Coverage,
34
+ If testing against USCDI v3 and v4, Encounter, ServiceRequest, Coverage,
35
35
  and MedicationDispense are also checked.
36
36
 
37
37
  For each of the resources that can be mapped to USCDI data class or
@@ -66,7 +66,14 @@ module ONCCertificationG10TestKit
66
66
  * RelatedPerson
67
67
  * Specimen
68
68
 
69
- It also does not test Provenance, as this resource type is accessed by
69
+ For USCDI v4 this includes:
70
+
71
+ * Organization
72
+ * Practitioner
73
+ * RelatedPerson
74
+ * Specimen
75
+
76
+ It also does not test Provenance or Location, as these resource types are accessed by
70
77
  queries through other resource types. These resources types are accessed
71
78
  in the more comprehensive Single Patient Query tests.
72
79
 
@@ -446,5 +453,85 @@ module ONCCertificationG10TestKit
446
453
  USCoreTestKit::USCoreV610::MedicationDispenseGroup
447
454
  end
448
455
  end
456
+
457
+ test from: :g10_restricted_access_test do
458
+ title 'Access to Encounter resources are restricted properly based on patient-selected scope'
459
+ description %(
460
+ This test ensures that access to the Encounter is granted or
461
+ denied based on the selection by the tester prior to the execution of
462
+ the test. If the tester indicated that access will be granted to this
463
+ resource, this test verifies that a search by patient in this resource
464
+ does not result in an access denied result. If the tester indicated that
465
+ access will be denied for this resource, this verifies that search by
466
+ patient in the resource results in an access denied result.
467
+ )
468
+ id :g10_us_core_7_encounter_restricted_access
469
+
470
+ required_suite_options G10Options::US_CORE_7_REQUIREMENT
471
+
472
+ def resource_group
473
+ USCoreTestKit::USCoreV700::EncounterGroup
474
+ end
475
+ end
476
+
477
+ test from: :g10_restricted_access_test do
478
+ title 'Access to ServiceRequest resources are restricted properly based on patient-selected scope'
479
+ description %(
480
+ This test ensures that access to the ServiceRequest is granted or
481
+ denied based on the selection by the tester prior to the execution of
482
+ the test. If the tester indicated that access will be granted to this
483
+ resource, this test verifies that a search by patient in this resource
484
+ does not result in an access denied result. If the tester indicated that
485
+ access will be denied for this resource, this verifies that search by
486
+ patient in the resource results in an access denied result.
487
+ )
488
+ id :g10_us_core_7_service_request_restricted_access
489
+
490
+ required_suite_options G10Options::US_CORE_7_REQUIREMENT
491
+
492
+ def resource_group
493
+ USCoreTestKit::USCoreV700::ServiceRequestGroup
494
+ end
495
+ end
496
+
497
+ test from: :g10_restricted_access_test do
498
+ title 'Access to Coverage resources are restricted properly based on patient-selected scope'
499
+ description %(
500
+ This test ensures that access to the Coverage is granted or
501
+ denied based on the selection by the tester prior to the execution of
502
+ the test. If the tester indicated that access will be granted to this
503
+ resource, this test verifies that a search by patient in this resource
504
+ does not result in an access denied result. If the tester indicated that
505
+ access will be denied for this resource, this verifies that search by
506
+ patient in the resource results in an access denied result.
507
+ )
508
+ id :g10_us_core_7_coverage_restricted_access
509
+
510
+ required_suite_options G10Options::US_CORE_7_REQUIREMENT
511
+
512
+ def resource_group
513
+ USCoreTestKit::USCoreV700::CoverageGroup
514
+ end
515
+ end
516
+
517
+ test from: :g10_restricted_access_test do
518
+ title 'Access to MedicationDispense resources are restricted properly based on patient-selected scope'
519
+ description %(
520
+ This test ensures that access to the MedicationDispense is granted or
521
+ denied based on the selection by the tester prior to the execution of
522
+ the test. If the tester indicated that access will be granted to this
523
+ resource, this test verifies that a search by patient in this resource
524
+ does not result in an access denied result. If the tester indicated that
525
+ access will be denied for this resource, this verifies that search by
526
+ patient in the resource results in an access denied result.
527
+ )
528
+ id :g10_us_core_7_medication_dispense_restricted_access
529
+
530
+ required_suite_options G10Options::US_CORE_7_REQUIREMENT
531
+
532
+ def resource_group
533
+ USCoreTestKit::USCoreV700::MedicationDispenseGroup
534
+ end
535
+ end
449
536
  end
450
537
  end