plan_executor 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (337) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +44 -0
  3. data/.simplecov +16 -0
  4. data/.travis.yml +13 -0
  5. data/Gemfile +26 -0
  6. data/Gemfile.lock +197 -0
  7. data/LICENSE +201 -0
  8. data/README.md +126 -0
  9. data/Rakefile +25 -0
  10. data/fixtures/daf/conformance-daf-query-responder.xml +1471 -0
  11. data/fixtures/diagnostic_order/do-100.xml +64 -0
  12. data/fixtures/diagnostic_order/do-200.xml +121 -0
  13. data/fixtures/diagnostic_order/do-300.xml +91 -0
  14. data/fixtures/diagnostic_order/do-400.xml +88 -0
  15. data/fixtures/diagnostic_report/dr-100.xml +96 -0
  16. data/fixtures/diagnostic_report/dr-200.xml +125 -0
  17. data/fixtures/diagnostic_report/dr-300.xml +132 -0
  18. data/fixtures/diagnostic_report/dr-400.xml +121 -0
  19. data/fixtures/financial/claim-example-average.xml +168 -0
  20. data/fixtures/financial/claim-example-simple.xml +67 -0
  21. data/fixtures/observation/obs-100.xml +58 -0
  22. data/fixtures/observation/obs-101.xml +58 -0
  23. data/fixtures/observation/obs-200.xml +125 -0
  24. data/fixtures/observation/obs-300.xml +106 -0
  25. data/fixtures/observation/obs-301.xml +106 -0
  26. data/fixtures/observation/obs-302.xml +106 -0
  27. data/fixtures/observation/obs-303.xml +106 -0
  28. data/fixtures/observation/obs-304.xml +106 -0
  29. data/fixtures/observation/obs-400.xml +87 -0
  30. data/fixtures/observation/obs-401.xml +95 -0
  31. data/fixtures/observation/obs-402.xml +95 -0
  32. data/fixtures/observation/obs-403.xml +84 -0
  33. data/fixtures/observation/obs-404.xml +84 -0
  34. data/fixtures/observation/obs-405.xml +83 -0
  35. data/fixtures/observation/obs-406.xml +83 -0
  36. data/fixtures/observation/obs-407.xml +70 -0
  37. data/fixtures/observation/obs-408.xml +84 -0
  38. data/fixtures/observation/obs-uslab-example5.xml +102 -0
  39. data/fixtures/order/order-100.xml +61 -0
  40. data/fixtures/order/order-200.xml +61 -0
  41. data/fixtures/order/order-300.xml +61 -0
  42. data/fixtures/order/order-400.xml +61 -0
  43. data/fixtures/order_response/ordresp-100.xml +79 -0
  44. data/fixtures/order_response/ordresp-110.xml +79 -0
  45. data/fixtures/order_response/ordresp-200.xml +79 -0
  46. data/fixtures/order_response/ordresp-210.xml +79 -0
  47. data/fixtures/order_response/ordresp-300.xml +79 -0
  48. data/fixtures/order_response/ordresp-310.xml +79 -0
  49. data/fixtures/order_response/ordresp-400.xml +79 -0
  50. data/fixtures/order_response/ordresp-410.xml +79 -0
  51. data/fixtures/organization/org-uslab-example3.xml +49 -0
  52. data/fixtures/patient/patient-example-updated.xml +140 -0
  53. data/fixtures/patient/patient-example-us-extensions(us01).xml +81 -0
  54. data/fixtures/patient/patient-example.xml +132 -0
  55. data/fixtures/patient/patient-format-example.xml +101 -0
  56. data/fixtures/patient/patient-minimal.xml +9 -0
  57. data/fixtures/patient/patient-uslab-example1.xml +44 -0
  58. data/fixtures/practitioner/pract-uslab-example1.xml +18 -0
  59. data/fixtures/practitioner/pract-uslab-example3.xml +36 -0
  60. data/fixtures/record/condition-example-f201-fever.xml +63 -0
  61. data/fixtures/record/condition-example-f205-infection.xml +20 -0
  62. data/fixtures/record/diagnosticreport-example-f201-brainct.xml +18 -0
  63. data/fixtures/record/encounter-example-f201-20130404.xml +17 -0
  64. data/fixtures/record/encounter-example-f202-20130128.xml +17 -0
  65. data/fixtures/record/observation-example-f202-temperature.xml +60 -0
  66. data/fixtures/record/organization-example-f201-aumc.xml +5 -0
  67. data/fixtures/record/organization-example-f203-bumc.xml +5 -0
  68. data/fixtures/record/patient-example-f201-roel.xml +16 -0
  69. data/fixtures/record/practitioner-example-f201-ab.xml +14 -0
  70. data/fixtures/record/procedure-example-f201-tpf.xml +23 -0
  71. data/fixtures/scheduling/appointment-simple.xml +24 -0
  72. data/fixtures/scheduling/appointmentresponse-patient-simple.xml +12 -0
  73. data/fixtures/scheduling/appointmentresponse-practitioner-simple.xml +12 -0
  74. data/fixtures/scheduling/practitioner-simple.xml +10 -0
  75. data/fixtures/scheduling/schedule-simple.xml +12 -0
  76. data/fixtures/scheduling/slot-simple.xml +10 -0
  77. data/fixtures/specimen/spec-100.xml +65 -0
  78. data/fixtures/specimen/spec-400.xml +70 -0
  79. data/fixtures/specimen/spec-uslab-example1.xml +82 -0
  80. data/fixtures/validation/observation.profile.xml +2045 -0
  81. data/fixtures/validation/observations/observation-example(example).xml +50 -0
  82. data/lib/FHIR_structure.json +529 -0
  83. data/lib/daf_resource_generator.rb +94 -0
  84. data/lib/data/fhir_structure.rb +8 -0
  85. data/lib/data/resources.rb +138 -0
  86. data/lib/executor.rb +56 -0
  87. data/lib/ext/client.rb +27 -0
  88. data/lib/ext/client_reply.rb +19 -0
  89. data/lib/plan_executor.rb +31 -0
  90. data/lib/resource_generator.rb +656 -0
  91. data/lib/tasks/tasks.rake +329 -0
  92. data/lib/tasks/templates/summary.html.erb +163 -0
  93. data/lib/test_result.rb +69 -0
  94. data/lib/tests/assertions.rb +261 -0
  95. data/lib/tests/base_test.rb +117 -0
  96. data/lib/tests/suites/argonaut_resprint_1_test.rb +260 -0
  97. data/lib/tests/suites/argonaut_resprint_2_test.rb +369 -0
  98. data/lib/tests/suites/argonaut_resprint_3_test.rb +309 -0
  99. data/lib/tests/suites/argonaut_sprint_1_test.rb +187 -0
  100. data/lib/tests/suites/argonaut_sprint_2_test.rb +115 -0
  101. data/lib/tests/suites/argonaut_sprint_3_test.rb +208 -0
  102. data/lib/tests/suites/argonaut_sprint_4_test.rb +335 -0
  103. data/lib/tests/suites/argonaut_sprint_5_test.rb +196 -0
  104. data/lib/tests/suites/argonaut_sprint_6_test.rb +243 -0
  105. data/lib/tests/suites/argonaut_sprint_7_test.rb +161 -0
  106. data/lib/tests/suites/base_suite.rb +116 -0
  107. data/lib/tests/suites/connectathon_audit_track.rb +354 -0
  108. data/lib/tests/suites/connectathon_fetch_patient_record.rb +443 -0
  109. data/lib/tests/suites/connectathon_financial_track.rb +380 -0
  110. data/lib/tests/suites/connectathon_lab_order_track.rb +239 -0
  111. data/lib/tests/suites/connectathon_patient_track.rb +364 -0
  112. data/lib/tests/suites/connectathon_profile_validation.rb +101 -0
  113. data/lib/tests/suites/connectathon_scheduling_track.rb +266 -0
  114. data/lib/tests/suites/connectathon_terminology_track.rb +242 -0
  115. data/lib/tests/suites/daf_profiles_test.rb +431 -0
  116. data/lib/tests/suites/format_test.rb +453 -0
  117. data/lib/tests/suites/history_test.rb +311 -0
  118. data/lib/tests/suites/read_test.rb +104 -0
  119. data/lib/tests/suites/resource_test.rb +553 -0
  120. data/lib/tests/suites/search_test.rb +219 -0
  121. data/lib/tests/suites/search_test_robust.rb +172 -0
  122. data/lib/tests/suites/sprinkler_search_test.rb +660 -0
  123. data/lib/tests/suites/suite_engine.rb +114 -0
  124. data/lib/tests/suites/transaction_test.rb +571 -0
  125. data/lib/tests/testscripts/base_testscript.rb +480 -0
  126. data/lib/tests/testscripts/testscript_engine.rb +81 -0
  127. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Client Assigned Id/track1-patient-base-client-id-json.xml +348 -0
  128. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Client Assigned Id/track1-patient-base-client-id-xml.xml +348 -0
  129. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Client Assigned Id/track1-patient-bonus-client-id-json.xml +420 -0
  130. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Client Assigned Id/track1-patient-bonus-client-id-xml.xml +420 -0
  131. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/README.html +68 -0
  132. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Server Assigned Id/track1-patient-base-server-id-json.xml +352 -0
  133. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Server Assigned Id/track1-patient-base-server-id-xml.xml +352 -0
  134. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Server Assigned Id/track1-patient-bonus-server-id-json.xml +421 -0
  135. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Server Assigned Id/track1-patient-bonus-server-id-xml.xml +421 -0
  136. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/conformance/PatientConformance.xml +34 -0
  137. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-create-PeterChalmers-min.json +45 -0
  138. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-create-PeterChalmers-min.xml +26 -0
  139. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-create-PeterChalmers.json +100 -0
  140. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-create-PeterChalmers.xml +102 -0
  141. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-create-bonus-PeterChalmers-min.json +53 -0
  142. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-create-bonus-PeterChalmers-min.xml +30 -0
  143. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-create-bonus-PeterChalmers.json +108 -0
  144. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-create-bonus-PeterChalmers.xml +108 -0
  145. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-PeterChalmers-min.json +45 -0
  146. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-PeterChalmers-min.xml +26 -0
  147. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-PeterChalmers.json +100 -0
  148. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-PeterChalmers.xml +102 -0
  149. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-bonus1-PeterChalmers-min.json +53 -0
  150. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-bonus1-PeterChalmers-min.xml +30 -0
  151. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-bonus1-PeterChalmers.json +108 -0
  152. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-bonus1-PeterChalmers.xml +107 -0
  153. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-bonus2-PeterChalmers-min.json +53 -0
  154. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-bonus2-PeterChalmers-min.xml +31 -0
  155. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-bonus2-PeterChalmers.json +108 -0
  156. data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-bonus2-PeterChalmers.xml +106 -0
  157. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/C-CDA_R2-1_CCD-ussg.xml +3414 -0
  158. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-A1-empty-on-instance.xml +9 -0
  159. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-A2-empty-by-ref.xml +15 -0
  160. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-A3-empty-by-identifier.xml +13 -0
  161. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-A4-empty-by-contained.xml +15 -0
  162. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-B1-CCDA-on-instance.xml +15 -0
  163. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-B2-CCDA-by-ref.xml +21 -0
  164. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-B3-CCDA-by-identifier.xml +19 -0
  165. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-B4-CCDA-by-contained.xml +21 -0
  166. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/questionnaire-sdc-profile-example-ussg-fht.xml +3905 -0
  167. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/questionnaireresponse-expected-ussg-fht-CCDA.xml +190 -0
  168. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/questionnaireresponse-expected-ussg-fht-empty.xml +177 -0
  169. data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/track11-sdc-prepop-xml.xml +142 -0
  170. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Expand/Client Assigned Id/track2-ts-suite1-expand-client-id.xml +925 -0
  171. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Expand/Client Assigned Id/track2-ts-suite2-expand-filter-client-id.xml +930 -0
  172. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Expand/Server Assigned Id/track2-ts-suite1-expand-server-id.xml +953 -0
  173. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Expand/Server Assigned Id/track2-ts-suite2-expand-filter-server-id.xml +958 -0
  174. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Lookup/track2-ts-suite5-loinc-lookup-xml.xml +224 -0
  175. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Lookup/track2-ts-suite5-snomed-lookup-xml.xml +224 -0
  176. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/README.html +85 -0
  177. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Translate/track2-ts-suite6-translate-xml.xml +224 -0
  178. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Validate-code/Client Assigned Id/track2-ts-suite3-validate-code-client-id.xml +1807 -0
  179. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Validate-code/Client Assigned Id/track2-ts-suite4-validate-code-client-id.xml +714 -0
  180. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Validate-code/Server Assigned Id/track2-ts-suite3-validate-code-server-id.xml +1835 -0
  181. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Validate-code/Server Assigned Id/track2-ts-suite4-validate-code-server-id.xml +742 -0
  182. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/conformance/ConceptMapSuite6Conformance.xml +11 -0
  183. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/conformance/ValueSetSuite1Conformance.xml +17 -0
  184. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/conformance/ValueSetSuite2Conformance.xml +17 -0
  185. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/conformance/ValueSetSuite3Conformance.xml +14 -0
  186. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/conformance/ValueSetSuite4Conformance.xml +14 -0
  187. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/conformance/ValueSetSuite5Conformance.xml +11 -0
  188. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/extensional-case-1-input-4-2-a.xml +11 -0
  189. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/extensional-case-1-input-4-2-b.xml +11 -0
  190. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/extensional-case-1-input-4-3-a.xml +13 -0
  191. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/extensional-case-1-input-4-3-b.xml +13 -0
  192. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/extensional-case-1-input-4-4-a.xml +15 -0
  193. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/extensional-case-1-input-4-4-b.xml +15 -0
  194. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/lookup-loinc-input-5-2.xml +10 -0
  195. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/lookup-loinc-input-5-3.xml +11 -0
  196. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/lookup-snomed-input-5-2.xml +10 -0
  197. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/lookup-snomed-input-5-3.xml +11 -0
  198. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/translate-conceptmap-input-6-2.xml +14 -0
  199. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/translate-conceptmap-input-6-3.xml +15 -0
  200. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-1-expand-min.xml +47 -0
  201. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-1-filter-min.xml +23 -0
  202. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-2-expand-min.xml +132 -0
  203. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-2-filter-min.xml +38 -0
  204. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-3-expand-min.xml +252 -0
  205. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-3-filter-min.xml +58 -0
  206. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-4-expand-min.xml +57 -0
  207. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-4-filter-min.xml +28 -0
  208. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/intensional-case-1-expand-min.xml +347 -0
  209. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/intensional-case-1-filter-min.xml +33 -0
  210. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/intensional-case-2-expand-min.xml +637 -0
  211. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/intensional-case-2-filter-min.xml +33 -0
  212. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/intensional-case-3-filter-min.xml +58 -0
  213. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/lookup-loinc-min.xml +11 -0
  214. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/lookup-snomed-min.xml +11 -0
  215. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/suite3-invalid-min.xml +10 -0
  216. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/suite3-valid-min.xml +7 -0
  217. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/suite4-invalid-min.xml +10 -0
  218. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/suite4-valid-min.xml +7 -0
  219. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/translate-conceptmap-min.xml +17 -0
  220. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/extensional-case-1.xml +55 -0
  221. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/extensional-case-2.xml +122 -0
  222. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/extensional-case-3.xml +222 -0
  223. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/extensional-case-4.xml +65 -0
  224. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/intensional-case-1.xml +31 -0
  225. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/intensional-case-2.xml +31 -0
  226. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/intensional-case-3.xml +31 -0
  227. data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/translate-conceptmap-case-1.xml +145 -0
  228. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/conformance/DecisionSupportServiceModule-Evaluate.xml +17 -0
  229. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-incomplete-request-payload.xml +26 -0
  230. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-incomplete-response-min-payload.xml +7 -0
  231. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-incomplete-response-payload.xml +332 -0
  232. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-malformed-request-payload.xml +28 -0
  233. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-malformed-response-min-payload.xml +7 -0
  234. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-malformed-response-payload.xml +20 -0
  235. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-request-payload.xml +28 -0
  236. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-response-min-payload.xml +7 -0
  237. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-response-payload.xml +332 -0
  238. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-unauthorized-request-payload.xml +28 -0
  239. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-unauthorized-response-min-payload.xml +7 -0
  240. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-unauthorized-response-payload.xml +8 -0
  241. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/gao-assessment-request-payload.xml +176 -0
  242. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/gao-assessment-response-payload-min.xml +32 -0
  243. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/gao-assessment-response-payload.xml +80 -0
  244. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/track3-cds-evaluate-cdc-immunization.xml +290 -0
  245. data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/track3-cds-evaluate-gao-profile.xml +110 -0
  246. data/lib/tests/testscripts/xml/Connectathon11/Track6-FHIR-Genomics/Client_Assigned_Id/TestScript_FHIR-Genomics.xml +170 -0
  247. data/lib/tests/testscripts/xml/Connectathon11/Track6-FHIR-Genomics/_reference/resources/sequence-example-1.xml +31 -0
  248. data/lib/tests/testscripts/xml/Connectathon11/Track6-FHIR-Genomics/_reference/resources/sequence-example-2.xml +31 -0
  249. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Actors.png +0 -0
  250. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Client_Assigned_Id/track7-laborder100-xml.xml +590 -0
  251. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Client_Assigned_Id/track7-laborder200-xml.xml +587 -0
  252. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Client_Assigned_Id/track7-laborder300-xml.xml +612 -0
  253. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Client_Assigned_Id/track7-laborder400-xml.xml +635 -0
  254. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Peer-to-Peer/track7-laborder100-peer2peer-xml.xml +752 -0
  255. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Thumbs.db +0 -0
  256. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/conformance/LabOrderLabReport-CreateDeleteReadUpdate.xml +187 -0
  257. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/conformance/html.xslt +45 -0
  258. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-100-update.xml +64 -0
  259. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-100.xml +64 -0
  260. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-200-update.xml +121 -0
  261. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-200.xml +121 -0
  262. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-300-update.xml +91 -0
  263. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-300.xml +91 -0
  264. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-400-update.xml +88 -0
  265. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-400.xml +88 -0
  266. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticReport/dr-100.xml +96 -0
  267. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticReport/dr-200.xml +125 -0
  268. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticReport/dr-300.xml +132 -0
  269. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticReport/dr-400.xml +121 -0
  270. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-100.xml +58 -0
  271. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-101.xml +58 -0
  272. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-200.xml +125 -0
  273. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-300.xml +106 -0
  274. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-301.xml +106 -0
  275. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-302.xml +106 -0
  276. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-303.xml +106 -0
  277. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-304.xml +106 -0
  278. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-400.xml +87 -0
  279. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-401.xml +95 -0
  280. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-402.xml +95 -0
  281. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-403.xml +84 -0
  282. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-404.xml +84 -0
  283. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-405.xml +83 -0
  284. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-406.xml +83 -0
  285. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-407.xml +70 -0
  286. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-408.xml +84 -0
  287. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-uslab-example5.xml +102 -0
  288. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Order/order-100.xml +61 -0
  289. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Order/order-200.xml +61 -0
  290. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Order/order-300.xml +61 -0
  291. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Order/order-400.xml +61 -0
  292. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-100.xml +79 -0
  293. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-110.xml +79 -0
  294. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-200.xml +79 -0
  295. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-210.xml +79 -0
  296. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-300.xml +79 -0
  297. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-310.xml +79 -0
  298. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-400.xml +79 -0
  299. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-410.xml +79 -0
  300. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Organization/org-uslab-example3.xml +49 -0
  301. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Patient/patient-uslab-example1.xml +44 -0
  302. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Practitioner/pract-uslab-example1.xml +18 -0
  303. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Practitioner/pract-uslab-example3.xml +36 -0
  304. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Specimen/Thumbs.db +0 -0
  305. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Specimen/spec-100.xml +65 -0
  306. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Specimen/spec-400.xml +70 -0
  307. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Specimen/spec-uslab-example1.xml +82 -0
  308. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Testscript 1 Document.txt +122 -0
  309. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Testscript 2 Document.txt +103 -0
  310. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Testscript 3 Document.txt +201 -0
  311. data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Testscript 4 Document.txt +310 -0
  312. data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/_reference/conformance/MedicationStatementCreate.xml +11 -0
  313. data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/_reference/conformance/PatientSearchType.xml +15 -0
  314. data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/_reference/resources/medicationstatement-create.json +39 -0
  315. data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/_reference/resources/medicationstatement-patch.json +3 -0
  316. data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/track9-patch-medicationstatement-json-if-match.xml +321 -0
  317. data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/track9-patch-medicationstatement-json.xml +303 -0
  318. data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/track9-patch-peer2peer-patient-json.xml +235 -0
  319. data/plan_executor.gemspec +14 -0
  320. data/test/fixtures/diagnostic_bundle.xml +51 -0
  321. data/test/fixtures/lab_results_bundle.xml +49 -0
  322. data/test/fixtures/observation_bundle.json +61 -0
  323. data/test/fixtures/testscript-example.xml +202 -0
  324. data/test/fixtures/testscript-history.xml +143 -0
  325. data/test/fixtures/testscript-readtest.xml +272 -0
  326. data/test/fixtures/testscript-search.xml +282 -0
  327. data/test/fixtures/testscript-update.xml +147 -0
  328. data/test/fixtures/vital_signs_bundle.xml +117 -0
  329. data/test/test_helper.rb +8 -0
  330. data/test/unit/argonaut_sprint6_test.rb +31 -0
  331. data/test/unit/argonaut_sprint7_test.rb +21 -0
  332. data/test/unit/basic_test.rb +27 -0
  333. data/test/unit/fetch_patient_record_test.rb +357 -0
  334. data/test/unit/financial_test.rb +41 -0
  335. data/test/unit/fixtures_test.rb +45 -0
  336. data/test/unit/metadata_test.rb +33 -0
  337. metadata +394 -0
@@ -0,0 +1,329 @@
1
+ namespace :crucible do
2
+
3
+ FHIR_SERVERS = [
4
+ # DSTU1
5
+ # 'http://fhir.healthintersections.com.au/open',
6
+ # 'http://bonfire.mitre.org:8080/fhir',
7
+ # 'http://spark.furore.com/fhir',
8
+ # 'http://nprogram.azurewebsites.net',
9
+ # 'https://fhir-api.smartplatforms.org',
10
+ # 'https://fhir-open-api.smartplatforms.org',
11
+ # 'https://fhir.orionhealth.com/blaze/fhir',
12
+ # 'http://worden.globalgold.co.uk:8080/FHIR_a/farm/cobalt',
13
+ # 'http://worden.globalgold.co.uk:8080/FHIR_a/farm/bronze',
14
+ # 'http://fhirtest.uhn.ca/base'
15
+
16
+ # DSTU2
17
+ 'https://fhir-api-dstu2.smarthealthit.org',
18
+ 'http://fhirtest.uhn.ca/baseDstu2',
19
+ 'http://bp.oridashi.com.au',
20
+ 'http://md.oridashi.com.au',
21
+ 'http://zm.oridashi.com.au',
22
+ 'http://wildfhir.aegis.net/fhir2',
23
+ 'http://fhir-dev.healthintersections.com.au/open'
24
+ ]
25
+
26
+ desc 'console'
27
+ task :console, [] do |t, args|
28
+ binding.pry
29
+ end
30
+
31
+ desc 'execute all'
32
+ task :execute_all, [:url, :html_summary] do |t, args|
33
+ require 'benchmark'
34
+ b = Benchmark.measure {
35
+ client = FHIR::Client.new(args.url)
36
+ options = client.get_oauth2_metadata_from_conformance
37
+ set_client_secrets(client,options) unless options.empty?
38
+ results = execute_all(client)
39
+ if args.html_summary
40
+ generate_html_summary(args.url, results, "ExecuteAll")
41
+ end
42
+ }
43
+ puts "Execute All completed in #{b.real} seconds."
44
+ end
45
+
46
+ desc 'execute all test scripts'
47
+ task :execute_all_testscripts, [:url, :html_summary] do |t, args|
48
+ require 'benchmark'
49
+ b = Benchmark.measure {
50
+ client = FHIR::Client.new(args.url)
51
+ options = client.get_oauth2_metadata_from_conformance
52
+ set_client_secrets(client,options) unless options.empty?
53
+ results = Crucible::Tests::TestScriptEngine.new(client).execute_all
54
+ output_results results
55
+ if args.html_summary
56
+ generate_html_summary(args.url, results, "ExecuteAll")
57
+ end
58
+ }
59
+ puts "Execute All completed in #{b.real} seconds."
60
+ end
61
+
62
+ desc 'execute'
63
+ task :execute, [:url, :test, :resource] do |t, args|
64
+ require 'benchmark'
65
+ b = Benchmark.measure {
66
+ client = FHIR::Client.new(args.url)
67
+ options = client.get_oauth2_metadata_from_conformance
68
+ set_client_secrets(client,options) unless options.empty?
69
+ execute_test(client, args.test, args.resource)
70
+ }
71
+ puts "Execute #{args.test} completed in #{b.real} seconds."
72
+ end
73
+
74
+ desc 'metadata'
75
+ task :metadata, [:url, :test] do |t, args|
76
+ require 'benchmark'
77
+ b = Benchmark.measure { collect_metadata(FHIR::Client.new(args.url), args.test) }
78
+ puts "Metadata #{args.test} completed in #{b.real} seconds."
79
+ end
80
+
81
+ def set_client_secrets(client,options)
82
+ puts "Using OAuth2 Options: #{options}"
83
+ print 'Enter client id: '
84
+ client_id = STDIN.gets.chomp
85
+ print 'Enter client secret: '
86
+ client_secret = STDIN.gets.chomp
87
+ if client_id!="" && client_secret!=""
88
+ options[:client_id] = client_id
89
+ options[:client_secret] = client_secret
90
+ # set_oauth2_auth(client,secret,authorizePath,tokenPath)
91
+ client.set_oauth2_auth(options[:client_id],options[:client_secret],options[:authorize_url],options[:token_url])
92
+ else
93
+ puts "Ignoring OAuth2 credentials: empty id or secret. Using unsecured client..."
94
+ end
95
+ end
96
+
97
+ def execute_test(client, key, resourceType=nil)
98
+ executor = Crucible::Tests::Executor.new(client)
99
+ test = executor.find_test(key)
100
+ if test.nil?
101
+ puts "Unable to find test: #{key}"
102
+ return
103
+ end
104
+ results = nil
105
+ if !resourceType.nil? && test.respond_to?(:resource_class=)
106
+ fhir_classes = Mongoid.models.select {|c| c.name.include? 'FHIR'}
107
+ klass = fhir_classes.find{|x|x.to_s.include?(resourceType)}
108
+ results = test.execute(klass) if !klass.nil?
109
+ end
110
+ results = executor.execute(test) if results.nil?
111
+ output_results results
112
+ end
113
+
114
+ def execute_all(client)
115
+ results = Crucible::Tests::Executor.new(client).execute_all
116
+ output_results results
117
+ end
118
+
119
+ def execute_multiserver_test(client, client2, key)
120
+ executor = Crucible::Tests::Executor.new(client, client2)
121
+ output_results executor.execute(executor.find_test(key))
122
+ end
123
+
124
+ def collect_metadata(client, test)
125
+ output_results Crucible::Tests::Executor.new(client).metadata(test), true
126
+ end
127
+
128
+ def output_results(results, metadata_only=false)
129
+ require 'turn'
130
+ results.keys.each do |suite_key|
131
+ puts suite_key
132
+ results[suite_key].each do |test|
133
+ puts write_result(test['status'], test[:test_method], test['message'])
134
+ if test['status'].upcase=='ERROR'
135
+ puts " "*12 + "-"*40
136
+ puts " "*12 + "#{test['data'].gsub("\n","\n"+" "*12)}"
137
+ puts " "*12 + "-"*40
138
+ end
139
+ if (metadata_only==true)
140
+ # warnings
141
+ puts (test['warnings'].map { |w| "#{(' '*10)}WARNING: #{w}" }).join("\n") if test['warnings']
142
+ # metadata
143
+ puts (test['links'].map { |w| "#{(' '*10)}Link: #{w}" }).join("\n") if test['links']
144
+ puts (test['requires'].map { |w| "#{(' '*10)}Requires: #{w[:resource]}: #{w[:methods]}" }).join("\n") if test['requires']
145
+ puts (test['validates'].map { |w| "#{(' '*10)}Validates: #{w[:resource]}: #{w[:methods]}" }).join("\n") if test['validates']
146
+ # data
147
+ puts (' '*10) + test['data'] if test['data']
148
+ end
149
+ end
150
+ end
151
+ results
152
+ end
153
+
154
+ def generate_html_summary(url, results, id="summary")
155
+ require 'erb'
156
+ require 'tilt'
157
+ require 'fileutils'
158
+ totals = Hash.new(0)
159
+ metadata = Hash.new(0)
160
+ results.values.each do |suite|
161
+ suite.map{|t| t["status"]}.each_with_object(totals) { |n, h| h[n] += 1}
162
+ suite.map{|t| {k: t["id"], v: t["validates"], s: t["status"]}}.each_with_object(metadata) do |n, h|
163
+ n[:v].each do |val|
164
+ resource = val[:resource].try(:titleize).try(:downcase)
165
+ test_key = n[:k]
166
+ h[resource] = {pass: [], fail: [], error: [], skip: []} unless h.keys.include?(resource)
167
+ h[resource][n[:s].to_sym] << test_key
168
+ val[:methods].each do |meth|
169
+ h[meth] = {pass: [], fail: [], error: [], skip: []} unless h.keys.include?(meth)
170
+ h[meth][n[:s].to_sym] << test_key
171
+ end if val[:methods]
172
+ val[:formats].each do |format|
173
+ h[format] = {pass: [], fail: [], error: [], skip: []} unless h.keys.include?(format)
174
+ h[format][n[:s].to_sym] << test_key
175
+ end if val[:formats]
176
+ end if n[:v]
177
+ end
178
+ end
179
+ template = Tilt.new(File.join(File.dirname(__FILE__), "templates", "summary.html.erb"))
180
+ timestamp = Time.now
181
+ summary = template.render(self, {:results => results, :timestamp => timestamp.strftime("%D %r"), :totals => totals, :url => url, :metadata => metadata})
182
+ summary_file = "#{id}_#{url.gsub(/[^a-z0-9]/,'-')}_#{timestamp.strftime("%m-%d-%y_%H-%M-%S")}.html"
183
+ FileUtils::mkdir_p("html_summaries/#{id}")
184
+ File.write("html_summaries/#{id}/#{summary_file}", summary)
185
+ system("open html_summaries/#{id}/#{summary_file}")
186
+ end
187
+
188
+ desc 'execute custom'
189
+ task :execute_custom, [:test, :resource_type, :html_summary] do |t, args|
190
+ require 'benchmark'
191
+
192
+ puts "# #{args.test}"
193
+ puts
194
+
195
+ seconds = 0.0
196
+
197
+ FHIR_SERVERS.each do |url|
198
+ puts "## #{url}"
199
+ puts "```"
200
+ b = Benchmark.measure {
201
+ client = FHIR::Client.new(url)
202
+ options = client.get_oauth2_metadata_from_conformance
203
+ set_client_secrets(client,options) unless options.empty?
204
+ results = execute_test(client, args.test, args.resource_type)
205
+ if args.html_summary
206
+ generate_html_summary(url, results, args.test)
207
+ end
208
+ }
209
+ seconds += b.real
210
+ puts "```"
211
+ puts
212
+ end
213
+ puts "Execute Custom #{args.test} completed for #{FHIR_SERVERS.length} servers in #{seconds} seconds."
214
+ end
215
+
216
+ desc 'execute all custom'
217
+ task :execute_all_custom, [:html_summary] do |t, args|
218
+ require 'benchmark'
219
+
220
+ puts "# #{args.test}"
221
+ puts
222
+
223
+ seconds = 0.0
224
+
225
+ FHIR_SERVERS.each do |url|
226
+ puts "## #{url}"
227
+ puts "```"
228
+ b = Benchmark.measure {
229
+ client = FHIR::Client.new(url)
230
+ options = client.get_oauth2_metadata_from_conformance
231
+ set_client_secrets(client,options) unless options.empty?
232
+ results = execute_all(client)
233
+ if args.html_summary
234
+ generate_html_summary(url, results, "ExecuteAll")
235
+ end
236
+ }
237
+ seconds += b.real
238
+ puts "```"
239
+ puts
240
+ end
241
+ puts "Execute All Custom #{args.test} completed for #{FHIR_SERVERS.length} servers in #{seconds} seconds."
242
+ end
243
+
244
+ desc 'list all'
245
+ task :list_all do
246
+ require 'benchmark'
247
+ b = Benchmark.measure { puts Crucible::Tests::Executor.list_all }
248
+ puts "List all tests completed in #{b.real} seconds."
249
+ end
250
+
251
+ desc 'list names of test suites'
252
+ task :list_suites do
253
+ require 'benchmark'
254
+ b = Benchmark.measure do
255
+ suites = Crucible::Tests::Executor.list_all
256
+ suite_names = []
257
+ suites.each do |key,value|
258
+ suite_names << value['author'].split('::').last if !key.start_with?('TS')
259
+ end
260
+ suite_names.uniq!
261
+ suite_names.each {|x| puts " #{x}"}
262
+ end
263
+ puts "List all suites completed in #{b.real} seconds."
264
+ end
265
+
266
+ desc 'list all test scripts'
267
+ task :list_all_test_scripts do
268
+ require 'benchmark'
269
+ b = Benchmark.measure { puts Crucible::Tests::TestScriptEngine.list_all.keys }
270
+ puts "List all tests completed in #{b.real} seconds."
271
+ end
272
+
273
+ desc 'execute with requirements'
274
+ task :execute_w_requirements, [:url, :test] do |t, args|
275
+ require 'turn'
276
+
277
+ module Crucible
278
+ module Tests
279
+ class BaseTest
280
+
281
+ alias execute_test_method_orig execute_test_method
282
+
283
+ def execute_test_method(test_method)
284
+ r = execute_test_method_orig(test_method)
285
+ @@requirements ||= {}
286
+ @@requirements[self.class.name] ||= {}
287
+ @@requirements[self.class.name][test_method] = @client.requirements
288
+ @client.clear_requirements
289
+ r
290
+ end
291
+
292
+ end
293
+ end
294
+ end
295
+
296
+ client = FHIR::Client.new(args.url)
297
+ options = client.get_oauth2_metadata_from_conformance
298
+ set_client_secrets(client,options) unless options.empty?
299
+ client.monitor_requirements
300
+ test = args.test.to_sym
301
+ execute_test(client, test)
302
+ pp Crucible::Tests::BaseTest.class_variable_get :@@requirements
303
+ end
304
+
305
+
306
+ def write_result(status, test_name, message)
307
+ tab_size = 10
308
+ "#{' '*(tab_size - status.length)}#{Turn::Colorize.method(status.to_sym).call(status.upcase)} #{test_name}: #{message}"
309
+ end
310
+
311
+ namespace :multiserver do
312
+ desc 'execute'
313
+ task :execute, [:url1, :url2, :test] do |t, args|
314
+ require 'turn'
315
+ require 'benchmark'
316
+ b = Benchmark.measure {
317
+ client1 = FHIR::Client.new(args.url1)
318
+ options = client1.get_oauth2_metadata_from_conformance
319
+ set_client_secrets(client1,options) unless options.empty?
320
+ client2 = FHIR::Client.new(args.url2)
321
+ options = client2.get_oauth2_metadata_from_conformance
322
+ set_client_secrets(client2,options) unless options.empty?
323
+ execute_multiserver_test(client1, client2, args.test)
324
+ }
325
+ puts "Execute multiserver #{args.test} completed in #{b.real} seconds."
326
+ end
327
+ end
328
+
329
+ end
@@ -0,0 +1,163 @@
1
+ <html>
2
+ <head>
3
+ <title>Execute All Summary :: <%= timestamp %></title>
4
+ <!-- Latest compiled and minified CSS -->
5
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
6
+
7
+ <!-- Optional theme -->
8
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">
9
+ </head>
10
+ <body>
11
+ <div class="container">
12
+ <h1>Executed <%= results.length %> Suites, <%= timestamp %></h1>
13
+ <h2><small><a href="<%= url %>" target="_blank"><%= url %></a></small></h2>
14
+ <div class="well well-sm">
15
+ <button class="btn btn-danger">
16
+ <span class="badge"><%= totals["error"] %></span> Errors
17
+ </button>
18
+ <button class="btn btn-warning">
19
+ <span class="badge"><%= totals["fail"] %></span> Failures
20
+ </button>
21
+ <button class="btn btn-success">
22
+ <span class="badge"><%= totals["pass"] %></span> Passes
23
+ </button>
24
+ <button class="btn btn-info">
25
+ <span class="badge"><%= totals["skip"] %></span> Skips
26
+ </button>
27
+ </div>
28
+
29
+ <div class="well well-sm">
30
+ <% metadata.each do |leaf, tags| %>
31
+ <div class="row">
32
+ <div class="col-md-2"><strong><%= leaf %></strong></div>
33
+ <div class="col-md-10">
34
+ <div class="row">
35
+ <% tags.each do |leaf, tags| %>
36
+ <% next unless tags.length>0 %>
37
+ <div class="col-md-2"><strong><%= tags.length %> <%= leaf.to_s.try(:pluralize) %></strong></div>
38
+ <div class="col-md-10"><%= tags %></div>
39
+ <% end %>
40
+ </div>
41
+ </div>
42
+ </div>
43
+ <% end %>
44
+ </div>
45
+
46
+ <% results.keys.each_with_index do |suite_key, index| %>
47
+ <% suite = results[suite_key] %>
48
+ <% errored = suite.detect{|t| t["status"] == "error"} %>
49
+ <% failed = suite.detect{|t| t["status"] == "fail"} || suite.detect{|t| t["status"] == "pass"}.nil? %>
50
+ <div class="panel panel-<%= if errored then "danger" elsif failed then "warning" else "success" end %>">
51
+ <div class="panel-heading" role="tab" id="heading<%= index %>">
52
+ <h3 class="panel-title">
53
+ <a data-toggle="collapse" data-parent="#accordion" href="#collapse<%= index %>" aria-expanded="true" aria-controls="collapse<%= index %>">
54
+ <%= suite_key.to_s %>
55
+ </a>
56
+ </h3>
57
+ </div>
58
+ <div id="collapse<%= index %>" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading<%= index %>">
59
+ <div class="panel-body">
60
+
61
+ <% suite.each do |test| %>
62
+ <% status_map = {"pass" => "success", "fail" => "warning", "error" => "danger", "skip" => "info"} %>
63
+ <div class="panel panel-<%= status_map[test["status"]]%>">
64
+ <div class="panel-heading">
65
+ <%= test["status"].upcase %> - <%= test["key"] %> - <%= test[:test_method].to_s %>
66
+ </div>
67
+ <div class="panel-body">
68
+ <% test.each do |key, value| %>
69
+ <% next if ["key", "code", :test_method].include?(key) %>
70
+ <% next if key=="data" && test["status"]!="error" %>
71
+ <div class="row">
72
+ <div class="col-md-1"><strong><%= key %></strong></div>
73
+ <div class="col-md-11">
74
+ <% if key == "data" %><pre><% end %>
75
+ <% if value.class == Hash %>
76
+ <% value.each do |k, v| %>
77
+ <div class="row">
78
+ <div class="col-md-1"><%= k %></div>
79
+ <div class="col-md-11"><%= v %></div>
80
+ </div>
81
+ <% end %>
82
+ <% elsif value.class == Array %>
83
+ <% value.each do |v| %>
84
+ <% if v.class == Hash %>
85
+ <% v.each do |vk, vv| %>
86
+ <div class="row">
87
+ <div class="col-md-1"><%= vk %></div>
88
+ <div class="col-md-11"><%= vv %></div>
89
+ </div>
90
+ <% end %>
91
+ <% else %>
92
+ <div class="row">
93
+ <div class="col-md-12"><%= v %></div>
94
+ </div>
95
+ <% end %>
96
+ <% end %>
97
+ <% else %>
98
+ <%= value %>
99
+ <% end %>
100
+ <% if key == "data" %></pre><% end %>
101
+ </div>
102
+ </div>
103
+ <% end %>
104
+ </div>
105
+ </div>
106
+ <% end %>
107
+
108
+ </div>
109
+ </div>
110
+ </div>
111
+ <% end %>
112
+
113
+ <div class="text-center">
114
+ <div class="btn btn-primary elevator-button">
115
+ <span class="glyphicon glyphicon-triangle-top" aria-hidden="true"></span> Back to Top
116
+ </div>
117
+ </div>
118
+ </div>
119
+ <script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
120
+ <!-- Latest compiled and minified JavaScript -->
121
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
122
+ <script>
123
+ var Elevator=function(){"use strict";function n(n,e){for(var t in e)t in n||(n[t]=e[t]);return n}function e(n,e,t,u){return n/=u/2,1>n?t/2*n*n+e:(n--,-t/2*(n*(n-2)-1)+e)}function t(n){p||(p=n);var u=n-p,o=e(u,v,-v,A);window.scrollTo(0,o),A>u?s=requestAnimationFrame(t):i()}function u(){w||(w=!0,v=document.documentElement.scrollTop||m.scrollTop,f||(A=1.5*v),requestAnimationFrame(t),c&&c.play())}function o(){p=null,v=null,w=!1}function i(){o(),c&&(c.pause(),c.currentTime=0),d&&d.play()}function r(){w&&(cancelAnimationFrame(s),o(),c&&(c.pause(),c.currentTime=0),window.scrollTo(0,0))}function l(n){n.addEventListener("click",u,!1)}function a(n){m=document.body,n.element&&l(n.element),n.duration&&(f=!0,A=n.duration),n.mainAudio&&(c=new Audio(n.mainAudio),c.setAttribute("preload","true"),c.setAttribute("loop","true")),n.endAudio&&(d=new Audio(n.endAudio),d.setAttribute("preload","true")),window.addEventListener("blur",r,!1)}var c,d,m=null,s=null,A=null,f=!1,p=null,v=null,w=!1;return n(a,{elevate:u})}();
124
+ </script>
125
+ <script>
126
+ function toggleErrors() {
127
+ $(".panel-body > .panel-danger").parents(".panel-danger > .panel-collapse").collapse('toggle');
128
+ $(".btn-danger").toggleClass("active");
129
+ }
130
+
131
+ function toggleFailures() {
132
+ $(".panel-body > .panel-warning").parents(".panel-collapse").collapse('toggle');
133
+ $(".btn-warnings").toggleClass("active");
134
+ }
135
+
136
+ function togglePasses() {
137
+ $(".panel-body > .panel-success").parents(".panel-collapse").collapse('toggle');
138
+ $(".btn-success").toggleClass("active");
139
+ }
140
+
141
+ function toggleSkips() {
142
+ $(".panel-body > .panel-info").parents(".panel-collapse").collapse('toggle');
143
+ $(".btn-info").toggleClass("active");
144
+ }
145
+
146
+ $(".btn-danger").click(toggleErrors);
147
+ $(".btn-warning").click(toggleFailures);
148
+ $(".btn-success").click(togglePasses);
149
+ $(".btn-info").click(toggleSkips);
150
+ </script>
151
+ <script>
152
+ // Elevator script included on the page, already.
153
+
154
+ window.onload = function() {
155
+ var elevator = new Elevator({
156
+ element: document.querySelector('.elevator-button'),
157
+ mainAudio: 'elevator-music.mp3',
158
+ endAudio: 'ding.mp3'
159
+ });
160
+ }
161
+ </script>
162
+ </body>
163
+ </html>
@@ -0,0 +1,69 @@
1
+ module Crucible
2
+ module Tests
3
+ class TestResult
4
+
5
+ attr_accessor :key
6
+ attr_accessor :id
7
+ attr_accessor :description
8
+ attr_accessor :status
9
+ attr_accessor :message
10
+ attr_accessor :data
11
+ attr_accessor :warnings
12
+ attr_accessor :requires
13
+ attr_accessor :validates
14
+ attr_accessor :links
15
+ attr_accessor :code
16
+
17
+ def initialize(key, description, status, message, data)
18
+ @key = key
19
+ @status = status
20
+ @description = description
21
+ @message = message
22
+ @data = data
23
+ end
24
+
25
+ def update(status, message, data)
26
+ @status = status
27
+ @message = message
28
+ @data = data
29
+ self
30
+ end
31
+
32
+ def passed?
33
+ return ( (@status==true) or (@status=='passed') )
34
+ end
35
+
36
+ def failed?
37
+ !self.passed?
38
+ end
39
+
40
+ def to_hash
41
+ hash = {}
42
+ hash['key'] = @key
43
+ hash['id'] = @id || @key
44
+ hash['description'] = force_encoding(@description)
45
+ hash['status'] = force_encoding(@status)
46
+ if @message.class == Array
47
+ hash['message'] = @message.map { |m| force_encoding(m) }
48
+ else
49
+ hash['message'] = force_encoding(@message)
50
+ end
51
+ hash['data'] = force_encoding(@data) unless hash['status'] == 'pass'
52
+ hash['warnings'] = warnings if warnings
53
+ hash['requires'] = requires if requires
54
+ hash['validates'] = validates if validates
55
+ hash['links'] = links if links
56
+ hash['code'] = @code
57
+ hash
58
+ end
59
+
60
+ private
61
+
62
+ def force_encoding(value)
63
+ return nil if value.blank?
64
+ value.force_encoding("UTF-8")
65
+ end
66
+
67
+ end
68
+ end
69
+ end