ipa_test_kit 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (270) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +201 -0
  3. data/lib/ipa_test_kit/custom_groups/capability_statement/conformance_support_test.rb +41 -0
  4. data/lib/ipa_test_kit/custom_groups/capability_statement/fhir_version_test.rb +15 -0
  5. data/lib/ipa_test_kit/custom_groups/capability_statement/json_support_test.rb +39 -0
  6. data/lib/ipa_test_kit/custom_groups/capability_statement/profile_support_test.rb +76 -0
  7. data/lib/ipa_test_kit/custom_groups/capability_statement_group.rb +64 -0
  8. data/lib/ipa_test_kit/date_search_validation.rb +101 -0
  9. data/lib/ipa_test_kit/ext/fhir_models.rb +59 -0
  10. data/lib/ipa_test_kit/fhir_resource_navigation.rb +63 -0
  11. data/lib/ipa_test_kit/generated/allergy_intolerance/allergy_intolerance_must_support_test.rb +40 -0
  12. data/lib/ipa_test_kit/generated/allergy_intolerance/allergy_intolerance_patient_clinical_status_search_test.rb +46 -0
  13. data/lib/ipa_test_kit/generated/allergy_intolerance/allergy_intolerance_patient_search_test.rb +60 -0
  14. data/lib/ipa_test_kit/generated/allergy_intolerance/allergy_intolerance_provenance_revinclude_search_test.rb +49 -0
  15. data/lib/ipa_test_kit/generated/allergy_intolerance/allergy_intolerance_read_test.rb +24 -0
  16. data/lib/ipa_test_kit/generated/allergy_intolerance/allergy_intolerance_reference_resolution_test.rb +28 -0
  17. data/lib/ipa_test_kit/generated/allergy_intolerance/allergy_intolerance_validation_test.rb +34 -0
  18. data/lib/ipa_test_kit/generated/allergy_intolerance/metadata.yml +165 -0
  19. data/lib/ipa_test_kit/generated/allergy_intolerance_group.rb +85 -0
  20. data/lib/ipa_test_kit/generated/bmi/bmi_must_support_test.rb +49 -0
  21. data/lib/ipa_test_kit/generated/bmi/bmi_patient_category_date_search_test.rb +46 -0
  22. data/lib/ipa_test_kit/generated/bmi/bmi_patient_category_search_test.rb +45 -0
  23. data/lib/ipa_test_kit/generated/bmi/bmi_patient_category_status_search_test.rb +47 -0
  24. data/lib/ipa_test_kit/generated/bmi/bmi_patient_code_date_search_test.rb +48 -0
  25. data/lib/ipa_test_kit/generated/bmi/bmi_patient_code_search_test.rb +62 -0
  26. data/lib/ipa_test_kit/generated/bmi/bmi_provenance_revinclude_search_test.rb +51 -0
  27. data/lib/ipa_test_kit/generated/bmi/bmi_read_test.rb +24 -0
  28. data/lib/ipa_test_kit/generated/bmi/bmi_reference_resolution_test.rb +28 -0
  29. data/lib/ipa_test_kit/generated/bmi/bmi_validation_test.rb +34 -0
  30. data/lib/ipa_test_kit/generated/bmi/metadata.yml +322 -0
  31. data/lib/ipa_test_kit/generated/bmi_group.rb +93 -0
  32. data/lib/ipa_test_kit/generated/bodyheight/bodyheight_must_support_test.rb +49 -0
  33. data/lib/ipa_test_kit/generated/bodyheight/bodyheight_patient_category_date_search_test.rb +46 -0
  34. data/lib/ipa_test_kit/generated/bodyheight/bodyheight_patient_category_search_test.rb +45 -0
  35. data/lib/ipa_test_kit/generated/bodyheight/bodyheight_patient_category_status_search_test.rb +47 -0
  36. data/lib/ipa_test_kit/generated/bodyheight/bodyheight_patient_code_date_search_test.rb +48 -0
  37. data/lib/ipa_test_kit/generated/bodyheight/bodyheight_patient_code_search_test.rb +62 -0
  38. data/lib/ipa_test_kit/generated/bodyheight/bodyheight_provenance_revinclude_search_test.rb +51 -0
  39. data/lib/ipa_test_kit/generated/bodyheight/bodyheight_read_test.rb +24 -0
  40. data/lib/ipa_test_kit/generated/bodyheight/bodyheight_reference_resolution_test.rb +28 -0
  41. data/lib/ipa_test_kit/generated/bodyheight/bodyheight_validation_test.rb +34 -0
  42. data/lib/ipa_test_kit/generated/bodyheight/metadata.yml +328 -0
  43. data/lib/ipa_test_kit/generated/bodyheight_group.rb +93 -0
  44. data/lib/ipa_test_kit/generated/bodytemp/bodytemp_must_support_test.rb +49 -0
  45. data/lib/ipa_test_kit/generated/bodytemp/bodytemp_patient_category_date_search_test.rb +46 -0
  46. data/lib/ipa_test_kit/generated/bodytemp/bodytemp_patient_category_search_test.rb +45 -0
  47. data/lib/ipa_test_kit/generated/bodytemp/bodytemp_patient_category_status_search_test.rb +47 -0
  48. data/lib/ipa_test_kit/generated/bodytemp/bodytemp_patient_code_date_search_test.rb +48 -0
  49. data/lib/ipa_test_kit/generated/bodytemp/bodytemp_patient_code_search_test.rb +62 -0
  50. data/lib/ipa_test_kit/generated/bodytemp/bodytemp_provenance_revinclude_search_test.rb +51 -0
  51. data/lib/ipa_test_kit/generated/bodytemp/bodytemp_read_test.rb +24 -0
  52. data/lib/ipa_test_kit/generated/bodytemp/bodytemp_reference_resolution_test.rb +28 -0
  53. data/lib/ipa_test_kit/generated/bodytemp/bodytemp_validation_test.rb +34 -0
  54. data/lib/ipa_test_kit/generated/bodytemp/metadata.yml +328 -0
  55. data/lib/ipa_test_kit/generated/bodytemp_group.rb +93 -0
  56. data/lib/ipa_test_kit/generated/bodyweight/bodyweight_must_support_test.rb +49 -0
  57. data/lib/ipa_test_kit/generated/bodyweight/bodyweight_patient_category_date_search_test.rb +46 -0
  58. data/lib/ipa_test_kit/generated/bodyweight/bodyweight_patient_category_search_test.rb +45 -0
  59. data/lib/ipa_test_kit/generated/bodyweight/bodyweight_patient_category_status_search_test.rb +47 -0
  60. data/lib/ipa_test_kit/generated/bodyweight/bodyweight_patient_code_date_search_test.rb +48 -0
  61. data/lib/ipa_test_kit/generated/bodyweight/bodyweight_patient_code_search_test.rb +62 -0
  62. data/lib/ipa_test_kit/generated/bodyweight/bodyweight_provenance_revinclude_search_test.rb +51 -0
  63. data/lib/ipa_test_kit/generated/bodyweight/bodyweight_read_test.rb +24 -0
  64. data/lib/ipa_test_kit/generated/bodyweight/bodyweight_reference_resolution_test.rb +28 -0
  65. data/lib/ipa_test_kit/generated/bodyweight/bodyweight_validation_test.rb +34 -0
  66. data/lib/ipa_test_kit/generated/bodyweight/metadata.yml +328 -0
  67. data/lib/ipa_test_kit/generated/bodyweight_group.rb +93 -0
  68. data/lib/ipa_test_kit/generated/bp/bp_must_support_test.rb +52 -0
  69. data/lib/ipa_test_kit/generated/bp/bp_patient_category_date_search_test.rb +46 -0
  70. data/lib/ipa_test_kit/generated/bp/bp_patient_category_search_test.rb +45 -0
  71. data/lib/ipa_test_kit/generated/bp/bp_patient_category_status_search_test.rb +47 -0
  72. data/lib/ipa_test_kit/generated/bp/bp_patient_code_date_search_test.rb +48 -0
  73. data/lib/ipa_test_kit/generated/bp/bp_patient_code_search_test.rb +62 -0
  74. data/lib/ipa_test_kit/generated/bp/bp_provenance_revinclude_search_test.rb +51 -0
  75. data/lib/ipa_test_kit/generated/bp/bp_read_test.rb +24 -0
  76. data/lib/ipa_test_kit/generated/bp/bp_reference_resolution_test.rb +28 -0
  77. data/lib/ipa_test_kit/generated/bp/bp_validation_test.rb +34 -0
  78. data/lib/ipa_test_kit/generated/bp/metadata.yml +379 -0
  79. data/lib/ipa_test_kit/generated/bp_group.rb +93 -0
  80. data/lib/ipa_test_kit/generated/condition/condition_must_support_test.rb +39 -0
  81. data/lib/ipa_test_kit/generated/condition/condition_patient_category_search_test.rb +47 -0
  82. data/lib/ipa_test_kit/generated/condition/condition_patient_clinical_status_search_test.rb +46 -0
  83. data/lib/ipa_test_kit/generated/condition/condition_patient_code_search_test.rb +47 -0
  84. data/lib/ipa_test_kit/generated/condition/condition_patient_onset_date_search_test.rb +47 -0
  85. data/lib/ipa_test_kit/generated/condition/condition_patient_search_test.rb +60 -0
  86. data/lib/ipa_test_kit/generated/condition/condition_provenance_revinclude_search_test.rb +49 -0
  87. data/lib/ipa_test_kit/generated/condition/condition_read_test.rb +24 -0
  88. data/lib/ipa_test_kit/generated/condition/condition_reference_resolution_test.rb +28 -0
  89. data/lib/ipa_test_kit/generated/condition/condition_validation_test.rb +34 -0
  90. data/lib/ipa_test_kit/generated/condition/metadata.yml +231 -0
  91. data/lib/ipa_test_kit/generated/condition_group.rb +91 -0
  92. data/lib/ipa_test_kit/generated/document_reference/document_reference_id_search_test.rb +40 -0
  93. data/lib/ipa_test_kit/generated/document_reference/document_reference_must_support_test.rb +49 -0
  94. data/lib/ipa_test_kit/generated/document_reference/document_reference_patient_category_date_search_test.rb +46 -0
  95. data/lib/ipa_test_kit/generated/document_reference/document_reference_patient_category_search_test.rb +45 -0
  96. data/lib/ipa_test_kit/generated/document_reference/document_reference_patient_search_test.rb +61 -0
  97. data/lib/ipa_test_kit/generated/document_reference/document_reference_patient_status_search_test.rb +46 -0
  98. data/lib/ipa_test_kit/generated/document_reference/document_reference_patient_type_period_search_test.rb +48 -0
  99. data/lib/ipa_test_kit/generated/document_reference/document_reference_patient_type_search_test.rb +45 -0
  100. data/lib/ipa_test_kit/generated/document_reference/document_reference_provenance_revinclude_search_test.rb +50 -0
  101. data/lib/ipa_test_kit/generated/document_reference/document_reference_read_test.rb +24 -0
  102. data/lib/ipa_test_kit/generated/document_reference/document_reference_reference_resolution_test.rb +28 -0
  103. data/lib/ipa_test_kit/generated/document_reference/document_reference_validation_test.rb +34 -0
  104. data/lib/ipa_test_kit/generated/document_reference/metadata.yml +356 -0
  105. data/lib/ipa_test_kit/generated/document_reference_group.rb +99 -0
  106. data/lib/ipa_test_kit/generated/head_circumference/head_circumference_must_support_test.rb +49 -0
  107. data/lib/ipa_test_kit/generated/head_circumference/head_circumference_patient_category_date_search_test.rb +46 -0
  108. data/lib/ipa_test_kit/generated/head_circumference/head_circumference_patient_category_search_test.rb +45 -0
  109. data/lib/ipa_test_kit/generated/head_circumference/head_circumference_patient_category_status_search_test.rb +47 -0
  110. data/lib/ipa_test_kit/generated/head_circumference/head_circumference_patient_code_date_search_test.rb +48 -0
  111. data/lib/ipa_test_kit/generated/head_circumference/head_circumference_patient_code_search_test.rb +62 -0
  112. data/lib/ipa_test_kit/generated/head_circumference/head_circumference_provenance_revinclude_search_test.rb +51 -0
  113. data/lib/ipa_test_kit/generated/head_circumference/head_circumference_read_test.rb +24 -0
  114. data/lib/ipa_test_kit/generated/head_circumference/head_circumference_reference_resolution_test.rb +28 -0
  115. data/lib/ipa_test_kit/generated/head_circumference/head_circumference_validation_test.rb +34 -0
  116. data/lib/ipa_test_kit/generated/head_circumference/metadata.yml +324 -0
  117. data/lib/ipa_test_kit/generated/head_circumference_group.rb +93 -0
  118. data/lib/ipa_test_kit/generated/heartrate/heartrate_must_support_test.rb +49 -0
  119. data/lib/ipa_test_kit/generated/heartrate/heartrate_patient_category_date_search_test.rb +46 -0
  120. data/lib/ipa_test_kit/generated/heartrate/heartrate_patient_category_search_test.rb +45 -0
  121. data/lib/ipa_test_kit/generated/heartrate/heartrate_patient_category_status_search_test.rb +47 -0
  122. data/lib/ipa_test_kit/generated/heartrate/heartrate_patient_code_date_search_test.rb +48 -0
  123. data/lib/ipa_test_kit/generated/heartrate/heartrate_patient_code_search_test.rb +62 -0
  124. data/lib/ipa_test_kit/generated/heartrate/heartrate_provenance_revinclude_search_test.rb +51 -0
  125. data/lib/ipa_test_kit/generated/heartrate/heartrate_read_test.rb +24 -0
  126. data/lib/ipa_test_kit/generated/heartrate/heartrate_reference_resolution_test.rb +28 -0
  127. data/lib/ipa_test_kit/generated/heartrate/heartrate_validation_test.rb +34 -0
  128. data/lib/ipa_test_kit/generated/heartrate/metadata.yml +325 -0
  129. data/lib/ipa_test_kit/generated/heartrate_group.rb +93 -0
  130. data/lib/ipa_test_kit/generated/immunization/immunization_must_support_test.rb +40 -0
  131. data/lib/ipa_test_kit/generated/immunization/immunization_patient_date_search_test.rb +47 -0
  132. data/lib/ipa_test_kit/generated/immunization/immunization_patient_search_test.rb +60 -0
  133. data/lib/ipa_test_kit/generated/immunization/immunization_patient_status_search_test.rb +45 -0
  134. data/lib/ipa_test_kit/generated/immunization/immunization_provenance_revinclude_search_test.rb +50 -0
  135. data/lib/ipa_test_kit/generated/immunization/immunization_read_test.rb +24 -0
  136. data/lib/ipa_test_kit/generated/immunization/immunization_reference_resolution_test.rb +28 -0
  137. data/lib/ipa_test_kit/generated/immunization/immunization_validation_test.rb +34 -0
  138. data/lib/ipa_test_kit/generated/immunization/metadata.yml +210 -0
  139. data/lib/ipa_test_kit/generated/immunization_group.rb +87 -0
  140. data/lib/ipa_test_kit/generated/ipa_test_suite.rb +88 -0
  141. data/lib/ipa_test_kit/generated/medication_request/medication_request_must_support_test.rb +44 -0
  142. data/lib/ipa_test_kit/generated/medication_request/medication_request_patient_intent_authoredon_search_test.rb +53 -0
  143. data/lib/ipa_test_kit/generated/medication_request/medication_request_patient_intent_encounter_search_test.rb +52 -0
  144. data/lib/ipa_test_kit/generated/medication_request/medication_request_patient_intent_search_test.rb +68 -0
  145. data/lib/ipa_test_kit/generated/medication_request/medication_request_patient_intent_status_search_test.rb +49 -0
  146. data/lib/ipa_test_kit/generated/medication_request/medication_request_provenance_revinclude_search_test.rb +51 -0
  147. data/lib/ipa_test_kit/generated/medication_request/medication_request_read_test.rb +24 -0
  148. data/lib/ipa_test_kit/generated/medication_request/medication_request_reference_resolution_test.rb +28 -0
  149. data/lib/ipa_test_kit/generated/medication_request/medication_request_validation_test.rb +34 -0
  150. data/lib/ipa_test_kit/generated/medication_request/medication_validation_test.rb +34 -0
  151. data/lib/ipa_test_kit/generated/medication_request/metadata.yml +307 -0
  152. data/lib/ipa_test_kit/generated/medication_request_group.rb +92 -0
  153. data/lib/ipa_test_kit/generated/medication_statement/medication_statement_must_support_test.rb +43 -0
  154. data/lib/ipa_test_kit/generated/medication_statement/medication_statement_patient_context_search_test.rb +51 -0
  155. data/lib/ipa_test_kit/generated/medication_statement/medication_statement_patient_effective_search_test.rb +52 -0
  156. data/lib/ipa_test_kit/generated/medication_statement/medication_statement_patient_search_test.rb +68 -0
  157. data/lib/ipa_test_kit/generated/medication_statement/medication_statement_patient_status_search_test.rb +49 -0
  158. data/lib/ipa_test_kit/generated/medication_statement/medication_statement_provenance_revinclude_search_test.rb +51 -0
  159. data/lib/ipa_test_kit/generated/medication_statement/medication_statement_read_test.rb +24 -0
  160. data/lib/ipa_test_kit/generated/medication_statement/medication_statement_reference_resolution_test.rb +28 -0
  161. data/lib/ipa_test_kit/generated/medication_statement/medication_statement_validation_test.rb +34 -0
  162. data/lib/ipa_test_kit/generated/medication_statement/medication_validation_test.rb +34 -0
  163. data/lib/ipa_test_kit/generated/medication_statement/metadata.yml +230 -0
  164. data/lib/ipa_test_kit/generated/medication_statement_group.rb +92 -0
  165. data/lib/ipa_test_kit/generated/metadata.yml +6230 -0
  166. data/lib/ipa_test_kit/generated/observation/metadata.yml +1280 -0
  167. data/lib/ipa_test_kit/generated/observation/observation_must_support_test.rb +41 -0
  168. data/lib/ipa_test_kit/generated/observation/observation_patient_category_date_search_test.rb +46 -0
  169. data/lib/ipa_test_kit/generated/observation/observation_patient_category_search_test.rb +62 -0
  170. data/lib/ipa_test_kit/generated/observation/observation_patient_category_status_search_test.rb +47 -0
  171. data/lib/ipa_test_kit/generated/observation/observation_patient_code_date_search_test.rb +48 -0
  172. data/lib/ipa_test_kit/generated/observation/observation_patient_code_search_test.rb +45 -0
  173. data/lib/ipa_test_kit/generated/observation/observation_provenance_revinclude_search_test.rb +51 -0
  174. data/lib/ipa_test_kit/generated/observation/observation_read_test.rb +24 -0
  175. data/lib/ipa_test_kit/generated/observation/observation_reference_resolution_test.rb +28 -0
  176. data/lib/ipa_test_kit/generated/observation/observation_validation_test.rb +34 -0
  177. data/lib/ipa_test_kit/generated/observation_group.rb +93 -0
  178. data/lib/ipa_test_kit/generated/oxygensat/metadata.yml +366 -0
  179. data/lib/ipa_test_kit/generated/oxygensat/oxygensat_must_support_test.rb +65 -0
  180. data/lib/ipa_test_kit/generated/oxygensat/oxygensat_patient_category_date_search_test.rb +46 -0
  181. data/lib/ipa_test_kit/generated/oxygensat/oxygensat_patient_category_search_test.rb +45 -0
  182. data/lib/ipa_test_kit/generated/oxygensat/oxygensat_patient_category_status_search_test.rb +47 -0
  183. data/lib/ipa_test_kit/generated/oxygensat/oxygensat_patient_code_date_search_test.rb +48 -0
  184. data/lib/ipa_test_kit/generated/oxygensat/oxygensat_patient_code_search_test.rb +62 -0
  185. data/lib/ipa_test_kit/generated/oxygensat/oxygensat_provenance_revinclude_search_test.rb +51 -0
  186. data/lib/ipa_test_kit/generated/oxygensat/oxygensat_read_test.rb +24 -0
  187. data/lib/ipa_test_kit/generated/oxygensat/oxygensat_reference_resolution_test.rb +28 -0
  188. data/lib/ipa_test_kit/generated/oxygensat/oxygensat_validation_test.rb +34 -0
  189. data/lib/ipa_test_kit/generated/oxygensat_group.rb +93 -0
  190. data/lib/ipa_test_kit/generated/patient/metadata.yml +320 -0
  191. data/lib/ipa_test_kit/generated/patient/patient_birthdate_family_search_test.rb +41 -0
  192. data/lib/ipa_test_kit/generated/patient/patient_birthdate_name_search_test.rb +39 -0
  193. data/lib/ipa_test_kit/generated/patient/patient_family_gender_search_test.rb +41 -0
  194. data/lib/ipa_test_kit/generated/patient/patient_gender_name_search_test.rb +39 -0
  195. data/lib/ipa_test_kit/generated/patient/patient_id_search_test.rb +53 -0
  196. data/lib/ipa_test_kit/generated/patient/patient_identifier_search_test.rb +40 -0
  197. data/lib/ipa_test_kit/generated/patient/patient_must_support_test.rb +57 -0
  198. data/lib/ipa_test_kit/generated/patient/patient_name_search_test.rb +39 -0
  199. data/lib/ipa_test_kit/generated/patient/patient_provenance_revinclude_search_test.rb +49 -0
  200. data/lib/ipa_test_kit/generated/patient/patient_read_test.rb +24 -0
  201. data/lib/ipa_test_kit/generated/patient/patient_reference_resolution_test.rb +28 -0
  202. data/lib/ipa_test_kit/generated/patient/patient_validation_test.rb +34 -0
  203. data/lib/ipa_test_kit/generated/patient_group.rb +99 -0
  204. data/lib/ipa_test_kit/generated/practitioner/metadata.yml +124 -0
  205. data/lib/ipa_test_kit/generated/practitioner/practitioner_identifier_search_test.rb +40 -0
  206. data/lib/ipa_test_kit/generated/practitioner/practitioner_must_support_test.rb +40 -0
  207. data/lib/ipa_test_kit/generated/practitioner/practitioner_name_search_test.rb +49 -0
  208. data/lib/ipa_test_kit/generated/practitioner/practitioner_read_test.rb +24 -0
  209. data/lib/ipa_test_kit/generated/practitioner/practitioner_reference_resolution_test.rb +28 -0
  210. data/lib/ipa_test_kit/generated/practitioner/practitioner_validation_test.rb +34 -0
  211. data/lib/ipa_test_kit/generated/practitioner_group.rb +84 -0
  212. data/lib/ipa_test_kit/generated/practitioner_role/metadata.yml +141 -0
  213. data/lib/ipa_test_kit/generated/practitioner_role/practitioner_role_identifier_search_test.rb +40 -0
  214. data/lib/ipa_test_kit/generated/practitioner_role/practitioner_role_must_support_test.rb +40 -0
  215. data/lib/ipa_test_kit/generated/practitioner_role/practitioner_role_practitioner_search_test.rb +51 -0
  216. data/lib/ipa_test_kit/generated/practitioner_role/practitioner_role_read_test.rb +24 -0
  217. data/lib/ipa_test_kit/generated/practitioner_role/practitioner_role_reference_resolution_test.rb +28 -0
  218. data/lib/ipa_test_kit/generated/practitioner_role/practitioner_role_validation_test.rb +34 -0
  219. data/lib/ipa_test_kit/generated/practitioner_role_group.rb +84 -0
  220. data/lib/ipa_test_kit/generated/provenance/metadata.yml +114 -0
  221. data/lib/ipa_test_kit/generated/provenance/provenance_read_test.rb +24 -0
  222. data/lib/ipa_test_kit/generated/provenance/provenance_reference_resolution_test.rb +28 -0
  223. data/lib/ipa_test_kit/generated/provenance/provenance_validation_test.rb +34 -0
  224. data/lib/ipa_test_kit/generated/provenance_group.rb +53 -0
  225. data/lib/ipa_test_kit/generated/resource_list.rb +18 -0
  226. data/lib/ipa_test_kit/generated/resprate/metadata.yml +325 -0
  227. data/lib/ipa_test_kit/generated/resprate/resprate_must_support_test.rb +49 -0
  228. data/lib/ipa_test_kit/generated/resprate/resprate_patient_category_date_search_test.rb +46 -0
  229. data/lib/ipa_test_kit/generated/resprate/resprate_patient_category_search_test.rb +45 -0
  230. data/lib/ipa_test_kit/generated/resprate/resprate_patient_category_status_search_test.rb +47 -0
  231. data/lib/ipa_test_kit/generated/resprate/resprate_patient_code_date_search_test.rb +48 -0
  232. data/lib/ipa_test_kit/generated/resprate/resprate_patient_code_search_test.rb +62 -0
  233. data/lib/ipa_test_kit/generated/resprate/resprate_provenance_revinclude_search_test.rb +51 -0
  234. data/lib/ipa_test_kit/generated/resprate/resprate_read_test.rb +24 -0
  235. data/lib/ipa_test_kit/generated/resprate/resprate_reference_resolution_test.rb +28 -0
  236. data/lib/ipa_test_kit/generated/resprate/resprate_validation_test.rb +34 -0
  237. data/lib/ipa_test_kit/generated/resprate_group.rb +93 -0
  238. data/lib/ipa_test_kit/generator/group_generator.rb +171 -0
  239. data/lib/ipa_test_kit/generator/group_metadata.rb +98 -0
  240. data/lib/ipa_test_kit/generator/group_metadata_extractor.rb +278 -0
  241. data/lib/ipa_test_kit/generator/ig_loader.rb +63 -0
  242. data/lib/ipa_test_kit/generator/ig_metadata.rb +49 -0
  243. data/lib/ipa_test_kit/generator/ig_metadata_extractor.rb +56 -0
  244. data/lib/ipa_test_kit/generator/ig_resources.rb +48 -0
  245. data/lib/ipa_test_kit/generator/must_support_metadata_extractor.rb +221 -0
  246. data/lib/ipa_test_kit/generator/must_support_test_generator.rb +86 -0
  247. data/lib/ipa_test_kit/generator/naming.rb +46 -0
  248. data/lib/ipa_test_kit/generator/provenance_revinclude_search_test_generator.rb +186 -0
  249. data/lib/ipa_test_kit/generator/read_test_generator.rb +89 -0
  250. data/lib/ipa_test_kit/generator/reference_resolution_test_generator.rb +72 -0
  251. data/lib/ipa_test_kit/generator/resource_list_generator.rb +46 -0
  252. data/lib/ipa_test_kit/generator/search_definition_metadata_extractor.rb +181 -0
  253. data/lib/ipa_test_kit/generator/search_metadata_extractor.rb +74 -0
  254. data/lib/ipa_test_kit/generator/search_test_generator.rb +295 -0
  255. data/lib/ipa_test_kit/generator/special_cases.rb +16 -0
  256. data/lib/ipa_test_kit/generator/suite_generator.rb +67 -0
  257. data/lib/ipa_test_kit/generator/terminology_binding_metadata_extractor.rb +105 -0
  258. data/lib/ipa_test_kit/generator/validation_test_generator.rb +124 -0
  259. data/lib/ipa_test_kit/generator.rb +86 -0
  260. data/lib/ipa_test_kit/igs/package.tgz +0 -0
  261. data/lib/ipa_test_kit/must_support_test.rb +146 -0
  262. data/lib/ipa_test_kit/read_test.rb +62 -0
  263. data/lib/ipa_test_kit/reference_resolution_test.rb +111 -0
  264. data/lib/ipa_test_kit/request_logger.rb +46 -0
  265. data/lib/ipa_test_kit/search_test.rb +728 -0
  266. data/lib/ipa_test_kit/search_test_properties.rb +61 -0
  267. data/lib/ipa_test_kit/validation_test.rb +48 -0
  268. data/lib/ipa_test_kit/version.rb +3 -0
  269. data/lib/ipa_test_kit.rb +2 -0
  270. metadata +397 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 94a7aa72a570056b4f06890c5e9984abd2dce72c3b1b90ca16c15c1d0dcde924
4
+ data.tar.gz: 7d84bc22ec9106e559e4a86a8378b30eb439c9a6580323164181638c1194caf9
5
+ SHA512:
6
+ metadata.gz: 64ce008784240da39615c20f5437f59538dadb3a6fcaf2c5c46d4bb8ceab225d1d64cb0f476bb787e557d6924a1597612d286bc6e546e4c2f176d218d6ff42dc
7
+ data.tar.gz: 460ada15a0e56911b89e8d488bd787570c89eb24bed6378464a3f3a45ea41cec774d1d3fb90fff63bbba115978fcfa0bd6a9f4b797dad479f38c8a67feff638a
data/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright {yyyy} {name of copyright owner}
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,41 @@
1
+ module IpaTestKit
2
+ class ConformanceSupportTest < Inferno::Test
3
+ id :ipa_010_conformance_support
4
+ title 'FHIR Server supports the conformance interaction'
5
+ description %(
6
+ The conformance 'whole system' interaction provides a method to get the
7
+ CapabilityStatement for the FHIR server. This test checks that the
8
+ server responds to a `GET` request at the following endpoint:
9
+
10
+ ```
11
+ GET [base]/metadata
12
+ ```
13
+
14
+ This test checks the following SHALL requirement:
15
+
16
+ > Applications SHALL return a resource that describes the functionality
17
+ of the server end-point.
18
+
19
+ [http://hl7.org/fhir/R4/http.html#capabilities](http://hl7.org/fhir/R4/http.html#capabilities)
20
+
21
+ It does this by checking that the server responds with an HTTP OK 200
22
+ status code and that the body of the response contains a valid
23
+ [CapabilityStatement
24
+ resource](http://hl7.org/fhir/R4/capabilitystatement.html). This test
25
+ does not inspect the content of the CapabilityStatement to see if it
26
+ contains the required information. It only checks to see if the RESTful
27
+ interaction is supported and returns a valid CapabilityStatement
28
+ resource.
29
+ )
30
+ makes_request :capability_statement
31
+
32
+ run do
33
+ fhir_client.set_no_auth
34
+ fhir_get_capability_statement(name: :capability_statement)
35
+
36
+ assert_response_status(200)
37
+ assert_resource_type(:capability_statement)
38
+ assert_valid_resource
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,15 @@
1
+ module IpaTestKit
2
+ class FHIRVersionTest < Inferno::Test
3
+ id :ipa_010_fhir_version
4
+ title 'Server is using FHIR R4'
5
+ description %(
6
+ This test inspects the CapabilityStatement returned by the server to
7
+ verify that the server is using FHIR R4.
8
+ )
9
+
10
+ run do
11
+ server_version = fhir_client.detect_version.to_s.upcase
12
+ assert server_version == 'R4', "Server is using FHIR version #{server_version} rather than R4"
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,39 @@
1
+ module IpaTestKit
2
+ class JSONSupportTest < Inferno::Test
3
+ id :ipa_010_json_support
4
+ title 'FHIR server capability states JSON support'
5
+ description %(
6
+ FHIR provides multiple [representation
7
+ formats](https://www.hl7.org/fhir/formats.html) for resources, including
8
+ JSON and XML. IPA profiles require servers to use the [JSON
9
+ representation](https://www.hl7.org/fhir/json.html):
10
+
11
+ [```The IPA Server **SHALL** Support json source formats for all IPA
12
+ interactions.```](http://hl7.org/fhir/uv/ipa/CapabilityStatement-ipa-server.html#behavior)
13
+
14
+ The FHIR conformance interaction require servers to describe which
15
+ formats are available for clients to use. The server must explicitly
16
+ state that JSON is supported. This is located in the [format
17
+ element](https://www.hl7.org/fhir/capabilitystatement-definitions.html#CapabilityStatement.format)
18
+ of the CapabilityStatement Resource.
19
+
20
+ This test checks that one of the following values are located in the
21
+ format field.
22
+
23
+ * json
24
+ * application/json
25
+ * application/fhir+json
26
+ )
27
+ uses_request :capability_statement
28
+
29
+ run do
30
+ assert_resource_type(:capability_statement)
31
+
32
+ json_formats = ['json', 'application/json', 'application/fhir+json']
33
+ server_formats = resource.format
34
+
35
+ assert server_formats.any? { |format| json_formats.include? format },
36
+ 'CapabilityStatement does not state support for JSON'
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,76 @@
1
+ module IpaTestKit
2
+ class ProfileSupportTest < Inferno::Test
3
+ id :ipa_010_profile_support
4
+ title 'Capability Statement lists support for required IPA Profiles'
5
+ description %(
6
+ The IPA Implementation Guide states:
7
+
8
+ ```
9
+ The IPA Server SHALL:
10
+ 1. Support the IPA Patient resource profile.
11
+ 2. Support at least one additional resource profile from the list of IPA
12
+ Profiles.
13
+ ```
14
+ )
15
+ uses_request :capability_statement
16
+
17
+ PROFILES = {
18
+ 'AllergyIntolerance' => ['http://hl7.org/fhir/uv/ipa/StructureDefinition/ipa-allergyintolerance'].freeze,
19
+ 'Condition' => ['http://hl7.org/fhir/uv/ipa/StructureDefinition/ipa-condition'].freeze,
20
+ 'DocumentReference' => ['http://hl7.org/fhir/uv/ipa/StructureDefinition/ipa-documentreference'].freeze,
21
+ 'Immunization' => ['http://hl7.org/fhir/uv/ipa/StructureDefinition/ipa-immunization'].freeze,
22
+ 'Medication' => ['http://hl7.org/fhir/uv/ipa/StructureDefinition/ipa-medication'].freeze,
23
+ 'MedicationRequest' => ['http://hl7.org/fhir/uv/ipa/StructureDefinition/ipa-medicationrequest'].freeze,
24
+ 'MedicationStatement' => ['http://hl7.org/fhir/uv/ipa/StructureDefinition/ipa-medicationstatement'].freeze,
25
+ 'Observation' => [
26
+ 'http://hl7.org/fhir/uv/ipa/StructureDefinition/ipa-observation',
27
+ 'http://hl7.org/fhir/StructureDefinition/bp/bmi',
28
+ 'http://hl7.org/fhir/StructureDefinition/bp/oxygensat',
29
+ 'http://hl7.org/fhir/StructureDefinition/bp',
30
+ 'http://hl7.org/fhir/StructureDefinition/bodyheight',
31
+ 'http://hl7.org/fhir/StructureDefinition/bodyweight',
32
+ 'http://hl7.org/fhir/StructureDefinition/heartrate',
33
+ 'http://hl7.org/fhir/StructureDefinition/resprate',
34
+ 'http://hl7.org/fhir/StructureDefinition/bodytemp',
35
+ 'http://hl7.org/fhir/StructureDefinition/headcircum'
36
+ ].freeze,
37
+ 'Patient' => ['http://hl7.org/fhir/uv/ipa/StructureDefinition/ipa-patient'].freeze,
38
+ 'Practitioner' => ['http://hl7.org/fhir/uv/ipa/StructureDefinition/ipa-practitioner'].freeze,
39
+ 'PractitionerRole' => ['http://hl7.org/fhir/uv/ipa/StructureDefinition/ipa-practitionerrole'].freeze
40
+ }.freeze
41
+
42
+ run do
43
+ assert_resource_type(:capability_statement)
44
+ capability_statement = resource
45
+
46
+ supported_resources =
47
+ capability_statement.rest
48
+ &.each_with_object([]) do |rest, resources|
49
+ rest.resource.each { |resource| resources << resource.type }
50
+ end.uniq
51
+ supported_profiles =
52
+ capability_statement.rest
53
+ &.flat_map(&:resource)
54
+ &.flat_map { |resource| resource.supportedProfile + [resource.profile] }
55
+ &.compact || []
56
+ supported_profiles.map! { |profile_url| profile_url.split('|').first }
57
+
58
+ assert supported_resources.include?('Patient'), 'IPA Patient profile not supported'
59
+
60
+ other_resources = PROFILES.keys.reject { |resource_type| resource_type == 'Patient' }
61
+ other_resources_supported = other_resources.any? { |resource| supported_resources.include? resource }
62
+ assert other_resources_supported, 'No IPA resources other than Patient are supported'
63
+
64
+ PROFILES.each do |resource_type, profiles|
65
+ next unless supported_resources.include? resource_type
66
+
67
+ profiles.each do |profile|
68
+ warning do
69
+ assert supported_profiles&.include?(profile),
70
+ "CapabilityStatement does not claim support for IPA #{resource_type} profile: #{profile}"
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,64 @@
1
+ require 'tls_test_kit'
2
+ require_relative 'capability_statement/conformance_support_test'
3
+ require_relative 'capability_statement/fhir_version_test'
4
+ require_relative 'capability_statement/json_support_test'
5
+ require_relative 'capability_statement/profile_support_test'
6
+
7
+ module IpaTestKit
8
+ class CapabilityStatementGroup < Inferno::TestGroup
9
+ id :ipa_010_capability_statement
10
+ title 'Capability Statement'
11
+ short_description 'Retrieve information about supported server functionality using the FHIR capabilties interaction.'
12
+ description %(
13
+ # Background
14
+ The #{title} Sequence tests a FHIR server's ability to formally describe
15
+ features supported by the API by using the [Capability
16
+ Statement](https://www.hl7.org/fhir/capabilitystatement.html) resource.
17
+ The features described in the Capability Statement must be consistent with
18
+ the required capabilities of a IPA server. The Capability Statement
19
+ must also advertise the location of the required SMART on FHIR endpoints
20
+ that enable authenticated access to the FHIR server resources.
21
+
22
+ The Capability Statement resource allows clients to determine which
23
+ resources are supported by a FHIR Server. Not all servers are expected to
24
+ implement all possible queries and data elements described in the IPA
25
+ API. For example, the IPA Implementation Guide requires that the
26
+ Patient resource and only one additional resource profile from the IPA
27
+ Profiles.
28
+
29
+ # Test Methodology
30
+
31
+ This test sequence accesses the server endpoint at `/metadata` using a
32
+ `GET` request. It parses the Capability Statement and verifies that:
33
+
34
+ * The endpoint is secured by an appropriate cryptographic protocol
35
+ * The resource matches the expected FHIR version defined by the tests
36
+ * The resource is a valid FHIR resource
37
+ * The server claims support for JSON encoding of resources
38
+ * The server claims support for the Patient resource and one other
39
+ resource
40
+
41
+ It collects the following information that is saved in the testing session
42
+ for use by later tests:
43
+
44
+ * List of resources supported
45
+ * List of queries parameters supported
46
+ )
47
+ run_as_group
48
+
49
+ test from: :tls_version_test,
50
+ id: :standalone_auth_tls,
51
+ title: 'FHIR server secured by transport layer security',
52
+ description: %(
53
+ Systems **SHALL** use TLS version 1.2 or higher for all transmissions
54
+ not taking place over a secure network connection.
55
+ ),
56
+ config: {
57
+ options: { minimum_allowed_version: OpenSSL::SSL::TLS1_2_VERSION }
58
+ }
59
+ test from: :ipa_010_conformance_support
60
+ test from: :ipa_010_fhir_version
61
+ test from: :ipa_010_json_support
62
+ test from: :ipa_010_profile_support
63
+ end
64
+ end
@@ -0,0 +1,101 @@
1
+ # frozen_string_literal: true
2
+
3
+ module IpaTestKit
4
+ module DateSearchValidation
5
+ def get_fhir_datetime_range(datetime)
6
+ range = { start: DateTime.xmlschema(datetime), end: nil }
7
+ range[:end] =
8
+ if /^\d{4}$/.match?(datetime) # YYYY
9
+ range[:start].next_year - 1.seconds
10
+ elsif /^\d{4}-\d{2}$/.match?(datetime) # YYYY-MM
11
+ range[:start].next_month - 1.seconds
12
+ elsif /^\d{4}-\d{2}-\d{2}$/.match?(datetime) # YYYY-MM-DD
13
+ range[:start].next_day - 1.seconds
14
+ else # YYYY-MM-DDThh:mm:ss+zz:zz
15
+ range[:start]
16
+ end
17
+ range
18
+ end
19
+
20
+ def get_fhir_period_range(period)
21
+ range = { start: nil, end: nil }
22
+ range[:start] = DateTime.xmlschema(period.start) unless period.start.nil?
23
+ return range if period.end.nil?
24
+
25
+ period_end_beginning = DateTime.xmlschema(period.end)
26
+ range[:end] =
27
+ if /^\d{4}$/.match?(period.end) # YYYY
28
+ period_end_beginning.next_year - 1.seconds
29
+ elsif /^\d{4}-\d{2}$/.match?(period.end) # YYYY-MM
30
+ period_end_beginning.next_month - 1.seconds
31
+ elsif /^\d{4}-\d{2}-\d{2}$/.match?(period.end) # YYYY-MM-DD
32
+ period_end_beginning.next_day - 1.seconds
33
+ else # YYYY-MM-DDThh:mm:ss+zz:zz
34
+ period_end_beginning
35
+ end
36
+ range
37
+ end
38
+
39
+ def fhir_date_comparer(search_range, target_range, comparator)
40
+ # Implicitly, a missing lower boundary is "less than" any actual date. A missing upper boundary is "greater than" any actual date.
41
+ case comparator
42
+ when 'eq' # the range of the search value fully contains the range of the target value
43
+ !target_range[:start].nil? && !target_range[:end].nil? && search_range[:start] <= target_range[:start] && search_range[:end] >= target_range[:end]
44
+ when 'ne' # the range of the search value does not fully contain the range of the target value
45
+ target_range[:start].nil? || target_range[:end].nil? || search_range[:start] > target_range[:start] || search_range[:end] < target_range[:end]
46
+ when 'gt' # the range above the search value intersects (i.e. overlaps) with the range of the target value
47
+ target_range[:end].nil? || search_range[:end] < target_range[:end]
48
+ when 'lt' # the range below the search value intersects (i.e. overlaps) with the range of the target value
49
+ target_range[:start].nil? || search_range[:start] > target_range[:start]
50
+ when 'ge'
51
+ fhir_date_comparer(search_range, target_range, 'gt') || fhir_date_comparer(search_range, target_range, 'eq')
52
+ when 'le'
53
+ fhir_date_comparer(search_range, target_range, 'lt') || fhir_date_comparer(search_range, target_range, 'eq')
54
+ when 'sa' # the range above the search value contains the range of the target value
55
+ !target_range[:start].nil? && search_range[:end] < target_range[:start]
56
+ when 'eb' # the range below the search value contains the range of the target value
57
+ !target_range[:end].nil? && search_range[:start] > target_range[:end]
58
+ when 'ap' # the range of the search value overlaps with the range of the target value
59
+ if target_range[:start].nil? || target_range[:end].nil?
60
+ (target_range[:start].nil? && search_range[:start] < target_range[:end]) ||
61
+ (target_range[:end].nil? && search_range[:end] > target_range[:start])
62
+ else
63
+ (search_range[:start] >= target_range[:start] && search_range[:start] <= target_range[:end]) ||
64
+ (search_range[:end] >= target_range[:start] && search_range[:end] <= target_range[:end])
65
+ end
66
+ end
67
+ end
68
+
69
+ def validate_date_search(search_value, target_value)
70
+ if target_value.instance_of? FHIR::Period
71
+ validate_period_search(search_value, target_value)
72
+ else
73
+ validate_datetime_search(search_value, target_value)
74
+ end
75
+ end
76
+
77
+ def validate_datetime_search(search_value, target_value)
78
+ comparator = search_value[0..1]
79
+ if ['eq', 'ge', 'gt', 'le', 'lt', 'ne', 'sa', 'eb', 'ap'].include? comparator
80
+ search_value = search_value[2..-1]
81
+ else
82
+ comparator = 'eq'
83
+ end
84
+ search_range = get_fhir_datetime_range(search_value)
85
+ target_range = get_fhir_datetime_range(target_value)
86
+ fhir_date_comparer(search_range, target_range, comparator)
87
+ end
88
+
89
+ def validate_period_search(search_value, target_value)
90
+ comparator = search_value[0..1]
91
+ if ['eq', 'ge', 'gt', 'le', 'lt', 'ne', 'sa', 'eb', 'ap'].include? comparator
92
+ search_value = search_value[2..-1]
93
+ else
94
+ comparator = 'eq'
95
+ end
96
+ search_range = get_fhir_datetime_range(search_value)
97
+ target_range = get_fhir_period_range(target_value)
98
+ fhir_date_comparer(search_range, target_range, comparator)
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,59 @@
1
+ require 'json'
2
+
3
+ # Extension to FHIR::Model. Prepending this into FHIR::Model (done below)
4
+ # allows us to call super() on initialize when we overriding it,
5
+ # while also defining new methods and attributes
6
+ module InfernoFHIRModelExtensions
7
+ attr_accessor :source_hash, :source_text
8
+
9
+ def initialize(hash = {})
10
+ super(hash)
11
+ @source_hash = hash
12
+ end
13
+
14
+ def source_contents
15
+ @source_text || JSON.generate(@source_hash)
16
+ end
17
+ end
18
+
19
+ module FHIR
20
+ class Model
21
+ prepend ::InfernoFHIRModelExtensions
22
+ end
23
+ end
24
+
25
+ # Extension to FHIR::Json. Prepending this into FHIR::Json (done below)
26
+ # allows us to call super() on from_json
27
+ module InfernoJson
28
+ def from_json(json)
29
+ resource = super(json)
30
+ resource.source_text = json
31
+ resource
32
+ end
33
+ end
34
+
35
+ # Extension to FHIR::Xml. Prepending this into FHIR::Xml (done below)
36
+ # allows us to call super() on from_xml
37
+ module InfernoXml
38
+ def from_xml(xml)
39
+ resource = super(xml)
40
+ resource.source_text = xml
41
+ resource
42
+ end
43
+ end
44
+
45
+ module FHIR
46
+ module Json
47
+ class << self
48
+ prepend InfernoJson
49
+ end
50
+ end
51
+ end
52
+
53
+ module FHIR
54
+ module Xml
55
+ class << self
56
+ prepend InfernoXml
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,63 @@
1
+ module IpaTestKit
2
+ module FHIRResourceNavigation
3
+ def resolve_path(elements, path)
4
+ elements = Array.wrap(elements)
5
+ return elements if path.blank?
6
+
7
+ paths = path.split('.')
8
+ segment = paths.first
9
+ remaining_path = paths.drop(1).join('.')
10
+
11
+ elements.flat_map do |element|
12
+ child = get_next_value(element, segment)
13
+ resolve_path(child, remaining_path)
14
+ end.compact
15
+ end
16
+
17
+ def find_a_value_at(element, path)
18
+ return nil if element.nil?
19
+
20
+ elements = Array.wrap(element)
21
+
22
+ if path.empty?
23
+ return elements.find { |el| yield(el) } if block_given?
24
+
25
+ return elements.first
26
+ end
27
+
28
+ path_segments = path.split('.')
29
+ segment = path_segments.shift.delete_suffix('[x]').to_sym
30
+
31
+ no_elements_present =
32
+ elements.none? do |element|
33
+ child = get_next_value(element, segment)
34
+
35
+ child.present? || child == false
36
+ end
37
+
38
+ return nil if no_elements_present
39
+
40
+ remaining_path = path_segments.join('.')
41
+
42
+ elements.each do |element|
43
+ child = get_next_value(element, segment)
44
+ element_found =
45
+ if block_given?
46
+ find_a_value_at(child, remaining_path) { |value_found| yield(value_found) }
47
+ else
48
+ find_a_value_at(child, remaining_path)
49
+ end
50
+
51
+ return element_found if element_found.present? || element_found == false
52
+ end
53
+
54
+ nil
55
+ end
56
+
57
+ def get_next_value(element, property)
58
+ element.send(property)
59
+ rescue NoMethodError
60
+ nil
61
+ end
62
+ end
63
+ end