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
@@ -6,7 +6,7 @@ module Crucible
6
6
  resource = minimal_patient(identifier,name)
7
7
  # resource.identifier = [ minimal_identifier(identifier) ]
8
8
  # resource.name = [ minimal_humanname(name) ]
9
- resource.meta = FHIR::Resource::ResourceMetaComponent.new
9
+ resource.meta = FHIR::Meta.new
10
10
  resource.meta.profile = ['http://hl7.org/fhir/StructureDefinition/daf-patient']
11
11
  # DAF must supports and DAF extensions
12
12
  resource.active = true
@@ -15,12 +15,12 @@ module Crucible
15
15
  resource.birthDate = DateTime.now.strftime("%Y-%m-%d")
16
16
  resource.deceasedBoolean = false
17
17
  resource.address = [ daf_address ]
18
- resource.maritalStatus = minimal_codeableconcept('http://hl7.org/fhir/marital-status','S')
18
+ resource.maritalStatus = minimal_codeableconcept('http://hl7.org/fhir/v3/MaritalStatus','S')
19
19
  resource.multipleBirthBoolean = false
20
20
  resource.contact = [ daf_patient_contact ]
21
21
  resource.communication = [ daf_patient_communication ]
22
- resource.careProvider = [ FHIR::Reference.new ] # reference to DAF-Organization or DAF-Pract
23
- resource.careProvider.first.display = 'DAF Organization or Practitioner'
22
+ # resource.careProvider = [ FHIR::Reference.new ] # reference to DAF-Organization or DAF-Pract
23
+ # resource.careProvider.first.display = 'DAF Organization or Practitioner'
24
24
  resource.managingOrganization = FHIR::Reference.new # reference to DAF-Organization
25
25
  resource.managingOrganization.display = 'DAF Organization'
26
26
  resource.extension = []
@@ -68,7 +68,7 @@ module Crucible
68
68
  end
69
69
 
70
70
  def self.daf_patient_contact
71
- resource = FHIR::Patient::ContactComponent.new
71
+ resource = FHIR::Patient::Contact.new
72
72
  resource.relationship = [ minimal_codeableconcept('http://hl7.org/fhir/patient-contact-relationship','parent'), minimal_codeableconcept('http://hl7.org/fhir/patient-contact-relationship','emergency') ]
73
73
  resource.name = minimal_humanname('Mom')
74
74
  resource.telecom = [ daf_contact_point ]
@@ -77,7 +77,7 @@ module Crucible
77
77
  end
78
78
 
79
79
  def self.daf_patient_communication
80
- resource = FHIR::Patient::PatientCommunicationComponent.new
80
+ resource = FHIR::Patient::Communication.new
81
81
  resource.language = minimal_codeableconcept('http://tools.ietf.org/html/bcp47','en-US')
82
82
  resource
83
83
  end
@@ -85,7 +85,7 @@ module Crucible
85
85
  def self.make_extension(url,type,value)
86
86
  extension = FHIR::Extension.new
87
87
  extension.url = url
88
- extension.value = FHIR::AnyType.new(type,value)
88
+ extension.method("value#{type}=".to_sym).call(value)
89
89
  extension
90
90
  end
91
91
 
@@ -14,67 +14,63 @@ module Crucible
14
14
  end
15
15
 
16
16
  def example_patient
17
- FHIR::Patient.from_xml File.read(File.join(fixture_path, 'patient', 'patient-example.xml'))
18
- end
19
-
20
- def example_format_patient
21
- FHIR::Patient.from_xml File.read(File.join(fixture_path, 'patient', 'patient-format-example.xml'))
17
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'patient', 'patient-example.xml'))
22
18
  end
23
19
 
24
20
  def example_patient_us
25
- FHIR::Patient.from_xml File.read(File.join(fixture_path, 'patient', 'patient-example-us-extensions(us01).xml'))
21
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'patient', 'patient-example-us-extensions.xml'))
26
22
  end
27
23
 
28
24
  def minimal_patient
29
- FHIR::Patient.from_xml File.read(File.join(fixture_path, 'patient', 'patient-minimal.xml'))
25
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'patient', 'patient-minimal.xml'))
30
26
  end
31
27
 
32
28
  def example_patient_record_201
33
- FHIR::Patient.from_xml File.read(File.join(fixture_path, 'record', 'patient-example-f201-roel.xml'))
29
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'record', 'patient-example-f201-roel.xml'))
34
30
  end
35
31
 
36
32
  def example_patient_record_condition_201
37
- FHIR::Condition.from_xml File.read(File.join(fixture_path, 'record', 'condition-example-f201-fever.xml'))
33
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'record', 'condition-example-f201-fever.xml'))
38
34
  end
39
35
 
40
36
  def example_patient_record_condition_205
41
- FHIR::Condition.from_xml File.read(File.join(fixture_path, 'record', 'condition-example-f205-infection.xml'))
37
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'record', 'condition-example-f205-infection.xml'))
42
38
  end
43
39
 
44
40
  def example_patient_record_diagnosticreport_201
45
- FHIR::DiagnosticReport.from_xml File.read(File.join(fixture_path, 'record', 'diagnosticreport-example-f201-brainct.xml'))
41
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'record', 'diagnosticreport-example-f201-brainct.xml'))
46
42
  end
47
43
 
48
44
  def example_patient_record_encounter_201
49
- FHIR::Encounter.from_xml File.read(File.join(fixture_path, 'record', 'encounter-example-f201-20130404.xml'))
45
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'record', 'encounter-example-f201-20130404.xml'))
50
46
  end
51
47
 
52
48
  def example_patient_record_encounter_202
53
- FHIR::Encounter.from_xml File.read(File.join(fixture_path, 'record', 'encounter-example-f202-20130128.xml'))
49
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'record', 'encounter-example-f202-20130128.xml'))
54
50
  end
55
51
 
56
52
  def example_patient_record_observation_202
57
- FHIR::Observation.from_xml File.read(File.join(fixture_path, 'record', 'observation-example-f202-temperature.xml'))
53
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'record', 'observation-example-f202-temperature.xml'))
58
54
  end
59
55
 
60
56
  def example_patient_record_organization_201
61
- FHIR::Organization.from_xml File.read(File.join(fixture_path, 'record', 'organization-example-f201-aumc.xml'))
57
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'record', 'organization-example-f201-aumc.xml'))
62
58
  end
63
59
 
64
60
  def example_patient_record_organization_203
65
- FHIR::Organization.from_xml File.read(File.join(fixture_path, 'record', 'organization-example-f203-bumc.xml'))
61
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'record', 'organization-example-f203-bumc.xml'))
66
62
  end
67
63
 
68
64
  def example_patient_record_practitioner_201
69
- FHIR::Practitioner.from_xml File.read(File.join(fixture_path, 'record', 'practitioner-example-f201-ab.xml'))
65
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'record', 'practitioner-example-f201-ab.xml'))
70
66
  end
71
67
 
72
68
  def example_patient_record_procedure_201
73
- FHIR::Procedure.from_xml File.read(File.join(fixture_path, 'record', 'procedure-example-f201-tpf.xml'))
69
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'record', 'procedure-example-f201-tpf.xml'))
74
70
  end
75
71
 
76
72
  def track3_profile
77
- FHIR::StructureDefinition.from_xml File.read(File.join(fixture_path, 'validation', 'observation.profile.xml'))
73
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'validation', 'observation.profile.xml'))
78
74
  end
79
75
 
80
76
  def track3_observations
@@ -82,7 +78,7 @@ module Crucible
82
78
  observations = []
83
79
  files = File.join(fixture_path, 'validation', 'observations', '*.xml')
84
80
  Dir.glob(files).each do |f|
85
- observations << FHIR::Observation.from_xml( File.read(f) )
81
+ observations << FHIR::Xml.from_xml( File.read(f) )
86
82
  end
87
83
  observations
88
84
  end
@@ -90,47 +86,71 @@ module Crucible
90
86
  # ------------------------------ CLAIM TEST TRACK ------------------------------
91
87
 
92
88
  def simple_claim
93
- FHIR::Claim.from_xml File.read(File.join(fixture_path, 'financial', 'claim-example-simple.xml'))
89
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'financial', 'claim-example.xml'))
94
90
  end
95
91
 
96
92
  def average_claim
97
- FHIR::Claim.from_xml File.read(File.join(fixture_path, 'financial', 'claim-example-average.xml'))
93
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'financial', 'claim-example-oral-average.xml'))
94
+ end
95
+
96
+ def complex_claim
97
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'financial', 'claim-example-oral-orthoplan.xml'))
98
98
  end
99
99
 
100
100
  # ------------------------------ SCHEDULING TEST TRACK ------------------------------
101
101
 
102
102
  def scheduling_appointment
103
- FHIR::Appointment.from_xml File.read(File.join(fixture_path, 'scheduling', 'appointment-simple.xml'))
103
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'scheduling', 'appointment-simple.xml'))
104
104
  end
105
105
 
106
106
  def scheduling_response_patient
107
- FHIR::AppointmentResponse.from_xml File.read(File.join(fixture_path, 'scheduling', 'appointmentresponse-patient-simple.xml'))
107
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'scheduling', 'appointmentresponse-patient-simple.xml'))
108
108
  end
109
109
 
110
110
  def scheduling_response_practitioner
111
- FHIR::AppointmentResponse.from_xml File.read(File.join(fixture_path, 'scheduling', 'appointmentresponse-practitioner-simple.xml'))
111
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'scheduling', 'appointmentresponse-practitioner-simple.xml'))
112
112
  end
113
113
 
114
114
  def scheduling_practitioner
115
- FHIR::Practitioner.from_xml File.read(File.join(fixture_path, 'scheduling', 'practitioner-simple.xml'))
115
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'scheduling', 'practitioner-simple.xml'))
116
116
  end
117
117
 
118
118
  def scheduling_schedule
119
- FHIR::Schedule.from_xml File.read(File.join(fixture_path, 'scheduling', 'schedule-simple.xml'))
119
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'scheduling', 'schedule-simple.xml'))
120
120
  end
121
121
 
122
122
  def scheduling_slot
123
- FHIR::Slot.from_xml File.read(File.join(fixture_path, 'scheduling', 'slot-simple.xml'))
123
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'scheduling', 'slot-simple.xml'))
124
124
  end
125
125
 
126
126
  # ------------------------------ DAF TESTS ------------------------------
127
127
 
128
128
  def daf_conformance
129
- FHIR::Conformance.from_xml File.read(File.join(fixture_path, 'daf', 'conformance-daf-query-responder.xml'))
129
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'daf', 'conformance-daf-query-responder.xml'))
130
+ end
131
+
132
+ # ------------------------------ TERMINOLOGY TRACK TESTS ------------------------------
133
+
134
+ def codesystem_simple
135
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'terminology', 'codesystem-simple.xml'))
136
+ end
137
+
138
+ def valueset_simple
139
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'terminology', 'valueset-example.xml'))
140
+ end
141
+
142
+ def conceptmap_simple
143
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'terminology', 'conceptmap-example.xml'))
144
+ end
145
+
146
+ # ------------------------------ PATCH TRACK TESTS ------------------------------
147
+
148
+ def medicationorder_simple
149
+ FHIR::Xml.from_xml File.read(File.join(fixture_path, 'patch', 'medicationrequest-simple.xml'))
130
150
  end
131
151
 
132
152
  def load_fixture(path)
133
- FHIR::Resource.from_contents(File.read(File.join(fixture_path, path)))
153
+ FHIR.from_contents(File.read(File.join(fixture_path, path)))
134
154
  end
135
155
 
136
156
  end
@@ -12,7 +12,7 @@ module FHIR
12
12
  def monitor_requests
13
13
  return if @decorated
14
14
  @decorated = true
15
- [:get, :put, :post, :delete, :head].each do |method|
15
+ [:get, :put, :post, :delete, :head, :patch].each do |method|
16
16
  class_eval %Q{
17
17
  alias #{method}_original #{method}
18
18
  def #{method}(*args, &block)
@@ -24,4 +24,4 @@ module FHIR
24
24
  end
25
25
  end
26
26
  end
27
- end
27
+ end
@@ -1,11 +1,16 @@
1
+ # OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
2
+
1
3
  # Top level include file that brings in all the necessary code
2
4
  require 'bundler/setup'
3
5
  require 'rubygems'
4
6
  require 'yaml'
5
7
  require 'nokogiri'
6
- require 'fhir_model'
8
+ require 'logger'
7
9
  require 'fhir_client'
8
10
  require 'nokogiri/diff'
11
+ require 'active_support/inflector'
12
+ require 'active_support/core_ext'
13
+ require 'jsonpath'
9
14
 
10
15
  require_relative File.join('.','executor.rb')
11
16
  require_relative File.join('.','test_result.rb')
@@ -10,14 +10,11 @@ module Crucible
10
10
  def self.generate(klass,embedded=0)
11
11
  resource = klass.new
12
12
  Time.zone = 'UTC'
13
- set_fields!(resource)
14
- if(embedded > 0)
15
- generate_children!(resource,embedded)
16
- end
17
- resource.xmlId=nil if resource.respond_to?(:xmlId=)
13
+ set_fields!(resource, embedded)
14
+ resource.id=nil if resource.respond_to?(:id=)
18
15
  resource.versionId=nil if resource.respond_to?(:versionId=)
19
16
  resource.version=nil if resource.respond_to?(:version=)
20
- resource.text=nil if [FHIR::Bundle,FHIR::Binary,FHIR::Parameters].include?(klass)
17
+ #resource.text=nil if [FHIR::Bundle,FHIR::Binary].include?(klass)
21
18
  apply_invariants!(resource)
22
19
  resource
23
20
  end
@@ -25,136 +22,131 @@ module Crucible
25
22
  #
26
23
  # Set the fields of this resource to have some random values.
27
24
  #
28
- def self.set_fields!(resource)
29
- # Organize some of the validators
30
- validators = {}
31
- resource.class.validators.collect{|v| v if v.class==Mongoid::Validatable::FormatValidator}.compact.each do |v|
32
- v.attributes.each{|a| validators[a] = v.options[:with]}
33
- end
25
+ def self.set_fields!(resource, embedded=0)
34
26
 
35
- # For now, we'll skip fields that can have multiple datatypes, such as attribute[x]
36
- multiples = []
27
+ unselected_multiples = []
37
28
  if resource.class.constants.include? :MULTIPLE_TYPES
38
- multiples = resource.class::MULTIPLE_TYPES.map{|k,v| v}.flatten
29
+ multiples = resource.class::MULTIPLE_TYPES.keys
30
+ all_multiples = multiples.map{|k| resource.class::MULTIPLE_TYPES[k].map{|d| "#{k}#{d.titleize.split.join}" }}.flatten
31
+ selected_multiples = multiples.map{|k| "#{k}#{resource.class::MULTIPLE_TYPES[k].sample.titleize.split.join}" }
32
+ unselected_multiples = all_multiples - selected_multiples
39
33
  end
40
-
41
- # Get valid codes
42
- valid_codes = {}
43
- if resource.class.constants.include? :VALID_CODES
44
- valid_codes = resource.class::VALID_CODES
34
+ unselected_multiples.each do |key|
35
+ resource.method("#{key}=").call(nil)
45
36
  end
46
37
 
47
- # Get special codes
48
- special_codes = {}
49
- if resource.class.constants.include? :SPECIAL_CODES
50
- special_codes = resource.class::SPECIAL_CODES
51
- end
38
+ resource.class::METADATA.each do |key, meta|
39
+ type = meta['type']
40
+ next if type == 'Meta'
41
+ next if ['id','contained','version','versionId','implicitRules'].include? key
42
+ next if unselected_multiples.include?(key)
52
43
 
53
- fields = resource.fields
54
- fields.each do |key,value|
55
- type = value.options[:type]
56
- next if ['id','xmlId','version','versionId','implicitRules'].include? key
57
- next if multiples.include? key
58
44
  gen = nil
59
- if type == String
45
+ if type == 'string' || type == 'markdown'
60
46
  gen = SecureRandom.base64
61
- if valid_codes[key.to_sym]
62
- valid_values = valid_codes[key.to_sym]
63
- if !valid_values.nil?
64
- gen = valid_values[ SecureRandom.random_number( valid_values.length ) ]
65
- end
66
- elsif validators[key.to_sym]
67
- date = DateTime.now
68
- regex = validators[key.to_sym]
69
- if date.strftime("%Y-%m-%dT%T.%LZ").match(regex)
70
- gen = date.strftime("%Y-%m-%dT%T.%LZ")
71
- elsif date.strftime("%Y-%m-%d").match(regex)
72
- gen = date.strftime("%Y-%m-%d")
73
- elsif date.strftime("%T").match(regex)
74
- gen = date.strftime("%T")
75
- end
76
- elsif special_codes[key.to_sym]
77
- if special_codes[key.to_sym]=='MimeType'
78
- gen = 'text/plain'
79
- elsif special_codes[key.to_sym]=='Language'
80
- gen = 'en-US'
81
- end
47
+ elsif type == 'oid'
48
+ gen = random_oid
49
+ elsif type == 'id'
50
+ gen = SecureRandom.uuid
51
+ elsif type == 'code'
52
+ if meta['valid_codes']
53
+ gen = meta['valid_codes'].values.first.sample
54
+ elsif meta['binding'] && ['http://tools.ietf.org/html/bcp47','http://hl7.org/fhir/ValueSet/languages'].include?(meta['binding']['uri'])
55
+ gen = 'en-US'
56
+ elsif meta['binding'] && ['http://www.rfc-editor.org/bcp/bcp13.txt','http://hl7.org/fhir/ValueSet/content-type'].include?(meta['binding']['uri'])
57
+ gen = MIME::Types.to_a.sample.content_type
58
+ else
59
+ gen = SecureRandom.base64
82
60
  end
83
- elsif type == Integer
84
- gen = (SecureRandom.random_number(100) + 1) # add one in case this is a "positiveInt" which must be > 0
85
- elsif type == Float
61
+ elsif type == 'xhtml'
62
+ gen = "<div>#{SecureRandom.base64}</div>"
63
+ elsif type == 'uri'
64
+ gen = "http://projectcrucible.org/#{SecureRandom.base64}"
65
+ elsif type == 'dateTime' || type == 'instant'
66
+ gen = DateTime.now.strftime("%Y-%m-%dT%T.%LZ")
67
+ elsif type == 'date'
68
+ gen = DateTime.now.strftime("%Y-%m-%d")
69
+ elsif type == 'time'
70
+ gen = DateTime.now.strftime("%T")
71
+ elsif type == 'boolean'
72
+ gen = (SecureRandom.random_number(100) % 2 == 0)
73
+ elsif type == 'positiveInt' || type == 'unsignedInt' || type == 'integer'
74
+ gen = (SecureRandom.random_number(100) + 1) # add one in case this is a "positiveInt" which must be > 0
75
+ elsif type == 'decimal'
86
76
  gen = SecureRandom.random_number
87
77
  while gen.to_s.match(/e/) # according to FHIR spec: decimals may not contain exponents
88
78
  gen = SecureRandom.random_number
89
79
  end
90
- elsif type == Mongoid::Boolean
91
- gen = (SecureRandom.random_number(100) % 2 == 0)
92
- elsif type == BSON::Binary
93
- # gen = SecureRandom.random_bytes
80
+ elsif type == 'base64Binary'
94
81
  gen = SecureRandom.base64
95
- elsif type == BSON::ObjectId or type == Array or type == Object or type == FHIR::AnyType
96
- gen = nil # ignore
97
- # else
98
- # puts "Unable to generate field #{key} for #{resource.class} -- unrecognized type: #{type}"
82
+ elsif FHIR::RESOURCES.include?(type)
83
+ if embedded > 0
84
+ gen = generate_child(type, embedded-1)
85
+ end
86
+ elsif FHIR::TYPES.include?(type)
87
+ if embedded > 0
88
+ gen = generate_child(type, embedded-1)
89
+ # apply bindings
90
+ if type == 'CodeableConcept' && meta['valid_codes'] && meta['binding']
91
+ gen.coding.each do |c|
92
+ c.system = meta['valid_codes'].keys.sample
93
+ c.code = meta['valid_codes'][c.system].sample
94
+ display = FHIR::Definitions.get_display(c.system, c.code)
95
+ c.display = display ? display : nil
96
+ end
97
+ elsif type == 'CodeableConcept' && meta['binding'] && meta['binding']['uri'] == 'http://hl7.org/fhir/ValueSet/use-context'
98
+ gen.coding.each do |c|
99
+ c.system = 'https://www.usps.com/'
100
+ c.code = ['CA','TX','NY','MA','DC'].sample
101
+ end
102
+ elsif type == 'Coding' && meta['valid_codes'] && meta['binding']
103
+ gen.system = meta['valid_codes'].keys.sample
104
+ gen.code = meta['valid_codes'][gen.system].sample
105
+ display = FHIR::Definitions.get_display(gen.system, gen.code)
106
+ gen.display = display ? display : nil
107
+ elsif type == 'Reference'
108
+ gen.reference = nil
109
+ gen.display = "#{meta['type_profiles'].map{|x|x.split('/').last}.sample} #{gen.display}" if meta['type_profiles']
110
+ elsif type == 'Attachment'
111
+ gen.contentType = MIME::Types.to_a.sample.content_type
112
+ gen.data = nil
113
+ elsif type == 'Narrative'
114
+ gen.status = 'generated'
115
+ end
116
+ end
117
+ elsif resource.class.constants.include? type.demodulize.to_sym
118
+ if embedded > 0
119
+ # CHILD component
120
+ gen = generate_child(type, embedded-1)
121
+ end
122
+ elsif ancestor_fhir_classes(resource.class).include? type.demodulize.to_sym
123
+ if embedded > 0
124
+ gen = generate_child(type, embedded-1)
125
+ end
126
+ elsif ("FHIR::#{type}".constantize rescue nil)
127
+ if embedded > 0
128
+ gen = generate_child(type, embedded-1)
129
+ end
130
+ else
131
+ puts "Unable to generate field #{key} for #{resource.class} -- unrecognized type: #{type}"
99
132
  end
100
- gen='en-US' if(key=='language' && type==String)
101
- resource[key] = gen if !gen.nil?
133
+ method = meta['local_name'] ? meta['local_name'] : key
134
+ gen = [gen] if meta['max'] > 1 && !gen.nil?
135
+ resource.method("#{method}=").call(gen) if !gen.nil?
102
136
  end
103
137
  resource
104
138
  end
105
139
 
140
+ def self.ancestor_fhir_classes(klass)
141
+ classes = klass.constants
142
+ classes.concat ancestor_fhir_classes(klass.parent) if klass.parent != FHIR && klass.parent != Object
143
+ classes
144
+ end
106
145
 
107
- #
108
- # Generate children for this resource.
109
- #
110
- def self.generate_children!(resource,embedded=0)
111
- # For now, we'll skip fields that can have multiple datatypes, such as attribute[x]
112
- multiples = []
113
- if resource.class.constants.include? :MULTIPLE_TYPES
114
- multiples = resource.class::MULTIPLE_TYPES.map{|k,v| v}.flatten
115
- end
116
-
117
- children = resource.embedded_relations
118
- children.each do |key,value|
119
- # TODO: Determine if we can generate references or meta information
120
- next if ['meta'].include? key
121
- next if multiples.include? key
122
-
123
- klass = resource.get_fhir_class_from_resource_type(value[:class_name])
124
- case klass
125
- when FHIR::Reference
126
- child = FHIR::Reference.new
127
- child.display = "#{key} #{SecureRandom.base64}"
128
- when FHIR::CodeableConcept
129
- child = FHIR::CodeableConcept.new
130
- child.text = "#{key} #{SecureRandom.base64}"
131
- when FHIR::Coding
132
- child = FHIR::Coding.new
133
- child.display = "#{key} #{SecureRandom.base64}"
134
- when FHIR::Quantity
135
- child = FHIR::Quantity.new
136
- child.value = SecureRandom.random_number
137
- while child.value.to_s.match(/e/) # according to FHIR spec: decimals may not contain exponents
138
- child.value = SecureRandom.random_number
139
- end
140
- child.unit = SecureRandom.base64
141
- else
142
- child = generate(klass,(embedded-1)) if(!['FHIR::Extension','FHIR::PrimitiveExtension','FHIR::Signature'].include?(value[:class_name]))
143
- end
144
-
145
- case klass
146
- when FHIR::Identifier
147
- child.system = nil
148
- when FHIR::Attachment
149
- child.url = nil
150
- end
151
-
152
- if value[:relation] == Mongoid::Relations::Embedded::Many
153
- child = ([] << child) if child
154
- end
155
- resource[key] = child if child
156
- end
157
- resource
146
+ def self.generate_child(type, embedded=0)
147
+ return if ['Meta','Extension','PrimitiveExtension'].include? type
148
+ klass = "FHIR::#{type}".constantize
149
+ generate(klass, embedded)
158
150
  end
159
151
 
160
152
  def self.random_oid
@@ -193,11 +185,11 @@ module Crucible
193
185
  # Default system/code are for SNOMED "Obese (finding)"
194
186
  def self.minimal_condition(system='http://snomed.info/sct',code='414915002',patientId=nil)
195
187
  resource = FHIR::Condition.new
196
- resource.patient = FHIR::Reference.new
188
+ resource.subject = FHIR::Reference.new
197
189
  if patientId
198
- resource.patient.reference = "Patient/#{patientId}"
190
+ resource.subject.reference = "Patient/#{patientId}"
199
191
  else
200
- resource.patient.display = 'Patient'
192
+ resource.subject.display = 'Patient'
201
193
  end
202
194
  resource.code = minimal_codeableconcept(system,code)
203
195
  resource.verificationStatus = 'confirmed'
@@ -215,9 +207,9 @@ module Crucible
215
207
  def self.minimal_humanname(name='Name')
216
208
  hn = FHIR::HumanName.new
217
209
  hn.use = 'official'
218
- hn.family = [ 'Crucible' ]
210
+ hn.family = 'Crucible'
219
211
  hn.given = [ name ]
220
- hn.text = "#{hn.given[0]} #{hn.family[0]}"
212
+ hn.text = "#{hn.given[0]} #{hn.family}"
221
213
  hn
222
214
  end
223
215
 
@@ -263,7 +255,7 @@ module Crucible
263
255
  end
264
256
 
265
257
  def self.minimal_animal
266
- animal = FHIR::Patient::AnimalComponent.new
258
+ animal = FHIR::Patient::Animal.new
267
259
  animal.species = minimal_codeableconcept('http://hl7.org/fhir/animal-species','canislf') # dog
268
260
  animal.breed = minimal_codeableconcept('http://hl7.org/fhir/animal-breed','gret') # golden retriever
269
261
  animal.genderStatus = minimal_codeableconcept('http://hl7.org/fhir/animal-genderstatus','intact') # intact
@@ -271,71 +263,102 @@ module Crucible
271
263
  end
272
264
 
273
265
  def self.apply_invariants!(resource)
274
- case resource.class
266
+ case resource
267
+ when FHIR::Age
268
+ resource.system = 'http://unitsofmeasure.org'
269
+ resource.code = 'a'
270
+ resource.value = (SecureRandom.random_number(100) + 1)
271
+ resource.unit = nil
272
+ resource.comparator = nil
273
+ when FHIR::AllergyIntolerance
274
+ resource.clinicalStatus = nil if resource.verificationStatus=='entered-in-error'
275
+ when FHIR::Duration
276
+ resource.system = 'http://unitsofmeasure.org'
277
+ resource.code = 'mo'
278
+ resource.unit = nil
279
+ resource.comparator = nil
280
+ when FHIR::Money
281
+ resource.system = 'urn:iso:std:iso:4217'
282
+ resource.code = 'USD'
283
+ resource.unit = nil
284
+ resource.comparator = nil
275
285
  when FHIR::Appointment
276
286
  resource.reason = minimal_codeableconcept('http://snomed.info/sct','219006') # drinker of alcohol
277
- resource.participant.each{|p| p.fhirType=[ minimal_codeableconcept('http://hl7.org/fhir/participant-type','emergency') ] }
287
+ resource.participant.each{|p| p.type=[ minimal_codeableconcept('http://hl7.org/fhir/participant-type','emergency') ] }
278
288
  when FHIR::AppointmentResponse
279
289
  resource.participantType = [ minimal_codeableconcept('http://hl7.org/fhir/participant-type','emergency') ]
280
290
  when FHIR::AuditEvent
281
- resource.object.each do |o|
291
+ resource.entity.each do |o|
282
292
  o.query=nil
283
293
  o.name = "name #{SecureRandom.base64}" if o.name.nil?
284
294
  end
285
295
  when FHIR::Bundle
286
- resource.total = nil if !['searchset','history'].include?(resource.fhirType)
287
- resource.entry.each {|e|e.search=nil} if resource.fhirType!='searchset'
288
- resource.entry.each {|e|e.request=nil} if !['batch','transaction','history'].include?(resource.fhirType)
289
- resource.entry.each {|e|e.response=nil} if !['batch-response','transaction-response'].include?(resource.fhirType)
296
+ resource.type = ['document','message','collection'].sample
297
+ resource.total = nil if !['searchset','history'].include?(resource.type)
298
+ resource.entry.each {|e|e.search=nil} if resource.type!='searchset'
299
+ resource.entry.each {|e|e.request=nil} if !['batch','transaction','history'].include?(resource.type)
300
+ resource.entry.each {|e|e.response=nil} if !['batch-response','transaction-response'].include?(resource.type)
290
301
  head = resource.entry.first
291
302
  if !head.nil?
292
- if head.request.nil? && head.response.nil? && head.resource.nil?
293
- if resource.fhirType == 'document'
294
- head.resource = generate(FHIR::Composition,3)
295
- elsif resource.fhirType == 'message'
296
- head.resource = generate(FHIR::MessageHeader,3)
297
- else
298
- head.resource = generate(FHIR::Basic,3)
299
- end
300
- end
301
- if head.resource.nil?
302
- head.fullUrl = nil
303
+ if resource.type == 'document'
304
+ head.resource = generate(FHIR::Composition,3)
305
+ elsif resource.type == 'message'
306
+ head.resource = generate(FHIR::MessageHeader,3)
303
307
  else
304
- rid = SecureRandom.random_number(100) + 1
305
- head.fullUrl = "http://projectcrucible.org/fhir/#{rid}"
306
- head.resource.xmlId = "#{rid}"
308
+ head.resource = generate(FHIR::Basic,3)
307
309
  end
310
+ rid = SecureRandom.random_number(100) + 1
311
+ head.fullUrl = "http://projectcrucible.org/fhir/#{head.resource.resourceType}/#{rid}"
312
+ head.resource.id = "#{rid}"
308
313
  end
309
314
  when FHIR::CarePlan
310
315
  resource.activity.each {|a| a.reference = nil if a.detail }
316
+ when FHIR::CodeSystem
317
+ resource.concept.each do |c|
318
+ c.concept.each do |d|
319
+ d.property.each do |p|
320
+ p.valueCode = nil
321
+ p.valueCoding = nil
322
+ p.valueString = SecureRandom.base64
323
+ p.valueInteger = nil
324
+ p.valueBoolean = nil
325
+ p.valueDateTime = nil
326
+ end
327
+ end
328
+ end
329
+ when FHIR::CapabilityStatement
330
+ resource.kind = 'instance'
331
+ resource.rest.each do |r|
332
+ r.resource.each do |res|
333
+ res.interaction.each{|i|i.code = ['read', 'vread', 'update', 'delete', 'history-instance', 'history-type', 'create', 'search-type'].sample}
334
+ end
335
+ r.interaction.each{|i|i.code = ['transaction', 'batch', 'search-system', 'history-system'].sample }
336
+ end
311
337
  when FHIR::Claim
312
338
  resource.item.each do |item|
313
- item.fhirType = minimal_coding('http://hl7.org/fhir/v3/ActCode','OHSINV')
339
+ item.category = minimal_coding('http://hl7.org/fhir/v3/ActCode','OHSINV')
314
340
  item.detail.each do |detail|
315
- detail.fhirType = minimal_coding('http://hl7.org/fhir/v3/ActCode','OHSINV')
341
+ detail.category = minimal_coding('http://hl7.org/fhir/v3/ActCode','OHSINV')
316
342
  detail.subDetail.each do |sub|
317
- sub.fhirType = minimal_coding('http://hl7.org/fhir/v3/ActCode','OHSINV')
343
+ sub.category = minimal_coding('http://hl7.org/fhir/v3/ActCode','OHSINV')
318
344
  sub.service = minimal_coding('http://hl7.org/fhir/ex-USCLS','1205')
319
345
  end
320
346
  end
321
347
  end
322
- resource.missingTeeth.each do |mt|
323
- mt.tooth = minimal_coding('http://hl7.org/fhir/ex-fdi','42')
324
- end
325
348
  when FHIR::ClaimResponse
326
349
  resource.item.each do |item|
327
- item.adjudication.each{|a|a.code = minimal_coding('http://hl7.org/fhir/adjudication','benefit')}
350
+ item.adjudication.each{|a|a.category = minimal_coding('http://hl7.org/fhir/adjudication','benefit')}
328
351
  item.detail.each do |detail|
329
- detail.adjudication.each{|a|a.code = minimal_coding('http://hl7.org/fhir/adjudication','benefit')}
352
+ detail.adjudication.each{|a|a.category = minimal_coding('http://hl7.org/fhir/adjudication','benefit')}
330
353
  detail.subDetail.each do |sub|
331
- sub.adjudication.each{|a|a.code = minimal_coding('http://hl7.org/fhir/adjudication','benefit')}
354
+ sub.adjudication.each{|a|a.category = minimal_coding('http://hl7.org/fhir/adjudication','benefit')}
332
355
  end
333
356
  end
334
357
  end
335
358
  resource.addItem.each do |addItem|
336
- addItem.adjudication.each{|a|a.code = minimal_coding('http://hl7.org/fhir/adjudication','benefit')}
359
+ addItem.adjudication.each{|a|a.category = minimal_coding('http://hl7.org/fhir/adjudication','benefit')}
337
360
  addItem.detail.each do |detail|
338
- detail.adjudication.each{|a|a.code = minimal_coding('http://hl7.org/fhir/adjudication','benefit')}
361
+ detail.adjudication.each{|a|a.category = minimal_coding('http://hl7.org/fhir/adjudication','benefit')}
339
362
  end
340
363
  end
341
364
  when FHIR::Communication
@@ -358,8 +381,28 @@ module Crucible
358
381
  if(resource.targetUri.nil? && resource.targetReference.nil?)
359
382
  resource.targetReference = textonly_reference('ValueSet')
360
383
  end
361
- when FHIR::Conformance
362
- resource.fhirVersion = 'DSTU2'
384
+ when FHIR::Condition
385
+ if resource.onsetAge
386
+ resource.onsetAge.system = 'http://unitsofmeasure.org'
387
+ resource.onsetAge.code = 'a'
388
+ resource.onsetAge.unit = 'yr'
389
+ resource.onsetAge.comparator = nil
390
+ end
391
+ if resource.abatementAge
392
+ resource.abatementAge.system = 'http://unitsofmeasure.org'
393
+ resource.abatementAge.code = 'a'
394
+ resource.abatementAge.unit = 'yr'
395
+ resource.abatementAge.comparator = nil
396
+ end
397
+ # Make sure the onsetAge is before the abatementAge. If it's not (and both exist), flip them around
398
+ if resource.onsetAge && resource.abatementAge
399
+ if resource.onsetAge.value > resource.abatementAge.value
400
+ # This is the "Ruby Way" to swap two variables without using a temporary third variable
401
+ resource.onsetAge, resource.abatementAge = resource.abatementAge, resource.onsetAge
402
+ end
403
+ end
404
+ when FHIR::CapabilityStatement
405
+ resource.fhirVersion = 'STU3'
363
406
  resource.format = ['xml','json']
364
407
  if resource.kind == 'capability'
365
408
  resource.implementation = nil
@@ -369,16 +412,44 @@ module Crucible
369
412
  end
370
413
  resource.messaging.each{|m| m.endpoint = nil} if resource.kind != 'instance'
371
414
  when FHIR::Contract
372
- resource.actor.each do |actor|
373
- actor.entity = textonly_reference('Patient')
415
+ resource.agent.each do |agent|
416
+ agent.actor = textonly_reference('Patient')
417
+ end
418
+ resource.valuedItem.each do |item|
419
+ if item.unitPrice
420
+ item.unitPrice.system = 'urn:iso:std:iso:4217'
421
+ item.unitPrice.code = 'USD'
422
+ item.unitPrice.unit = nil
423
+ item.unitPrice.comparator = nil
424
+ end
425
+ if item.net
426
+ item.net.system = 'urn:iso:std:iso:4217'
427
+ item.net.code = 'USD'
428
+ item.net.unit = nil
429
+ item.net.comparator = nil
430
+ end
374
431
  end
375
432
  resource.term.each do |term|
376
- term.actor.each do |actor|
377
- actor.entity = textonly_reference('Organization')
433
+ term.agent.each do |agent|
434
+ agent.actor = textonly_reference('Organization')
378
435
  end
379
436
  term.group.each do |group|
380
- group.actor.each do |actor|
381
- actor.entity = textonly_reference('Organization')
437
+ group.agent.each do |agent|
438
+ agent.actor = textonly_reference('Organization')
439
+ end
440
+ end
441
+ term.valuedItem.each do |item|
442
+ if item.unitPrice
443
+ item.unitPrice.system = 'urn:iso:std:iso:4217'
444
+ item.unitPrice.code = 'USD'
445
+ item.unitPrice.unit = nil
446
+ item.unitPrice.comparator = nil
447
+ end
448
+ if item.net
449
+ item.net.system = 'urn:iso:std:iso:4217'
450
+ item.net.code = 'USD'
451
+ item.net.unit = nil
452
+ item.net.comparator = nil
382
453
  end
383
454
  end
384
455
  end
@@ -396,8 +467,13 @@ module Crucible
396
467
  end
397
468
  when FHIR::DataElement
398
469
  resource.mapping.each do |m|
399
- m.fhirIdentity = SecureRandom.base64 if m.fhirIdentity.nil?
400
- m.fhirIdentity.gsub!(/[^0-9A-Za-z]/, '')
470
+ m.identity = SecureRandom.base64 if m.identity.nil?
471
+ m.identity.gsub!(/[^0-9A-Za-z]/, '')
472
+ end
473
+ when FHIR::DeviceComponent
474
+ resource.languageCode.coding.each do |c|
475
+ c.system = 'http://tools.ietf.org/html/bcp47'
476
+ c.code = 'en-US'
401
477
  end
402
478
  when FHIR::DeviceMetric
403
479
  resource.measurementPeriod = nil
@@ -422,21 +498,61 @@ module Crucible
422
498
  end
423
499
  resource.condition = keys
424
500
  resource.mapping.each do |m|
425
- m.fhirIdentity = SecureRandom.base64 if m.fhirIdentity.nil?
426
- m.fhirIdentity.gsub!(/[^0-9A-Za-z]/, '')
501
+ m.identity = SecureRandom.base64 if m.identity.nil?
502
+ m.identity.gsub!(/[^0-9A-Za-z]/, '')
427
503
  end
428
504
  resource.max = "#{resource.min+1}"
429
505
  # TODO remove bindings for things that can't be code, Coding, CodeableConcept
430
506
  is_codeable = false
431
- resource.fhirType.each do |f|
507
+ resource.type.each do |f|
432
508
  is_codeable = (['code','Coding','CodeableConcept'].include?(f.code))
509
+ f.aggregation = []
433
510
  end
434
511
  resource.binding = nil unless is_codeable
512
+ resource.contentReference = nil
513
+ FHIR::ElementDefinition::MULTIPLE_TYPES['defaultValue'].each do |type|
514
+ resource.instance_variable_set("@defaultValue#{type.capitalize}".to_sym, nil)
515
+ resource.instance_variable_set("@fixed#{type.capitalize}".to_sym, nil)
516
+ resource.instance_variable_set("@pattern#{type.capitalize}".to_sym, nil)
517
+ resource.instance_variable_set("@example#{type.capitalize}".to_sym, nil)
518
+ resource.instance_variable_set("@minValue#{type.capitalize}".to_sym, nil)
519
+ resource.instance_variable_set("@maxValue#{type.capitalize}".to_sym, nil)
520
+ end
521
+ when FHIR::ExpansionProfile
522
+ resource.designation.exclude = nil
523
+ when FHIR::FamilyMemberHistory
524
+ if resource.ageAge
525
+ resource.ageAge.system = 'http://unitsofmeasure.org'
526
+ resource.ageAge.code = 'a'
527
+ resource.ageAge.unit = nil
528
+ resource.ageAge.comparator = nil
529
+ end
530
+ if SecureRandom.random_number(1)==0
531
+ resource.bornPeriod = nil
532
+ resource.bornDate = nil
533
+ resource.bornString = nil
534
+ else
535
+ resource.ageAge = nil
536
+ resource.ageRange = nil
537
+ resource.ageString = nil
538
+ end
539
+ if resource.deceasedAge
540
+ resource.deceasedAge.system = 'http://unitsofmeasure.org'
541
+ resource.deceasedAge.code = 'a'
542
+ resource.deceasedAge.unit = nil
543
+ resource.deceasedAge.comparator = nil
544
+ end
435
545
  when FHIR::Goal
436
546
  resource.outcome.each do |outcome|
437
547
  outcome.resultCodeableConcept = nil
438
548
  outcome.resultReference = textonly_reference('Observation')
439
549
  end
550
+ if resource.targetDuration
551
+ resource.targetDuration.system = 'http://unitsofmeasure.org'
552
+ resource.targetDuration.code = 'a'
553
+ resource.targetDuration.unit = nil
554
+ resource.targetDuration.comparator = nil
555
+ end
440
556
  when FHIR::Group
441
557
  resource.member = [] if resource.actual==false
442
558
  resource.characteristic.each do |c|
@@ -445,30 +561,32 @@ module Crucible
445
561
  c.valueQuantity = nil
446
562
  c.valueRange = nil
447
563
  end
448
- when FHIR::ImagingObjectSelection
449
- resource.uid = random_oid
450
- index = SecureRandom.random_number(FHIR::ImagingObjectSelection::VALID_CODES[:title].length)
451
- code = FHIR::ImagingObjectSelection::VALID_CODES[:title][index]
452
- resource.title = minimal_codeableconcept('http://nema.org/dicom/dicm',code)
453
- resource.study.each do |study|
454
- study.uid = random_oid
455
- study.series.each do |series|
456
- series.uid = random_oid
457
- series.instance.each do |instance|
458
- instance.sopClass = random_oid
459
- instance.uid = random_oid
460
- end
461
- end
462
- end
463
564
  when FHIR::ImagingStudy
464
565
  resource.uid = random_oid
566
+ availability = ['ONLINE', 'OFFLINE', 'NEARLINE', 'UNAVAILABLE']
465
567
  resource.series.each do |series|
466
568
  series.uid=random_oid
569
+ series.availability = availability.sample
467
570
  series.instance.each do |instance|
468
571
  instance.uid = random_oid
469
572
  instance.sopClass = random_oid
470
573
  end
471
574
  end
575
+ resource.availability = availability.sample
576
+ when FHIR::ImagingManifest
577
+ resource.title.coding.each{|c|c.code=['113000', '113002', '113003', '113004', '113005', '113006', '113007', '113008', '113009'].sample}
578
+ resource.study.each do |study|
579
+ study.series.each do |series|
580
+ series.baseLocation.each do |b|
581
+ b.type = minimal_coding('http://hl7.org/fhir/dWebType',['WADO-RS', 'WADO-URI', 'IID'].sample)
582
+ b.url = "http://projectcrucible.org/#{SecureRandom.base64}"
583
+ end
584
+ series.instance.each do |i|
585
+ i.sopClass = random_oid
586
+ i.uid = random_oid
587
+ end
588
+ end
589
+ end
472
590
  when FHIR::Immunization
473
591
  if resource.wasNotGiven
474
592
  resource.explanation.reasonNotGiven = [ textonly_codeableconcept("reasonNotGiven #{SecureRandom.base64}") ]
@@ -479,7 +597,7 @@ module Crucible
479
597
  resource.explanation.reason = [ textonly_codeableconcept("reason #{SecureRandom.base64}") ]
480
598
  end
481
599
  when FHIR::ImplementationGuide
482
- resource.fhirVersion = "DSTU2"
600
+ resource.fhirVersion = "STU3"
483
601
  resource.package.each do |package|
484
602
  package.resource.each do |r|
485
603
  r.sourceUri = nil
@@ -489,14 +607,14 @@ module Crucible
489
607
  when FHIR::List
490
608
  resource.emptyReason = nil
491
609
  resource.entry.each do |entry|
492
- resource.mode = 'changes' if !entry.fhirDeleted.nil?
610
+ resource.mode = 'changes' if !entry.deleted.nil?
493
611
  end
494
612
  when FHIR::Media
495
- if resource.fhirType == 'video'
613
+ if resource.type == 'video'
496
614
  resource.frames = nil
497
- elsif resource.fhirType == 'photo'
615
+ elsif resource.type == 'photo'
498
616
  resource.duration = nil
499
- elsif resource.fhirType == 'audio'
617
+ elsif resource.type == 'audio'
500
618
  resource.height = nil
501
619
  resource.width = nil
502
620
  resource.frames = nil
@@ -511,9 +629,9 @@ module Crucible
511
629
  end
512
630
  when FHIR::MedicationAdministration
513
631
  date = DateTime.now
514
- resource.effectiveTimeDateTime = date.strftime("%Y-%m-%dT%T.%LZ")
515
- resource.effectiveTimePeriod = nil
516
- if resource.wasNotGiven
632
+ resource.effectiveDateTime = date.strftime("%Y-%m-%dT%T.%LZ")
633
+ resource.effectivePeriod = nil
634
+ if resource.notGiven
517
635
  resource.reasonGiven = nil
518
636
  else
519
637
  resource.reasonNotGiven = nil
@@ -524,12 +642,12 @@ module Crucible
524
642
  resource.medicationReference = textonly_reference('Medication')
525
643
  resource.medicationCodeableConcept = nil
526
644
  resource.dosageInstruction.each {|d|d.timing = nil }
527
- when FHIR::MedicationOrder
645
+ when FHIR::MedicationRequest
528
646
  resource.medicationReference = textonly_reference('Medication')
529
647
  resource.medicationCodeableConcept = nil
530
648
  resource.dosageInstruction.each {|d|d.timing = nil }
531
649
  when FHIR::MedicationStatement
532
- resource.reasonNotTaken = nil if resource.wasNotTaken != true
650
+ resource.reasonNotTaken = nil if resource.notTaken != true
533
651
  resource.medicationReference = textonly_reference('Medication')
534
652
  resource.medicationCodeableConcept = nil
535
653
  resource.dosage.each{|d|d.timing=nil}
@@ -539,13 +657,14 @@ module Crucible
539
657
  resource.replacedBy = nil if resource.status!='retired'
540
658
  if resource.kind == 'root'
541
659
  resource.uniqueId.each do |uid|
542
- uid.fhirType='other' if ['uuid','oid'].include?(uid.fhirType)
660
+ uid.type='uuid'
661
+ uid.value = SecureRandom.uuid
543
662
  end
544
663
  end
545
664
  resource.uniqueId.each do |uid|
546
665
  uid.preferred = nil
547
666
  end
548
- when FHIR::NutritionOrder
667
+ when FHIR::NutritionRequest
549
668
  resource.oralDiet.schedule = nil if resource.oralDiet
550
669
  resource.supplement.each{|s|s.schedule=nil}
551
670
  resource.enteralFormula.administration = nil if resource.enteralFormula
@@ -553,35 +672,85 @@ module Crucible
553
672
  resource.parameter.each do |p|
554
673
  p.binding = nil
555
674
  p.part = nil
675
+ p.searchType = nil unless p.type == 'string'
556
676
  end
557
- when FHIR::Order
558
- resource.when.schedule = nil
559
677
  when FHIR::Patient
560
678
  resource.maritalStatus = minimal_codeableconcept('http://hl7.org/fhir/v3/MaritalStatus','S')
679
+ when FHIR::PlanDefinition
680
+ resource.actionDefinition.each do |a|
681
+ a.actionDefinition.each do |b|
682
+ b.relatedAction = []
683
+ end
684
+ end
561
685
  when FHIR::Procedure
562
686
  resource.reasonNotPerformed = nil if resource.notPerformed != true
563
687
  resource.focalDevice.each do |fd|
564
- fd.action = minimal_codeableconcept('http://hl7.org/fhir/ValueSet/device-action','implanted')
688
+ code = ['implanted', 'explanted', 'manipulated'].sample
689
+ fd.action = minimal_codeableconcept('http://hl7.org/fhir/device-action', code)
565
690
  end
566
691
  when FHIR::Provenance
567
692
  resource.entity.each do |e|
568
- e.agent.relatedAgent = nil if e.agent
693
+ e.agent.each{|a| a.relatedAgentType = nil }
694
+ end
695
+ when FHIR::Practitioner
696
+ resource.communication.each do |comm|
697
+ comm.coding.each do |c|
698
+ c.system = 'http://tools.ietf.org/html/bcp47'
699
+ c.code = 'en-US'
700
+ end
569
701
  end
570
702
  when FHIR::RelatedPerson
571
703
  resource.relationship = minimal_codeableconcept('http://hl7.org/fhir/patient-contact-relationship','family')
572
704
  when FHIR::Questionnaire
573
- resource.group.required = true
574
- resource.group.group = nil
575
- resource.group.question.each {|q|q.options = nil }
705
+ resource.item.each do |i|
706
+ i.required = true
707
+ i.item = []
708
+ i.options = nil
709
+ i.option = []
710
+ if ['choice','open-choice'].include?(i.type)
711
+ choice_a = FHIR::Questionnaire::Item::Option.new({'valueString'=>'true'})
712
+ choice_b = FHIR::Questionnaire::Item::Option.new({'valueString'=>'false'})
713
+ i.option = [ choice_a, choice_b ]
714
+ end
715
+ if i.type=='display'
716
+ i.required = nil
717
+ i.repeats = nil
718
+ i.readOnly = nil
719
+ i.concept = []
720
+ FHIR::Questionnaire::Item::MULTIPLE_TYPES['initial'].each do |type|
721
+ i.instance_variable_set("@initial#{type.capitalize}".to_sym, nil)
722
+ end
723
+ end
724
+ i.enableWhen.each do |ew|
725
+ ew.hasAnswer = false
726
+ ew.hasAnswer = nil if ew.answer
727
+ end
728
+ i.maxLength = nil if !['boolean', 'decimal', 'integer', 'string', 'text', 'url'].include?(i.type)
729
+ end
576
730
  when FHIR::QuestionnaireResponse
577
- resource.group.group = nil
578
- resource.group.question.each {|q|q.answer = nil }
731
+ resource.item.each do |i|
732
+ i.item = nil
733
+ i.answer.each {|q|q.valueBoolean = true if !q.value }
734
+ end
735
+ when FHIR::Range
736
+ # validate that the low/high values in the range are correct (e.g. the low value is not higher than the high value)
737
+ if resource.low && resource.high
738
+ if resource.low.value > resource.high.value
739
+ # This is the "Ruby Way" to swap two variables without using a temporary third variable
740
+ resource.low.value,resource.high.value = resource.high.value,resource.low.value
741
+ end
742
+ end
743
+ when FHIR::Signature
744
+ resource.type = [ minimal_coding('urn:iso-astm:E1762-95:2013','1.2.840.10065.1.12.1.18') ]
745
+ resource.whoUri = 'http://projectcrucible.org'
746
+ resource.whoReference = nil
579
747
  when FHIR::Subscription
580
- resource.status = 'requested' if resource.xmlId.nil?
748
+ resource.status = 'requested' if resource.id.nil?
581
749
  resource.channel.payload = 'applicaton/json+fhir'
582
750
  resource.end = nil
751
+ resource.criteria = 'Observation?code=http://loinc.org|1975-2'
583
752
  when FHIR::SupplyDelivery
584
- resource.fhirType = minimal_codeableconcept('http://hl7.org/fhir/supply-item-type','medication')
753
+ resource.type = minimal_codeableconcept('http://hl7.org/fhir/supply-item-type','medication')
585
754
  when FHIR::SupplyRequest
586
755
  resource.kind = minimal_codeableconcept('http://hl7.org/fhir/supply-kind','central')
587
756
  if resource.when
@@ -589,10 +758,44 @@ module Crucible
589
758
  resource.when.code = minimal_codeableconcept('http://snomed.info/sct','20050000') #biweekly
590
759
  end
591
760
  when FHIR::StructureDefinition
592
- resource.fhirVersion = 'DSTU2'
593
- resource.snapshot.element.first.path = resource.constrainedType if resource.snapshot && resource.snapshot.element
761
+ resource.derivation = 'constraint'
762
+ resource.fhirVersion = 'STU3'
763
+ resource.baseDefinition = "http://hl7.org/fhir/StructureDefinition/#{resource.type}"
764
+ is_pattern = (SecureRandom.random_number(1)==0)
765
+ if resource.snapshot && resource.snapshot.element
766
+ resource.snapshot.element.first.id = resource.type
767
+ resource.snapshot.element.first.path = resource.type
768
+ resource.snapshot.element.first.label = nil
769
+ resource.snapshot.element.first.code = nil
770
+ resource.snapshot.element.first.requirements = nil
771
+ resource.snapshot.element.first.type = nil
772
+ if is_pattern
773
+ FHIR::ElementDefinition::MULTIPLE_TYPES['defaultValue'].each do |type|
774
+ resource.snapshot.element.first.instance_variable_set("@defaultValue#{type.capitalize}".to_sym, nil)
775
+ resource.snapshot.element.first.instance_variable_set("@fixed#{type.capitalize}".to_sym, nil)
776
+ resource.snapshot.element.first.instance_variable_set("@example#{type.capitalize}".to_sym, nil)
777
+ resource.snapshot.element.first.instance_variable_set("@minValue#{type.capitalize}".to_sym, nil)
778
+ resource.snapshot.element.first.instance_variable_set("@maxValue#{type.capitalize}".to_sym, nil)
779
+ end
780
+ else
781
+ FHIR::ElementDefinition::MULTIPLE_TYPES['defaultValue'].each do |type|
782
+ resource.snapshot.element.first.instance_variable_set("@defaultValue#{type.capitalize}".to_sym, nil)
783
+ resource.snapshot.element.first.instance_variable_set("@pattern#{type.capitalize}".to_sym, nil)
784
+ resource.snapshot.element.first.instance_variable_set("@example#{type.capitalize}".to_sym, nil)
785
+ resource.snapshot.element.first.instance_variable_set("@minValue#{type.capitalize}".to_sym, nil)
786
+ resource.snapshot.element.first.instance_variable_set("@maxValue#{type.capitalize}".to_sym, nil)
787
+ end
788
+ end
789
+ end
790
+ if resource.differential && resource.differential.element
791
+ resource.differential.element[0] = resource.snapshot.element[0]
792
+ end
594
793
  resource.mapping.each do |m|
595
- m.fhirIdentity.gsub!(/[^0-9A-Za-z]/, '') if m.fhirIdentity
794
+ m.identity.gsub!(/[^0-9A-Za-z]/, '') if m.identity
795
+ end
796
+ when FHIR::StructureMap
797
+ resource.group.each do |g|
798
+ g.rule.each{|r|r.rule = nil}
596
799
  end
597
800
  when FHIR::TestScript
598
801
  resource.variable.each do |v|
@@ -600,7 +803,6 @@ module Crucible
600
803
  v.path = nil if v.headerField
601
804
  end
602
805
  if resource.setup
603
- resource.setup.metadata = nil
604
806
  resource.setup.action.each do |a|
605
807
  a.assert = nil if a.operation
606
808
  apply_invariants!(a.operation) if a.operation
@@ -608,7 +810,6 @@ module Crucible
608
810
  end
609
811
  end
610
812
  resource.test.each do |test|
611
- test.metadata = nil
612
813
  test.action.each do |a|
613
814
  a.assert = nil if a.operation
614
815
  apply_invariants!(a.operation) if a.operation
@@ -620,7 +821,7 @@ module Crucible
620
821
  apply_invariants!(a.operation) if a.operation
621
822
  end
622
823
  end
623
- when FHIR::TestScript::TestScriptSetupActionAssertComponent
824
+ when FHIR::TestScript::Setup::Action::Assert
624
825
  # an assertion can only contain one of these...
625
826
  keys = ['contentType','headerField','minimumId','navigationLinks','path','resource','responseCode','response','validateProfileId']
626
827
  has_keys = []
@@ -633,7 +834,7 @@ module Crucible
633
834
  end
634
835
  resource.sourceId.gsub!(/[^0-9A-Za-z]/, '') if resource.sourceId
635
836
  resource.validateProfileId.gsub!(/[^0-9A-Za-z]/, '') if resource.validateProfileId
636
- when FHIR::TestScript::TestScriptSetupActionOperationComponent
837
+ when FHIR::TestScript::Setup::Action::Operation
637
838
  resource.responseId.gsub!(/[^0-9A-Za-z]/, '') if resource.responseId
638
839
  resource.sourceId.gsub!(/[^0-9A-Za-z]/, '') if resource.sourceId
639
840
  resource.targetId.gsub!(/[^0-9A-Za-z]/, '') if resource.targetId