plan_executor 1.0.2 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (420) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +3 -2
  4. data/Gemfile +3 -6
  5. data/Gemfile.lock +52 -48
  6. data/README.md +2 -2
  7. data/fixtures/attachment/ccda_pdf.pdf +0 -0
  8. data/fixtures/attachment/ccda_pdf_base64.txt +2489 -0
  9. data/fixtures/attachment/ccda_structured.xml +1976 -0
  10. data/fixtures/attachment/ccda_unstructured.xml +2563 -0
  11. data/fixtures/daf/conformance-daf-query-responder.xml +2024 -193
  12. data/fixtures/diagnostic_report/diagnosticreport-familyhistory-create.xml +67 -0
  13. data/fixtures/diagnostic_report/diagnosticreport-hlatyping-create.xml +64 -0
  14. data/fixtures/diagnostic_report/diagnosticreport-pathologyreport-create.xml +312 -0
  15. data/fixtures/diagnostic_report/dr-100.xml +3 -3
  16. data/fixtures/diagnostic_report/dr-200.xml +5 -5
  17. data/fixtures/diagnostic_report/dr-300.xml +3 -3
  18. data/fixtures/diagnostic_report/dr-400.xml +3 -3
  19. data/fixtures/{diagnostic_order → diagnostic_request}/do-100.xml +57 -64
  20. data/fixtures/diagnostic_request/do-200.xml +73 -0
  21. data/fixtures/{diagnostic_order → diagnostic_request}/do-300.xml +73 -91
  22. data/{lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder → fixtures/diagnostic_request}/do-400.xml +74 -88
  23. data/fixtures/family_member_history/familymemberhistory-familyhistory-create.xml +27 -0
  24. data/fixtures/financial/claim-example-oral-average.xml +199 -0
  25. data/fixtures/financial/claim-example-oral-orthoplan.xml +298 -0
  26. data/fixtures/financial/claim-example.xml +98 -0
  27. data/fixtures/financial/eligibilityrequest-example.xml +40 -0
  28. data/fixtures/observation/obs-401.xml +7 -17
  29. data/fixtures/observation/obs-402.xml +7 -17
  30. data/fixtures/observation/obs-403.xml +4 -29
  31. data/fixtures/observation/obs-407.xml +4 -11
  32. data/fixtures/observation/observation-datawarehouse-create.xml +72 -0
  33. data/fixtures/observation/observation-familyhistory-create.xml +61 -0
  34. data/fixtures/observation/observation-germline-create.xml +72 -0
  35. data/fixtures/observation/observation-register-create.xml +72 -0
  36. data/fixtures/patch/medicationrequest-simple.xml +16 -0
  37. data/fixtures/patient/patient-example-updated.xml +1 -7
  38. data/fixtures/patient/patient-example-us-extensions.xml +119 -0
  39. data/fixtures/patient/patient-example.xml +46 -27
  40. data/fixtures/patient/patient-familyhistory-create.xml +45 -0
  41. data/fixtures/patient/patient-register-create.xml +47 -0
  42. data/fixtures/practitioner/practitioner-register-create.xml +32 -0
  43. data/fixtures/record/condition-example-f201-fever.xml +54 -49
  44. data/fixtures/record/condition-example-f205-infection.xml +16 -15
  45. data/fixtures/record/diagnosticreport-example-f201-brainct.xml +45 -18
  46. data/fixtures/record/encounter-example-f201-20130404.xml +42 -15
  47. data/fixtures/record/encounter-example-f202-20130128.xml +57 -15
  48. data/fixtures/record/observation-example-f202-temperature.xml +85 -60
  49. data/fixtures/record/organization-example-f201-aumc.xml +87 -4
  50. data/fixtures/record/organization-example-f203-bumc.xml +53 -4
  51. data/fixtures/record/patient-example-f201-roel.xml +108 -8
  52. data/fixtures/record/practitioner-example-f201-ab.xml +73 -14
  53. data/fixtures/record/procedure-example-f201-tpf.xml +39 -9
  54. data/fixtures/scheduling/slot-simple.xml +1 -1
  55. data/fixtures/sequence/sequence-register-create.xml +31 -0
  56. data/fixtures/specimen/spec-100.xml +8 -8
  57. data/fixtures/specimen/spec-400.xml +11 -11
  58. data/fixtures/specimen/spec-uslab-example1.xml +11 -11
  59. data/fixtures/specimen/specimen-familyhistory-create.xml +54 -0
  60. data/fixtures/specimen/specimen-register-create.xml +49 -0
  61. data/fixtures/terminology/codesystem-data-types.json +230 -0
  62. data/fixtures/terminology/codesystem-resource-types.json +482 -0
  63. data/fixtures/terminology/codesystem-simple.xml +129 -0
  64. data/fixtures/terminology/conceptmap-example.xml +141 -0
  65. data/fixtures/terminology/v2-codesystem.json +1297 -0
  66. data/fixtures/terminology/v2-valueset.json +16 -0
  67. data/fixtures/terminology/valueset-defined-types.json +25 -0
  68. data/fixtures/terminology/valueset-example.xml +111 -0
  69. data/fixtures/validation/observation.profile.xml +1534 -253
  70. data/fixtures/validation/observations/observation-example.xml +66 -0
  71. data/lib/FHIR_structure.json +129 -82
  72. data/lib/daf_resource_generator.rb +7 -7
  73. data/lib/data/resources.rb +50 -30
  74. data/lib/ext/client.rb +2 -2
  75. data/lib/plan_executor.rb +6 -1
  76. data/lib/resource_generator.rb +413 -212
  77. data/lib/tasks/tasks.rake +151 -20
  78. data/lib/tests/assertions.rb +24 -18
  79. data/lib/tests/base_test.rb +17 -3
  80. data/lib/tests/suites/argonaut_provider_connectathon_test.rb +234 -0
  81. data/lib/tests/suites/base_suite.rb +7 -3
  82. data/lib/tests/suites/connectathon_attachment_track_test.rb +124 -0
  83. data/lib/tests/suites/connectathon_audit_track.rb +113 -69
  84. data/lib/tests/suites/connectathon_care_plan_track.rb +237 -0
  85. data/lib/tests/suites/connectathon_fetch_patient_record.rb +40 -39
  86. data/lib/tests/suites/connectathon_financial_track.rb +231 -23
  87. data/lib/tests/suites/connectathon_genomics_track_test.rb +255 -0
  88. data/lib/tests/suites/connectathon_lab_order_track.rb +131 -104
  89. data/lib/tests/suites/connectathon_patch_track.rb +125 -0
  90. data/lib/tests/suites/connectathon_patient_track.rb +75 -68
  91. data/lib/tests/suites/connectathon_profile_validation.rb +9 -8
  92. data/lib/tests/suites/connectathon_scheduling_track.rb +127 -70
  93. data/lib/tests/suites/connectathon_terminology_track.rb +211 -34
  94. data/lib/tests/suites/daf_profiles_test.rb +112 -72
  95. data/lib/tests/suites/format_test.rb +113 -255
  96. data/lib/tests/suites/history_test.rb +72 -68
  97. data/lib/tests/suites/read_test.rb +31 -27
  98. data/lib/tests/suites/resource_test.rb +283 -85
  99. data/lib/tests/suites/search_test.rb +5 -3
  100. data/lib/tests/suites/search_test_robust.rb +8 -76
  101. data/lib/tests/suites/sprinkler_search_test.rb +104 -84
  102. data/lib/tests/suites/suite_engine.rb +17 -23
  103. data/lib/tests/suites/transaction_test.rb +117 -174
  104. data/lib/tests/testscripts/base_testscript.rb +425 -189
  105. data/lib/tests/testscripts/scripts/connectathon/Patient-01-Intro/Client Assigned Id/connectathon-14-patient-base-client-id-json.xml +517 -0
  106. data/lib/tests/testscripts/scripts/connectathon/Patient-01-Intro/Client Assigned Id/connectathon-14-patient-base-client-id-xml.xml +517 -0
  107. data/lib/tests/testscripts/scripts/connectathon/Patient-01-Intro/Client Assigned Id/connectathon-14-patient-bonus-client-id-json.xml +648 -0
  108. data/lib/tests/testscripts/scripts/connectathon/Patient-01-Intro/Client Assigned Id/connectathon-14-patient-bonus-client-id-xml.xml +648 -0
  109. data/lib/tests/testscripts/scripts/connectathon/Patient-01-Intro/README.html +68 -0
  110. data/lib/tests/testscripts/scripts/connectathon/Patient-01-Intro/Server Assigned Id/connectathon-14-patient-base-server-id-json.xml +515 -0
  111. data/lib/tests/testscripts/scripts/connectathon/Patient-01-Intro/Server Assigned Id/connectathon-14-patient-base-server-id-xml.xml +515 -0
  112. data/lib/tests/testscripts/scripts/connectathon/Patient-01-Intro/Server Assigned Id/connectathon-14-patient-bonus-server-id-json.xml +645 -0
  113. data/lib/tests/testscripts/scripts/connectathon/Patient-01-Intro/Server Assigned Id/connectathon-14-patient-bonus-server-id-xml.xml +642 -0
  114. data/lib/tests/testscripts/scripts/connectathon/Patient-01-Intro/_reference/capabilities/PatientCapabilityStatement.xml +43 -0
  115. data/lib/tests/testscripts/{xml/Connectathon11/Track1-Patient → scripts/connectathon/Patient-01-Intro}/_reference/resources/patient-create-PeterChalmers-min.json +1 -3
  116. data/lib/tests/testscripts/{xml/Connectathon11/Track1-Patient → scripts/connectathon/Patient-01-Intro}/_reference/resources/patient-create-PeterChalmers-min.xml +0 -0
  117. data/lib/tests/testscripts/{xml/Connectathon11/Track1-Patient → scripts/connectathon/Patient-01-Intro}/_reference/resources/patient-create-PeterChalmers.json +5 -10
  118. data/lib/tests/testscripts/{xml/Connectathon11/Track1-Patient → scripts/connectathon/Patient-01-Intro}/_reference/resources/patient-create-PeterChalmers.xml +5 -5
  119. data/lib/tests/testscripts/{xml/Connectathon11/Track1-Patient → scripts/connectathon/Patient-01-Intro}/_reference/resources/patient-create-bonus-PeterChalmers-min.json +1 -3
  120. data/lib/tests/testscripts/{xml/Connectathon11/Track1-Patient → scripts/connectathon/Patient-01-Intro}/_reference/resources/patient-create-bonus-PeterChalmers-min.xml +0 -0
  121. data/lib/tests/testscripts/{xml/Connectathon11/Track1-Patient → scripts/connectathon/Patient-01-Intro}/_reference/resources/patient-create-bonus-PeterChalmers.json +5 -10
  122. data/lib/tests/testscripts/{xml/Connectathon11/Track1-Patient → scripts/connectathon/Patient-01-Intro}/_reference/resources/patient-create-bonus-PeterChalmers.xml +4 -5
  123. data/lib/tests/testscripts/scripts/connectathon/Patient-01-Intro/_reference/resources/patient-create-client-id-PeterChalmers.json +96 -0
  124. data/lib/tests/testscripts/scripts/connectathon/Patient-01-Intro/_reference/resources/patient-create-client-id-PeterChalmers.xml +103 -0
  125. data/lib/tests/testscripts/scripts/connectathon/Patient-01-Intro/_reference/resources/patient-create-client-id-bonus-PeterChalmers.json +104 -0
  126. data/lib/tests/testscripts/scripts/connectathon/Patient-01-Intro/_reference/resources/patient-create-client-id-bonus-PeterChalmers.xml +108 -0
  127. data/lib/tests/testscripts/{xml/Connectathon11/Track1-Patient → scripts/connectathon/Patient-01-Intro}/_reference/resources/patient-update-PeterChalmers-min.json +1 -3
  128. data/lib/tests/testscripts/{xml/Connectathon11/Track1-Patient → scripts/connectathon/Patient-01-Intro}/_reference/resources/patient-update-PeterChalmers-min.xml +0 -0
  129. data/lib/tests/testscripts/{xml/Connectathon11/Track1-Patient → scripts/connectathon/Patient-01-Intro}/_reference/resources/patient-update-PeterChalmers.json +6 -10
  130. data/lib/tests/testscripts/{xml/Connectathon11/Track1-Patient → scripts/connectathon/Patient-01-Intro}/_reference/resources/patient-update-PeterChalmers.xml +6 -5
  131. data/lib/tests/testscripts/{xml/Connectathon11/Track1-Patient → scripts/connectathon/Patient-01-Intro}/_reference/resources/patient-update-bonus1-PeterChalmers-min.json +1 -3
  132. data/lib/tests/testscripts/{xml/Connectathon11/Track1-Patient → scripts/connectathon/Patient-01-Intro}/_reference/resources/patient-update-bonus1-PeterChalmers-min.xml +0 -0
  133. data/lib/tests/testscripts/{xml/Connectathon11/Track1-Patient → scripts/connectathon/Patient-01-Intro}/_reference/resources/patient-update-bonus1-PeterChalmers.json +7 -11
  134. data/lib/tests/testscripts/{xml/Connectathon11/Track1-Patient → scripts/connectathon/Patient-01-Intro}/_reference/resources/patient-update-bonus1-PeterChalmers.xml +5 -5
  135. data/lib/tests/testscripts/{xml/Connectathon11/Track1-Patient → scripts/connectathon/Patient-01-Intro}/_reference/resources/patient-update-bonus2-PeterChalmers-min.json +2 -4
  136. data/lib/tests/testscripts/{xml/Connectathon11/Track1-Patient → scripts/connectathon/Patient-01-Intro}/_reference/resources/patient-update-bonus2-PeterChalmers-min.xml +1 -1
  137. data/lib/tests/testscripts/{xml/Connectathon11/Track1-Patient → scripts/connectathon/Patient-01-Intro}/_reference/resources/patient-update-bonus2-PeterChalmers.json +7 -11
  138. data/lib/tests/testscripts/{xml/Connectathon11/Track1-Patient → scripts/connectathon/Patient-01-Intro}/_reference/resources/patient-update-bonus2-PeterChalmers.xml +8 -7
  139. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRClient/01-RegisterPatient/connectathon-14-patient-fhirclient-01-register-client-id-xml.xml +306 -0
  140. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRClient/01-RegisterPatient/connectathon-14-patient-fhirclient-01-register-server-id-xml.xml +317 -0
  141. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRClient/02-PatientUpdate/connectathon-14-patient-fhirclient-02-update-client-id-xml.xml +346 -0
  142. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRClient/02-PatientUpdate/connectathon-14-patient-fhirclient-02-update-server-id-xml.xml +385 -0
  143. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRClient/_reference/capabilities/PatientCapabilityStatement.json +50 -0
  144. data/lib/tests/testscripts/{xml/Connectathon11/Track1-Patient/_reference/conformance/PatientConformance.xml → scripts/connectathon/Patient-02-Formal/FHIRClient/_reference/capabilities/PatientCapabilityStatement.xml} +10 -2
  145. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRClient/_reference/resources/patient-create-client-id.json +21 -0
  146. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRClient/_reference/resources/patient-create-client-id.xml +15 -0
  147. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRClient/_reference/resources/patient-create-server-id.json +20 -0
  148. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRClient/_reference/resources/patient-create-server-id.xml +14 -0
  149. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRClient/_reference/resources/patient-update-client-id.json +21 -0
  150. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRClient/_reference/resources/patient-update-client-id.xml +15 -0
  151. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRClient/_reference/resources/patient-update-server-id.json +20 -0
  152. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRClient/_reference/resources/patient-update-server-id.xml +14 -0
  153. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/01-RegisterPatient/connectathon-14-patient-fhirserver-01-register-client-id-json.xml +262 -0
  154. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/01-RegisterPatient/connectathon-14-patient-fhirserver-01-register-client-id-xml.xml +262 -0
  155. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/01-RegisterPatient/connectathon-14-patient-fhirserver-01-register-server-id-json.xml +273 -0
  156. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/01-RegisterPatient/connectathon-14-patient-fhirserver-01-register-server-id-xml.xml +273 -0
  157. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/02-PatientUpdate/connectathon-14-patient-fhirserver-02-update-client-id-json.xml +290 -0
  158. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/02-PatientUpdate/connectathon-14-patient-fhirserver-02-update-client-id-xml.xml +290 -0
  159. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/02-PatientUpdate/connectathon-14-patient-fhirserver-02-update-server-id-json.xml +326 -0
  160. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/02-PatientUpdate/connectathon-14-patient-fhirserver-02-update-server-id-xml.xml +326 -0
  161. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/03-PatientRead/connectathon-14-patient-fhirserver-03-read-client-id-json.xml +247 -0
  162. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/03-PatientRead/connectathon-14-patient-fhirserver-03-read-client-id-xml.xml +247 -0
  163. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/03-PatientRead/connectathon-14-patient-fhirserver-03-read-server-id-json.xml +282 -0
  164. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/03-PatientRead/connectathon-14-patient-fhirserver-03-read-server-id-xml.xml +281 -0
  165. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/04-PatientHistory/connectathon-14-patient-fhirserver-04-history-client-id-json.xml +330 -0
  166. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/04-PatientHistory/connectathon-14-patient-fhirserver-04-history-client-id-xml.xml +330 -0
  167. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/04-PatientHistory/connectathon-14-patient-fhirserver-04-history-server-id-json.xml +366 -0
  168. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/04-PatientHistory/connectathon-14-patient-fhirserver-04-history-server-id-xml.xml +366 -0
  169. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/05-PatientVRead/connectathon-14-patient-fhirserver-05-vread-client-id-json.xml +527 -0
  170. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/05-PatientVRead/connectathon-14-patient-fhirserver-05-vread-client-id-xml.xml +527 -0
  171. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/05-PatientVRead/connectathon-14-patient-fhirserver-05-vread-server-id-json.xml +519 -0
  172. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/05-PatientVRead/connectathon-14-patient-fhirserver-05-vread-server-id-xml.xml +519 -0
  173. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/06-PatientSearching/connectathon-14-patient-fhirserver-06-search-client-id-json.xml +290 -0
  174. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/06-PatientSearching/connectathon-14-patient-fhirserver-06-search-client-id-xml.xml +290 -0
  175. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/06-PatientSearching/connectathon-14-patient-fhirserver-06-search-server-id-json.xml +288 -0
  176. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/06-PatientSearching/connectathon-14-patient-fhirserver-06-search-server-id-xml.xml +288 -0
  177. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/07-PatientDeletion/connectathon-14-patient-fhirserver-07-delete-client-id-json.xml +252 -0
  178. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/07-PatientDeletion/connectathon-14-patient-fhirserver-07-delete-client-id-xml.xml +252 -0
  179. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/07-PatientDeletion/connectathon-14-patient-fhirserver-07-delete-server-id-json.xml +284 -0
  180. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/07-PatientDeletion/connectathon-14-patient-fhirserver-07-delete-server-id-xml.xml +284 -0
  181. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/99-PatientAll/connectathon-14-patient-fhirserver-99-all-client-id-json.xml +897 -0
  182. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/99-PatientAll/connectathon-14-patient-fhirserver-99-all-client-id-xml.xml +897 -0
  183. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/99-PatientAll/connectathon-14-patient-fhirserver-99-all-server-id-json.xml +963 -0
  184. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/99-PatientAll/connectathon-14-patient-fhirserver-99-all-server-id-xml.xml +963 -0
  185. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/_reference/capabilities/PatientCapabilityStatement.json +50 -0
  186. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/_reference/capabilities/PatientCapabilityStatement.xml +42 -0
  187. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/_reference/resources/patient-create-client-id.json +86 -0
  188. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/_reference/resources/patient-create-client-id.xml +62 -0
  189. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/_reference/resources/patient-create-server-id.json +85 -0
  190. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/_reference/resources/patient-create-server-id.xml +61 -0
  191. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/_reference/resources/patient-update-client-id.json +86 -0
  192. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/_reference/resources/patient-update-client-id.xml +62 -0
  193. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/_reference/resources/patient-update-server-id.json +86 -0
  194. data/lib/tests/testscripts/scripts/connectathon/Patient-02-Formal/FHIRServer/_reference/resources/patient-update-server-id.xml +62 -0
  195. data/lib/tests/testscripts/scripts/spec/_reference/resources/patient-example-update.json +145 -0
  196. data/lib/tests/testscripts/scripts/spec/_reference/resources/patient-example.json +146 -0
  197. data/lib/tests/testscripts/scripts/spec/testscript-example-history.xml +191 -0
  198. data/lib/tests/testscripts/scripts/spec/testscript-example-multisystem.xml +190 -0
  199. data/lib/tests/testscripts/scripts/spec/testscript-example-readtest.xml +178 -0
  200. data/lib/tests/testscripts/scripts/spec/testscript-example-rule.xml +266 -0
  201. data/lib/tests/testscripts/scripts/spec/testscript-example-search.xml +177 -0
  202. data/lib/tests/testscripts/scripts/spec/testscript-example-update.xml +163 -0
  203. data/lib/tests/testscripts/scripts/spec/testscript-example.xml +228 -0
  204. data/lib/tests/testscripts/testscript_engine.rb +36 -22
  205. data/logs/.keep +0 -0
  206. data/plan_executor.gemspec +11 -3
  207. data/test/test_helper.rb +3 -3
  208. data/test/unit/fixtures_test.rb +24 -24
  209. data/test/unit/metadata_test.rb +19 -9
  210. data/test/unit/resource_generator_test.rb +20 -0
  211. metadata +244 -249
  212. data/fixtures/diagnostic_order/do-200.xml +0 -121
  213. data/fixtures/diagnostic_order/do-400.xml +0 -88
  214. data/fixtures/financial/claim-example-average.xml +0 -168
  215. data/fixtures/financial/claim-example-simple.xml +0 -67
  216. data/fixtures/order/order-100.xml +0 -61
  217. data/fixtures/order/order-200.xml +0 -61
  218. data/fixtures/order/order-300.xml +0 -61
  219. data/fixtures/order/order-400.xml +0 -61
  220. data/fixtures/order_response/ordresp-100.xml +0 -79
  221. data/fixtures/order_response/ordresp-110.xml +0 -79
  222. data/fixtures/order_response/ordresp-200.xml +0 -79
  223. data/fixtures/order_response/ordresp-210.xml +0 -79
  224. data/fixtures/order_response/ordresp-300.xml +0 -79
  225. data/fixtures/order_response/ordresp-310.xml +0 -79
  226. data/fixtures/order_response/ordresp-400.xml +0 -79
  227. data/fixtures/order_response/ordresp-410.xml +0 -79
  228. data/fixtures/patient/patient-example-us-extensions(us01).xml +0 -81
  229. data/fixtures/patient/patient-format-example.xml +0 -101
  230. data/fixtures/validation/observations/observation-example(example).xml +0 -50
  231. data/lib/tests/suites/argonaut_resprint_1_test.rb +0 -260
  232. data/lib/tests/suites/argonaut_resprint_2_test.rb +0 -369
  233. data/lib/tests/suites/argonaut_resprint_3_test.rb +0 -309
  234. data/lib/tests/suites/argonaut_sprint_1_test.rb +0 -187
  235. data/lib/tests/suites/argonaut_sprint_2_test.rb +0 -115
  236. data/lib/tests/suites/argonaut_sprint_3_test.rb +0 -208
  237. data/lib/tests/suites/argonaut_sprint_4_test.rb +0 -335
  238. data/lib/tests/suites/argonaut_sprint_5_test.rb +0 -196
  239. data/lib/tests/suites/argonaut_sprint_6_test.rb +0 -243
  240. data/lib/tests/suites/argonaut_sprint_7_test.rb +0 -161
  241. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Client Assigned Id/track1-patient-base-client-id-json.xml +0 -348
  242. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Client Assigned Id/track1-patient-base-client-id-xml.xml +0 -348
  243. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Client Assigned Id/track1-patient-bonus-client-id-json.xml +0 -420
  244. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Client Assigned Id/track1-patient-bonus-client-id-xml.xml +0 -420
  245. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/README.html +0 -68
  246. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Server Assigned Id/track1-patient-base-server-id-json.xml +0 -352
  247. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Server Assigned Id/track1-patient-base-server-id-xml.xml +0 -352
  248. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Server Assigned Id/track1-patient-bonus-server-id-json.xml +0 -421
  249. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Server Assigned Id/track1-patient-bonus-server-id-xml.xml +0 -421
  250. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/C-CDA_R2-1_CCD-ussg.xml +0 -3414
  251. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-A1-empty-on-instance.xml +0 -9
  252. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-A2-empty-by-ref.xml +0 -15
  253. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-A3-empty-by-identifier.xml +0 -13
  254. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-A4-empty-by-contained.xml +0 -15
  255. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-B1-CCDA-on-instance.xml +0 -15
  256. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-B2-CCDA-by-ref.xml +0 -21
  257. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-B3-CCDA-by-identifier.xml +0 -19
  258. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-B4-CCDA-by-contained.xml +0 -21
  259. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/questionnaire-sdc-profile-example-ussg-fht.xml +0 -3905
  260. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/questionnaireresponse-expected-ussg-fht-CCDA.xml +0 -190
  261. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/questionnaireresponse-expected-ussg-fht-empty.xml +0 -177
  262. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/track11-sdc-prepop-xml.xml +0 -142
  263. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Expand/Client Assigned Id/track2-ts-suite1-expand-client-id.xml +0 -925
  264. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Expand/Client Assigned Id/track2-ts-suite2-expand-filter-client-id.xml +0 -930
  265. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Expand/Server Assigned Id/track2-ts-suite1-expand-server-id.xml +0 -953
  266. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Expand/Server Assigned Id/track2-ts-suite2-expand-filter-server-id.xml +0 -958
  267. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Lookup/track2-ts-suite5-loinc-lookup-xml.xml +0 -224
  268. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Lookup/track2-ts-suite5-snomed-lookup-xml.xml +0 -224
  269. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/README.html +0 -85
  270. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Translate/track2-ts-suite6-translate-xml.xml +0 -224
  271. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Validate-code/Client Assigned Id/track2-ts-suite3-validate-code-client-id.xml +0 -1807
  272. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Validate-code/Client Assigned Id/track2-ts-suite4-validate-code-client-id.xml +0 -714
  273. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Validate-code/Server Assigned Id/track2-ts-suite3-validate-code-server-id.xml +0 -1835
  274. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Validate-code/Server Assigned Id/track2-ts-suite4-validate-code-server-id.xml +0 -742
  275. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/conformance/ConceptMapSuite6Conformance.xml +0 -11
  276. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/conformance/ValueSetSuite1Conformance.xml +0 -17
  277. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/conformance/ValueSetSuite2Conformance.xml +0 -17
  278. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/conformance/ValueSetSuite3Conformance.xml +0 -14
  279. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/conformance/ValueSetSuite4Conformance.xml +0 -14
  280. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/conformance/ValueSetSuite5Conformance.xml +0 -11
  281. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/extensional-case-1-input-4-2-a.xml +0 -11
  282. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/extensional-case-1-input-4-2-b.xml +0 -11
  283. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/extensional-case-1-input-4-3-a.xml +0 -13
  284. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/extensional-case-1-input-4-3-b.xml +0 -13
  285. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/extensional-case-1-input-4-4-a.xml +0 -15
  286. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/extensional-case-1-input-4-4-b.xml +0 -15
  287. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/lookup-loinc-input-5-2.xml +0 -10
  288. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/lookup-loinc-input-5-3.xml +0 -11
  289. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/lookup-snomed-input-5-2.xml +0 -10
  290. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/lookup-snomed-input-5-3.xml +0 -11
  291. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/translate-conceptmap-input-6-2.xml +0 -14
  292. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/translate-conceptmap-input-6-3.xml +0 -15
  293. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-1-expand-min.xml +0 -47
  294. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-1-filter-min.xml +0 -23
  295. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-2-expand-min.xml +0 -132
  296. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-2-filter-min.xml +0 -38
  297. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-3-expand-min.xml +0 -252
  298. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-3-filter-min.xml +0 -58
  299. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-4-expand-min.xml +0 -57
  300. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-4-filter-min.xml +0 -28
  301. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/intensional-case-1-expand-min.xml +0 -347
  302. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/intensional-case-1-filter-min.xml +0 -33
  303. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/intensional-case-2-expand-min.xml +0 -637
  304. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/intensional-case-2-filter-min.xml +0 -33
  305. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/intensional-case-3-filter-min.xml +0 -58
  306. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/lookup-loinc-min.xml +0 -11
  307. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/lookup-snomed-min.xml +0 -11
  308. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/suite3-invalid-min.xml +0 -10
  309. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/suite3-valid-min.xml +0 -7
  310. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/suite4-invalid-min.xml +0 -10
  311. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/suite4-valid-min.xml +0 -7
  312. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/translate-conceptmap-min.xml +0 -17
  313. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/extensional-case-1.xml +0 -55
  314. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/extensional-case-2.xml +0 -122
  315. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/extensional-case-3.xml +0 -222
  316. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/extensional-case-4.xml +0 -65
  317. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/intensional-case-1.xml +0 -31
  318. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/intensional-case-2.xml +0 -31
  319. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/intensional-case-3.xml +0 -31
  320. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/translate-conceptmap-case-1.xml +0 -145
  321. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/conformance/DecisionSupportServiceModule-Evaluate.xml +0 -17
  322. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-incomplete-request-payload.xml +0 -26
  323. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-incomplete-response-min-payload.xml +0 -7
  324. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-incomplete-response-payload.xml +0 -332
  325. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-malformed-request-payload.xml +0 -28
  326. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-malformed-response-min-payload.xml +0 -7
  327. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-malformed-response-payload.xml +0 -20
  328. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-request-payload.xml +0 -28
  329. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-response-min-payload.xml +0 -7
  330. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-response-payload.xml +0 -332
  331. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-unauthorized-request-payload.xml +0 -28
  332. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-unauthorized-response-min-payload.xml +0 -7
  333. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-unauthorized-response-payload.xml +0 -8
  334. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/gao-assessment-request-payload.xml +0 -176
  335. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/gao-assessment-response-payload-min.xml +0 -32
  336. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/gao-assessment-response-payload.xml +0 -80
  337. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/track3-cds-evaluate-cdc-immunization.xml +0 -290
  338. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/track3-cds-evaluate-gao-profile.xml +0 -110
  339. data/lib/tests/testscripts/xml/Connectathon11/Track6-FHIR-Genomics/Client_Assigned_Id/TestScript_FHIR-Genomics.xml +0 -170
  340. data/lib/tests/testscripts/xml/Connectathon11/Track6-FHIR-Genomics/_reference/resources/sequence-example-1.xml +0 -31
  341. data/lib/tests/testscripts/xml/Connectathon11/Track6-FHIR-Genomics/_reference/resources/sequence-example-2.xml +0 -31
  342. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Actors.png +0 -0
  343. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Client_Assigned_Id/track7-laborder100-xml.xml +0 -590
  344. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Client_Assigned_Id/track7-laborder200-xml.xml +0 -587
  345. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Client_Assigned_Id/track7-laborder300-xml.xml +0 -612
  346. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Client_Assigned_Id/track7-laborder400-xml.xml +0 -635
  347. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Peer-to-Peer/track7-laborder100-peer2peer-xml.xml +0 -752
  348. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Thumbs.db +0 -0
  349. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/conformance/LabOrderLabReport-CreateDeleteReadUpdate.xml +0 -187
  350. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/conformance/html.xslt +0 -45
  351. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-100-update.xml +0 -64
  352. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-100.xml +0 -64
  353. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-200-update.xml +0 -121
  354. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-200.xml +0 -121
  355. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-300-update.xml +0 -91
  356. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-300.xml +0 -91
  357. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-400-update.xml +0 -88
  358. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticReport/dr-100.xml +0 -96
  359. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticReport/dr-200.xml +0 -125
  360. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticReport/dr-300.xml +0 -132
  361. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticReport/dr-400.xml +0 -121
  362. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-100.xml +0 -58
  363. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-101.xml +0 -58
  364. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-200.xml +0 -125
  365. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-300.xml +0 -106
  366. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-301.xml +0 -106
  367. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-302.xml +0 -106
  368. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-303.xml +0 -106
  369. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-304.xml +0 -106
  370. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-400.xml +0 -87
  371. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-401.xml +0 -95
  372. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-402.xml +0 -95
  373. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-403.xml +0 -84
  374. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-404.xml +0 -84
  375. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-405.xml +0 -83
  376. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-406.xml +0 -83
  377. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-407.xml +0 -70
  378. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-408.xml +0 -84
  379. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-uslab-example5.xml +0 -102
  380. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Order/order-100.xml +0 -61
  381. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Order/order-200.xml +0 -61
  382. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Order/order-300.xml +0 -61
  383. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Order/order-400.xml +0 -61
  384. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-100.xml +0 -79
  385. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-110.xml +0 -79
  386. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-200.xml +0 -79
  387. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-210.xml +0 -79
  388. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-300.xml +0 -79
  389. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-310.xml +0 -79
  390. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-400.xml +0 -79
  391. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-410.xml +0 -79
  392. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Organization/org-uslab-example3.xml +0 -49
  393. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Patient/patient-uslab-example1.xml +0 -44
  394. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Practitioner/pract-uslab-example1.xml +0 -18
  395. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Practitioner/pract-uslab-example3.xml +0 -36
  396. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Specimen/Thumbs.db +0 -0
  397. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Specimen/spec-100.xml +0 -65
  398. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Specimen/spec-400.xml +0 -70
  399. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Specimen/spec-uslab-example1.xml +0 -82
  400. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Testscript 1 Document.txt +0 -122
  401. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Testscript 2 Document.txt +0 -103
  402. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Testscript 3 Document.txt +0 -201
  403. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Testscript 4 Document.txt +0 -310
  404. data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/_reference/conformance/MedicationStatementCreate.xml +0 -11
  405. data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/_reference/conformance/PatientSearchType.xml +0 -15
  406. data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/_reference/resources/medicationstatement-create.json +0 -39
  407. data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/_reference/resources/medicationstatement-patch.json +0 -3
  408. data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/track9-patch-medicationstatement-json-if-match.xml +0 -321
  409. data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/track9-patch-medicationstatement-json.xml +0 -303
  410. data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/track9-patch-peer2peer-patient-json.xml +0 -235
  411. data/test/fixtures/testscript-example.xml +0 -202
  412. data/test/fixtures/testscript-history.xml +0 -143
  413. data/test/fixtures/testscript-readtest.xml +0 -272
  414. data/test/fixtures/testscript-search.xml +0 -282
  415. data/test/fixtures/testscript-update.xml +0 -147
  416. data/test/unit/argonaut_sprint6_test.rb +0 -31
  417. data/test/unit/argonaut_sprint7_test.rb +0 -21
  418. data/test/unit/basic_test.rb +0 -27
  419. data/test/unit/fetch_patient_record_test.rb +0 -357
  420. data/test/unit/financial_test.rb +0 -41
@@ -40,7 +40,6 @@ module Crucible
40
40
  @category = {id: 'testscript', title: 'TestScript'}
41
41
  @id_map = {}
42
42
  @response_map = {}
43
- @warnings = []
44
43
  @autocreate = []
45
44
  @autodelete = []
46
45
  @testscript = testscript
@@ -58,15 +57,36 @@ module Crucible
58
57
  end
59
58
 
60
59
  def id
61
- @testscript.xmlId
60
+ @testscript.id
62
61
  end
63
62
 
64
63
  def title
65
64
  "TS-#{id}"
66
65
  end
67
66
 
67
+ def multiserver
68
+ @testscript.origin.length >= 2 || @testscript.destination.length >= 2
69
+ end
70
+
71
+ def containsRuleAssertions?
72
+ has_declared_rule = !@testscript.rule.empty? || !@testscript.ruleset.empty?
73
+ return true if has_declared_rule
74
+
75
+ if @testscript.setup
76
+ has_setup_rule = @testscript.setup.action.find{ |action| action.assert && (action.assert.rule || action.assert.ruleset) }
77
+ return true if has_setup_rule
78
+ end
79
+
80
+ has_test_rule = @testscript.test.find do |test|
81
+ test.action.find{ |action| action.assert && (action.assert.rule || action.assert.ruleset) }
82
+ end
83
+ return true if has_test_rule
84
+
85
+ false
86
+ end
87
+
68
88
  def tests
69
- @testscript.test.map { |test| "#{test.xmlId} #{test.name} test".downcase.tr(' ', '_').to_sym }
89
+ @testscript.test.map { |test| "#{test.id} #{test.name} test".downcase.tr(' ', '_').to_sym }
70
90
  end
71
91
 
72
92
  def debug_prefix
@@ -74,12 +94,14 @@ module Crucible
74
94
  end
75
95
 
76
96
  def log(message)
77
- puts "#{debug_prefix}#{message}"
97
+ output = "#{debug_prefix}#{message}"
98
+ puts output
99
+ FHIR.logger.info(output)
78
100
  end
79
101
 
80
102
  def define_tests
81
103
  @testscript.test.each do |test|
82
- test_method = "#{test.xmlId} #{test.name} test".downcase.tr(' ', '_').to_sym
104
+ test_method = "#{test.id} #{test.name} test".downcase.tr(' ', '_').to_sym
83
105
  define_singleton_method test_method, -> { process_test(test) }
84
106
  end
85
107
  end
@@ -87,105 +109,250 @@ module Crucible
87
109
  def load_fixtures
88
110
  @fixtures = {}
89
111
  @testscript.fixture.each do |fixture|
90
- @fixtures[fixture.xmlId] = get_reference(fixture.resource.reference)
91
- @fixtures[fixture.xmlId].xmlId = nil unless @fixtures[fixture.xmlId].nil? #fixture resources cannot have an ID
92
- @autocreate << fixture.xmlId if fixture.autocreate
93
- @autodelete << fixture.xmlId if fixture.autodelete
112
+ @fixtures[fixture.id] = get_reference(fixture.resource.reference)
113
+ @fixtures[fixture.id].id = nil unless @fixtures[fixture.id].nil? #fixture resources cannot have an ID
114
+ @autocreate << fixture.id if fixture.autocreate
115
+ @autodelete << fixture.id if fixture.autodelete
94
116
  end
95
117
  end
96
118
 
97
- def collect_metadata(methods_only=false)
98
- @metadata_only = true
99
- result = execute
100
- result = result.values.first if methods_only
101
- @metadata_only = false
102
- result
119
+ def collect_metadata(_methods_only=nil)
120
+ metadata = {}
121
+ metadata['links'] = []
122
+ metadata['requires'] = nil
123
+ metadata['validates'] = nil
124
+
125
+ if @testscript.metadata
126
+ @testscript.metadata.link.each do |link|
127
+ metadata['links'] << link.url
128
+ end
129
+ @testscript.metadata.capability.each do |capability|
130
+ capability.link.each{|url| metadata['links'] << url }
131
+ metadata['links'] << capability.capabilities.reference if capability.capabilities.reference
132
+ end
133
+ end
134
+
135
+ {
136
+ @testscript.id => @testscript.test.map do |test|
137
+ {
138
+ "key" => "#{test.id} #{test.name} test".downcase.tr(' ', '_'),
139
+ "id" => "#{test.id} #{test.name} test".downcase.tr(' ', '_'),
140
+ "description" => test.description,
141
+ :test_method=> "#{test.id} #{test.name} test".downcase.tr(' ', '_').to_sym
142
+
143
+ }.merge(metadata)
144
+ end
145
+ }
146
+
103
147
  end
104
148
 
105
- def process_test(test)
106
- result = TestResult.new("TS_#{test.xmlId}", test.name, STATUS[:pass], '','')
107
- @last_response = nil # clear out any responses from previous tests
108
- @warnings = [] # clear out any previous warnings
149
+ def testreport_template
150
+ report = FHIR::TestReport.new(
151
+ {
152
+ 'identifier' => { 'system' => 'http://projectcrucible.org', 'value' => id },
153
+ 'status' => 'complete',
154
+ 'TestScript' => { 'display' => id },
155
+ 'issued' => Time.now.to_s.sub(' ','T').sub(' ','').insert(-3,':'),
156
+ 'participant' => [
157
+ {
158
+ 'type' => 'test-engine',
159
+ 'uri' => 'http://projectcrucible.org',
160
+ 'display' => 'plan_executor'
161
+ },
162
+ {
163
+ 'type' => 'server',
164
+ 'uri' => (@client ? @client.full_resource_url({}) : nil )
165
+ }
166
+ ]
167
+ })
168
+ report.participant.pop if @client.nil?
169
+ report
170
+ end
171
+
172
+ # This overrides a method of the same name in the Crucible::Tests::BaseTest base class,
173
+ # to handle differences in the structure of the FHIR TestReport resource than Crucible's
174
+ # internal TestResult class.
175
+ def execute_test_methods
176
+ @testreport = testreport_template
109
177
  begin
110
- test.action.each do |action|
111
- perform_action action
112
- end unless @setup_failed || @metadata_only
178
+ @testreport.setup = setup if respond_to? :setup and not @metadata_only
113
179
  rescue AssertionException => e
114
- result.update(STATUS[:fail], e.message, e.data)
115
- rescue => e
116
- result.update(STATUS[:error], "Fatal Error: #{e.message}", e.backtrace.join("\n"))
180
+ FHIR.logger.error "Setup Error #{id}: #{e.message}\n#{e.backtrace}"
181
+ @setup_failed = e
182
+ @testreport.status = 'error'
183
+ if @testreport.setup.action.last.operation
184
+ @testreport.setup.action.last.operation.message = "#{e.message}\n#{e.backtrace}"
185
+ elsif @testreport.setup.action.last.assert
186
+ @testreport.setup.action.last.assert.message = "#{e.message}\n#{e.backtrace}"
187
+ end
117
188
  end
118
- result.update(STATUS[:skip], "Skipped because setup failed.", "-") if @setup_failed
119
- result.warnings = @warnings unless @warnings.empty?
120
- result.requires = []
121
- result.validates = []
122
- unless test.metadata.nil?
123
- test.metadata.capability.each do |capability|
124
- conf = get_reference(capability.conformance.reference)
125
- conf.rest.each do |rest|
126
- interactions = rest.resource.map{|resource| { resource: resource.fhirType, methods: resource.interaction.map(&:code)}}
127
- result.requires.concat(interactions) if capability.required
128
- result.validates.concat(interactions) if capability.fhirValidated
189
+ prefix = if @metadata_only then 'generating metadata' else 'executing' end
190
+ methods = tests
191
+ methods = tests & @tests_subset unless @tests_subset.blank?
192
+ methods.each do |test_method|
193
+ @client.requests = [] if @client
194
+ FHIR.logger.info "[#{title}#{('_' + @resource_class.name.demodulize) if @resource_class}] #{prefix}: #{test_method}..."
195
+ begin
196
+ @testreport.test << self.method(test_method).call
197
+ rescue => e
198
+ FHIR.logger.error "Fatal Error executing #{id} #{test_method}: #{e.message}\n#{e.backtrace}"
199
+ @testreport.status = 'error'
200
+ if @testreport.test.last.action.last.operation
201
+ @testreport.test.last.action.last.operation.message = "#{e.message}\n#{e.backtrace}"
202
+ elsif @testreport.test.last.action.last.assert
203
+ @testreport.test.last.action.last.assert.message = "#{e.message}\n#{e.backtrace}"
129
204
  end
130
205
  end
131
- result.links = test.metadata.capability.map(&:link).flatten.uniq
206
+ end
207
+ begin
208
+ @testreport.teardown = teardown if respond_to? :teardown and not @metadata_only
209
+ rescue
210
+ end
211
+ @testreport
212
+ end
213
+
214
+ # Returns a FHIR::TestReport::Test
215
+ def process_test(test)
216
+ result = FHIR::TestReport::Test.new({
217
+ 'name' => test.id,
218
+ 'description' => test.description,
219
+ 'action' => []
220
+ })
221
+ @current_test = test
222
+ @last_response = nil # clear out any responses from previous tests
223
+ @test_failed = false
224
+ begin
225
+ test.action.each do |action|
226
+ if !@test_failed
227
+ @current_action = action
228
+ result.action << perform_action(action)
229
+ @test_failed = true if action_failed?(result.action.last)
230
+ end
231
+ end unless @metadata_only
232
+ rescue => e
233
+ @testreport.status = 'error'
234
+ FHIR.logger.error "Fatal Error processing TestScript #{test.id} Action: #{e.message}\n#{e.backtrace}"
132
235
  end
133
236
  result
134
237
  end
135
238
 
239
+ def action_failed?(action)
240
+ return true if action.nil?
241
+ if action.operation
242
+ ['fail','error'].include?(action.operation.result)
243
+ elsif action.assert
244
+ ['fail','error'].include?(action.assert.result)
245
+ else
246
+ true
247
+ end
248
+ end
249
+
250
+ # Returns a FHIR::TestReport::Setup
136
251
  def setup
137
- return if @testscript.setup.blank? && @autocreate.empty?
252
+ return nil if @testscript.setup.blank? && @autocreate.empty?
253
+ report_setup = FHIR::TestReport::Setup.new
254
+ @current_test = :setup
138
255
  @setup_failed = false
139
- begin
140
- @autocreate.each do |fixture_id|
256
+ # Run any autocreates
257
+ @autocreate.each do |fixture_id|
258
+ if !@setup_failed
259
+ @current_action = "Autocreate Fixture #{fixture_id}"
141
260
  @last_response = @client.create @fixtures[fixture_id]
142
261
  @id_map[fixture_id] = @last_response.id
143
- end unless @client.nil?
144
- @testscript.setup.action.each do |action|
145
- perform_action action
146
- end unless @testscript.setup.blank?
147
- rescue AssertionException
148
- @setup_failed = true
149
- end
262
+ report_setup.action << FHIR::TestReport::Setup::Action.new({
263
+ 'operation' => {
264
+ 'result' => ( [200,201].include?(@last_response.code) ? 'pass' : 'fail' ),
265
+ 'message' => @current_action
266
+ }
267
+ })
268
+ @setup_failed = true unless [200,201].include?(@last_response.code)
269
+ end
270
+ end unless @client.nil?
271
+ # Run setup actions if any
272
+ @testscript.setup.action.each do |action|
273
+ if !@setup_failed
274
+ @current_action = action
275
+ report_setup.action << perform_action(action)
276
+ @setup_failed = true if action_failed?(report_setup.action.last)
277
+ end
278
+ end unless @testscript.setup.blank?
279
+ report_setup
150
280
  end
151
281
 
282
+ # Returns a FHIR::TestReport::Teardown
152
283
  def teardown
153
- return if @testscript.teardown.blank? && @autodelete.empty?
284
+ return nil if @testscript.teardown.blank? && @autodelete.empty?
285
+ report_teardown = FHIR::TestReport::Teardown.new
286
+ # First run teardown as normal
154
287
  @testscript.teardown.action.each do |action|
155
- execute_operation action.operation unless action.operation.nil?
288
+ report_teardown.action << perform_action(action)
156
289
  end unless @testscript.teardown.blank?
290
+ # Next autodelete any auto fixtures
157
291
  @autodelete.each do |fixture_id|
158
292
  @last_response = @client.destroy @fixtures[fixture_id].class, @id_map[fixture_id]
159
293
  @id_map.delete(fixture_id)
294
+ report_teardown.action << FHIR::TestReport::Setup::Action.new({
295
+ 'operation' => {
296
+ 'result' => ( [200,204].include?(@last_response.code) ? 'pass' : 'fail' ),
297
+ 'message' => "Autodelete Fixture #{fixture_id}"
298
+ }
299
+ })
160
300
  end unless @client.nil?
301
+ report_teardown
161
302
  end
162
303
 
304
+ # Returns a FHIR::TestReport::Setup::Action
305
+ # containing either a FHIR::TestReport::Setup::Action::Operation
306
+ # or a FHIR::TestReport::Setup::Action::Assert
163
307
  def perform_action(action)
164
- execute_operation action.operation unless action.operation.nil?
165
- handle_assertion action.assert unless action.assert.nil?
308
+ result = FHIR::TestReport::Setup::Action.new
309
+ if action.operation
310
+ result.operation = execute_operation(action.operation)
311
+ elsif action.assert
312
+ result.assert = handle_assertion(action.assert)
313
+ end
314
+ result
166
315
  end
167
316
 
317
+ # Returns a FHIR::TestReport::Setup::Action::Operation
168
318
  def execute_operation(operation)
169
- return if @client.nil?
170
- requestHeaders = Hash[operation.requestHeader.all.map{|u| [u.field, u.value]}] #Client needs upgrade to support
319
+ return nil if @client.nil?
320
+ result = FHIR::TestReport::Setup::Action::Operation.new({
321
+ 'result' => 'pass',
322
+ 'message' => operation.description
323
+ })
324
+
325
+ requestHeaders = Hash[(operation.requestHeader || []).map{|u| [u.field, u.value]}] #Client needs upgrade to support
171
326
  format = FHIR::Formats::ResourceFormat::RESOURCE_XML
172
327
  format = FORMAT_MAP[operation.contentType] unless operation.contentType.nil?
173
328
  format = FORMAT_MAP[operation.accept] unless operation.accept.nil?
174
329
 
175
330
  operationCode = 'empty'
176
- operationCode = operation.fhirType.code unless operation.fhirType.nil?
331
+ operationCode = operation.type.code unless operation.type.nil?
177
332
 
178
333
  case operationCode
179
334
  when 'read'
180
- if !operation.targetId.nil?
181
- @last_response = @client.read @fixtures[operation.targetId].class, @id_map[operation.targetId]
335
+ if operation.targetId
336
+ @last_response = @client.read @fixtures[operation.targetId].class, @id_map[operation.targetId], format
337
+ elsif operation.url
338
+ @last_response = @client.get replace_variables(operation.url), @client.fhir_headers({ format: format})
339
+ @last_response.resource = FHIR.from_contents(@last_response.body)
340
+ @last_response.resource_class = @last_response.resource.class
182
341
  else
183
342
  resource_type = replace_variables(operation.resource)
184
343
  resource_id = replace_variables(operation.params)
185
- @last_response = @client.read "FHIR::#{resource_type}".constantize, id_from_path(resource_id)
344
+ @last_response = @client.read "FHIR::#{resource_type}".constantize, id_from_path(resource_id), format
186
345
  end
187
346
  when 'vread'
188
- raise 'vread not implemented'
347
+ if operation.url
348
+ @last_response = @client.get replace_variables(operation.url), @client.fhir_headers({ format: format})
349
+ @last_response.resource = FHIR.from_contents(@last_response.body)
350
+ @last_response.resource_class = @last_response.resource.class
351
+ else
352
+ resource_type = replace_variables(operation.resource)
353
+ resource_id = replace_variables(operation.params)
354
+ @last_response = @client.read "FHIR::#{resource_type}".constantize, resource_id, format
355
+ end
189
356
  when 'search'
190
357
  if operation.url.nil?
191
358
  params = extract_operation_parameters(operation)
@@ -201,7 +368,7 @@ module Crucible
201
368
  when 'create'
202
369
  @last_response = @client.base_create(@fixtures[operation.sourceId], requestHeaders, format)
203
370
  @id_map[operation.sourceId] = @last_response.id
204
- when 'update'
371
+ when 'update','updateCreate'
205
372
  target_id = nil
206
373
 
207
374
  if !operation.targetId.nil?
@@ -210,15 +377,15 @@ module Crucible
210
377
  target_id = id_from_path(replace_variables(operation.params))
211
378
  end
212
379
 
213
- raise "No target specified for update" if target_id.nil?
214
-
215
380
  fixture = @fixtures[operation.sourceId]
216
- fixture.xmlId = replace_variables(target_id) if fixture.xmlId.nil?
381
+ fixture.id = replace_variables(target_id) if fixture.id.nil?
217
382
  @last_response = @client.update fixture, replace_variables(target_id), format
218
383
  when 'transaction'
219
- raise 'transaction not implemented'
384
+ result.result = 'error'
385
+ result.message = 'transaction not implemented'
220
386
  when 'conformance'
221
- raise 'conformance not implemented'
387
+ result.result = 'error'
388
+ result.message = 'conformance not implemented'
222
389
  when 'delete'
223
390
  if operation.targetId.nil?
224
391
  params = replace_variables(operation.params)
@@ -228,49 +395,46 @@ module Crucible
228
395
  @id_map.delete(operation.targetId)
229
396
  end
230
397
  when '$expand'
231
- raise '$expand not supported'
398
+ result.result = 'error'
399
+ result.message = '$expand not supported'
232
400
  # @last_response = @client.value_set_expansion( extract_operation_parameters(operation) )
233
401
  when '$validate'
234
- raise '$validate not supported'
402
+ result.result = 'error'
403
+ result.message = '$validate not supported'
235
404
  # @last_response = @client.value_set_code_validation( extract_operation_parameters(operation) )
236
405
  when '$validate-code'
237
- raise 'could not find params for $validate-code' unless operation.params
238
-
239
- params = nil
240
- # TODO: need to figure this out
241
- # if operation.params =~ URI::regexp
242
- # params = CGI.parse(URI.parse(operation.params).query)
243
- # end
244
-
245
- raise 'could not find any parameters for $validate-code' unless params
246
- raise 'could not find system for $validate-code' unless params['system']
247
- raise 'could not find code for $validate-code' unless params['code']
248
-
249
- options = {
250
- :operation => {
251
- :method => 'GET',
252
- :parameters => {
253
- 'code' => { type: 'Code', value: params['code'] },
254
- 'identifier' => { type: 'Uri', value: params['system'] }
255
- }
256
- }
257
- }
258
- @last_response = @client.value_set_code_validation(options)
259
-
406
+ result.result = 'error'
407
+ result.message = '$validate-code not supported'
408
+ # options = {
409
+ # :operation => {
410
+ # :method => 'GET',
411
+ # :parameters => {
412
+ # 'code' => { type: 'Code', value: params['code'] },
413
+ # 'identifier' => { type: 'Uri', value: params['system'] }
414
+ # }
415
+ # }
416
+ # }
417
+ # @last_response = @client.value_set_code_validation(options)
260
418
  when 'empty'
261
-
262
419
  if !operation.params.nil? && !operation.resource.nil?
263
420
  resource = "FHIR::#{operation.resource}".constantize
264
421
  @last_response = @client.read resource, nil, FORMAT_MAP[operation.accept], nil, params: replace_variables(operation.params)
265
- end
266
-
422
+ end
267
423
  else
268
- raise "Undefined operation for #{@testscript.name}-#{title}: #{operation.fhirType}"
424
+ result.result = 'error'
425
+ result.message = "Undefined operation #{operation.type.to_json}"
426
+ FHIR.logger.error(result.message)
269
427
  end
270
428
  handle_response(operation)
429
+ result
271
430
  end
272
431
 
432
+ # Returns a FHIR::TestReport::Setup::Action::Assert
273
433
  def handle_assertion(assertion)
434
+ result = FHIR::TestReport::Setup::Action::Assert.new({
435
+ 'result' => 'pass',
436
+ 'message' => assertion.label || assertion.description
437
+ })
274
438
 
275
439
  operator = :equals
276
440
  operator = OPERATOR_MAP[assertion.operator] unless assertion.operator.nil?
@@ -278,102 +442,173 @@ module Crucible
278
442
  warningOnly = false
279
443
  warningOnly = assertion.warningOnly unless assertion.warningOnly.nil?
280
444
 
281
- case
282
- when !assertion.contentType.nil?
283
- call_assertion(:assert_resource_content_type, warningOnly, @last_response, assertion.contentType)
445
+ begin
446
+ case
447
+ when !assertion.contentType.nil?
448
+ call_assertion(:assert_resource_content_type, @last_response, assertion.contentType)
449
+
450
+ when !assertion.headerField.nil?
451
+ if assertion.direction && assertion.direction=='request'
452
+ header_value = @last_response.request[:headers][assertion.headerField]
453
+ msg_prefix = 'Request'
454
+ else
455
+ header_value = @last_response.response[:headers][assertion.headerField.downcase]
456
+ msg_prefix = 'Response'
457
+ end
458
+ call_assertion(:assert_operator, operator, replace_variables(assertion.value), header_value, "#{msg_prefix} Header field #{assertion.headerField}")
459
+ when !assertion.minimumId.nil?
460
+ call_assertion(:assert_minimum, @last_response, @fixtures[assertion.minimumId])
461
+
462
+ when !assertion.navigationLinks.nil?
463
+ call_assertion(:assert_navigation_links, @last_response.resource)
464
+
465
+ when !assertion.path.nil?
466
+ actual_value = nil
467
+ resource = nil
468
+ if assertion.sourceId.nil?
469
+ resource = @last_response.try(:resource) || FHIR.from_contents(@last_response.body)
470
+ else
471
+ resource = @fixtures[assertion.sourceId]
472
+ resource = @response_map[assertion.sourceId].try(:resource) || FHIR.from_contents(@response_map[assertion.sourceId].body) if resource.nil?
473
+ end
474
+ actual_value = extract_value_by_path(resource, assertion.path)
284
475
 
285
- when !assertion.headerField.nil?
286
- call_assertion(:assert_operator, warningOnly, operator, replace_variables(assertion.value), @last_response.response[:headers][assertion.headerField.downcase], "Header field #{assertion.headerField}")
476
+ expected_value = replace_variables(assertion.value)
477
+ unless assertion.compareToSourceId.nil?
478
+ resource = @fixtures[assertion.compareToSourceId]
479
+ resource = @response_map[assertion.compareToSourceId].try(:resource) || FHIR.from_contents(@response_map[assertion.compareToSourceId].body) if resource.nil?
480
+ expected_value = extract_value_by_path(resource, assertion.path)
481
+ end
287
482
 
288
- when !assertion.minimumId.nil?
289
- call_assertion(:assert_minimum, warningOnly, @last_response, @fixtures[assertion.minimumId])
483
+ call_assertion(:assert_operator, operator, expected_value, actual_value)
484
+ when !assertion.compareToSourcePath.nil?
485
+ actual_value = nil
486
+ resource = nil
487
+ if assertion.sourceId
488
+ resource = @fixtures[assertion.sourceId]
489
+ resource = @response_map[assertion.sourceId].try(:resource) || FHIR.from_contents(@response_map[assertion.sourceId].body) if resource.nil?
490
+ else
491
+ raise AssertionException.new("compareToSourcePath requires sourceId: #{assertion.to_json}")
492
+ end
493
+ actual_value = extract_value_by_path(resource, assertion.compareToSourcePath)
290
494
 
291
- when !assertion.navigationLinks.nil?
292
- call_assertion(:assert_navigation_links, warningOnly, @last_response.resource)
495
+ expected_value = replace_variables(assertion.value)
496
+ unless assertion.compareToSourceId.nil?
497
+ resource = @fixtures[assertion.compareToSourceId]
498
+ resource = @response_map[assertion.compareToSourceId].try(:resource) || FHIR.from_contents(@response_map[assertion.compareToSourceId].body) if resource.nil?
499
+ expected_value = extract_value_by_path(resource, assertion.compareToSourcePath)
500
+ end
293
501
 
294
- when !assertion.path.nil?
295
- actual_value = nil
502
+ call_assertion(:assert_operator, operator, expected_value, actual_value)
503
+ when !assertion.resource.nil?
504
+ call_assertion(:assert_resource_type, @last_response, "FHIR::#{assertion.resource}".constantize)
296
505
 
297
- resource_xml = nil
298
- if assertion.sourceId.nil?
299
- resource_xml = @last_response.try(:resource).try(:to_xml) || @last_response.body
300
- else
301
- resource_xml = @fixtures[assertion.sourceId].try(:to_xml)
302
- resource_xml = @response_map[assertion.sourceId].try(:resource).try(:to_xml) || @response_map[assertion.soureId].body if resource_xml.nil?
303
- end
506
+ when !assertion.responseCode.nil?
507
+ call_assertion(:assert_operator, operator, assertion.responseCode, @last_response.response[:code].to_s)
304
508
 
305
- actual_value = extract_xpath_value(resource_xml, assertion.path)
509
+ when !assertion.response.nil?
510
+ call_assertion(:assert_response_code, @last_response, CODE_MAP[assertion.response])
306
511
 
307
- expected_value = replace_variables(assertion.value)
308
- unless assertion.compareToSourceId.nil?
309
- resource_xml = @fixtures[assertion.compareToSourceId].try(:to_xml)
310
- resource_xml = @response_map[assertion.compareToSourceId].try(:resource).try(:to_xml) || @response_map[assertion.compareToSourceId].body if resource_xml.nil?
512
+ when !assertion.validateProfileId.nil?
513
+ profile_uri = @testscript.profile.first{|p| p.id = assertion.validateProfileId}.reference
514
+ reply = @client.validate(@last_response.resource,{profile_uri: profile_uri})
515
+ call_assertion(:assert_valid_profile, reply.response, @last_response.resource.class)
311
516
 
312
- expected_value = extract_xpath_value(resource_xml, assertion.path)
517
+ when !assertion.expression.nil?
518
+ resource = nil
519
+ if assertion.sourceId.nil?
520
+ resource = @last_response.try(:resource) || FHIR.from_contents(@last_response.body)
521
+ else
522
+ resource = @fixtures[assertion.sourceId]
523
+ resource = @response_map[assertion.sourceId].try(:resource) || FHIR.from_contents(@response_map[assertion.sourceId].body) if resource.nil?
524
+ end
525
+ begin
526
+ unless FluentPath.evaluate(assertion.expression, resource.to_hash)
527
+ raise AssertionException.new("Expression did not evaluate to true: #{assertion.expression}", assertion.expression)
528
+ end
529
+ rescue => fpe
530
+ raise "Invalid Expression: #{assertion.expression}"
531
+ end
532
+ when !assertion.compareToSourceExpression.nil?
533
+ resource = nil
534
+ if assertion.sourceId
535
+ resource = @fixtures[assertion.sourceId]
536
+ resource = @response_map[assertion.sourceId].try(:resource) || FHIR.from_contents(@response_map[assertion.sourceId].body) if resource.nil?
537
+ else
538
+ raise AssertionException.new("compareToSourceExpression requires sourceId: #{assertion.to_json}")
539
+ end
540
+ begin
541
+ unless FluentPath.evaluate(assertion.compareToSourceExpression, resource.to_hash)
542
+ raise AssertionException.new("Expression did not evaluate to true: #{assertion.compareToSourceExpression}", assertion.compareToSourceExpression)
543
+ end
544
+ rescue => fpe
545
+ raise "Invalid Expression: #{assertion.compareToSourceExpression}"
546
+ end
547
+ else
548
+ result.result = 'error'
549
+ result.message = "Unhandled Assertion: #{assertion.to_json}"
313
550
  end
314
-
315
- call_assertion(:assert_operator, warningOnly, operator, expected_value, actual_value)
316
-
317
- when !assertion.resource.nil?
318
- call_assertion(:assert_resource_type, warningOnly, @last_response, "FHIR::#{assertion.resource}".constantize)
319
-
320
- when !assertion.responseCode.nil?
321
- call_assertion(:assert_operator, warningOnly, operator, assertion.responseCode, @last_response.response[:code], "Response Code #{assertion.responseCode}")
322
-
323
- # call_assertion(:assert_response_code, warningOnly, @last_response, assertion.responseCode)
324
-
325
- when !assertion.response.nil?
326
- call_assertion(:assert_response_code, warningOnly, @last_response, CODE_MAP[assertion.response])
327
-
328
- when !assertion.validateProfileId.nil?
329
- profile_uri = @testscript.profile.first{|p| p.xmlId = assertion.validateProfileId}.reference
330
- reply = @client.validate(@last_response.resource,{profile_uri: profile_uri})
331
- call_assertion(:assert_valid_profile, warningOnly, reply.response, @last_response.resource.class)
332
-
333
- else
334
- raise "Unknown Assertion"
335
-
551
+ rescue AssertionException => ae
552
+ result.result = 'fail'
553
+ result.result = 'warning' if warningOnly
554
+ result.message = ae.message
555
+ rescue => e
556
+ result.result = 'error'
557
+ result.message = "#{e.message}\n#{e.backtrace}"
336
558
  end
337
559
 
560
+ result
338
561
  end
339
562
 
340
- def call_assertion(method, warned, *params)
341
- if warned
342
- warning { self.method(method).call(*params) }
343
- else
344
- self.method(method).call(*params)
345
- end
563
+ def call_assertion(method, *params)
564
+ FHIR.logger.debug "Assertion: #{method}"
565
+ self.method(method).call(*params)
346
566
  end
347
567
 
348
568
  def replace_variables(input)
349
569
  return nil if input.nil?
570
+ return input unless input.include?('${')
350
571
 
351
572
  @testscript.variable.each do |var|
352
- if !var.headerField.nil?
353
- variable_source_response = @response_map[var.sourceId]
354
- variable_value = variable_source_response.response[:headers][var.headerField]
355
- input.gsub!("${" + var.name + "}", variable_value)
356
- elsif !var.path.nil?
357
-
358
- resource_xml = nil
359
-
360
- variable_source_response = @response_map[var.sourceId]
361
- unless variable_source_response.nil?
362
- resource_xml = variable_source_response.try(:resource).try(:to_xml) || variable_source_response.body
363
- else
364
- resource_xml = @fixtures[var.sourceId].to_xml
573
+ if input.include? "${#{var.name}}"
574
+ variable_value = nil
575
+
576
+ if !var.headerField.nil?
577
+ variable_source_response = @response_map[var.sourceId]
578
+ headers = variable_source_response.response[:headers]
579
+ headers.each do |key,value|
580
+ variable_value = value if key.downcase == var.headerField.downcase
581
+ end
582
+ elsif !var.path.nil?
583
+
584
+ resource = nil
585
+ variable_source_response = @response_map[var.sourceId]
586
+ unless variable_source_response.nil?
587
+ resource = variable_source_response.try(:resource) || FHIR.from_contents(variable_source_response.body)
588
+ else
589
+ resource = @fixtures[var.sourceId]
590
+ end
591
+
592
+ variable_value = extract_value_by_path(resource, var.path)
365
593
  end
366
594
 
367
- extracted_value = extract_xpath_value(resource_xml, var.path)
368
-
369
- input.gsub!("${" + var.name + "}", extracted_value) unless extracted_value.nil?
595
+ unless variable_value
596
+ if var.defaultValue
597
+ variable_value = var.defaultValue
598
+ else
599
+ variable_value = ''
600
+ end
601
+ end
370
602
 
371
- end if input.include? "${" + var.name + "}"
603
+ input.gsub!("${#{var.name}}", variable_value)
604
+ end
372
605
  end
373
606
 
374
607
  if input.include? '${'
375
- puts "An unknown variable was unable to be replaced: #{input}!"
376
- warning { assert !input.include?('${'), "An unknown variable was unable to be substituted: #{input}" }
608
+ unknown_variables = input.scan(/(\$\{)([A-Za-z0-9\_]+)(\})/).map{|x|x[1]}
609
+ message = "Unknown variables: #{unknown_variables.join(', ')}"
610
+ log message
611
+ warning { assert unknown_variables.empty?, message }
377
612
  end
378
613
 
379
614
  input
@@ -392,24 +627,35 @@ module Crucible
392
627
  end
393
628
 
394
629
  def handle_response(operation)
395
- if !operation.responseId.blank? && operation.fhirType.code != 'delete'
630
+ if !operation.responseId.blank? && operation.type.code != 'delete'
396
631
  log "Overwriting response #{operation.responseId}..." if @response_map.keys.include?(operation.responseId)
397
632
  log "Storing response #{operation.responseId}..."
398
633
  @response_map[operation.responseId] = @last_response
399
634
  end
400
635
  end
401
636
 
402
- def extract_xpath_value(resource_xml, resource_xpath)
637
+ def extract_value_by_path(resource, path)
638
+ result = nil
639
+ begin
640
+ # First, try xpath
641
+ result = extract_xpath_value(resource.to_xml, path)
642
+ rescue
643
+ # If xpath fails, see if JSON path will work...
644
+ result = JsonPath.new(path).first(resource.to_json)
645
+ end
646
+ result
647
+ end
403
648
 
649
+ def extract_xpath_value(resource_xml, resource_xpath)
404
650
  # Massage the xpath if it doesn't have fhir: namespace or if doesn't end in @value
405
651
  # Also make it look in the entire xml document instead of just starting at the root
406
- resource_xpath = resource_xpath.split("/").map{|s| if s.starts_with?("fhir:") || s.length == 0 then s else "fhir:#{s}" end}.join("/")
407
- resource_xpath = "#{resource_xpath}/@value" unless resource_xpath.ends_with? "/@value"
408
- resource_xpath = "//#{resource_xpath}"
652
+ xpath = resource_xpath.split("/").map{|s| if s.starts_with?('fhir:') || s.length == 0 || s.starts_with?('@') then s else "fhir:#{s}" end}.join('/')
653
+ xpath = "#{xpath}/@value" unless xpath.ends_with? '@value'
654
+ xpath = "//#{xpath}"
409
655
 
410
656
  resource_doc = Nokogiri::XML(resource_xml)
411
657
  resource_doc.root.add_namespace_definition('fhir', 'http://hl7.org/fhir')
412
- resource_element = resource_doc.xpath(resource_xpath)
658
+ resource_element = resource_doc.xpath(xpath)
413
659
 
414
660
  # This doesn't work on warningOnly; consider putting back in place
415
661
  # raise AssertionException.new("[#{resource_xpath}] resolved to multiple values instead of a single value", resource_element.to_s) if resource_element.length>1
@@ -424,26 +670,16 @@ module Crucible
424
670
  resource = nil
425
671
  if reference.start_with?('#')
426
672
  contained_id = reference[1..-1]
427
- resource = @testscript.contained.select{|r| r.xmlId == contained_id}.first
673
+ resource = @testscript.contained.select{|r| r.id == contained_id}.first
674
+ elsif reference.start_with?('http')
675
+ raise "Remote references not supported: #{reference}"
428
676
  else
429
- root = File.expand_path '.', File.dirname(File.absolute_path(__FILE__))
430
- return nil unless File.exist? "#{root}/xml#{reference}"
431
- file = File.open("#{root}/xml#{reference}", "r:UTF-8", &:read)
677
+ filepath = File.expand_path reference, File.dirname(File.absolute_path(@testscript.url))
678
+ return nil unless File.exist? filepath
679
+ file = File.open(filepath, 'r:UTF-8', &:read)
432
680
  file.encode!('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')
433
681
  file = preprocess(file) if file.include?('${')
434
- if reference.split('.').last == "json"
435
- resourceType = JSON.parse(file)["resourceType"]
436
- resource = "FHIR::#{resourceType}".constantize.from_fhir_json(file)
437
- else
438
- resourceType = Nokogiri::XML(file).children.find{|x| x.class == Nokogiri::XML::Element}.name
439
- fhirType = "FHIR::#{resourceType}".constantize
440
- if fhirType.respond_to? :from_xml
441
- resource = fhirType.from_xml(file)
442
- else
443
- puts "Unable to load reference: Method from_xml undefined on FHIR::#{resourceType}"
444
- end
445
-
446
- end
682
+ resource = FHIR.from_contents(file)
447
683
  end
448
684
 
449
685
  resource
@@ -458,8 +694,8 @@ module Crucible
458
694
  if @preprocessed_vars.key?(match[0])
459
695
  output.sub!("${#{match[0]}}", @preprocessed_vars[match[0]])
460
696
  else
461
- code_matches = /^([a-zA-Z]+)(\d+)$/.match(match[0])
462
- continue unless code_matches.size == 3
697
+ code_matches = /^(C|c|D|d|CD|cd)(\d+)$/.match(match[0])
698
+ next unless code_matches && code_matches.size == 3
463
699
  mock_data = generate_mock_data(code_matches[1], code_matches[2].to_i)
464
700
  output.sub!("${#{match[0]}}", mock_data)
465
701
  @preprocessed_vars[match[0]] = mock_data