plan_executor 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (337) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +44 -0
  3. data/.simplecov +16 -0
  4. data/.travis.yml +13 -0
  5. data/Gemfile +26 -0
  6. data/Gemfile.lock +197 -0
  7. data/LICENSE +201 -0
  8. data/README.md +126 -0
  9. data/Rakefile +25 -0
  10. data/fixtures/daf/conformance-daf-query-responder.xml +1471 -0
  11. data/fixtures/diagnostic_order/do-100.xml +64 -0
  12. data/fixtures/diagnostic_order/do-200.xml +121 -0
  13. data/fixtures/diagnostic_order/do-300.xml +91 -0
  14. data/fixtures/diagnostic_order/do-400.xml +88 -0
  15. data/fixtures/diagnostic_report/dr-100.xml +96 -0
  16. data/fixtures/diagnostic_report/dr-200.xml +125 -0
  17. data/fixtures/diagnostic_report/dr-300.xml +132 -0
  18. data/fixtures/diagnostic_report/dr-400.xml +121 -0
  19. data/fixtures/financial/claim-example-average.xml +168 -0
  20. data/fixtures/financial/claim-example-simple.xml +67 -0
  21. data/fixtures/observation/obs-100.xml +58 -0
  22. data/fixtures/observation/obs-101.xml +58 -0
  23. data/fixtures/observation/obs-200.xml +125 -0
  24. data/fixtures/observation/obs-300.xml +106 -0
  25. data/fixtures/observation/obs-301.xml +106 -0
  26. data/fixtures/observation/obs-302.xml +106 -0
  27. data/fixtures/observation/obs-303.xml +106 -0
  28. data/fixtures/observation/obs-304.xml +106 -0
  29. data/fixtures/observation/obs-400.xml +87 -0
  30. data/fixtures/observation/obs-401.xml +95 -0
  31. data/fixtures/observation/obs-402.xml +95 -0
  32. data/fixtures/observation/obs-403.xml +84 -0
  33. data/fixtures/observation/obs-404.xml +84 -0
  34. data/fixtures/observation/obs-405.xml +83 -0
  35. data/fixtures/observation/obs-406.xml +83 -0
  36. data/fixtures/observation/obs-407.xml +70 -0
  37. data/fixtures/observation/obs-408.xml +84 -0
  38. data/fixtures/observation/obs-uslab-example5.xml +102 -0
  39. data/fixtures/order/order-100.xml +61 -0
  40. data/fixtures/order/order-200.xml +61 -0
  41. data/fixtures/order/order-300.xml +61 -0
  42. data/fixtures/order/order-400.xml +61 -0
  43. data/fixtures/order_response/ordresp-100.xml +79 -0
  44. data/fixtures/order_response/ordresp-110.xml +79 -0
  45. data/fixtures/order_response/ordresp-200.xml +79 -0
  46. data/fixtures/order_response/ordresp-210.xml +79 -0
  47. data/fixtures/order_response/ordresp-300.xml +79 -0
  48. data/fixtures/order_response/ordresp-310.xml +79 -0
  49. data/fixtures/order_response/ordresp-400.xml +79 -0
  50. data/fixtures/order_response/ordresp-410.xml +79 -0
  51. data/fixtures/organization/org-uslab-example3.xml +49 -0
  52. data/fixtures/patient/patient-example-updated.xml +140 -0
  53. data/fixtures/patient/patient-example-us-extensions(us01).xml +81 -0
  54. data/fixtures/patient/patient-example.xml +132 -0
  55. data/fixtures/patient/patient-format-example.xml +101 -0
  56. data/fixtures/patient/patient-minimal.xml +9 -0
  57. data/fixtures/patient/patient-uslab-example1.xml +44 -0
  58. data/fixtures/practitioner/pract-uslab-example1.xml +18 -0
  59. data/fixtures/practitioner/pract-uslab-example3.xml +36 -0
  60. data/fixtures/record/condition-example-f201-fever.xml +63 -0
  61. data/fixtures/record/condition-example-f205-infection.xml +20 -0
  62. data/fixtures/record/diagnosticreport-example-f201-brainct.xml +18 -0
  63. data/fixtures/record/encounter-example-f201-20130404.xml +17 -0
  64. data/fixtures/record/encounter-example-f202-20130128.xml +17 -0
  65. data/fixtures/record/observation-example-f202-temperature.xml +60 -0
  66. data/fixtures/record/organization-example-f201-aumc.xml +5 -0
  67. data/fixtures/record/organization-example-f203-bumc.xml +5 -0
  68. data/fixtures/record/patient-example-f201-roel.xml +16 -0
  69. data/fixtures/record/practitioner-example-f201-ab.xml +14 -0
  70. data/fixtures/record/procedure-example-f201-tpf.xml +23 -0
  71. data/fixtures/scheduling/appointment-simple.xml +24 -0
  72. data/fixtures/scheduling/appointmentresponse-patient-simple.xml +12 -0
  73. data/fixtures/scheduling/appointmentresponse-practitioner-simple.xml +12 -0
  74. data/fixtures/scheduling/practitioner-simple.xml +10 -0
  75. data/fixtures/scheduling/schedule-simple.xml +12 -0
  76. data/fixtures/scheduling/slot-simple.xml +10 -0
  77. data/fixtures/specimen/spec-100.xml +65 -0
  78. data/fixtures/specimen/spec-400.xml +70 -0
  79. data/fixtures/specimen/spec-uslab-example1.xml +82 -0
  80. data/fixtures/validation/observation.profile.xml +2045 -0
  81. data/fixtures/validation/observations/observation-example(example).xml +50 -0
  82. data/lib/FHIR_structure.json +529 -0
  83. data/lib/daf_resource_generator.rb +94 -0
  84. data/lib/data/fhir_structure.rb +8 -0
  85. data/lib/data/resources.rb +138 -0
  86. data/lib/executor.rb +56 -0
  87. data/lib/ext/client.rb +27 -0
  88. data/lib/ext/client_reply.rb +19 -0
  89. data/lib/plan_executor.rb +31 -0
  90. data/lib/resource_generator.rb +656 -0
  91. data/lib/tasks/tasks.rake +329 -0
  92. data/lib/tasks/templates/summary.html.erb +163 -0
  93. data/lib/test_result.rb +69 -0
  94. data/lib/tests/assertions.rb +261 -0
  95. data/lib/tests/base_test.rb +117 -0
  96. data/lib/tests/suites/argonaut_resprint_1_test.rb +260 -0
  97. data/lib/tests/suites/argonaut_resprint_2_test.rb +369 -0
  98. data/lib/tests/suites/argonaut_resprint_3_test.rb +309 -0
  99. data/lib/tests/suites/argonaut_sprint_1_test.rb +187 -0
  100. data/lib/tests/suites/argonaut_sprint_2_test.rb +115 -0
  101. data/lib/tests/suites/argonaut_sprint_3_test.rb +208 -0
  102. data/lib/tests/suites/argonaut_sprint_4_test.rb +335 -0
  103. data/lib/tests/suites/argonaut_sprint_5_test.rb +196 -0
  104. data/lib/tests/suites/argonaut_sprint_6_test.rb +243 -0
  105. data/lib/tests/suites/argonaut_sprint_7_test.rb +161 -0
  106. data/lib/tests/suites/base_suite.rb +116 -0
  107. data/lib/tests/suites/connectathon_audit_track.rb +354 -0
  108. data/lib/tests/suites/connectathon_fetch_patient_record.rb +443 -0
  109. data/lib/tests/suites/connectathon_financial_track.rb +380 -0
  110. data/lib/tests/suites/connectathon_lab_order_track.rb +239 -0
  111. data/lib/tests/suites/connectathon_patient_track.rb +364 -0
  112. data/lib/tests/suites/connectathon_profile_validation.rb +101 -0
  113. data/lib/tests/suites/connectathon_scheduling_track.rb +266 -0
  114. data/lib/tests/suites/connectathon_terminology_track.rb +242 -0
  115. data/lib/tests/suites/daf_profiles_test.rb +431 -0
  116. data/lib/tests/suites/format_test.rb +453 -0
  117. data/lib/tests/suites/history_test.rb +311 -0
  118. data/lib/tests/suites/read_test.rb +104 -0
  119. data/lib/tests/suites/resource_test.rb +553 -0
  120. data/lib/tests/suites/search_test.rb +219 -0
  121. data/lib/tests/suites/search_test_robust.rb +172 -0
  122. data/lib/tests/suites/sprinkler_search_test.rb +660 -0
  123. data/lib/tests/suites/suite_engine.rb +114 -0
  124. data/lib/tests/suites/transaction_test.rb +571 -0
  125. data/lib/tests/testscripts/base_testscript.rb +480 -0
  126. data/lib/tests/testscripts/testscript_engine.rb +81 -0
  127. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Client Assigned Id/track1-patient-base-client-id-json.xml +348 -0
  128. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Client Assigned Id/track1-patient-base-client-id-xml.xml +348 -0
  129. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Client Assigned Id/track1-patient-bonus-client-id-json.xml +420 -0
  130. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Client Assigned Id/track1-patient-bonus-client-id-xml.xml +420 -0
  131. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/README.html +68 -0
  132. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Server Assigned Id/track1-patient-base-server-id-json.xml +352 -0
  133. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Server Assigned Id/track1-patient-base-server-id-xml.xml +352 -0
  134. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Server Assigned Id/track1-patient-bonus-server-id-json.xml +421 -0
  135. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Server Assigned Id/track1-patient-bonus-server-id-xml.xml +421 -0
  136. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/conformance/PatientConformance.xml +34 -0
  137. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-create-PeterChalmers-min.json +45 -0
  138. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-create-PeterChalmers-min.xml +26 -0
  139. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-create-PeterChalmers.json +100 -0
  140. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-create-PeterChalmers.xml +102 -0
  141. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-create-bonus-PeterChalmers-min.json +53 -0
  142. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-create-bonus-PeterChalmers-min.xml +30 -0
  143. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-create-bonus-PeterChalmers.json +108 -0
  144. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-create-bonus-PeterChalmers.xml +108 -0
  145. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-PeterChalmers-min.json +45 -0
  146. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-PeterChalmers-min.xml +26 -0
  147. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-PeterChalmers.json +100 -0
  148. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-PeterChalmers.xml +102 -0
  149. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-bonus1-PeterChalmers-min.json +53 -0
  150. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-bonus1-PeterChalmers-min.xml +30 -0
  151. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-bonus1-PeterChalmers.json +108 -0
  152. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-bonus1-PeterChalmers.xml +107 -0
  153. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-bonus2-PeterChalmers-min.json +53 -0
  154. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-bonus2-PeterChalmers-min.xml +31 -0
  155. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-bonus2-PeterChalmers.json +108 -0
  156. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-bonus2-PeterChalmers.xml +106 -0
  157. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/C-CDA_R2-1_CCD-ussg.xml +3414 -0
  158. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-A1-empty-on-instance.xml +9 -0
  159. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-A2-empty-by-ref.xml +15 -0
  160. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-A3-empty-by-identifier.xml +13 -0
  161. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-A4-empty-by-contained.xml +15 -0
  162. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-B1-CCDA-on-instance.xml +15 -0
  163. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-B2-CCDA-by-ref.xml +21 -0
  164. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-B3-CCDA-by-identifier.xml +19 -0
  165. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-B4-CCDA-by-contained.xml +21 -0
  166. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/questionnaire-sdc-profile-example-ussg-fht.xml +3905 -0
  167. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/questionnaireresponse-expected-ussg-fht-CCDA.xml +190 -0
  168. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/questionnaireresponse-expected-ussg-fht-empty.xml +177 -0
  169. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/track11-sdc-prepop-xml.xml +142 -0
  170. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Expand/Client Assigned Id/track2-ts-suite1-expand-client-id.xml +925 -0
  171. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Expand/Client Assigned Id/track2-ts-suite2-expand-filter-client-id.xml +930 -0
  172. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Expand/Server Assigned Id/track2-ts-suite1-expand-server-id.xml +953 -0
  173. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Expand/Server Assigned Id/track2-ts-suite2-expand-filter-server-id.xml +958 -0
  174. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Lookup/track2-ts-suite5-loinc-lookup-xml.xml +224 -0
  175. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Lookup/track2-ts-suite5-snomed-lookup-xml.xml +224 -0
  176. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/README.html +85 -0
  177. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Translate/track2-ts-suite6-translate-xml.xml +224 -0
  178. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Validate-code/Client Assigned Id/track2-ts-suite3-validate-code-client-id.xml +1807 -0
  179. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Validate-code/Client Assigned Id/track2-ts-suite4-validate-code-client-id.xml +714 -0
  180. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Validate-code/Server Assigned Id/track2-ts-suite3-validate-code-server-id.xml +1835 -0
  181. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Validate-code/Server Assigned Id/track2-ts-suite4-validate-code-server-id.xml +742 -0
  182. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/conformance/ConceptMapSuite6Conformance.xml +11 -0
  183. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/conformance/ValueSetSuite1Conformance.xml +17 -0
  184. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/conformance/ValueSetSuite2Conformance.xml +17 -0
  185. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/conformance/ValueSetSuite3Conformance.xml +14 -0
  186. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/conformance/ValueSetSuite4Conformance.xml +14 -0
  187. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/conformance/ValueSetSuite5Conformance.xml +11 -0
  188. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/extensional-case-1-input-4-2-a.xml +11 -0
  189. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/extensional-case-1-input-4-2-b.xml +11 -0
  190. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/extensional-case-1-input-4-3-a.xml +13 -0
  191. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/extensional-case-1-input-4-3-b.xml +13 -0
  192. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/extensional-case-1-input-4-4-a.xml +15 -0
  193. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/extensional-case-1-input-4-4-b.xml +15 -0
  194. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/lookup-loinc-input-5-2.xml +10 -0
  195. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/lookup-loinc-input-5-3.xml +11 -0
  196. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/lookup-snomed-input-5-2.xml +10 -0
  197. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/lookup-snomed-input-5-3.xml +11 -0
  198. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/translate-conceptmap-input-6-2.xml +14 -0
  199. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/translate-conceptmap-input-6-3.xml +15 -0
  200. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-1-expand-min.xml +47 -0
  201. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-1-filter-min.xml +23 -0
  202. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-2-expand-min.xml +132 -0
  203. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-2-filter-min.xml +38 -0
  204. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-3-expand-min.xml +252 -0
  205. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-3-filter-min.xml +58 -0
  206. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-4-expand-min.xml +57 -0
  207. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-4-filter-min.xml +28 -0
  208. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/intensional-case-1-expand-min.xml +347 -0
  209. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/intensional-case-1-filter-min.xml +33 -0
  210. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/intensional-case-2-expand-min.xml +637 -0
  211. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/intensional-case-2-filter-min.xml +33 -0
  212. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/intensional-case-3-filter-min.xml +58 -0
  213. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/lookup-loinc-min.xml +11 -0
  214. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/lookup-snomed-min.xml +11 -0
  215. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/suite3-invalid-min.xml +10 -0
  216. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/suite3-valid-min.xml +7 -0
  217. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/suite4-invalid-min.xml +10 -0
  218. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/suite4-valid-min.xml +7 -0
  219. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/translate-conceptmap-min.xml +17 -0
  220. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/extensional-case-1.xml +55 -0
  221. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/extensional-case-2.xml +122 -0
  222. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/extensional-case-3.xml +222 -0
  223. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/extensional-case-4.xml +65 -0
  224. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/intensional-case-1.xml +31 -0
  225. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/intensional-case-2.xml +31 -0
  226. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/intensional-case-3.xml +31 -0
  227. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/translate-conceptmap-case-1.xml +145 -0
  228. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/conformance/DecisionSupportServiceModule-Evaluate.xml +17 -0
  229. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-incomplete-request-payload.xml +26 -0
  230. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-incomplete-response-min-payload.xml +7 -0
  231. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-incomplete-response-payload.xml +332 -0
  232. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-malformed-request-payload.xml +28 -0
  233. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-malformed-response-min-payload.xml +7 -0
  234. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-malformed-response-payload.xml +20 -0
  235. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-request-payload.xml +28 -0
  236. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-response-min-payload.xml +7 -0
  237. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-response-payload.xml +332 -0
  238. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-unauthorized-request-payload.xml +28 -0
  239. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-unauthorized-response-min-payload.xml +7 -0
  240. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-unauthorized-response-payload.xml +8 -0
  241. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/gao-assessment-request-payload.xml +176 -0
  242. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/gao-assessment-response-payload-min.xml +32 -0
  243. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/gao-assessment-response-payload.xml +80 -0
  244. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/track3-cds-evaluate-cdc-immunization.xml +290 -0
  245. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/track3-cds-evaluate-gao-profile.xml +110 -0
  246. data/lib/tests/testscripts/xml/Connectathon11/Track6-FHIR-Genomics/Client_Assigned_Id/TestScript_FHIR-Genomics.xml +170 -0
  247. data/lib/tests/testscripts/xml/Connectathon11/Track6-FHIR-Genomics/_reference/resources/sequence-example-1.xml +31 -0
  248. data/lib/tests/testscripts/xml/Connectathon11/Track6-FHIR-Genomics/_reference/resources/sequence-example-2.xml +31 -0
  249. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Actors.png +0 -0
  250. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Client_Assigned_Id/track7-laborder100-xml.xml +590 -0
  251. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Client_Assigned_Id/track7-laborder200-xml.xml +587 -0
  252. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Client_Assigned_Id/track7-laborder300-xml.xml +612 -0
  253. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Client_Assigned_Id/track7-laborder400-xml.xml +635 -0
  254. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Peer-to-Peer/track7-laborder100-peer2peer-xml.xml +752 -0
  255. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Thumbs.db +0 -0
  256. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/conformance/LabOrderLabReport-CreateDeleteReadUpdate.xml +187 -0
  257. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/conformance/html.xslt +45 -0
  258. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-100-update.xml +64 -0
  259. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-100.xml +64 -0
  260. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-200-update.xml +121 -0
  261. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-200.xml +121 -0
  262. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-300-update.xml +91 -0
  263. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-300.xml +91 -0
  264. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-400-update.xml +88 -0
  265. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-400.xml +88 -0
  266. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticReport/dr-100.xml +96 -0
  267. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticReport/dr-200.xml +125 -0
  268. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticReport/dr-300.xml +132 -0
  269. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticReport/dr-400.xml +121 -0
  270. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-100.xml +58 -0
  271. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-101.xml +58 -0
  272. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-200.xml +125 -0
  273. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-300.xml +106 -0
  274. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-301.xml +106 -0
  275. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-302.xml +106 -0
  276. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-303.xml +106 -0
  277. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-304.xml +106 -0
  278. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-400.xml +87 -0
  279. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-401.xml +95 -0
  280. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-402.xml +95 -0
  281. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-403.xml +84 -0
  282. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-404.xml +84 -0
  283. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-405.xml +83 -0
  284. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-406.xml +83 -0
  285. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-407.xml +70 -0
  286. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-408.xml +84 -0
  287. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-uslab-example5.xml +102 -0
  288. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Order/order-100.xml +61 -0
  289. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Order/order-200.xml +61 -0
  290. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Order/order-300.xml +61 -0
  291. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Order/order-400.xml +61 -0
  292. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-100.xml +79 -0
  293. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-110.xml +79 -0
  294. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-200.xml +79 -0
  295. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-210.xml +79 -0
  296. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-300.xml +79 -0
  297. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-310.xml +79 -0
  298. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-400.xml +79 -0
  299. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-410.xml +79 -0
  300. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Organization/org-uslab-example3.xml +49 -0
  301. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Patient/patient-uslab-example1.xml +44 -0
  302. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Practitioner/pract-uslab-example1.xml +18 -0
  303. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Practitioner/pract-uslab-example3.xml +36 -0
  304. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Specimen/Thumbs.db +0 -0
  305. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Specimen/spec-100.xml +65 -0
  306. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Specimen/spec-400.xml +70 -0
  307. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Specimen/spec-uslab-example1.xml +82 -0
  308. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Testscript 1 Document.txt +122 -0
  309. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Testscript 2 Document.txt +103 -0
  310. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Testscript 3 Document.txt +201 -0
  311. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Testscript 4 Document.txt +310 -0
  312. data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/_reference/conformance/MedicationStatementCreate.xml +11 -0
  313. data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/_reference/conformance/PatientSearchType.xml +15 -0
  314. data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/_reference/resources/medicationstatement-create.json +39 -0
  315. data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/_reference/resources/medicationstatement-patch.json +3 -0
  316. data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/track9-patch-medicationstatement-json-if-match.xml +321 -0
  317. data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/track9-patch-medicationstatement-json.xml +303 -0
  318. data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/track9-patch-peer2peer-patient-json.xml +235 -0
  319. data/plan_executor.gemspec +14 -0
  320. data/test/fixtures/diagnostic_bundle.xml +51 -0
  321. data/test/fixtures/lab_results_bundle.xml +49 -0
  322. data/test/fixtures/observation_bundle.json +61 -0
  323. data/test/fixtures/testscript-example.xml +202 -0
  324. data/test/fixtures/testscript-history.xml +143 -0
  325. data/test/fixtures/testscript-readtest.xml +272 -0
  326. data/test/fixtures/testscript-search.xml +282 -0
  327. data/test/fixtures/testscript-update.xml +147 -0
  328. data/test/fixtures/vital_signs_bundle.xml +117 -0
  329. data/test/test_helper.rb +8 -0
  330. data/test/unit/argonaut_sprint6_test.rb +31 -0
  331. data/test/unit/argonaut_sprint7_test.rb +21 -0
  332. data/test/unit/basic_test.rb +27 -0
  333. data/test/unit/fetch_patient_record_test.rb +357 -0
  334. data/test/unit/financial_test.rb +41 -0
  335. data/test/unit/fixtures_test.rb +45 -0
  336. data/test/unit/metadata_test.rb +33 -0
  337. metadata +394 -0
@@ -0,0 +1,369 @@
1
+ module Crucible
2
+ module Tests
3
+ class ArgonautResprint2Test < BaseSuite
4
+ attr_accessor :rc
5
+ attr_accessor :conformance
6
+ attr_accessor :patient_id
7
+
8
+ def id
9
+ 'ArgonautResprint2Test'
10
+ end
11
+
12
+ def description
13
+ 'In Re-Sprint 2, we\'ll get up to speed on Argonaut\'s updated implementation guidance for Vital Signs and Laboratory Results, while also introducing the Smoking Status Observation and CareTeam resources.'
14
+ end
15
+
16
+ def details
17
+ {
18
+ 'Overview' => 'Since the Argonaut Implementation Program began in 2015, we\'ve come a long way. We\'ve gained early implementation experience working with FHIR DSTU2 and the Data Access Framework profiles — and we\'ve produced updated guidance based on this experience. We\'re running a series of "Re-Sprints" with three goals: ensure we have a chance to battle-test our latest "best practices" in time for MU3; help existing Argonaut implementers come up to speed; and provide an easy on-ramp for new Argonaut implementers.',
19
+ 'Instructions' => 'If you\'re working on a server, please complete the "servers" tab of the Sprints Spreadsheet. You\'ll need to update the status flag to indicate whether you\'ve begun work (or completed work), so clients will know when to start testing. You\'ll also share details about how a developer can obtain OAuth client credentials (client_id for public apps, or a client_id and client_secret for confidential apps) as well as user login credentials. You might consider simply sharing a set of fixed credentials in this spreadsheet, or else directing users to a web page where they can complete self-service registration. If absolutely necessary, you can ask developers to e-mail you directly. If you\'re working on a client, please complete the "clients" tab of the Sprints Spreadsheet. You\'ll also need to update the status flag to indicate whether you\'ve begun work (or completed work).',
20
+ 'FHIR API Calls' => 'For this sprint, EHRs should focus on the following FHIR Resources: Observation, DiagnosticReport, and CareTeam.'
21
+ }
22
+ end
23
+
24
+ def initialize(client1, client2=nil)
25
+ super(client1, client2)
26
+ @rc = FHIR::Patient
27
+ @tags.append('argonaut')
28
+ @category = {id: 'argonaut', title: 'Argonaut'}
29
+ @loinc_codes = ['8716-3', '9279-1', '8867-4', '59408-5', '8310-5', '8302-2', '8306-3', '8287-5', '29463-7', '39156-5', '55284-4', '8480-6', '8462-4']
30
+ @loinc_code_units = {'8716-3' => nil, '9279-1' => '/min', '8867-4' => '/min', '59408-5' => '%', '8310-5' => 'Cel', '8302-2' => 'cm', '8306-3' => 'cm', '8287-5' => 'cm', '29463-7' => 'g, kg', '39156-5' => 'kg/m2', '55284-4' => nil, '8480-6' => 'mm[Hg]', '8462-4' => 'mm[Hg]'}
31
+ @smoking_codes = ['449868002', '428041000124106', '8517006', '266919005', '77176002', '266927001', '428071000124103', '428061000124105']
32
+ end
33
+
34
+ def setup
35
+ if !@client.client.try(:params).nil? && @client.client.params['patient']
36
+ @patient_id = @client.client.params['patient']
37
+ end
38
+ end
39
+
40
+ test 'ARS201', 'Get patient by ID' do
41
+ metadata {
42
+ links "#{REST_SPEC_LINK}#read"
43
+ requires resource: "Patient", methods: ["read", "search"]
44
+ validates resource: "Patient", methods: ["read", "search"]
45
+ }
46
+
47
+ begin
48
+ options = {
49
+ :search => {
50
+ :flag => true,
51
+ :compartment => nil,
52
+ :parameters => {
53
+ _count: 1
54
+ }
55
+ }
56
+ }
57
+ @patient_id ||= @client.search(@rc, options).resource.entry.first.resource.xmlId
58
+ rescue NoMethodError
59
+ @patient_id = nil
60
+ end
61
+
62
+ skip if !@patient_id
63
+
64
+ reply = @client.read(FHIR::Patient, @patient_id)
65
+ assert_response_ok(reply)
66
+ assert_equal @patient_id, reply.id, 'Server returned wrong patient.'
67
+ @patient = reply.resource
68
+ assert @patient, "could not get patient by id: #{@patient_id}"
69
+ warning { assert_valid_resource_content_type_present(reply) }
70
+ warning { assert_last_modified_present(reply) }
71
+ end
72
+
73
+ test 'ARS202', 'GET vital-sign Observations with Patient ID' do
74
+ metadata {
75
+ links "#{REST_SPEC_LINK}#search"
76
+ requires resource: "Observation", methods: ["read", "search"]
77
+ validates resource: "Observation", methods: ["read", "search"]
78
+ }
79
+
80
+ skip if !@patient_id
81
+
82
+ options = {
83
+ search: {
84
+ flag: false,
85
+ compartment: nil,
86
+ parameters: {
87
+ patient: @patient_id,
88
+ category: 'vital-signs'
89
+ }
90
+ }
91
+ }
92
+
93
+ reply = @client.search(FHIR::Observation, options)
94
+
95
+ validate_vitalsign_reply(reply)
96
+ end
97
+
98
+ test 'ARS203', 'GET coded Observation with Patient ID' do
99
+ metadata {
100
+ links "#{REST_SPEC_LINK}#search"
101
+ requires resource: "Observation", methods: ["read", "search"]
102
+ validates resource: "Observation", methods: ["read", "search"]
103
+ }
104
+
105
+ skip if !@patient_id
106
+
107
+ options = {
108
+ search: {
109
+ flag: false,
110
+ compartment: nil,
111
+ parameters: {
112
+ patient: @patient_id,
113
+ code: @loinc_codes.join(',')
114
+ }
115
+ }
116
+ }
117
+
118
+ reply = @client.search(FHIR::Observation, options)
119
+
120
+ validate_vitalsign_reply(reply)
121
+ end
122
+
123
+ test 'ARS204', 'GET coded Observation with Patient ID' do
124
+ metadata {
125
+ links "#{REST_SPEC_LINK}#search"
126
+ requires resource: "Observation", methods: ["read", "search"]
127
+ validates resource: "Observation", methods: ["read", "search"]
128
+ }
129
+
130
+ skip if !@patient_id
131
+
132
+ options = {
133
+ search: {
134
+ flag: false,
135
+ compartment: nil,
136
+ parameters: {
137
+ patient: patient_id,
138
+ category: 'laboratory'
139
+ }
140
+ }
141
+ }
142
+
143
+ reply = @client.search(FHIR::Observation, options)
144
+
145
+ validate_lab_reply(reply)
146
+ end
147
+
148
+ test 'ARS205', 'GET DiagnosticReport with Patient ID' do
149
+ metadata {
150
+ links "#{REST_SPEC_LINK}#search"
151
+ requires resource: "DiagnosticReport", methods: ["read", "search"]
152
+ validates resource: "DiagnosticReport", methods: ["read", "search"]
153
+ }
154
+
155
+ skip if !@patient_id
156
+
157
+ options = {
158
+ search: {
159
+ flag: false,
160
+ compartment: nil,
161
+ parameters: {
162
+ patient: patient_id,
163
+ category: 'LAB'
164
+ }
165
+ }
166
+ }
167
+
168
+ reply = @client.search(FHIR::DiagnosticReport, options)
169
+
170
+ validate_diagnostic_report_reply(reply)
171
+ end
172
+
173
+ test 'ARS206', 'GET Smoking Status Observation with patient ID' do
174
+ metadata {
175
+ links "#{REST_SPEC_LINK}#search"
176
+ requires resource: 'Observation', methods: ['read', 'search']
177
+ validates resource: 'Observation', methods: ['read', 'search']
178
+ }
179
+
180
+ skip if !@patient_id
181
+
182
+ options = {
183
+ search: {
184
+ flag: false,
185
+ compartment: nil,
186
+ parameters: {
187
+ patient: @patient_id,
188
+ code: '72166-2'
189
+ }
190
+ }
191
+ }
192
+
193
+ reply = @client.search(FHIR::Observation, options)
194
+
195
+ validate_smoking_status_reply(reply)
196
+ end
197
+
198
+ test 'ARS207', 'GET CarePlan with patient ID' do
199
+ metadata {
200
+ links "#{REST_SPEC_LINK}#search"
201
+ requires resource: 'CarePlan', methods: ['read', 'search']
202
+ validates resource: 'CarePlan', methods: ['read', 'search']
203
+ }
204
+
205
+ skip if !@patient_id
206
+
207
+ options = {
208
+ search: {
209
+ flag: false,
210
+ compartment: nil,
211
+ parameters: {
212
+ patient: @patient_id,
213
+ category: 'careteam',
214
+ status: 'active'
215
+ }
216
+ }
217
+ }
218
+
219
+ reply = @client.search(FHIR::CarePlan, options)
220
+
221
+ validate_care_plan_reply(reply)
222
+ end
223
+
224
+ private
225
+
226
+ def validate_care_plan_reply(reply)
227
+ assert_response_ok(reply)
228
+
229
+ valid_care_plans_count = 0
230
+
231
+ reply.resource.entry.each do |entry|
232
+ careplan = entry.resource
233
+ if careplan.category.to_a.find { |cat| cat.coding.to_a.find { |c| c.system == "http://argonaut.hl7.org/ValueSet/extension-codes" && c.code == 'careteam' } }
234
+ valid_care_plans_count += 1
235
+ assert careplan.subject
236
+ assert_equal careplan.subject.reference, "Patient/#{@patient_id}", "Expected patient #{@patient_id} did not match CarePlan Subject #{careplan.subject.reference}"
237
+ careplan.participant.each do |participant|
238
+ assert participant.role, "Participant '#{participant.id}' does not have a role"
239
+ assert participant.member.display, "Participant '#{participant.id}' does not have a complete name in Participant.member.display"
240
+ end
241
+ end
242
+ end
243
+
244
+ warning { assert valid_care_plans_count > 0, "No care team CarePlans were found for this patient" }
245
+ skip unless valid_care_plans_count > 0
246
+
247
+ end
248
+
249
+ def validate_smoking_status_reply(reply)
250
+ assert_response_ok(reply)
251
+
252
+ valid_smoking_status_count = 0
253
+
254
+ reply.resource.entry.each do |entry|
255
+ observation = entry.resource
256
+ if observation.code.coding.to_a.find { |c| c.system == 'http://loinc.org' && c.code == '72166-2' }
257
+ valid_smoking_status_count += 1
258
+ assert !observation.status.empty?
259
+ assert observation.subject
260
+ assert_equal observation.subject.reference, "Patient/#{@patient_id}"
261
+ assert observation.issued, "No instant available in observation '#{observation.xmlId}'s' 'issued' field"
262
+ assert observation.valueCodeableConcept "No codeableConcept specified for Observation '#{observation.xmlId}''"
263
+ assert observation.valueCodeableConcept.coding.to_a.find{|c|@smoking_codes.include?(c.code)}, "Observation valueCodeableConcept #{observation.valueCodeableConcept.to_fhir_json} isn't part of DAF Smoking Status Value Set"
264
+ end
265
+ end
266
+
267
+ warning { assert valid_smoking_status_count > 0, "No smoking status Observations were found for this patient" }
268
+ skip unless valid_smoking_status_count > 0
269
+ end
270
+
271
+ def validate_vitalsign_reply(reply)
272
+ assert_response_ok(reply)
273
+
274
+ valid_observation_count = 0
275
+
276
+ reply.resource.entry.each do |entry|
277
+ observation = entry.resource
278
+ if observation.category.nil?
279
+ warning { assert observation.category, "An observation did not have a category"}
280
+ next
281
+ end
282
+ if observation.category.coding.to_a.find { |c| c.code == "vital-signs" }
283
+ valid_observation_count += 1
284
+ assert !observation.status.empty?
285
+ assert observation.category
286
+ assert observation.category.coding.to_a.find { |c| c.system == "http://hl7.org/fhir/observation-category" }, "Wrong category codeSystem used, expected FHIR ObservationCategory"
287
+ assert observation.subject
288
+ assert get_value(observation) || observation.dataAbsentReason || !observation.component.blank?
289
+ coding = observation.code.coding.first
290
+ assert coding.system == "http://loinc.org", "The observation is coded using the wrong code system, is #{coding.system}, should be LOINC"
291
+ warning { assert @loinc_codes.index(coding.code), "The code included in an Observation doesn't match any in the code lists provided by the Argonaut project" }
292
+ if @loinc_code_units[coding.code] && get_value(observation)
293
+ value = get_value(observation)
294
+ if value.respond_to? :unit
295
+ assert_equal @loinc_code_units[coding.code], value.unit, "The unit of the observation is not correct."
296
+ end
297
+ end
298
+ # systolic and diastolic in components
299
+ if coding.code == '55284-4'
300
+ assert observation.component.length >= 2, "expected at least 2 components for combined blood pressure grouping structure"
301
+ systolic = observation.component.to_a.find {|component| component.code.coding.first.code == '8480-6'}
302
+ diastolic = observation.component.to_a.find {|component| component.code.coding.first.code == '8462-4'}
303
+ assert !systolic.blank?, "could not find a systolic blood pressure on a bp grouping vital sign observation"
304
+ assert !diastolic.blank?, "could not find a diastolic blood pressure on a bp grouping vital sign observation"
305
+ assert get_value(systolic), "systolic blood pressure did not have a value"
306
+ assert_equal 'mmHg', get_value(systolic).unit, "The unit of the systolic blood pressure is not correct."
307
+ assert get_value(diastolic), "systolic blood pressure did not have a value"
308
+ assert_equal 'mmHg', get_value(diastolic).unit, "The unit of the systolic blood pressure is not correct."
309
+ end
310
+
311
+ end
312
+ end
313
+ warning { assert valid_observation_count > 0, "No vital signs Observations were found for this patient" }
314
+ skip unless valid_observation_count > 0
315
+ end
316
+
317
+ def validate_diagnostic_report_reply(reply)
318
+ assert_response_ok(reply)
319
+
320
+ reply.resource.entry.each do |entry|
321
+ report = entry.resource
322
+
323
+ assert report.category, "DiagnosticReport has no category"
324
+ assert report.category.coding.each do |c|
325
+ assert c.code=='LAB',"Category code should be 'LAB'"
326
+ end
327
+ assert report.status, "No status for DiagnosticReport"
328
+ assert report.code, "DiagnosticReport has no code"
329
+ assert report.subject, "DiagnosticReport has no subject"
330
+ assert report.effectivePeriod? || report.effectiveDateTime?, "DiagnosticReport has no effective date/time"
331
+ assert report.issued, "DiagnosticReport has no issued"
332
+ assert report.performer, "DiagnosticReport has no performer"
333
+ assert report.result, "DiagnosticReport has no results"
334
+ end
335
+ end
336
+
337
+ def validate_lab_reply(reply)
338
+ assert_response_ok(reply)
339
+
340
+ valid_observation_count = 0
341
+
342
+ reply.resource.entry.each do |entry|
343
+ observation = entry.resource
344
+ if observation.category.nil?
345
+ warning { assert observation.category, "An observation did not have a category"}
346
+ next
347
+ end
348
+ if observation.category.coding.to_a.find { |c| c.code == "laboratory" }
349
+ valid_observation_count += 1
350
+ assert !observation.status.empty?
351
+ assert observation.category
352
+ assert observation.category.coding.to_a.find{ |c| c.system == "http://hl7.org/fhir/observation-category" }, "Wrong category codeSystem used, expected FHIR ObservationCategory"
353
+ assert observation.subject
354
+ assert get_value(observation) || observation.dataAbsentReason
355
+ coding = observation.code.coding.first
356
+ assert coding.system == "http://loinc.org", "The observation is coded using the wrong code system, is #{coding.system}, should be LOINC"
357
+ end
358
+ end
359
+ warning { assert valid_observation_count > 0, "No laboratory Observations were found for this patient" }
360
+ skip unless valid_observation_count > 0
361
+ end
362
+
363
+ def get_value(observation)
364
+ observation.valueQuantity || observation.valueCodeableConcept || observation.valueString || observation.valueRange || observation.valueRatio || observation.valueSampledData || observation.valueAttachment || observation.valueTime || observation.valueDateTime || observation.valuePeriod
365
+ end
366
+
367
+ end
368
+ end
369
+ end
@@ -0,0 +1,309 @@
1
+ module Crucible
2
+ module Tests
3
+ class ArgonautResprint3Test < BaseSuite
4
+ attr_accessor :rc
5
+ attr_accessor :conformance
6
+ attr_accessor :searchParams
7
+ attr_reader :canSearchById
8
+ attr_accessor :patient_id
9
+
10
+ def id
11
+ 'ArgonautResprint3Test'
12
+ end
13
+
14
+ def description
15
+ 'In Re-Sprint 3, we\'ll get up to speed on Argonaut\'s updated implementation guidance for: Medications, Immunizations, Goals, and UDI.'
16
+ end
17
+
18
+ def details
19
+ {
20
+ 'Overview' => 'Since the Argonaut Implementation Program began in 2015, we\'ve come a long way. We\'ve gained early implementation experience working with FHIR DSTU2 and the Data Access Framework profiles — and we\'ve produced updated guidance based on this experience. We\'re running a series of "Re-Sprints" with three goals: ensure we have a chance to battle-test our latest "best practices" in time for MU3; help existing Argonaut implementers come up to speed; and provide an easy on-ramp for new Argonaut implementers.',
21
+ 'Instructions' => 'If you\'re working on a server, please complete the "servers" tab of the Sprints Spreadsheet. You\'ll need to update the status flag to indicate whether you\'ve begun work (or completed work), so clients will know when to start testing. You\'ll also share details about how a developer can obtain OAuth client credentials (client_id for public apps, or a client_id and client_secret for confidential apps) as well as user login credentials. You might consider simply sharing a set of fixed credentials in this spreadsheet, or else directing users to a web page where they can complete self-service registration. If absolutely necessary, you can ask developers to e-mail you directly. If you\'re working on a client, please complete the "clients" tab of the Sprints Spreadsheet. You\'ll also need to update the status flag to indicate whether you\'ve begun work (or completed work).',
22
+ 'FHIR API Calls' => 'For this sprint, EHRs should focus on the following FHIR Resources: MedicationStatement, MedicationOrder, Immunization, Goal, and Device'
23
+ }
24
+ end
25
+
26
+ def initialize(client1, client2=nil)
27
+ super(client1, client2)
28
+ @rc = FHIR::Patient
29
+ @tags.append('argonaut')
30
+ @category = {id: 'argonaut', title: 'Argonaut'}
31
+ @status_codes = ['active', 'unconfirmed', 'confirmed', 'inactive', 'resolved', 'refuted', 'entered-in-error']
32
+ end
33
+
34
+ def setup
35
+ if !@client.client.try(:params).nil? && @client.client.params['patient']
36
+ @patient_id = @client.client.params['patient']
37
+ end
38
+ end
39
+
40
+ test 'ARS301', 'Get patient by ID' do
41
+ metadata {
42
+ links "#{REST_SPEC_LINK}#read"
43
+ requires resource: "Patient", methods: ["read", "search"]
44
+ validates resource: "Patient", methods: ["read", "search"]
45
+ }
46
+
47
+ begin
48
+ options = {
49
+ :search => {
50
+ :flag => true,
51
+ :compartment => nil,
52
+ :parameters => {
53
+ _count: 1
54
+ }
55
+ }
56
+ }
57
+ @patient_id ||= @client.search(@rc, options).resource.entry.first.resource.xmlId
58
+ rescue NoMethodError
59
+ @patient = nil
60
+ end
61
+
62
+ skip unless @patient_id
63
+
64
+ reply = @client.read(FHIR::Patient, @patient_id)
65
+ assert_response_ok(reply)
66
+ assert_equal @patient_id.to_s, reply.id.to_s, 'Server returned wrong patient.'
67
+ @patient = reply.resource
68
+ assert @patient, "could not get patient by id: #{@patient_id}"
69
+ warning { assert_valid_resource_content_type_present(reply) }
70
+ warning { assert_last_modified_present(reply) }
71
+ end
72
+
73
+ test 'ARS302', 'GET MedicationOrder with Patient ID' do
74
+ metadata {
75
+ links "#{REST_SPEC_LINK}#search"
76
+ requires resource: "MedicationOrder", methods: ["read", "search"]
77
+ validates resource: "MedicationOrder", methods: ["read", "search"]
78
+ }
79
+
80
+ skip if !@patient_id
81
+
82
+ options = {
83
+ search: {
84
+ flag: false,
85
+ compartment: nil,
86
+ parameters: {
87
+ patient: @patient_id
88
+ }
89
+ }
90
+ }
91
+
92
+ reply = @client.search(FHIR::MedicationOrder, options)
93
+
94
+ assert_response_ok(reply)
95
+
96
+ valid_entries = 0
97
+
98
+ reply.resource.entry.each do |entry|
99
+ med = entry.resource
100
+ assert med.dateWritten, "MedicationOrder '#{med.xmlId}' does not have a dateWritten"
101
+ assert med.medicationCodeableConcept || med.medicationReference, "MedicationOrder '#{med.xmlId}' does not have an embedded Medication"
102
+ assert med.status && !med.status.empty?, "MedicationOrder '#{med.xmlId}' must have a non-blank status"
103
+ assert med.patient.reference == "Patient/#{@patient_id}", "MedicationOrder '#{med.xmlId}' patient (#{med.patient.reference}) doesn't match the specified patient (Patient/#{@patient_id}})"
104
+ assert med.prescriber, "MedicationOrder '#{med.xmlId}' does not have a prescriber"
105
+ valid_entries += 1
106
+ end
107
+
108
+ warning { assert valid_entries > 0, "No MedicationOrders were found for patient #{@patient_id}" }
109
+ skip unless valid_entries > 0
110
+ end
111
+
112
+ test 'ARS303', 'GET MedicationStatement with Patient ID' do
113
+ metadata {
114
+ links "#{REST_SPEC_LINK}#search"
115
+ requires resource: "MedicationStatement", methods: ["read", "search"]
116
+ validates resource: "MedicationStatement", methods: ["read", "search"]
117
+ }
118
+
119
+ skip if !@patient_id
120
+
121
+ options = {
122
+ search: {
123
+ flag: false,
124
+ compartment: nil,
125
+ parameters: {
126
+ patient: @patient_id
127
+ }
128
+ }
129
+ }
130
+
131
+ reply = @client.search(FHIR::MedicationStatement, options)
132
+
133
+ assert_response_ok(reply)
134
+
135
+ valid_entries = 0
136
+
137
+ reply.resource.entry.each do |entry|
138
+ # Note: haven't been able to find a server that supports MedicationStatement and has a patient with it.
139
+ med = entry.resource
140
+ assert med.effectiveDateTime || med.effectivePeriod, "MedicationStatement '#{med.xmlId} 'does not have an effective date or period"
141
+ assert med.medicationCodeableConcept || med.medicationReference, "MedicationStatement '#{med.xmlId}' does not have an embedded Medication"
142
+ assert med.status && !med.status.empty?, "MedicationStatement '#{med.xmlId}' must have a non-blank status"
143
+ assert med.patient.reference == "Patient/#{@patient_id}", "MedicationStatement '#{med.xmlId}' patient (#{med.patient.reference}) doesn't match the specified patient (Patient/#{@patient_id}})"
144
+ valid_entries += 1
145
+ end
146
+
147
+ warning { assert valid_entries > 0, "No MedicationStatements were found for patient #{@patient_id}" }
148
+ skip unless valid_entries > 0
149
+ end
150
+
151
+ test 'ARS304', 'GET Immunization with Patient ID' do
152
+ metadata {
153
+ links "#{REST_SPEC_LINK}#search"
154
+ requires resource: "Immunization", methods: ["read", "search"]
155
+ validates resource: "Immunization", methods: ["read", "search"]
156
+ }
157
+
158
+ skip if !@patient_id
159
+
160
+ options = {
161
+ search: {
162
+ flag: false,
163
+ compartment: nil,
164
+ parameters: {
165
+ patient: @patient_id
166
+ }
167
+ }
168
+ }
169
+
170
+ reply = @client.search(FHIR::Immunization, options)
171
+
172
+ assert_response_ok(reply)
173
+
174
+ valid_entries = 0
175
+
176
+ reply.resource.entry.each do |entry|
177
+ imm = entry.resource
178
+ assert imm.date, "Immunization '#{imm.xmlId}' does not have an administration date"
179
+ assert imm.status && !imm.status.empty?, "Immunization '#{imm.xmlId}' must have a non-blank status"
180
+ assert imm.patient.reference == "Patient/#{@patient_id}", "Immunization '#{imm.xmlId}' patient (#{imm.patient.reference}) doesn't match the specified patient (Patient/#{@patient_id})"
181
+ assert imm.wasNotGiven != nil, "Immunization '#{imm.xmlId}' does not have a boolean value in 'wasNotGiven'"
182
+ assert imm.reported != nil, "Immunization '#{imm.xmlId}' does not have a boolean value in 'reported'"
183
+ assert imm.vaccineCode, "Immunization '#{imm.xmlId}' does not have a code value in vaccineCode"
184
+ #can't check whether vaccineCode is in the DAF CVX valueSet, because that valueSet has no codes in it.
185
+ valid_entries += 1
186
+ end
187
+
188
+ warning { assert valid_entries > 0, "No Immunizations were found for patient #{@patient_id}" }
189
+ skip unless valid_entries > 0
190
+ end
191
+
192
+ test 'ARS305', 'GET Goals with Patient ID' do
193
+ metadata {
194
+ links "#{REST_SPEC_LINK}#search"
195
+ requires resource: "Goal", methods: ["read", "search"]
196
+ validates resource: "Goal", methods: ["read", "search"]
197
+ }
198
+
199
+ skip if !@patient_id
200
+
201
+ options = {
202
+ search: {
203
+ flag: false,
204
+ compartment: nil,
205
+ parameters: {
206
+ patient: @patient_id
207
+ }
208
+ }
209
+ }
210
+
211
+ reply = @client.search(FHIR::Goal, options)
212
+
213
+ assert_response_ok(reply)
214
+
215
+ valid_entries = 0
216
+
217
+ reply.resource.entry.each do |entry|
218
+ med = entry.resource
219
+ assert med.status && !med.status.empty?, "Goal '#{med.xmlId}' must have a non-blank status"
220
+ # array is composed of GoalStatus ValueSet codes: http://hl7.org/fhir/DSTU2/valueset-Goal-status.html
221
+ assert %w{proposed planned accepted rejected in-progress achieved sustaining on-hold cancelled}.include?(med.status), "Goal '#{med.xmlId}' must have a status from the GoalStatus Value set at http://hl7.org/fhir/DSTU2/valueset-Goal-status.html"
222
+ assert med.description && !med.description.empty?, "Goal '#{med.xmlId}' must have a non-blank description"
223
+ assert med.subject.reference == "Patient/#{@patient_id}", "Goal '#{med.xmlId}' patient (#{med.subject.reference}) doesn't match the specified patient (Patient/#{@patient_id})"
224
+ valid_entries += 1
225
+ end
226
+
227
+ warning { assert valid_entries > 0, "No Goals were found for patient #{@patient_id}" }
228
+ skip unless valid_entries > 0
229
+ end
230
+
231
+ test 'ARS306', 'GET Goals with Patient ID and Date' do
232
+ metadata {
233
+ links "#{REST_SPEC_LINK}#search"
234
+ requires resource: "Goal", methods: ["read", "search"]
235
+ validates resource: "Goal", methods: ["read", "search"]
236
+ }
237
+
238
+ skip if !@patient_id
239
+
240
+ options = {
241
+ search: {
242
+ flag: false,
243
+ compartment: nil,
244
+ parameters: {
245
+ patient: @patient_id,
246
+ targetdate: 'ge2000-01-01'
247
+ }
248
+ }
249
+ }
250
+
251
+ reply = @client.search(FHIR::Goal, options)
252
+
253
+ assert_response_ok(reply)
254
+
255
+ valid_entries = 0
256
+
257
+ reply.resource.entry.each do |entry|
258
+ med = entry.resource
259
+ assert med.status && !med.status.empty?, "Goal '#{med.xmlId}' must have a non-blank status"
260
+ # array is composed of GoalStatus ValueSet codes: http://hl7.org/fhir/DSTU2/valueset-Goal-status.html
261
+ assert %w{proposed planned accepted rejected in-progress achieved sustaining on-hold cancelled}.include?(med.status), "Goal '#{med.xmlId}' must have a status from the GoalStatus Value set at http://hl7.org/fhir/DSTU2/valueset-Goal-status.html"
262
+ assert med.description && !med.description.empty?, "Goal '#{med.xmlId}' must have a non-blank description"
263
+ assert med.subject.reference == "Patient/#{@patient_id}", "Goal '#{med.xmlId}' patient (#{med.subject.reference}) doesn't match the specified patient (Patient/#{@patient_id})"
264
+ valid_entries += 1
265
+ end
266
+
267
+ warning { assert valid_entries > 0, "No Goals were found for patient #{@patient_id} after Jan 1, 2000" }
268
+ skip unless valid_entries > 0
269
+ end
270
+
271
+ test 'ARS307', 'GET Devices with Patient ID' do
272
+ metadata {
273
+ links "#{REST_SPEC_LINK}#search"
274
+ requires resource: "Device", methods: ["read", "search"]
275
+ validates resource: "Device", methods: ["read", "search"]
276
+ }
277
+
278
+ skip if !@patient_id
279
+
280
+ options = {
281
+ search: {
282
+ flag: false,
283
+ compartment: nil,
284
+ parameters: {
285
+ patient: @patient_id
286
+ }
287
+ }
288
+ }
289
+
290
+ reply = @client.search(FHIR::Device, options)
291
+
292
+ assert_response_ok(reply)
293
+
294
+ valid_entries = 0
295
+
296
+ reply.resource.entry.each do |entry|
297
+ med = entry.resource
298
+ assert med.fhirType && !med.fhirType.coding.empty?, "Device '#{med.xmlId}' must have a non-blank status"
299
+ assert med.udi && !med.udi.empty?, "Device '#{med.xmlId}' must have a non-blank UDI string"
300
+ assert med.patient.reference == "Patient/#{@patient_id}", "Device '#{med.xmlId}' patient (#{med.patient.reference}) doesn't match the specified patient (Patient/#{@patient_id})"
301
+ valid_entries += 1
302
+ end
303
+
304
+ warning { assert valid_entries > 0, "No Devices were found for patient #{@patient_id}" }
305
+ skip unless valid_entries > 0
306
+ end
307
+ end
308
+ end
309
+ end