us_core_test_kit 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/lib/us_core_test_kit/custom_groups/capability_statement/profile_support_test.rb +18 -16
  3. data/lib/us_core_test_kit/custom_groups/v3.1.1/capability_statement_group.rb +1 -1
  4. data/lib/us_core_test_kit/custom_groups/v3.1.1/profile_support_test.rb +51 -0
  5. data/lib/us_core_test_kit/custom_groups/v4.0.0/capability_statement_group.rb +1 -1
  6. data/lib/us_core_test_kit/custom_groups/v5.0.1/capability_statement_group.rb +1 -1
  7. data/lib/us_core_test_kit/custom_groups/v6.1.0/capability_statement_group.rb +1 -1
  8. data/lib/us_core_test_kit/generated/v3.1.1/allergy_intolerance/allergy_intolerance_reference_resolution_test.rb +0 -2
  9. data/lib/us_core_test_kit/generated/v3.1.1/bodyheight/bodyheight_reference_resolution_test.rb +0 -2
  10. data/lib/us_core_test_kit/generated/v3.1.1/bodytemp/bodytemp_reference_resolution_test.rb +0 -2
  11. data/lib/us_core_test_kit/generated/v3.1.1/bodyweight/bodyweight_reference_resolution_test.rb +0 -2
  12. data/lib/us_core_test_kit/generated/v3.1.1/bp/bp_reference_resolution_test.rb +0 -2
  13. data/lib/us_core_test_kit/generated/v3.1.1/care_plan/care_plan_reference_resolution_test.rb +0 -2
  14. data/lib/us_core_test_kit/generated/v3.1.1/care_team/care_team_reference_resolution_test.rb +0 -2
  15. data/lib/us_core_test_kit/generated/v3.1.1/condition/condition_reference_resolution_test.rb +0 -2
  16. data/lib/us_core_test_kit/generated/v3.1.1/device/device_reference_resolution_test.rb +0 -2
  17. data/lib/us_core_test_kit/generated/v3.1.1/diagnostic_report_lab/diagnostic_report_lab_reference_resolution_test.rb +0 -2
  18. data/lib/us_core_test_kit/generated/v3.1.1/diagnostic_report_note/diagnostic_report_note_reference_resolution_test.rb +0 -2
  19. data/lib/us_core_test_kit/generated/v3.1.1/document_reference/document_reference_reference_resolution_test.rb +0 -2
  20. data/lib/us_core_test_kit/generated/v3.1.1/encounter/encounter_reference_resolution_test.rb +0 -2
  21. data/lib/us_core_test_kit/generated/v3.1.1/goal/goal_reference_resolution_test.rb +0 -2
  22. data/lib/us_core_test_kit/generated/v3.1.1/head_circumference/head_circumference_reference_resolution_test.rb +0 -2
  23. data/lib/us_core_test_kit/generated/v3.1.1/heartrate/heartrate_reference_resolution_test.rb +0 -2
  24. data/lib/us_core_test_kit/generated/v3.1.1/immunization/immunization_reference_resolution_test.rb +0 -2
  25. data/lib/us_core_test_kit/generated/v3.1.1/medication_request/medication_request_reference_resolution_test.rb +0 -2
  26. data/lib/us_core_test_kit/generated/v3.1.1/observation_lab/observation_lab_reference_resolution_test.rb +0 -2
  27. data/lib/us_core_test_kit/generated/v3.1.1/pediatric_bmi_for_age/pediatric_bmi_for_age_reference_resolution_test.rb +0 -2
  28. data/lib/us_core_test_kit/generated/v3.1.1/pediatric_weight_for_height/pediatric_weight_for_height_reference_resolution_test.rb +0 -2
  29. data/lib/us_core_test_kit/generated/v3.1.1/procedure/procedure_reference_resolution_test.rb +0 -2
  30. data/lib/us_core_test_kit/generated/v3.1.1/provenance/provenance_reference_resolution_test.rb +0 -2
  31. data/lib/us_core_test_kit/generated/v3.1.1/pulse_oximetry/pulse_oximetry_reference_resolution_test.rb +0 -2
  32. data/lib/us_core_test_kit/generated/v3.1.1/resprate/resprate_reference_resolution_test.rb +0 -2
  33. data/lib/us_core_test_kit/generated/v3.1.1/smokingstatus/smokingstatus_reference_resolution_test.rb +0 -2
  34. data/lib/us_core_test_kit/generated/v4.0.0/allergy_intolerance/allergy_intolerance_reference_resolution_test.rb +0 -2
  35. data/lib/us_core_test_kit/generated/v4.0.0/blood_pressure/blood_pressure_reference_resolution_test.rb +0 -2
  36. data/lib/us_core_test_kit/generated/v4.0.0/bmi/bmi_reference_resolution_test.rb +0 -2
  37. data/lib/us_core_test_kit/generated/v4.0.0/body_height/body_height_reference_resolution_test.rb +0 -2
  38. data/lib/us_core_test_kit/generated/v4.0.0/body_temperature/body_temperature_reference_resolution_test.rb +0 -2
  39. data/lib/us_core_test_kit/generated/v4.0.0/body_weight/body_weight_reference_resolution_test.rb +0 -2
  40. data/lib/us_core_test_kit/generated/v4.0.0/care_plan/care_plan_reference_resolution_test.rb +0 -2
  41. data/lib/us_core_test_kit/generated/v4.0.0/care_team/care_team_reference_resolution_test.rb +0 -2
  42. data/lib/us_core_test_kit/generated/v4.0.0/condition/condition_reference_resolution_test.rb +0 -2
  43. data/lib/us_core_test_kit/generated/v4.0.0/device/device_reference_resolution_test.rb +0 -2
  44. data/lib/us_core_test_kit/generated/v4.0.0/diagnostic_report_lab/diagnostic_report_lab_reference_resolution_test.rb +0 -2
  45. data/lib/us_core_test_kit/generated/v4.0.0/diagnostic_report_note/diagnostic_report_note_reference_resolution_test.rb +0 -2
  46. data/lib/us_core_test_kit/generated/v4.0.0/document_reference/document_reference_reference_resolution_test.rb +0 -2
  47. data/lib/us_core_test_kit/generated/v4.0.0/encounter/encounter_reference_resolution_test.rb +0 -2
  48. data/lib/us_core_test_kit/generated/v4.0.0/goal/goal_reference_resolution_test.rb +0 -2
  49. data/lib/us_core_test_kit/generated/v4.0.0/head_circumference/head_circumference_reference_resolution_test.rb +0 -2
  50. data/lib/us_core_test_kit/generated/v4.0.0/head_circumference_percentile/head_circumference_percentile_reference_resolution_test.rb +0 -2
  51. data/lib/us_core_test_kit/generated/v4.0.0/heart_rate/heart_rate_reference_resolution_test.rb +0 -2
  52. data/lib/us_core_test_kit/generated/v4.0.0/immunization/immunization_reference_resolution_test.rb +0 -2
  53. data/lib/us_core_test_kit/generated/v4.0.0/medication_request/medication_request_reference_resolution_test.rb +0 -2
  54. data/lib/us_core_test_kit/generated/v4.0.0/observation_lab/observation_lab_reference_resolution_test.rb +0 -2
  55. data/lib/us_core_test_kit/generated/v4.0.0/pediatric_bmi_for_age/pediatric_bmi_for_age_reference_resolution_test.rb +0 -2
  56. data/lib/us_core_test_kit/generated/v4.0.0/pediatric_weight_for_height/pediatric_weight_for_height_reference_resolution_test.rb +0 -2
  57. data/lib/us_core_test_kit/generated/v4.0.0/procedure/procedure_reference_resolution_test.rb +0 -2
  58. data/lib/us_core_test_kit/generated/v4.0.0/provenance/provenance_reference_resolution_test.rb +0 -2
  59. data/lib/us_core_test_kit/generated/v4.0.0/pulse_oximetry/pulse_oximetry_reference_resolution_test.rb +0 -2
  60. data/lib/us_core_test_kit/generated/v4.0.0/respiratory_rate/respiratory_rate_reference_resolution_test.rb +0 -2
  61. data/lib/us_core_test_kit/generated/v4.0.0/smokingstatus/smokingstatus_reference_resolution_test.rb +0 -2
  62. data/lib/us_core_test_kit/generated/v5.0.1/allergy_intolerance/allergy_intolerance_reference_resolution_test.rb +0 -2
  63. data/lib/us_core_test_kit/generated/v5.0.1/blood_pressure/blood_pressure_reference_resolution_test.rb +0 -2
  64. data/lib/us_core_test_kit/generated/v5.0.1/bmi/bmi_reference_resolution_test.rb +0 -2
  65. data/lib/us_core_test_kit/generated/v5.0.1/body_height/body_height_reference_resolution_test.rb +0 -2
  66. data/lib/us_core_test_kit/generated/v5.0.1/body_temperature/body_temperature_reference_resolution_test.rb +0 -2
  67. data/lib/us_core_test_kit/generated/v5.0.1/body_weight/body_weight_reference_resolution_test.rb +0 -2
  68. data/lib/us_core_test_kit/generated/v5.0.1/care_plan/care_plan_reference_resolution_test.rb +0 -2
  69. data/lib/us_core_test_kit/generated/v5.0.1/care_team/care_team_reference_resolution_test.rb +0 -2
  70. data/lib/us_core_test_kit/generated/v5.0.1/condition_encounter_diagnosis/condition_encounter_diagnosis_reference_resolution_test.rb +0 -2
  71. data/lib/us_core_test_kit/generated/v5.0.1/condition_problems_health_concerns/condition_problems_health_concerns_reference_resolution_test.rb +0 -2
  72. data/lib/us_core_test_kit/generated/v5.0.1/device/device_reference_resolution_test.rb +0 -2
  73. data/lib/us_core_test_kit/generated/v5.0.1/diagnostic_report_lab/diagnostic_report_lab_reference_resolution_test.rb +0 -2
  74. data/lib/us_core_test_kit/generated/v5.0.1/diagnostic_report_note/diagnostic_report_note_reference_resolution_test.rb +0 -2
  75. data/lib/us_core_test_kit/generated/v5.0.1/document_reference/document_reference_reference_resolution_test.rb +0 -2
  76. data/lib/us_core_test_kit/generated/v5.0.1/encounter/encounter_reference_resolution_test.rb +0 -2
  77. data/lib/us_core_test_kit/generated/v5.0.1/goal/goal_reference_resolution_test.rb +0 -2
  78. data/lib/us_core_test_kit/generated/v5.0.1/head_circumference/head_circumference_reference_resolution_test.rb +0 -2
  79. data/lib/us_core_test_kit/generated/v5.0.1/head_circumference_percentile/head_circumference_percentile_reference_resolution_test.rb +0 -2
  80. data/lib/us_core_test_kit/generated/v5.0.1/heart_rate/heart_rate_reference_resolution_test.rb +0 -2
  81. data/lib/us_core_test_kit/generated/v5.0.1/immunization/immunization_reference_resolution_test.rb +0 -2
  82. data/lib/us_core_test_kit/generated/v5.0.1/medication_request/medication_request_reference_resolution_test.rb +0 -2
  83. data/lib/us_core_test_kit/generated/v5.0.1/observation_clinical_test/observation_clinical_test_reference_resolution_test.rb +0 -2
  84. data/lib/us_core_test_kit/generated/v5.0.1/observation_imaging/observation_imaging_reference_resolution_test.rb +0 -2
  85. data/lib/us_core_test_kit/generated/v5.0.1/observation_lab/observation_lab_reference_resolution_test.rb +0 -2
  86. data/lib/us_core_test_kit/generated/v5.0.1/observation_sdoh_assessment/observation_sdoh_assessment_reference_resolution_test.rb +0 -2
  87. data/lib/us_core_test_kit/generated/v5.0.1/observation_sexual_orientation/observation_sexual_orientation_reference_resolution_test.rb +0 -2
  88. data/lib/us_core_test_kit/generated/v5.0.1/observation_social_history/observation_social_history_reference_resolution_test.rb +0 -2
  89. data/lib/us_core_test_kit/generated/v5.0.1/pediatric_bmi_for_age/pediatric_bmi_for_age_reference_resolution_test.rb +0 -2
  90. data/lib/us_core_test_kit/generated/v5.0.1/pediatric_weight_for_height/pediatric_weight_for_height_reference_resolution_test.rb +0 -2
  91. data/lib/us_core_test_kit/generated/v5.0.1/procedure/procedure_reference_resolution_test.rb +0 -2
  92. data/lib/us_core_test_kit/generated/v5.0.1/provenance/provenance_reference_resolution_test.rb +0 -2
  93. data/lib/us_core_test_kit/generated/v5.0.1/pulse_oximetry/pulse_oximetry_reference_resolution_test.rb +0 -2
  94. data/lib/us_core_test_kit/generated/v5.0.1/questionnaire_response/questionnaire_response_reference_resolution_test.rb +0 -2
  95. data/lib/us_core_test_kit/generated/v5.0.1/related_person/related_person_reference_resolution_test.rb +0 -2
  96. data/lib/us_core_test_kit/generated/v5.0.1/respiratory_rate/respiratory_rate_reference_resolution_test.rb +0 -2
  97. data/lib/us_core_test_kit/generated/v5.0.1/service_request/service_request_reference_resolution_test.rb +0 -2
  98. data/lib/us_core_test_kit/generated/v5.0.1/smokingstatus/smokingstatus_reference_resolution_test.rb +0 -2
  99. data/lib/us_core_test_kit/generated/v6.1.0/allergy_intolerance/allergy_intolerance_reference_resolution_test.rb +0 -2
  100. data/lib/us_core_test_kit/generated/v6.1.0/blood_pressure/blood_pressure_reference_resolution_test.rb +0 -2
  101. data/lib/us_core_test_kit/generated/v6.1.0/bmi/bmi_reference_resolution_test.rb +0 -2
  102. data/lib/us_core_test_kit/generated/v6.1.0/body_height/body_height_reference_resolution_test.rb +0 -2
  103. data/lib/us_core_test_kit/generated/v6.1.0/body_temperature/body_temperature_reference_resolution_test.rb +0 -2
  104. data/lib/us_core_test_kit/generated/v6.1.0/body_weight/body_weight_reference_resolution_test.rb +0 -2
  105. data/lib/us_core_test_kit/generated/v6.1.0/care_plan/care_plan_reference_resolution_test.rb +0 -2
  106. data/lib/us_core_test_kit/generated/v6.1.0/care_team/care_team_reference_resolution_test.rb +0 -2
  107. data/lib/us_core_test_kit/generated/v6.1.0/condition_encounter_diagnosis/condition_encounter_diagnosis_reference_resolution_test.rb +0 -2
  108. data/lib/us_core_test_kit/generated/v6.1.0/condition_problems_health_concerns/condition_problems_health_concerns_reference_resolution_test.rb +0 -2
  109. data/lib/us_core_test_kit/generated/v6.1.0/coverage/coverage_reference_resolution_test.rb +0 -2
  110. data/lib/us_core_test_kit/generated/v6.1.0/device/device_reference_resolution_test.rb +0 -2
  111. data/lib/us_core_test_kit/generated/v6.1.0/diagnostic_report_lab/diagnostic_report_lab_reference_resolution_test.rb +0 -2
  112. data/lib/us_core_test_kit/generated/v6.1.0/diagnostic_report_note/diagnostic_report_note_reference_resolution_test.rb +0 -2
  113. data/lib/us_core_test_kit/generated/v6.1.0/document_reference/document_reference_reference_resolution_test.rb +0 -2
  114. data/lib/us_core_test_kit/generated/v6.1.0/encounter/encounter_reference_resolution_test.rb +0 -2
  115. data/lib/us_core_test_kit/generated/v6.1.0/goal/goal_reference_resolution_test.rb +0 -2
  116. data/lib/us_core_test_kit/generated/v6.1.0/head_circumference/head_circumference_reference_resolution_test.rb +0 -2
  117. data/lib/us_core_test_kit/generated/v6.1.0/head_circumference_percentile/head_circumference_percentile_reference_resolution_test.rb +0 -2
  118. data/lib/us_core_test_kit/generated/v6.1.0/heart_rate/heart_rate_reference_resolution_test.rb +0 -2
  119. data/lib/us_core_test_kit/generated/v6.1.0/immunization/immunization_reference_resolution_test.rb +0 -2
  120. data/lib/us_core_test_kit/generated/v6.1.0/medication_dispense/medication_dispense_patient_search_test.rb +2 -2
  121. data/lib/us_core_test_kit/generated/v6.1.0/medication_dispense/medication_dispense_patient_status_search_test.rb +2 -2
  122. data/lib/us_core_test_kit/generated/v6.1.0/medication_dispense/medication_dispense_patient_status_type_search_test.rb +2 -2
  123. data/lib/us_core_test_kit/generated/v6.1.0/medication_dispense/medication_dispense_reference_resolution_test.rb +0 -2
  124. data/lib/us_core_test_kit/generated/v6.1.0/medication_request/medication_request_reference_resolution_test.rb +0 -2
  125. data/lib/us_core_test_kit/generated/v6.1.0/observation_clinical_result/observation_clinical_result_reference_resolution_test.rb +0 -2
  126. data/lib/us_core_test_kit/generated/v6.1.0/observation_lab/observation_lab_reference_resolution_test.rb +0 -2
  127. data/lib/us_core_test_kit/generated/v6.1.0/observation_occupation/observation_occupation_reference_resolution_test.rb +0 -2
  128. data/lib/us_core_test_kit/generated/v6.1.0/observation_pregnancyintent/observation_pregnancyintent_reference_resolution_test.rb +0 -2
  129. data/lib/us_core_test_kit/generated/v6.1.0/observation_pregnancystatus/observation_pregnancystatus_reference_resolution_test.rb +0 -2
  130. data/lib/us_core_test_kit/generated/v6.1.0/observation_screening_assessment/observation_screening_assessment_reference_resolution_test.rb +0 -2
  131. data/lib/us_core_test_kit/generated/v6.1.0/observation_sexual_orientation/observation_sexual_orientation_reference_resolution_test.rb +0 -2
  132. data/lib/us_core_test_kit/generated/v6.1.0/pediatric_bmi_for_age/pediatric_bmi_for_age_reference_resolution_test.rb +0 -2
  133. data/lib/us_core_test_kit/generated/v6.1.0/pediatric_weight_for_height/pediatric_weight_for_height_reference_resolution_test.rb +0 -2
  134. data/lib/us_core_test_kit/generated/v6.1.0/procedure/procedure_reference_resolution_test.rb +0 -2
  135. data/lib/us_core_test_kit/generated/v6.1.0/provenance/provenance_reference_resolution_test.rb +0 -2
  136. data/lib/us_core_test_kit/generated/v6.1.0/pulse_oximetry/pulse_oximetry_reference_resolution_test.rb +0 -2
  137. data/lib/us_core_test_kit/generated/v6.1.0/questionnaire_response/questionnaire_response_reference_resolution_test.rb +0 -2
  138. data/lib/us_core_test_kit/generated/v6.1.0/related_person/related_person_reference_resolution_test.rb +0 -2
  139. data/lib/us_core_test_kit/generated/v6.1.0/respiratory_rate/respiratory_rate_reference_resolution_test.rb +0 -2
  140. data/lib/us_core_test_kit/generated/v6.1.0/service_request/service_request_reference_resolution_test.rb +0 -2
  141. data/lib/us_core_test_kit/generated/v6.1.0/simple_observation/simple_observation_reference_resolution_test.rb +0 -2
  142. data/lib/us_core_test_kit/generated/v6.1.0/smokingstatus/smokingstatus_reference_resolution_test.rb +0 -2
  143. data/lib/us_core_test_kit/generated/v6.1.0/specimen/specimen_reference_resolution_test.rb +0 -2
  144. data/lib/us_core_test_kit/generator/group_metadata_extractor.rb +0 -1
  145. data/lib/us_core_test_kit/generator/ig_loader.rb +2 -0
  146. data/lib/us_core_test_kit/generator/search_test_generator.rb +2 -2
  147. data/lib/us_core_test_kit/generator.rb +0 -6
  148. data/lib/us_core_test_kit/search_test.rb +29 -7
  149. data/lib/us_core_test_kit/version.rb +1 -1
  150. metadata +3 -7
  151. data/lib/us_core_test_kit/generated/v3.1.1/resource_list.rb +0 -28
  152. data/lib/us_core_test_kit/generated/v4.0.0/resource_list.rb +0 -28
  153. data/lib/us_core_test_kit/generated/v5.0.1/resource_list.rb +0 -31
  154. data/lib/us_core_test_kit/generated/v6.1.0/resource_list.rb +0 -34
  155. data/lib/us_core_test_kit/generator/resource_list_generator.rb +0 -42
@@ -1,11 +1,9 @@
1
1
  require_relative '../../../reference_resolution_test'
2
- require_relative '../resource_list'
3
2
 
4
3
  module USCoreTestKit
5
4
  module USCoreV610
6
5
  class SpecimenReferenceResolutionTest < Inferno::Test
7
6
  include USCoreTestKit::ReferenceResolutionTest
8
- include ResourceList
9
7
 
10
8
  title 'MustSupport references within Specimen resources are valid'
11
9
  description %(
@@ -187,7 +187,6 @@ module USCoreTestKit
187
187
  end
188
188
 
189
189
  def profile_name
190
- binding.pry if profile.nil?
191
190
  profile.title.gsub(' ', ' ')
192
191
  end
193
192
 
@@ -33,6 +33,8 @@ module USCoreTestKit
33
33
 
34
34
  file_name = entry.full_name.split('/').last
35
35
 
36
+ next if file_name.end_with? 'openapi.json'
37
+
36
38
  next unless file_name.end_with? '.json'
37
39
 
38
40
  next unless entry.full_name.start_with? 'package/'
@@ -257,9 +257,9 @@ module USCoreTestKit
257
257
  return '' unless test_medication_inclusion?
258
258
 
259
259
  <<~MEDICATION_INCLUSION_DESCRIPTION
260
- If any MedicationRequest resources use external references to
260
+ If any #{resource_type} resources use external references to
261
261
  Medications, the search will be repeated with
262
- `_include=MedicationRequest:medication`.
262
+ `_include=#{resource_type}:medication`.
263
263
  MEDICATION_INCLUSION_DESCRIPTION
264
264
  end
265
265
 
@@ -8,7 +8,6 @@ require_relative 'generator/must_support_test_generator'
8
8
  require_relative 'generator/provenance_revinclude_search_test_generator'
9
9
  require_relative 'generator/read_test_generator'
10
10
  require_relative 'generator/reference_resolution_test_generator'
11
- require_relative 'generator/resource_list_generator'
12
11
  require_relative 'generator/search_test_generator'
13
12
  require_relative 'generator/suite_generator'
14
13
  require_relative 'generator/validation_test_generator'
@@ -33,7 +32,6 @@ module USCoreTestKit
33
32
  puts "Generating tests for IG #{File.basename(ig_file_name)}"
34
33
  load_ig_package
35
34
  extract_metadata
36
- generate_resource_list
37
35
  generate_search_tests
38
36
  generate_read_tests
39
37
  # TODO: generate_vread_tests
@@ -66,10 +64,6 @@ module USCoreTestKit
66
64
  self.ig_resources = IGLoader.new(ig_file_name).load
67
65
  end
68
66
 
69
- def generate_resource_list
70
- ResourceListGenerator.generate(ig_metadata, base_output_dir)
71
- end
72
-
73
67
  def generate_reference_resolution_tests
74
68
  ReferenceResolutionTestGenerator.generate(ig_metadata, base_output_dir)
75
69
  end
@@ -373,7 +373,7 @@ module USCoreTestKit
373
373
  end
374
374
  end
375
375
 
376
- def test_medication_inclusion(medication_requests, params, patient_id)
376
+ def test_medication_inclusion(base_resources, params, patient_id)
377
377
  return if search_variant_test_records[:medication_inclusion]
378
378
 
379
379
  scratch[:medication_resources] ||= {}
@@ -381,13 +381,13 @@ module USCoreTestKit
381
381
  scratch[:medication_resources][patient_id] ||= []
382
382
  scratch[:medication_resources][:contained] ||= []
383
383
 
384
- requests_with_external_references =
385
- medication_requests
384
+ base_resources_with_external_reference =
385
+ base_resources
386
386
  .select { |request| request&.medicationReference&.present? }
387
387
  .reject { |request| request&.medicationReference&.reference&.start_with? '#' }
388
388
 
389
389
  contained_medications =
390
- medication_requests
390
+ base_resources
391
391
  .select { |request| request&.medicationReference&.reference&.start_with? '#' }
392
392
  .flat_map(&:contained)
393
393
  .select { |resource| resource.resourceType == 'Medication' }
@@ -396,15 +396,32 @@ module USCoreTestKit
396
396
  scratch[:medication_resources][patient_id] += contained_medications
397
397
  scratch[:medication_resources][:contained] += contained_medications
398
398
 
399
- return if requests_with_external_references.blank?
399
+ return if base_resources_with_external_reference.blank?
400
400
 
401
- search_params = params.merge(_include: 'MedicationRequest:medication')
401
+ search_params = params.merge(_include: "#{resource_type}:medication")
402
402
 
403
403
  search_and_check_response(search_params)
404
404
 
405
405
  medications = fetch_all_bundled_resources.select { |resource| resource.resourceType == 'Medication' }
406
406
  assert medications.present?, 'No Medications were included in the search results'
407
407
 
408
+ included_medications = medications.map { |medication| "#{medication.resourceType}/#{medication.id}" }
409
+
410
+ matched_base_resources = base_resources_with_external_reference.select do |base_resource|
411
+ included_medications.any? do |medication_reference|
412
+ is_reference_match?(base_resource.medicationReference.reference, medication_reference)
413
+ end
414
+ end
415
+
416
+ not_matched_included_medications = included_medications.select do |medication_reference|
417
+ matched_base_resources.none? do |base_resource|
418
+ is_reference_match?(base_resource.medicationReference.reference, medication_reference)
419
+ end
420
+ end
421
+
422
+ not_matched_included_medications_string = not_matched_included_medications.join(',')
423
+ assert not_matched_included_medications.empty?, "No #{resource_type} references #{not_matched_included_medications_string} in the search result."
424
+
408
425
  medications.uniq!(&:id)
409
426
 
410
427
  scratch[:medication_resources][:all] += medications
@@ -413,6 +430,11 @@ module USCoreTestKit
413
430
  search_variant_test_records[:medication_inclusion] = true
414
431
  end
415
432
 
433
+ def is_reference_match? (reference, local_reference)
434
+ regex_pattern = /^(#{Regexp.escape(local_reference)}|\S+\/#{Regexp.escape(local_reference)}(?:[\/|]\S+)*)$/
435
+ reference.match?(regex_pattern)
436
+ end
437
+
416
438
  def all_scratch_resources
417
439
  scratch_resources[:all] ||= []
418
440
  end
@@ -547,7 +569,7 @@ module USCoreTestKit
547
569
  end
548
570
 
549
571
  valid_resource_types = [resource_type, 'OperationOutcome'].concat(additional_resource_types)
550
- valid_resource_types << 'Medication' if resource_type == 'MedicationRequest'
572
+ valid_resource_types << 'Medication' if ['MedicationRequest', 'MedicationDispense'].include?(resource_type)
551
573
 
552
574
  invalid_resource_types =
553
575
  resources.reject { |entry| valid_resource_types.include? entry.resourceType }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module USCoreTestKit
4
- VERSION = '0.6.0'
4
+ VERSION = '0.6.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: us_core_test_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen MacVicar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-29 00:00:00.000000000 Z
11
+ date: 2023-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inferno_core
@@ -113,6 +113,7 @@ files:
113
113
  - lib/us_core_test_kit/custom_groups/data_absent_reason_group.rb
114
114
  - lib/us_core_test_kit/custom_groups/v3.1.1/capability_statement_group.rb
115
115
  - lib/us_core_test_kit/custom_groups/v3.1.1/clinical_notes_guidance_group.rb
116
+ - lib/us_core_test_kit/custom_groups/v3.1.1/profile_support_test.rb
116
117
  - lib/us_core_test_kit/custom_groups/v4.0.0/capability_statement_group.rb
117
118
  - lib/us_core_test_kit/custom_groups/v4.0.0/clinical_notes_guidance_group.rb
118
119
  - lib/us_core_test_kit/custom_groups/v4.0.0/document_reference_custodian_test.rb
@@ -420,7 +421,6 @@ files:
420
421
  - lib/us_core_test_kit/generated/v3.1.1/pulse_oximetry/pulse_oximetry_reference_resolution_test.rb
421
422
  - lib/us_core_test_kit/generated/v3.1.1/pulse_oximetry/pulse_oximetry_validation_test.rb
422
423
  - lib/us_core_test_kit/generated/v3.1.1/pulse_oximetry_group.rb
423
- - lib/us_core_test_kit/generated/v3.1.1/resource_list.rb
424
424
  - lib/us_core_test_kit/generated/v3.1.1/resprate/metadata.yml
425
425
  - lib/us_core_test_kit/generated/v3.1.1/resprate/resprate_must_support_test.rb
426
426
  - lib/us_core_test_kit/generated/v3.1.1/resprate/resprate_patient_category_date_search_test.rb
@@ -770,7 +770,6 @@ files:
770
770
  - lib/us_core_test_kit/generated/v4.0.0/pulse_oximetry/pulse_oximetry_reference_resolution_test.rb
771
771
  - lib/us_core_test_kit/generated/v4.0.0/pulse_oximetry/pulse_oximetry_validation_test.rb
772
772
  - lib/us_core_test_kit/generated/v4.0.0/pulse_oximetry_group.rb
773
- - lib/us_core_test_kit/generated/v4.0.0/resource_list.rb
774
773
  - lib/us_core_test_kit/generated/v4.0.0/respiratory_rate/metadata.yml
775
774
  - lib/us_core_test_kit/generated/v4.0.0/respiratory_rate/respiratory_rate_must_support_test.rb
776
775
  - lib/us_core_test_kit/generated/v4.0.0/respiratory_rate/respiratory_rate_patient_category_date_search_test.rb
@@ -1229,7 +1228,6 @@ files:
1229
1228
  - lib/us_core_test_kit/generated/v5.0.1/related_person/related_person_reference_resolution_test.rb
1230
1229
  - lib/us_core_test_kit/generated/v5.0.1/related_person/related_person_validation_test.rb
1231
1230
  - lib/us_core_test_kit/generated/v5.0.1/related_person_group.rb
1232
- - lib/us_core_test_kit/generated/v5.0.1/resource_list.rb
1233
1231
  - lib/us_core_test_kit/generated/v5.0.1/respiratory_rate/metadata.yml
1234
1232
  - lib/us_core_test_kit/generated/v5.0.1/respiratory_rate/respiratory_rate_must_support_test.rb
1235
1233
  - lib/us_core_test_kit/generated/v5.0.1/respiratory_rate/respiratory_rate_patient_category_date_search_test.rb
@@ -1736,7 +1734,6 @@ files:
1736
1734
  - lib/us_core_test_kit/generated/v6.1.0/related_person/related_person_reference_resolution_test.rb
1737
1735
  - lib/us_core_test_kit/generated/v6.1.0/related_person/related_person_validation_test.rb
1738
1736
  - lib/us_core_test_kit/generated/v6.1.0/related_person_group.rb
1739
- - lib/us_core_test_kit/generated/v6.1.0/resource_list.rb
1740
1737
  - lib/us_core_test_kit/generated/v6.1.0/respiratory_rate/metadata.yml
1741
1738
  - lib/us_core_test_kit/generated/v6.1.0/respiratory_rate/respiratory_rate_must_support_test.rb
1742
1739
  - lib/us_core_test_kit/generated/v6.1.0/respiratory_rate/respiratory_rate_patient_category_date_search_test.rb
@@ -1814,7 +1811,6 @@ files:
1814
1811
  - lib/us_core_test_kit/generator/provenance_revinclude_search_test_generator.rb
1815
1812
  - lib/us_core_test_kit/generator/read_test_generator.rb
1816
1813
  - lib/us_core_test_kit/generator/reference_resolution_test_generator.rb
1817
- - lib/us_core_test_kit/generator/resource_list_generator.rb
1818
1814
  - lib/us_core_test_kit/generator/search_definition_metadata_extractor.rb
1819
1815
  - lib/us_core_test_kit/generator/search_metadata_extractor.rb
1820
1816
  - lib/us_core_test_kit/generator/search_test_generator.rb
@@ -1,28 +0,0 @@
1
- module USCoreTestKit
2
- module USCoreV311
3
- module ResourceList
4
- RESOURCE_LIST = [
5
- 'AllergyIntolerance',
6
- 'CarePlan',
7
- 'CareTeam',
8
- 'Condition',
9
- 'Device',
10
- 'DiagnosticReport',
11
- 'DocumentReference',
12
- 'Encounter',
13
- 'Goal',
14
- 'Immunization',
15
- 'Location',
16
- 'Medication',
17
- 'MedicationRequest',
18
- 'Observation',
19
- 'Organization',
20
- 'Patient',
21
- 'Practitioner',
22
- 'PractitionerRole',
23
- 'Procedure',
24
- 'Provenance'
25
- ].freeze
26
- end
27
- end
28
- end
@@ -1,28 +0,0 @@
1
- module USCoreTestKit
2
- module USCoreV400
3
- module ResourceList
4
- RESOURCE_LIST = [
5
- 'AllergyIntolerance',
6
- 'CarePlan',
7
- 'CareTeam',
8
- 'Condition',
9
- 'Device',
10
- 'DiagnosticReport',
11
- 'DocumentReference',
12
- 'Encounter',
13
- 'Goal',
14
- 'Immunization',
15
- 'Location',
16
- 'Medication',
17
- 'MedicationRequest',
18
- 'Observation',
19
- 'Organization',
20
- 'Patient',
21
- 'Practitioner',
22
- 'PractitionerRole',
23
- 'Procedure',
24
- 'Provenance'
25
- ].freeze
26
- end
27
- end
28
- end
@@ -1,31 +0,0 @@
1
- module USCoreTestKit
2
- module USCoreV501
3
- module ResourceList
4
- RESOURCE_LIST = [
5
- 'AllergyIntolerance',
6
- 'CarePlan',
7
- 'CareTeam',
8
- 'Condition',
9
- 'Device',
10
- 'DiagnosticReport',
11
- 'DocumentReference',
12
- 'Encounter',
13
- 'Goal',
14
- 'Immunization',
15
- 'Location',
16
- 'Medication',
17
- 'MedicationRequest',
18
- 'Observation',
19
- 'Organization',
20
- 'Patient',
21
- 'Practitioner',
22
- 'PractitionerRole',
23
- 'Procedure',
24
- 'Provenance',
25
- 'QuestionnaireResponse',
26
- 'RelatedPerson',
27
- 'ServiceRequest'
28
- ].freeze
29
- end
30
- end
31
- end
@@ -1,34 +0,0 @@
1
- module USCoreTestKit
2
- module USCoreV610
3
- module ResourceList
4
- RESOURCE_LIST = [
5
- 'AllergyIntolerance',
6
- 'CarePlan',
7
- 'CareTeam',
8
- 'Condition',
9
- 'Coverage',
10
- 'Device',
11
- 'DiagnosticReport',
12
- 'DocumentReference',
13
- 'Encounter',
14
- 'Goal',
15
- 'Immunization',
16
- 'Location',
17
- 'Medication',
18
- 'MedicationDispense',
19
- 'MedicationRequest',
20
- 'Observation',
21
- 'Organization',
22
- 'Patient',
23
- 'Practitioner',
24
- 'PractitionerRole',
25
- 'Procedure',
26
- 'Provenance',
27
- 'QuestionnaireResponse',
28
- 'RelatedPerson',
29
- 'ServiceRequest',
30
- 'Specimen'
31
- ].freeze
32
- end
33
- end
34
- end
@@ -1,42 +0,0 @@
1
- module USCoreTestKit
2
- class Generator
3
- class ResourceListGenerator
4
- class << self
5
- def generate(ig_metadata, base_output_dir)
6
- @ig_metadata = ig_metadata
7
-
8
- FileUtils.mkdir_p(base_output_dir)
9
- File.open(File.join(base_output_dir, base_output_file_name), 'w') { |f| f.write(output) }
10
- end
11
-
12
- def resource_list
13
- @ig_metadata.groups.map(&:resource).uniq
14
- end
15
-
16
- def resource_list_string
17
- resource_list.map { |resource| " '#{resource}'" }.join(",\n")
18
- end
19
-
20
- def module_name
21
- "USCore#{@ig_metadata.reformatted_version.upcase}"
22
- end
23
-
24
- def read_interaction(group_metadata)
25
- group_metadata.interactions.find { |interaction| interaction[:code] == 'read' }
26
- end
27
-
28
- def template
29
- @template ||= File.read(File.join(__dir__, 'templates', 'resource_list.rb.erb'))
30
- end
31
-
32
- def output
33
- ERB.new(template).result(binding)
34
- end
35
-
36
- def base_output_file_name
37
- "resource_list.rb"
38
- end
39
- end
40
- end
41
- end
42
- end