plan_executor 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +44 -0
- data/.simplecov +16 -0
- data/.travis.yml +13 -0
- data/Gemfile +26 -0
- data/Gemfile.lock +197 -0
- data/LICENSE +201 -0
- data/README.md +126 -0
- data/Rakefile +25 -0
- data/fixtures/daf/conformance-daf-query-responder.xml +1471 -0
- data/fixtures/diagnostic_order/do-100.xml +64 -0
- data/fixtures/diagnostic_order/do-200.xml +121 -0
- data/fixtures/diagnostic_order/do-300.xml +91 -0
- data/fixtures/diagnostic_order/do-400.xml +88 -0
- data/fixtures/diagnostic_report/dr-100.xml +96 -0
- data/fixtures/diagnostic_report/dr-200.xml +125 -0
- data/fixtures/diagnostic_report/dr-300.xml +132 -0
- data/fixtures/diagnostic_report/dr-400.xml +121 -0
- data/fixtures/financial/claim-example-average.xml +168 -0
- data/fixtures/financial/claim-example-simple.xml +67 -0
- data/fixtures/observation/obs-100.xml +58 -0
- data/fixtures/observation/obs-101.xml +58 -0
- data/fixtures/observation/obs-200.xml +125 -0
- data/fixtures/observation/obs-300.xml +106 -0
- data/fixtures/observation/obs-301.xml +106 -0
- data/fixtures/observation/obs-302.xml +106 -0
- data/fixtures/observation/obs-303.xml +106 -0
- data/fixtures/observation/obs-304.xml +106 -0
- data/fixtures/observation/obs-400.xml +87 -0
- data/fixtures/observation/obs-401.xml +95 -0
- data/fixtures/observation/obs-402.xml +95 -0
- data/fixtures/observation/obs-403.xml +84 -0
- data/fixtures/observation/obs-404.xml +84 -0
- data/fixtures/observation/obs-405.xml +83 -0
- data/fixtures/observation/obs-406.xml +83 -0
- data/fixtures/observation/obs-407.xml +70 -0
- data/fixtures/observation/obs-408.xml +84 -0
- data/fixtures/observation/obs-uslab-example5.xml +102 -0
- data/fixtures/order/order-100.xml +61 -0
- data/fixtures/order/order-200.xml +61 -0
- data/fixtures/order/order-300.xml +61 -0
- data/fixtures/order/order-400.xml +61 -0
- data/fixtures/order_response/ordresp-100.xml +79 -0
- data/fixtures/order_response/ordresp-110.xml +79 -0
- data/fixtures/order_response/ordresp-200.xml +79 -0
- data/fixtures/order_response/ordresp-210.xml +79 -0
- data/fixtures/order_response/ordresp-300.xml +79 -0
- data/fixtures/order_response/ordresp-310.xml +79 -0
- data/fixtures/order_response/ordresp-400.xml +79 -0
- data/fixtures/order_response/ordresp-410.xml +79 -0
- data/fixtures/organization/org-uslab-example3.xml +49 -0
- data/fixtures/patient/patient-example-updated.xml +140 -0
- data/fixtures/patient/patient-example-us-extensions(us01).xml +81 -0
- data/fixtures/patient/patient-example.xml +132 -0
- data/fixtures/patient/patient-format-example.xml +101 -0
- data/fixtures/patient/patient-minimal.xml +9 -0
- data/fixtures/patient/patient-uslab-example1.xml +44 -0
- data/fixtures/practitioner/pract-uslab-example1.xml +18 -0
- data/fixtures/practitioner/pract-uslab-example3.xml +36 -0
- data/fixtures/record/condition-example-f201-fever.xml +63 -0
- data/fixtures/record/condition-example-f205-infection.xml +20 -0
- data/fixtures/record/diagnosticreport-example-f201-brainct.xml +18 -0
- data/fixtures/record/encounter-example-f201-20130404.xml +17 -0
- data/fixtures/record/encounter-example-f202-20130128.xml +17 -0
- data/fixtures/record/observation-example-f202-temperature.xml +60 -0
- data/fixtures/record/organization-example-f201-aumc.xml +5 -0
- data/fixtures/record/organization-example-f203-bumc.xml +5 -0
- data/fixtures/record/patient-example-f201-roel.xml +16 -0
- data/fixtures/record/practitioner-example-f201-ab.xml +14 -0
- data/fixtures/record/procedure-example-f201-tpf.xml +23 -0
- data/fixtures/scheduling/appointment-simple.xml +24 -0
- data/fixtures/scheduling/appointmentresponse-patient-simple.xml +12 -0
- data/fixtures/scheduling/appointmentresponse-practitioner-simple.xml +12 -0
- data/fixtures/scheduling/practitioner-simple.xml +10 -0
- data/fixtures/scheduling/schedule-simple.xml +12 -0
- data/fixtures/scheduling/slot-simple.xml +10 -0
- data/fixtures/specimen/spec-100.xml +65 -0
- data/fixtures/specimen/spec-400.xml +70 -0
- data/fixtures/specimen/spec-uslab-example1.xml +82 -0
- data/fixtures/validation/observation.profile.xml +2045 -0
- data/fixtures/validation/observations/observation-example(example).xml +50 -0
- data/lib/FHIR_structure.json +529 -0
- data/lib/daf_resource_generator.rb +94 -0
- data/lib/data/fhir_structure.rb +8 -0
- data/lib/data/resources.rb +138 -0
- data/lib/executor.rb +56 -0
- data/lib/ext/client.rb +27 -0
- data/lib/ext/client_reply.rb +19 -0
- data/lib/plan_executor.rb +31 -0
- data/lib/resource_generator.rb +656 -0
- data/lib/tasks/tasks.rake +329 -0
- data/lib/tasks/templates/summary.html.erb +163 -0
- data/lib/test_result.rb +69 -0
- data/lib/tests/assertions.rb +261 -0
- data/lib/tests/base_test.rb +117 -0
- data/lib/tests/suites/argonaut_resprint_1_test.rb +260 -0
- data/lib/tests/suites/argonaut_resprint_2_test.rb +369 -0
- data/lib/tests/suites/argonaut_resprint_3_test.rb +309 -0
- data/lib/tests/suites/argonaut_sprint_1_test.rb +187 -0
- data/lib/tests/suites/argonaut_sprint_2_test.rb +115 -0
- data/lib/tests/suites/argonaut_sprint_3_test.rb +208 -0
- data/lib/tests/suites/argonaut_sprint_4_test.rb +335 -0
- data/lib/tests/suites/argonaut_sprint_5_test.rb +196 -0
- data/lib/tests/suites/argonaut_sprint_6_test.rb +243 -0
- data/lib/tests/suites/argonaut_sprint_7_test.rb +161 -0
- data/lib/tests/suites/base_suite.rb +116 -0
- data/lib/tests/suites/connectathon_audit_track.rb +354 -0
- data/lib/tests/suites/connectathon_fetch_patient_record.rb +443 -0
- data/lib/tests/suites/connectathon_financial_track.rb +380 -0
- data/lib/tests/suites/connectathon_lab_order_track.rb +239 -0
- data/lib/tests/suites/connectathon_patient_track.rb +364 -0
- data/lib/tests/suites/connectathon_profile_validation.rb +101 -0
- data/lib/tests/suites/connectathon_scheduling_track.rb +266 -0
- data/lib/tests/suites/connectathon_terminology_track.rb +242 -0
- data/lib/tests/suites/daf_profiles_test.rb +431 -0
- data/lib/tests/suites/format_test.rb +453 -0
- data/lib/tests/suites/history_test.rb +311 -0
- data/lib/tests/suites/read_test.rb +104 -0
- data/lib/tests/suites/resource_test.rb +553 -0
- data/lib/tests/suites/search_test.rb +219 -0
- data/lib/tests/suites/search_test_robust.rb +172 -0
- data/lib/tests/suites/sprinkler_search_test.rb +660 -0
- data/lib/tests/suites/suite_engine.rb +114 -0
- data/lib/tests/suites/transaction_test.rb +571 -0
- data/lib/tests/testscripts/base_testscript.rb +480 -0
- data/lib/tests/testscripts/testscript_engine.rb +81 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Client Assigned Id/track1-patient-base-client-id-json.xml +348 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Client Assigned Id/track1-patient-base-client-id-xml.xml +348 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Client Assigned Id/track1-patient-bonus-client-id-json.xml +420 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Client Assigned Id/track1-patient-bonus-client-id-xml.xml +420 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/README.html +68 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Server Assigned Id/track1-patient-base-server-id-json.xml +352 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Server Assigned Id/track1-patient-base-server-id-xml.xml +352 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Server Assigned Id/track1-patient-bonus-server-id-json.xml +421 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/Server Assigned Id/track1-patient-bonus-server-id-xml.xml +421 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/conformance/PatientConformance.xml +34 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-create-PeterChalmers-min.json +45 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-create-PeterChalmers-min.xml +26 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-create-PeterChalmers.json +100 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-create-PeterChalmers.xml +102 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-create-bonus-PeterChalmers-min.json +53 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-create-bonus-PeterChalmers-min.xml +30 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-create-bonus-PeterChalmers.json +108 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-create-bonus-PeterChalmers.xml +108 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-PeterChalmers-min.json +45 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-PeterChalmers-min.xml +26 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-PeterChalmers.json +100 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-PeterChalmers.xml +102 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-bonus1-PeterChalmers-min.json +53 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-bonus1-PeterChalmers-min.xml +30 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-bonus1-PeterChalmers.json +108 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-bonus1-PeterChalmers.xml +107 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-bonus2-PeterChalmers-min.json +53 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-bonus2-PeterChalmers-min.xml +31 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-bonus2-PeterChalmers.json +108 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track1-Patient/_reference/resources/patient-update-bonus2-PeterChalmers.xml +106 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/C-CDA_R2-1_CCD-ussg.xml +3414 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-A1-empty-on-instance.xml +9 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-A2-empty-by-ref.xml +15 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-A3-empty-by-identifier.xml +13 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-A4-empty-by-contained.xml +15 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-B1-CCDA-on-instance.xml +15 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-B2-CCDA-by-ref.xml +21 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-B3-CCDA-by-identifier.xml +19 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/parameters-B4-CCDA-by-contained.xml +21 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/questionnaire-sdc-profile-example-ussg-fht.xml +3905 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/questionnaireresponse-expected-ussg-fht-CCDA.xml +190 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/_reference/resources/questionnaireresponse-expected-ussg-fht-empty.xml +177 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track11-SDC/track11-sdc-prepop-xml.xml +142 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Expand/Client Assigned Id/track2-ts-suite1-expand-client-id.xml +925 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Expand/Client Assigned Id/track2-ts-suite2-expand-filter-client-id.xml +930 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Expand/Server Assigned Id/track2-ts-suite1-expand-server-id.xml +953 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Expand/Server Assigned Id/track2-ts-suite2-expand-filter-server-id.xml +958 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Lookup/track2-ts-suite5-loinc-lookup-xml.xml +224 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Lookup/track2-ts-suite5-snomed-lookup-xml.xml +224 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/README.html +85 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Translate/track2-ts-suite6-translate-xml.xml +224 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Validate-code/Client Assigned Id/track2-ts-suite3-validate-code-client-id.xml +1807 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Validate-code/Client Assigned Id/track2-ts-suite4-validate-code-client-id.xml +714 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Validate-code/Server Assigned Id/track2-ts-suite3-validate-code-server-id.xml +1835 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/Validate-code/Server Assigned Id/track2-ts-suite4-validate-code-server-id.xml +742 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/conformance/ConceptMapSuite6Conformance.xml +11 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/conformance/ValueSetSuite1Conformance.xml +17 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/conformance/ValueSetSuite2Conformance.xml +17 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/conformance/ValueSetSuite3Conformance.xml +14 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/conformance/ValueSetSuite4Conformance.xml +14 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/conformance/ValueSetSuite5Conformance.xml +11 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/extensional-case-1-input-4-2-a.xml +11 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/extensional-case-1-input-4-2-b.xml +11 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/extensional-case-1-input-4-3-a.xml +13 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/extensional-case-1-input-4-3-b.xml +13 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/extensional-case-1-input-4-4-a.xml +15 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/extensional-case-1-input-4-4-b.xml +15 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/lookup-loinc-input-5-2.xml +10 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/lookup-loinc-input-5-3.xml +11 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/lookup-snomed-input-5-2.xml +10 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/lookup-snomed-input-5-3.xml +11 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/translate-conceptmap-input-6-2.xml +14 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/input/translate-conceptmap-input-6-3.xml +15 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-1-expand-min.xml +47 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-1-filter-min.xml +23 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-2-expand-min.xml +132 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-2-filter-min.xml +38 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-3-expand-min.xml +252 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-3-filter-min.xml +58 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-4-expand-min.xml +57 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/extensional-case-4-filter-min.xml +28 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/intensional-case-1-expand-min.xml +347 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/intensional-case-1-filter-min.xml +33 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/intensional-case-2-expand-min.xml +637 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/intensional-case-2-filter-min.xml +33 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/intensional-case-3-filter-min.xml +58 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/lookup-loinc-min.xml +11 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/lookup-snomed-min.xml +11 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/suite3-invalid-min.xml +10 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/suite3-valid-min.xml +7 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/suite4-invalid-min.xml +10 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/suite4-valid-min.xml +7 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/output/translate-conceptmap-min.xml +17 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/extensional-case-1.xml +55 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/extensional-case-2.xml +122 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/extensional-case-3.xml +222 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/extensional-case-4.xml +65 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/intensional-case-1.xml +31 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/intensional-case-2.xml +31 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/intensional-case-3.xml +31 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track2-Terminology/_reference/resources/translate-conceptmap-case-1.xml +145 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/conformance/DecisionSupportServiceModule-Evaluate.xml +17 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-incomplete-request-payload.xml +26 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-incomplete-response-min-payload.xml +7 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-incomplete-response-payload.xml +332 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-malformed-request-payload.xml +28 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-malformed-response-min-payload.xml +7 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-malformed-response-payload.xml +20 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-request-payload.xml +28 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-response-min-payload.xml +7 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-response-payload.xml +332 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-unauthorized-request-payload.xml +28 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-unauthorized-response-min-payload.xml +7 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/ecrs-fhir-cdc-immunizations-unauthorized-response-payload.xml +8 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/gao-assessment-request-payload.xml +176 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/gao-assessment-response-payload-min.xml +32 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/_reference/resources/gao-assessment-response-payload.xml +80 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/track3-cds-evaluate-cdc-immunization.xml +290 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track3-CDS-on-FHIR/track3-cds-evaluate-gao-profile.xml +110 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track6-FHIR-Genomics/Client_Assigned_Id/TestScript_FHIR-Genomics.xml +170 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track6-FHIR-Genomics/_reference/resources/sequence-example-1.xml +31 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track6-FHIR-Genomics/_reference/resources/sequence-example-2.xml +31 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Actors.png +0 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Client_Assigned_Id/track7-laborder100-xml.xml +590 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Client_Assigned_Id/track7-laborder200-xml.xml +587 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Client_Assigned_Id/track7-laborder300-xml.xml +612 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Client_Assigned_Id/track7-laborder400-xml.xml +635 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Peer-to-Peer/track7-laborder100-peer2peer-xml.xml +752 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/Thumbs.db +0 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/conformance/LabOrderLabReport-CreateDeleteReadUpdate.xml +187 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/conformance/html.xslt +45 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-100-update.xml +64 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-100.xml +64 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-200-update.xml +121 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-200.xml +121 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-300-update.xml +91 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-300.xml +91 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-400-update.xml +88 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticOrder/do-400.xml +88 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticReport/dr-100.xml +96 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticReport/dr-200.xml +125 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticReport/dr-300.xml +132 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/DiagnosticReport/dr-400.xml +121 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-100.xml +58 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-101.xml +58 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-200.xml +125 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-300.xml +106 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-301.xml +106 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-302.xml +106 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-303.xml +106 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-304.xml +106 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-400.xml +87 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-401.xml +95 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-402.xml +95 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-403.xml +84 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-404.xml +84 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-405.xml +83 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-406.xml +83 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-407.xml +70 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-408.xml +84 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Observation/obs-uslab-example5.xml +102 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Order/order-100.xml +61 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Order/order-200.xml +61 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Order/order-300.xml +61 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Order/order-400.xml +61 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-100.xml +79 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-110.xml +79 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-200.xml +79 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-210.xml +79 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-300.xml +79 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-310.xml +79 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-400.xml +79 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/OrderResponse/ordresp-410.xml +79 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Organization/org-uslab-example3.xml +49 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Patient/patient-uslab-example1.xml +44 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Practitioner/pract-uslab-example1.xml +18 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Practitioner/pract-uslab-example3.xml +36 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Specimen/Thumbs.db +0 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Specimen/spec-100.xml +65 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Specimen/spec-400.xml +70 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Specimen/spec-uslab-example1.xml +82 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Testscript 1 Document.txt +122 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Testscript 2 Document.txt +103 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Testscript 3 Document.txt +201 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track7-LabOrderLabReport/_reference/resources/Testscript 4 Document.txt +310 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/_reference/conformance/MedicationStatementCreate.xml +11 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/_reference/conformance/PatientSearchType.xml +15 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/_reference/resources/medicationstatement-create.json +39 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/_reference/resources/medicationstatement-patch.json +3 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/track9-patch-medicationstatement-json-if-match.xml +321 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/track9-patch-medicationstatement-json.xml +303 -0
- data/lib/tests/testscripts/xml/Connectathon11/Track9-Patch/track9-patch-peer2peer-patient-json.xml +235 -0
- data/plan_executor.gemspec +14 -0
- data/test/fixtures/diagnostic_bundle.xml +51 -0
- data/test/fixtures/lab_results_bundle.xml +49 -0
- data/test/fixtures/observation_bundle.json +61 -0
- data/test/fixtures/testscript-example.xml +202 -0
- data/test/fixtures/testscript-history.xml +143 -0
- data/test/fixtures/testscript-readtest.xml +272 -0
- data/test/fixtures/testscript-search.xml +282 -0
- data/test/fixtures/testscript-update.xml +147 -0
- data/test/fixtures/vital_signs_bundle.xml +117 -0
- data/test/test_helper.rb +8 -0
- data/test/unit/argonaut_sprint6_test.rb +31 -0
- data/test/unit/argonaut_sprint7_test.rb +21 -0
- data/test/unit/basic_test.rb +27 -0
- data/test/unit/fetch_patient_record_test.rb +357 -0
- data/test/unit/financial_test.rb +41 -0
- data/test/unit/fixtures_test.rb +45 -0
- data/test/unit/metadata_test.rb +33 -0
- metadata +394 -0
@@ -0,0 +1,261 @@
|
|
1
|
+
module Crucible
|
2
|
+
module Tests
|
3
|
+
module Assertions
|
4
|
+
|
5
|
+
def assert(test, message="assertion failed, no message", data="")
|
6
|
+
unless test
|
7
|
+
raise AssertionException.new message, data
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def assert_equal(expected, actual, message="", data="")
|
12
|
+
unless assertion_negated( expected == actual )
|
13
|
+
message += " Expected: #{expected}, but found: #{actual}."
|
14
|
+
raise AssertionException.new message, data
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def assert_operator(operator, expected, actual, message="", data="")
|
19
|
+
case operator
|
20
|
+
when :equals
|
21
|
+
unless assertion_negated( expected == actual )
|
22
|
+
message += " Expected: #{expected}, but found: #{actual}."
|
23
|
+
raise AssertionException.new message, data
|
24
|
+
end
|
25
|
+
when :notEquals
|
26
|
+
unless assertion_negated( expected != actual )
|
27
|
+
message += " Expected not: #{expected}, but found: #{actual}."
|
28
|
+
raise AssertionException.new message, data
|
29
|
+
end
|
30
|
+
when :in
|
31
|
+
unless assertion_negated(expected.split(",").include?(actual))
|
32
|
+
message += " Expected #{actual} to be in #{expected}."
|
33
|
+
raise AssertionException.new message, data
|
34
|
+
end
|
35
|
+
when :notIn
|
36
|
+
unless assertion_negated(!expected.split(",").include?(actual))
|
37
|
+
message += " Expected #{actual} to not be in: #{expected}."
|
38
|
+
raise AssertionException.new message, data
|
39
|
+
end
|
40
|
+
when :greaterThan
|
41
|
+
unless assertion_negated(!actual.nil? && !expected.nil? && actual > expected)
|
42
|
+
message += " Expected #{actual} to be greater than #{expected}."
|
43
|
+
raise AssertionException.new message, data
|
44
|
+
end
|
45
|
+
when :lessThan
|
46
|
+
unless assertion_negated(!actual.nil? && !expected.nil? && actual < expected)
|
47
|
+
message += " Expected #{actual} to be greater than #{expected}."
|
48
|
+
raise AssertionException.new message, data
|
49
|
+
end
|
50
|
+
when :empty
|
51
|
+
unless assertion_negated(actual.nil? || actual.length == 0)
|
52
|
+
message += " Expected #{actual} to be empty."
|
53
|
+
raise AssertionException.new message, data
|
54
|
+
end
|
55
|
+
when :notEmpty
|
56
|
+
unless assertion_negated(!actual.nil? && actual.length > 0)
|
57
|
+
message += " Expected #{actual} to not be empty."
|
58
|
+
raise AssertionException.new message, data
|
59
|
+
end
|
60
|
+
when :contains
|
61
|
+
unless assertion_negated(actual.include?(expected))
|
62
|
+
message += " Expected #{actual} to contain #{actual}."
|
63
|
+
raise AssertionException.new message, data
|
64
|
+
end
|
65
|
+
when :notContains
|
66
|
+
unless assertion_negated(!actual.include?(expected))
|
67
|
+
message += " Expected #{actual} to not contain #{actual}."
|
68
|
+
raise AssertionException.new message, data
|
69
|
+
end
|
70
|
+
else
|
71
|
+
message += " Invalid test; unknown operator: #{operator}."
|
72
|
+
raise AssertionExection.new message, data
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
def assert_valid_profile(response, klass)
|
78
|
+
unless assertion_negated( response[:code].to_s == "200")
|
79
|
+
|
80
|
+
raise AssertionException.new "Server created a #{klass.name.demodulize} with the ID `_validate` rather than validate the resource." if response[:code].to_s == "201"
|
81
|
+
|
82
|
+
raise AssertionException.new "Response code #{response[:code]} with no OperationOutcome provided"
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
def assert_response_ok(response, error_message="")
|
88
|
+
unless assertion_negated( [200, 201].include?(response.code) )
|
89
|
+
raise AssertionException.new "Bad response code: expected 200, 201, but found #{response.code}.#{" " + error_message}", response.body
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def assert_response_created(response, error_message="")
|
94
|
+
unless assertion_negated( [201].include?(response.code) )
|
95
|
+
raise AssertionException.new "Bad response code: expected 201, but found #{response.code}.#{" " + error_message}", response.body
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def assert_response_gone(response)
|
100
|
+
unless assertion_negated( [410].include?(response.code) )
|
101
|
+
raise AssertionException.new "Bad response code: expected 410, but found #{response.code}", response.body
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def assert_response_not_found(response)
|
106
|
+
unless assertion_negated( [404].include?(response.code) )
|
107
|
+
raise AssertionException.new "Bad response code: expected 404, but found #{response.code}", response.body
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def assert_response_bad(response)
|
112
|
+
unless assertion_negated( [400].include?(response.code) )
|
113
|
+
raise AssertionException.new "Bad response code: expected 400, but found #{response.code}", response.body
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def assert_navigation_links(bundle)
|
118
|
+
unless assertion_negated( bundle.first_link && bundle.last_link && bundle.next_link )
|
119
|
+
raise AssertionException.new "Expecting first, next and last link to be present"
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
def assert_bundle_response(response)
|
124
|
+
unless assertion_negated( response.resource.class == FHIR::Bundle )
|
125
|
+
# check what this is...
|
126
|
+
found = response.resource
|
127
|
+
begin
|
128
|
+
found = FHIR::Resource.from_contents(response.body)
|
129
|
+
rescue
|
130
|
+
found = nil
|
131
|
+
end
|
132
|
+
raise AssertionException.new "Expected FHIR Bundle but found: #{found.class.name.demodulize}", response.body
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def assert_bundle_entry_count(response, count)
|
137
|
+
unless assertion_negated( response.resource.total == count.to_i )
|
138
|
+
raise AssertionException.new "Expected FHIR Bundle with #{count} entries but found: #{response.resource.total} entries", response.body
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
def assert_bundle_transactions_okay(response)
|
143
|
+
response.resource.entry.each do |entry|
|
144
|
+
unless assertion_negated( !entry.response.nil? )
|
145
|
+
raise AssertionException.new "All Transaction/Batch Bundle.entry elements SHALL have a response."
|
146
|
+
end
|
147
|
+
status = entry.response.status
|
148
|
+
unless assertion_negated( status && status.start_with?('200','201','204') )
|
149
|
+
raise AssertionException.new "Expected all Bundle.entry.response.status to be 200, 201, or 204; but found: #{status}"
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
def assert_resource_content_type(client_reply, content_type)
|
155
|
+
header = client_reply.response[:headers]['content-type']
|
156
|
+
response_content_type = header
|
157
|
+
response_content_type = header[0, header.index(';')] if !header.index(';').nil?
|
158
|
+
|
159
|
+
unless assertion_negated( "application/#{content_type}+fhir" == response_content_type )
|
160
|
+
raise AssertionException.new "Expected a #{content_type} content-type", response_content_type
|
161
|
+
end
|
162
|
+
|
163
|
+
end
|
164
|
+
|
165
|
+
# Based on MIME Types defined in
|
166
|
+
# http://hl7.org/fhir/2015May/http.html#2.1.0.6
|
167
|
+
def assert_valid_resource_content_type_present(client_reply)
|
168
|
+
header = client_reply.response[:headers]['content-type']
|
169
|
+
content_type = header
|
170
|
+
charset = encoding = nil
|
171
|
+
|
172
|
+
content_type = header[0, header.index(';')] if !header.index(';').nil?
|
173
|
+
charset = header[header.index('charset=')+8..-1] if !header.index('charset=').nil?
|
174
|
+
encoding = Encoding.find(charset) if !charset.nil?
|
175
|
+
|
176
|
+
unless assertion_negated( encoding == Encoding::UTF_8 )
|
177
|
+
raise AssertionException.new "Response content-type specifies encoding other than UTF-8: #{charset}", header
|
178
|
+
end
|
179
|
+
unless assertion_negated( (content_type == FHIR::Formats::ResourceFormat::RESOURCE_XML) || (content_type == FHIR::Formats::ResourceFormat::RESOURCE_JSON) )
|
180
|
+
raise AssertionException.new "Invalid FHIR content-type: #{content_type}", header
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
def assert_etag_present(client_reply)
|
185
|
+
header = client_reply.response[:headers]['etag']
|
186
|
+
assert assertion_negated( !header.nil? ), 'ETag HTTP header is missing.'
|
187
|
+
end
|
188
|
+
|
189
|
+
def assert_last_modified_present(client_reply)
|
190
|
+
header = client_reply.response[:headers]['last-modified']
|
191
|
+
assert assertion_negated( !header.nil? ), 'Last-modified HTTP header is missing.'
|
192
|
+
end
|
193
|
+
|
194
|
+
def assert_valid_content_location_present(client_reply)
|
195
|
+
header = client_reply.response[:headers]['location']
|
196
|
+
assert assertion_negated( !header.nil? ), 'Location HTTP header is missing.'
|
197
|
+
end
|
198
|
+
|
199
|
+
def assert_response_code(response, code)
|
200
|
+
unless assertion_negated( code.to_s == response.code.to_s )
|
201
|
+
raise AssertionException.new "Bad response code: expected #{code}, but found #{response.code}", response.body
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
def assert_resource_type(response, resource_type)
|
206
|
+
unless assertion_negated( !response.resource.nil? && response.resource.class == resource_type )
|
207
|
+
raise AssertionException.new "Bad response type: expected #{resource_type}, but found #{response.resource.class}.", response.body
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
def assert_minimum(response, fixture)
|
212
|
+
resource_xml = response.try(:resource).try(:to_xml) || response.try(:body)
|
213
|
+
fixture_xml = fixture.try(:to_xml)
|
214
|
+
|
215
|
+
resource_doc = Nokogiri::XML(resource_xml)
|
216
|
+
raise "Could not retrieve Resource as XML from response" if resource_doc.root.nil?
|
217
|
+
resource_doc.root.add_namespace_definition('fhir', 'http://hl7.org/fhir')
|
218
|
+
|
219
|
+
fixture_doc = Nokogiri::XML(fixture_xml)
|
220
|
+
raise "Could not retrieve Resource as XML from fixture" if fixture_doc.root.nil?
|
221
|
+
fixture_doc.root.add_namespace_definition('fhir', 'http://hl7.org/fhir')
|
222
|
+
|
223
|
+
# FIXME: This doesn't seem to work for a simple case...needs more work!
|
224
|
+
# diffs = []
|
225
|
+
# d1 = Nokogiri::XML('<b><p><a>1</a><b>2</b></p><p><a>2</a><b>3</b></p></b>')
|
226
|
+
# d2 = Nokogiri::XML('<p><a>2</a><b>3</b></p>')
|
227
|
+
# d2.diff(d1, :removed=>true){|change, node| diffs << node.to_xml}
|
228
|
+
# diffs.empty? # this returns a list with d2 in it...
|
229
|
+
|
230
|
+
diffs = []
|
231
|
+
fixture_doc.diff(resource_doc, :removed => true){|change, node| diffs << node.to_xml}
|
232
|
+
diffs.select!{|d| d.strip.length > 0}
|
233
|
+
|
234
|
+
unless assertion_negated( diffs.empty? )
|
235
|
+
raise AssertionException.new "Found #{diffs.length} difference(s) between minimum and actual resource.", diffs.to_s
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
def assertion_negated(expression)
|
240
|
+
if @negated then !expression else expression end
|
241
|
+
end
|
242
|
+
|
243
|
+
def skip
|
244
|
+
raise SkipException.new
|
245
|
+
end
|
246
|
+
|
247
|
+
end
|
248
|
+
|
249
|
+
class AssertionException < Exception
|
250
|
+
attr_accessor :data
|
251
|
+
def initialize(message, data=nil)
|
252
|
+
super(message)
|
253
|
+
@data = data
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
class SkipException < Exception
|
258
|
+
end
|
259
|
+
|
260
|
+
end
|
261
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
module Crucible
|
2
|
+
module Tests
|
3
|
+
class BaseTest
|
4
|
+
|
5
|
+
include Crucible::Tests::Assertions
|
6
|
+
|
7
|
+
BASE_SPEC_LINK = 'http://hl7.org/fhir/DSTU2'
|
8
|
+
REST_SPEC_LINK = "#{BASE_SPEC_LINK}/http.html"
|
9
|
+
|
10
|
+
attr_accessor :tests_subset
|
11
|
+
attr_accessor :tags
|
12
|
+
attr_accessor :category
|
13
|
+
|
14
|
+
# Base test fields, used in Crucible::Tests::Executor.list_all
|
15
|
+
JSON_FIELDS = ['author','description','id','tests','title', 'multiserver', 'tags', 'details', 'category']
|
16
|
+
STATUS = {
|
17
|
+
pass: 'pass',
|
18
|
+
fail: 'fail',
|
19
|
+
error: 'error',
|
20
|
+
skip: 'skip'
|
21
|
+
}
|
22
|
+
METADATA_FIELDS = ['links', 'requires', 'validates']
|
23
|
+
|
24
|
+
def initialize(client, client2=nil)
|
25
|
+
@client = client
|
26
|
+
@client2 = client2
|
27
|
+
@client.monitor_requests if @client
|
28
|
+
@client2.monitor_requests if @client2
|
29
|
+
@tags ||= []
|
30
|
+
end
|
31
|
+
|
32
|
+
def multiserver
|
33
|
+
false
|
34
|
+
end
|
35
|
+
|
36
|
+
def execute
|
37
|
+
@client.use_format_param = false if @client
|
38
|
+
@client2.use_format_param = false if @client2
|
39
|
+
{id => execute_test_methods}
|
40
|
+
end
|
41
|
+
|
42
|
+
def requires_authorization
|
43
|
+
true
|
44
|
+
end
|
45
|
+
|
46
|
+
def execute_test_methods
|
47
|
+
result = []
|
48
|
+
begin
|
49
|
+
setup if respond_to? :setup and not @metadata_only
|
50
|
+
rescue AssertionException => e
|
51
|
+
@setup_failed = e
|
52
|
+
end
|
53
|
+
prefix = if @metadata_only then 'generating metadata' else 'executing' end
|
54
|
+
methods = tests
|
55
|
+
methods = tests & @tests_subset unless @tests_subset.blank?
|
56
|
+
methods.each do |test_method|
|
57
|
+
@client.requests = [] if @client
|
58
|
+
puts "[#{title}#{('_' + @resource_class.name.demodulize) if @resource_class}] #{prefix}: #{test_method}..."
|
59
|
+
begin
|
60
|
+
result << execute_test_method(test_method)
|
61
|
+
rescue => e
|
62
|
+
result << TestResult.new('ERROR', "Error #{prefix} #{test_method}", STATUS[:error], "#{test_method} failed, fatal error: #{e.message}", e.backtrace.join("\n")).to_hash.merge!({:test_method => test_method})
|
63
|
+
end
|
64
|
+
end
|
65
|
+
teardown if respond_to? :teardown and not @metadata_only
|
66
|
+
result
|
67
|
+
end
|
68
|
+
|
69
|
+
def execute_test_method(test_method)
|
70
|
+
response = self.method(test_method).call().to_hash.merge!({:test_method => test_method })
|
71
|
+
response.merge!({:requests => @client.requests.map { |r| r.to_hash } }) if @client
|
72
|
+
response
|
73
|
+
end
|
74
|
+
|
75
|
+
def author
|
76
|
+
# String identifying test file author
|
77
|
+
self.class.name
|
78
|
+
end
|
79
|
+
|
80
|
+
def description
|
81
|
+
# String containing test file description
|
82
|
+
self.class.name
|
83
|
+
end
|
84
|
+
|
85
|
+
def details
|
86
|
+
{}
|
87
|
+
end
|
88
|
+
|
89
|
+
def id
|
90
|
+
# String used to order test files for execution
|
91
|
+
self.object_id.to_s
|
92
|
+
end
|
93
|
+
|
94
|
+
def tests(keys=nil)
|
95
|
+
# Array of test methods within test file
|
96
|
+
methods = self.methods.grep(/_test$/)
|
97
|
+
if keys
|
98
|
+
matches = []
|
99
|
+
keys.each do |key|
|
100
|
+
matches << methods.grep(/^#{key}/i)
|
101
|
+
end
|
102
|
+
methods = matches.flatten
|
103
|
+
end
|
104
|
+
methods
|
105
|
+
end
|
106
|
+
|
107
|
+
def warning
|
108
|
+
begin
|
109
|
+
yield
|
110
|
+
rescue AssertionException => e
|
111
|
+
@warnings << e.message
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
@@ -0,0 +1,260 @@
|
|
1
|
+
module Crucible
|
2
|
+
module Tests
|
3
|
+
class ArgonautResprint1Test < BaseSuite
|
4
|
+
attr_accessor :rc
|
5
|
+
attr_accessor :conformance
|
6
|
+
attr_accessor :searchParams
|
7
|
+
attr_reader :canSearchById
|
8
|
+
attr_accessor :patient_id
|
9
|
+
|
10
|
+
def id
|
11
|
+
'ArgonautResprint1Test'
|
12
|
+
end
|
13
|
+
|
14
|
+
def description
|
15
|
+
'In Re-Sprint 1, we\'ll get up to speed on Argonaut\'s updated implementation guidance for: Patient, Allergies, and Problems & Health Concerns.'
|
16
|
+
end
|
17
|
+
|
18
|
+
def details
|
19
|
+
{
|
20
|
+
'Overview' => 'Since the Argonaut Implementation Program began in 2015, we\'ve come a long way. We\'ve gained early implementation experience working with FHIR DSTU2 and the Data Access Framework profiles — and we\'ve produced updated guidance based on this experience. We\'re running a series of "Re-Sprints" with three goals: ensure we have a chance to battle-test our latest "best practices" in time for MU3; help existing Argonaut implementers come up to speed; and provide an easy on-ramp for new Argonaut implementers.',
|
21
|
+
'Instructions' => 'If you\'re working on a server, please complete the "servers" tab of the Sprints Spreadsheet. You\'ll need to update the status flag to indicate whether you\'ve begun work (or completed work), so clients will know when to start testing. You\'ll also share details about how a developer can obtain OAuth client credentials (client_id for public apps, or a client_id and client_secret for confidential apps) as well as user login credentials. You might consider simply sharing a set of fixed credentials in this spreadsheet, or else directing users to a web page where they can complete self-service registration. If absolutely necessary, you can ask developers to e-mail you directly. If you\'re working on a client, please complete the "clients" tab of the Sprints Spreadsheet. You\'ll also need to update the status flag to indicate whether you\'ve begun work (or completed work).',
|
22
|
+
'FHIR API Calls' => 'For this sprint, EHRs should focus on the following FHIR Resources: Patient, AllergyIntolerance, and Condition. Patients should be retrieveable by ID, and should be searchable by demographics such as name, gender and birthdate. AllergyIntolerances should be searchable by the associated Patient ID. Conditions should be retrievable by code, where code is in the Problem valueset, and should be searchable by Patient ID as well.'
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
def initialize(client1, client2=nil)
|
27
|
+
super(client1, client2)
|
28
|
+
@rc = FHIR::Patient
|
29
|
+
@tags.append('argonaut')
|
30
|
+
@category = {id: 'argonaut', title: 'Argonaut'}
|
31
|
+
@status_codes = ['active', 'unconfirmed', 'confirmed', 'inactive', 'resolved', 'refuted', 'entered-in-error']
|
32
|
+
end
|
33
|
+
|
34
|
+
def setup
|
35
|
+
if !@client.client.try(:params).nil? && @client.client.params['patient']
|
36
|
+
@patient_id = @client.client.params['patient']
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
test 'ARS101', 'Get patient by ID' do
|
41
|
+
metadata {
|
42
|
+
links "#{REST_SPEC_LINK}#read"
|
43
|
+
requires resource: "Patient", methods: ["read", "search"]
|
44
|
+
validates resource: "Patient", methods: ["read", "search"]
|
45
|
+
}
|
46
|
+
|
47
|
+
begin
|
48
|
+
options = {
|
49
|
+
:search => {
|
50
|
+
:flag => true,
|
51
|
+
:compartment => nil,
|
52
|
+
:parameters => {
|
53
|
+
_count: 1
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
@patient_id ||= @client.search(@rc, options).resource.entry.first.resource.xmlId
|
58
|
+
rescue NoMethodError
|
59
|
+
@patient = nil
|
60
|
+
end
|
61
|
+
|
62
|
+
skip if !@patient_id
|
63
|
+
|
64
|
+
reply = @client.read(FHIR::Patient, @patient_id)
|
65
|
+
assert_response_ok(reply)
|
66
|
+
assert_equal @patient_id, reply.id, 'Server returned wrong patient.'
|
67
|
+
@patient = reply.resource
|
68
|
+
assert @patient, "could not get patient by id: #{@patient_id}"
|
69
|
+
warning { assert_valid_resource_content_type_present(reply) }
|
70
|
+
warning { assert_last_modified_present(reply) }
|
71
|
+
end
|
72
|
+
|
73
|
+
test 'ARS102', 'Search by identifier' do
|
74
|
+
metadata {
|
75
|
+
define_metadata('search')
|
76
|
+
}
|
77
|
+
skip if !@patient
|
78
|
+
get_patient_by_param(:identifier => @patient[:identifier].first.try(:value))
|
79
|
+
end
|
80
|
+
|
81
|
+
test 'ARS103', 'Identifier without search keyword' do
|
82
|
+
metadata {
|
83
|
+
define_metadata('search')
|
84
|
+
}
|
85
|
+
skip if !@patient
|
86
|
+
get_patient_by_param({ :identifier => @patient[:identifier].first.try(:value) }, false)
|
87
|
+
end
|
88
|
+
|
89
|
+
test 'ARS104', 'Search by Family & Given' do
|
90
|
+
metadata {
|
91
|
+
define_metadata('search')
|
92
|
+
}
|
93
|
+
skip if !@patient
|
94
|
+
family = @patient[:name].first.try(:family).try(:first)
|
95
|
+
given = @patient[:name].first.try(:given).try(:first)
|
96
|
+
assert family, "Patient family name not returned"
|
97
|
+
assert given, "Patient given name not returned"
|
98
|
+
get_patient_by_param(family: family, given: given)
|
99
|
+
end
|
100
|
+
|
101
|
+
test 'ARS105', 'Family & Given without search keyword' do
|
102
|
+
metadata {
|
103
|
+
define_metadata('search')
|
104
|
+
}
|
105
|
+
skip if !@patient
|
106
|
+
family = @patient[:name].first.try(:family).try(:first)
|
107
|
+
given = @patient[:name].first.try(:given).try(:first)
|
108
|
+
assert family, "Patient family name not provided"
|
109
|
+
assert given, "Patient given name not provided"
|
110
|
+
get_patient_by_param({ family: family, given: given }, false)
|
111
|
+
end
|
112
|
+
|
113
|
+
test 'ARS106', 'Search by name and gender' do
|
114
|
+
metadata {
|
115
|
+
define_metadata('search')
|
116
|
+
}
|
117
|
+
skip if !@patient
|
118
|
+
name = @patient[:name].first.try(:family).try(:first)
|
119
|
+
gender = @patient[:gender]
|
120
|
+
assert name, "Patient name not provided"
|
121
|
+
assert gender, "Patient gender not provided"
|
122
|
+
get_patient_by_param(name: name, gender: gender)
|
123
|
+
end
|
124
|
+
|
125
|
+
test 'ARS107', 'Name and gender without search keyword' do
|
126
|
+
metadata {
|
127
|
+
define_metadata('search')
|
128
|
+
}
|
129
|
+
skip if !@patient
|
130
|
+
name = @patient[:name].first.try(:family).try(:first)
|
131
|
+
gender = @patient[:gender]
|
132
|
+
assert name, "Patient name not provided"
|
133
|
+
assert gender, "Patient gender not provided"
|
134
|
+
get_patient_by_param(name: name, gender: gender)
|
135
|
+
end
|
136
|
+
|
137
|
+
test 'ARS108', 'Search by Birthdate' do
|
138
|
+
metadata {
|
139
|
+
define_metadata('search')
|
140
|
+
}
|
141
|
+
skip if !@patient
|
142
|
+
birthdate = @patient[:birthDate]
|
143
|
+
gender = @patient[:gender]
|
144
|
+
assert birthdate, "Patient birthdate not provided"
|
145
|
+
assert gender, "Patient gender not provided"
|
146
|
+
get_patient_by_param(birthdate: birthdate, gender: gender)
|
147
|
+
end
|
148
|
+
|
149
|
+
test 'ARS109', 'Birthdate without search keyword' do
|
150
|
+
metadata {
|
151
|
+
define_metadata('search')
|
152
|
+
}
|
153
|
+
skip if !@patient
|
154
|
+
birthdate = @patient[:birthDate]
|
155
|
+
gender = @patient[:gender]
|
156
|
+
assert birthdate, "Patient birthdate not provided"
|
157
|
+
assert gender, "Patient gender not provided"
|
158
|
+
get_patient_by_param({ birthdate: birthdate, gender: gender }, false)
|
159
|
+
end
|
160
|
+
|
161
|
+
test 'ARS110', 'GET AllergyIntolerance with Patient IDs' do
|
162
|
+
metadata {
|
163
|
+
links "#{REST_SPEC_LINK}#search"
|
164
|
+
requires resource: 'Patient', methods: ['read', 'search']
|
165
|
+
requires resource: 'AllergyIntolerance', methods: ['read', 'search']
|
166
|
+
validates resource: 'Patient', methods: ['read', 'search']
|
167
|
+
validates resource: 'AllergyIntolerance', methods: ['read', 'search']
|
168
|
+
}
|
169
|
+
|
170
|
+
assert !@client.client.try(:params).nil?, "The client was not authorized for the test"
|
171
|
+
assert @client.client.params["patient"], "No patient parameter was passed to the client"
|
172
|
+
|
173
|
+
patient_id = @patient.xmlId
|
174
|
+
|
175
|
+
options = {
|
176
|
+
search: {
|
177
|
+
flag: false,
|
178
|
+
compartment: nil,
|
179
|
+
parameters: {
|
180
|
+
patient: patient_id
|
181
|
+
}
|
182
|
+
}
|
183
|
+
}
|
184
|
+
|
185
|
+
reply = @client.search(FHIR::AllergyIntolerance, options)
|
186
|
+
|
187
|
+
assert_response_ok(reply)
|
188
|
+
|
189
|
+
reply.resource.entry.each do |entry|
|
190
|
+
assert (entry.resource.patient && entry.resource.patient.reference.include?(patient_id)), "Patient on AllergyIntolerance does not match patient requested"
|
191
|
+
assert entry.resource.substance, "No substance defined for AllergyIntolerance"
|
192
|
+
entry.resource.substance.coding.each do |coding|
|
193
|
+
warn { assert ['http://rxnav.nlm.nih.gov/REST/Ndfrt', 'http://snomed.info/sct', 'http://www.nlm.nih.gov/research/umls/rxnorm'].include?(coding.system), "Code system #{coding.system} does not match expected code system for Allergy substance coding" }
|
194
|
+
end
|
195
|
+
assert @status_codes.include?(entry.resource.status), 'Allergy Status is not part of status Value Set'
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
test 'ARS111', 'GET Condition with Patient IDs' do
|
200
|
+
metadata {
|
201
|
+
links "#{REST_SPEC_LINK}#search"
|
202
|
+
requires resource: "Patient", methods: ["read", "search"]
|
203
|
+
validates resource: "Patient", methods: ["read", "search"]
|
204
|
+
}
|
205
|
+
|
206
|
+
assert !@client.client.try(:params).nil?, "The client was not authorized for the test"
|
207
|
+
assert @client.client.params["patient"], "No patient parameter was passed to the client"
|
208
|
+
|
209
|
+
patient_id = @patient.xmlId
|
210
|
+
|
211
|
+
options = {
|
212
|
+
search: {
|
213
|
+
flag: false,
|
214
|
+
compartment: nil,
|
215
|
+
parameters: {
|
216
|
+
patient: patient_id
|
217
|
+
}
|
218
|
+
}
|
219
|
+
}
|
220
|
+
|
221
|
+
reply = @client.search(FHIR::Condition, options)
|
222
|
+
|
223
|
+
assert_response_ok(reply)
|
224
|
+
|
225
|
+
reply.resource.entry.each do |entry|
|
226
|
+
assert (entry.resource.patient && entry.resource.patient.reference.include?(patient_id)), "Patient on condition does not match patient requested"
|
227
|
+
entry.resource.code.coding.each do |coding|
|
228
|
+
warn { assert coding.system == "http://snomed.info/sct", "Condition Code System is not SNOMED-CT" }
|
229
|
+
assert !coding.code.empty?, "No code defined for Coding"
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
private
|
235
|
+
|
236
|
+
def get_patient_by_param(params = {}, flag = true)
|
237
|
+
assert !params.empty?, "No params for patient"
|
238
|
+
options = {
|
239
|
+
:search => {
|
240
|
+
:flag => flag,
|
241
|
+
:compartment => nil,
|
242
|
+
:parameters => params
|
243
|
+
}
|
244
|
+
}
|
245
|
+
reply = @client.search(@rc, options)
|
246
|
+
assert_response_ok(reply)
|
247
|
+
assert_bundle_response(reply)
|
248
|
+
assert reply.resource.get_by_id(@patient_id).equals?(@patient, ['_id', "text", "meta", "lastUpdated"]), 'Server returned wrong patient.'
|
249
|
+
end
|
250
|
+
|
251
|
+
def define_metadata(method)
|
252
|
+
links "#{REST_SPEC_LINK}##{method}"
|
253
|
+
links "#{BASE_SPEC_LINK}/#{@rc.name.demodulize.downcase}.html"
|
254
|
+
requires resource: @rc.name.demodulize, methods: [method]
|
255
|
+
validates resource: @rc.name.demodulize, methods: [method]
|
256
|
+
end
|
257
|
+
|
258
|
+
end
|
259
|
+
end
|
260
|
+
end
|