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,571 @@
|
|
1
|
+
module Crucible
|
2
|
+
module Tests
|
3
|
+
class TransactionAndBatchTest < BaseSuite
|
4
|
+
|
5
|
+
def id
|
6
|
+
'TransactionAndBatchTest'
|
7
|
+
end
|
8
|
+
|
9
|
+
def description
|
10
|
+
'Test server support for transactions and batch processing including conditional logic.'
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize(client1, client2=nil)
|
14
|
+
super(client1, client2)
|
15
|
+
@category = {id: 'core_functionality', title: 'Core Functionality'}
|
16
|
+
end
|
17
|
+
|
18
|
+
def setup
|
19
|
+
@transferIds = {}
|
20
|
+
end
|
21
|
+
|
22
|
+
def teardown
|
23
|
+
# delete resources
|
24
|
+
@client.destroy(FHIR::Observation, @obs4.xmlId) if @obs4 && !@obs4.xmlId.nil?
|
25
|
+
@client.destroy(FHIR::Observation, @obs3.xmlId) if @obs3 && !@obs3.xmlId.nil?
|
26
|
+
@client.destroy(FHIR::Observation, @obs2.xmlId) if @obs2 && !@obs2.xmlId.nil?
|
27
|
+
@client.destroy(FHIR::Observation, @obs1.xmlId) if @obs1 && !@obs1.xmlId.nil?
|
28
|
+
@client.destroy(FHIR::Observation, @obs0a.xmlId) if @obs0a && !@obs0a.xmlId.nil?
|
29
|
+
@client.destroy(FHIR::Observation, @obs0b.xmlId) if @obs0b && !@obs0b.xmlId.nil?
|
30
|
+
@client.destroy(FHIR::Condition, @condition0.xmlId) if @condition0 && !@condition0.xmlId.nil?
|
31
|
+
@client.destroy(FHIR::Condition, @conditionId) if @conditionId
|
32
|
+
@client.destroy(FHIR::Patient, @patient0.xmlId) if @patient0 && !@patient0.xmlId.nil?
|
33
|
+
@client.destroy(FHIR::Patient, @patient1.xmlId) if @patient1 && !@patient1.xmlId.nil?
|
34
|
+
@client.destroy(FHIR::Patient, @badPatientId) if @badPatientId
|
35
|
+
@transferIds.each do |klass,list|
|
36
|
+
list.each do |id|
|
37
|
+
@client.destroy(klass, id) if(!id.nil? && !id.strip.empty?)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
@client.destroy(FHIR::Observation, @batch_obs.xmlId) if @batch_obs && !@batch_obs.xmlId.nil?
|
41
|
+
@client.destroy(FHIR::Patient, @batch_patient.xmlId) if @batch_patient && !@batch_patient.xmlId.nil?
|
42
|
+
@client.destroy(FHIR::Observation, @batch_obs_2.xmlId) if @batch_obs_2 && !@batch_obs_2.xmlId.nil?
|
43
|
+
@client.destroy(FHIR::Observation, @batch_obs_3.xmlId) if @batch_obs_3 && !@batch_obs_3.xmlId.nil?
|
44
|
+
@client.destroy(FHIR::Patient, @batch_patient_2.xmlId) if @batch_patient_2 && !@batch_patient_2.xmlId.nil?
|
45
|
+
@client.destroy(FHIR::Observation, @obs0a_B.xmlId) if @obs0a_B && !@obs0a_B.xmlId.nil?
|
46
|
+
@client.destroy(FHIR::Observation, @obs0b_B.xmlId) if @obs0b_B && !@obs0b_B.xmlId.nil?
|
47
|
+
@client.destroy(FHIR::Condition, @condition0_B.xmlId) if @condition0_B && !@condition0_B.xmlId.nil?
|
48
|
+
@client.destroy(FHIR::Patient, @patient0_B.xmlId) if @patient0_B && !@patient0_B.xmlId.nil?
|
49
|
+
end
|
50
|
+
|
51
|
+
# Create a Patient Record as a transaction
|
52
|
+
test 'XFER0','Create a Patient Record as Transaction' do
|
53
|
+
metadata {
|
54
|
+
links "#{REST_SPEC_LINK}#transaction"
|
55
|
+
links "#{BASE_SPEC_LINK}/patient.html"
|
56
|
+
links "#{BASE_SPEC_LINK}/observation.html"
|
57
|
+
links "#{BASE_SPEC_LINK}/condition.html"
|
58
|
+
requires resource: 'Patient', methods: ['create']
|
59
|
+
requires resource: 'Observation', methods: ['create']
|
60
|
+
requires resource: 'Condition', methods: ['create']
|
61
|
+
requires resource: nil, methods: ['transaction-system']
|
62
|
+
validates resource: 'Patient', methods: ['create']
|
63
|
+
validates resource: 'Observation', methods: ['create']
|
64
|
+
validates resource: 'Condition', methods: ['create']
|
65
|
+
validates resource: nil, methods: ['transaction-system']
|
66
|
+
}
|
67
|
+
|
68
|
+
@patient0 = ResourceGenerator.minimal_patient("#{Time.now.to_i}",'Transaction')
|
69
|
+
@patient0.xmlId = 'foo' # assign an id so related resources can reference the patient
|
70
|
+
# height
|
71
|
+
@obs0a = ResourceGenerator.minimal_observation('http://loinc.org','8302-2',170,'cm',@patient0.xmlId)
|
72
|
+
# weight
|
73
|
+
@obs0b = ResourceGenerator.minimal_observation('http://loinc.org','3141-9',200,'kg',@patient0.xmlId)
|
74
|
+
# obesity
|
75
|
+
@condition0 = ResourceGenerator.minimal_condition('http://snomed.info/sct','414915002',@patient0.xmlId)
|
76
|
+
|
77
|
+
@client.begin_transaction
|
78
|
+
@client.add_transaction_request('POST',nil,@patient0)
|
79
|
+
@client.add_transaction_request('POST',nil,@obs0a)
|
80
|
+
@client.add_transaction_request('POST',nil,@obs0b)
|
81
|
+
@client.add_transaction_request('POST',nil,@condition0)
|
82
|
+
reply = @client.end_transaction
|
83
|
+
|
84
|
+
# set the patient id as nil, until we know that the transaction was successful, so teardown doesn't try
|
85
|
+
# to delete something that wasn't created
|
86
|
+
@patient0.xmlId = nil
|
87
|
+
|
88
|
+
assert( ((200..299).include?(reply.code)), "Unexpected status code: #{reply.code}" )
|
89
|
+
warning{ assert_response_ok(reply) }
|
90
|
+
assert_bundle_response(reply)
|
91
|
+
assert_bundle_transactions_okay(reply)
|
92
|
+
@created_patient_record = true
|
93
|
+
|
94
|
+
# set the IDs to whatever the server created
|
95
|
+
@patient0.xmlId = FHIR::ResourceAddress.pull_out_id('Patient',reply.resource.entry[0].try(:response).try(:location))
|
96
|
+
@patient0.xmlId = reply.resource.entry[0].try(:resource).try(:xmlId) if @patient0.xmlId.nil?
|
97
|
+
|
98
|
+
@obs0a.xmlId = FHIR::ResourceAddress.pull_out_id('Observation',reply.resource.entry[1].try(:response).try(:location))
|
99
|
+
@obs0a.xmlId = reply.resource.entry[1].try(:resource).try(:xmlId) if @obs0a.xmlId.nil?
|
100
|
+
|
101
|
+
@obs0b.xmlId = FHIR::ResourceAddress.pull_out_id('Observation',reply.resource.entry[2].try(:response).try(:location))
|
102
|
+
@obs0b.xmlId = reply.resource.entry[2].try(:resource).try(:xmlId) if @obs0b.xmlId.nil?
|
103
|
+
|
104
|
+
@condition0.xmlId = FHIR::ResourceAddress.pull_out_id('Condition',reply.resource.entry[3].try(:response).try(:location))
|
105
|
+
@condition0.xmlId = reply.resource.entry[3].try(:resource).try(:xmlId) if @condition0.xmlId.nil?
|
106
|
+
|
107
|
+
# check that the Observations and Condition reference the correct Patient.id
|
108
|
+
assert( (reply.resource.entry[1].resource.subject.reference.ends_with?(@patient0.xmlId) rescue false), "Observation doesn't correctly reference Patient/#{@patient0.xmlId}")
|
109
|
+
assert( (reply.resource.entry[2].resource.subject.reference.ends_with?(@patient0.xmlId) rescue false), "Observation doesn't correctly reference Patient/#{@patient0.xmlId}")
|
110
|
+
assert( (reply.resource.entry[3].resource.patient.reference.ends_with?(@patient0.xmlId) rescue false), "Condition doesn't correctly reference Patient/#{@patient0.xmlId}")
|
111
|
+
end
|
112
|
+
|
113
|
+
# Create a Patient record that uses Bundle.entry.fullUrl to link/reference, rather than Bundle.entry.resource.id
|
114
|
+
test 'XFER0B','Create a Patient Record as Transaction (with references using fullUrl rather than IDs)' do
|
115
|
+
metadata {
|
116
|
+
links "#{REST_SPEC_LINK}#transaction"
|
117
|
+
links "#{BASE_SPEC_LINK}/patient.html"
|
118
|
+
links "#{BASE_SPEC_LINK}/observation.html"
|
119
|
+
links "#{BASE_SPEC_LINK}/condition.html"
|
120
|
+
requires resource: 'Patient', methods: ['create']
|
121
|
+
requires resource: 'Observation', methods: ['create']
|
122
|
+
requires resource: 'Condition', methods: ['create']
|
123
|
+
requires resource: nil, methods: ['transaction-system']
|
124
|
+
validates resource: 'Patient', methods: ['create']
|
125
|
+
validates resource: 'Observation', methods: ['create']
|
126
|
+
validates resource: 'Condition', methods: ['create']
|
127
|
+
validates resource: nil, methods: ['transaction-system']
|
128
|
+
}
|
129
|
+
|
130
|
+
@patient0_B = ResourceGenerator.minimal_patient("#{Time.now.to_i}",'Transaction')
|
131
|
+
patient0_B_id = SecureRandom.uuid
|
132
|
+
patient0_B_uri = "urn:uuid:#{patient0_B_id}"
|
133
|
+
|
134
|
+
# height
|
135
|
+
@obs0a_B = ResourceGenerator.minimal_observation('http://loinc.org','8302-2',170,'cm',patient0_B_id)
|
136
|
+
# weight
|
137
|
+
@obs0b_B = ResourceGenerator.minimal_observation('http://loinc.org','3141-9',200,'kg',patient0_B_id)
|
138
|
+
# obesity
|
139
|
+
@condition0_B = ResourceGenerator.minimal_condition('http://snomed.info/sct','414915002',patient0_B_id)
|
140
|
+
|
141
|
+
@client.begin_transaction
|
142
|
+
@client.add_transaction_request('POST',nil,@patient0_B)
|
143
|
+
@client.transaction_bundle.entry.first.fullUrl = patient0_B_id
|
144
|
+
@client.add_transaction_request('POST',nil,@obs0a_B)
|
145
|
+
@client.add_transaction_request('POST',nil,@obs0b_B)
|
146
|
+
@client.add_transaction_request('POST',nil,@condition0_B)
|
147
|
+
reply = @client.end_transaction
|
148
|
+
|
149
|
+
assert( ((200..299).include?(reply.code)), "Unexpected status code: #{reply.code}" )
|
150
|
+
warning{ assert_response_ok(reply) }
|
151
|
+
assert_bundle_response(reply)
|
152
|
+
assert_bundle_transactions_okay(reply)
|
153
|
+
|
154
|
+
# set the IDs to whatever the server created
|
155
|
+
@patient0_B.xmlId = FHIR::ResourceAddress.pull_out_id('Patient',reply.resource.entry[0].try(:response).try(:location))
|
156
|
+
@patient0_B.xmlId = reply.resource.entry[0].try(:resource).try(:xmlId) if @patient0_B.xmlId.nil?
|
157
|
+
|
158
|
+
@obs0a_B.xmlId = FHIR::ResourceAddress.pull_out_id('Observation',reply.resource.entry[1].try(:response).try(:location))
|
159
|
+
@obs0a_B.xmlId = reply.resource.entry[1].try(:resource).try(:xmlId) if @obs0a_B.xmlId.nil?
|
160
|
+
|
161
|
+
@obs0b_B.xmlId = FHIR::ResourceAddress.pull_out_id('Observation',reply.resource.entry[2].try(:response).try(:location))
|
162
|
+
@obs0b_B.xmlId = reply.resource.entry[2].try(:resource).try(:xmlId) if @obs0b_B.xmlId.nil?
|
163
|
+
|
164
|
+
@condition0_B.xmlId = FHIR::ResourceAddress.pull_out_id('Condition',reply.resource.entry[3].try(:response).try(:location))
|
165
|
+
@condition0_B.xmlId = reply.resource.entry[3].try(:resource).try(:xmlId) if @condition0_B.xmlId.nil?
|
166
|
+
|
167
|
+
# check that the Observations and Condition reference the correct Patient.id
|
168
|
+
assert( (reply.resource.entry[1].resource.subject.reference.ends_with?(@patient0_B.xmlId) rescue false), "Observation doesn't correctly reference Patient/#{@patient0_B.xmlId}")
|
169
|
+
assert( (reply.resource.entry[2].resource.subject.reference.ends_with?(@patient0_B.xmlId) rescue false), "Observation doesn't correctly reference Patient/#{@patient0_B.xmlId}")
|
170
|
+
assert( (reply.resource.entry[3].resource.patient.reference.ends_with?(@patient0_B.xmlId) rescue false), "Condition doesn't correctly reference Patient/#{@patient0_B.xmlId}")
|
171
|
+
end
|
172
|
+
|
173
|
+
# Update a Patient Record as a transaction
|
174
|
+
# Conditional create patient
|
175
|
+
# Conditional create/update observations
|
176
|
+
test 'XFER1','Conditionally Create Patient and add new Observation as Transaction' do
|
177
|
+
metadata {
|
178
|
+
links "#{REST_SPEC_LINK}#transaction"
|
179
|
+
links "#{BASE_SPEC_LINK}/patient.html"
|
180
|
+
links "#{BASE_SPEC_LINK}/observation.html"
|
181
|
+
requires resource: 'Patient', methods: ['create']
|
182
|
+
requires resource: 'Observation', methods: ['create']
|
183
|
+
requires resource: nil, methods: ['transaction-system']
|
184
|
+
validates resource: 'Patient', methods: ['create']
|
185
|
+
validates resource: 'Observation', methods: ['create']
|
186
|
+
validates resource: nil, methods: ['transaction-system']
|
187
|
+
}
|
188
|
+
skip unless @created_patient_record
|
189
|
+
|
190
|
+
# patient has gained weight
|
191
|
+
@obs1 = ResourceGenerator.minimal_observation('http://loinc.org','3141-9',250,'kg',@patient0.xmlId)
|
192
|
+
|
193
|
+
@client.begin_transaction
|
194
|
+
@client.add_transaction_request('POST',nil,@patient0,"identifier=#{@patient0.identifier.first.system}|#{@patient0.identifier.first.value}")
|
195
|
+
@client.add_transaction_request('POST',nil,@obs1)
|
196
|
+
reply = @client.end_transaction
|
197
|
+
|
198
|
+
assert( ((200..299).include?(reply.code)), "Unexpected status code: #{reply.code}" )
|
199
|
+
warning{ assert_response_ok(reply) }
|
200
|
+
assert_bundle_response(reply)
|
201
|
+
assert_bundle_transactions_okay(reply)
|
202
|
+
|
203
|
+
# set the IDs to whatever the server created
|
204
|
+
# @patient0.xmlId = FHIR::ResourceAddress.pull_out_id('Patient',reply.resource.entry[0].try(:response).try(:location))
|
205
|
+
@obs1.xmlId = FHIR::ResourceAddress.pull_out_id('Observation',reply.resource.entry[1].try(:response).try(:location))
|
206
|
+
@obs1.xmlId = reply.resource.entry[1].try(:resource).try(:xmlId) if @obs1.xmlId.nil?
|
207
|
+
end
|
208
|
+
|
209
|
+
# Conditionally Update entire patient record
|
210
|
+
# - Patient grew taller, lost weight, obesity is refuted
|
211
|
+
# - Condition ETag plus ?patient=Patient/foo&code=http://snomed.info/sct|414915002
|
212
|
+
test 'XFER2','Delete and Create Observation and Conditionally Update Condition as Transaction' do
|
213
|
+
metadata {
|
214
|
+
links "#{REST_SPEC_LINK}#transaction"
|
215
|
+
links "#{BASE_SPEC_LINK}/observation.html"
|
216
|
+
links "#{BASE_SPEC_LINK}/condition.html"
|
217
|
+
requires resource: 'Observation', methods: ['create','delete']
|
218
|
+
requires resource: 'Condition', methods: ['update']
|
219
|
+
requires resource: nil, methods: ['transaction-system']
|
220
|
+
validates resource: 'Observation', methods: ['create','delete']
|
221
|
+
validates resource: 'Condition', methods: ['update']
|
222
|
+
validates resource: nil, methods: ['transaction-system']
|
223
|
+
}
|
224
|
+
skip unless @created_patient_record
|
225
|
+
|
226
|
+
# weight
|
227
|
+
@obs2 = ResourceGenerator.minimal_observation('http://loinc.org','3141-9',100,'kg',@patient0.xmlId)
|
228
|
+
# obesity has been refuted
|
229
|
+
@condition0.patient.reference = "Patient/#{@patient0.xmlId}"
|
230
|
+
@condition0.clinicalStatus = 'resolved'
|
231
|
+
@condition0.verificationStatus = 'refuted'
|
232
|
+
@condition0.abatementBoolean = true
|
233
|
+
|
234
|
+
@client.begin_transaction
|
235
|
+
@client.add_transaction_request('DELETE',"Observation/#{@obs0b.xmlId}") if @obs0b && !@obs0b.xmlId.nil? # delete first weight
|
236
|
+
@client.add_transaction_request('DELETE',"Observation/#{@obs1.xmlId}") if @obs1 && !@obs1.xmlId.nil? # delete second weight
|
237
|
+
@client.add_transaction_request('POST',nil,@obs2) # create new weight observation
|
238
|
+
@client.add_transaction_request('PUT',"Condition?code=#{@condition0.code.coding.first.system}|#{@condition0.code.coding.first.code}&patient=Patient/#{@patient0.xmlId}",@condition0)
|
239
|
+
reply = @client.end_transaction
|
240
|
+
|
241
|
+
assert( ((200..299).include?(reply.code)), "Unexpected status code: #{reply.code}" )
|
242
|
+
warning{ assert_response_ok(reply) }
|
243
|
+
assert_bundle_response(reply)
|
244
|
+
assert_bundle_transactions_okay(reply)
|
245
|
+
|
246
|
+
# set the IDs to whatever the server created
|
247
|
+
@obs2.xmlId = FHIR::ResourceAddress.pull_out_id('Observation',reply.resource.entry[-2].try(:response).try(:location))
|
248
|
+
@obs2.xmlId = reply.resource.entry[-2].try(:resource).try(:xmlId) if @obs2.xmlId.nil?
|
249
|
+
|
250
|
+
@conditionId = FHIR::ResourceAddress.pull_out_id('Condition',reply.resource.entry[-1].try(:response).try(:location))
|
251
|
+
@conditionId = reply.resource.entry[-1].try(:resource).try(:xmlId) if @conditionId.nil?
|
252
|
+
end
|
253
|
+
|
254
|
+
# Create Patients with same identifier, THEN conditionally create patient as part of transaction -- transaction should fail with OperationOutcome
|
255
|
+
test 'XFER3','Bad Transaction to Conditionally Create Patient with multiple matches' do
|
256
|
+
metadata {
|
257
|
+
links "#{REST_SPEC_LINK}#transaction"
|
258
|
+
links "#{BASE_SPEC_LINK}/patient.html"
|
259
|
+
requires resource: 'Patient', methods: ['create']
|
260
|
+
requires resource: nil, methods: ['transaction-system']
|
261
|
+
validates resource: 'Patient', methods: ['create']
|
262
|
+
validates resource: nil, methods: ['transaction-system']
|
263
|
+
}
|
264
|
+
skip unless @created_patient_record
|
265
|
+
|
266
|
+
@patient1 = ResourceGenerator.minimal_patient(@patient0.identifier.first.value,@patient0.name.first.given.first)
|
267
|
+
reply = @client.create @patient1
|
268
|
+
assert_response_ok(reply)
|
269
|
+
@patient1.xmlId = (reply.resource.try(:xmlId) || reply.id)
|
270
|
+
|
271
|
+
@client.begin_transaction
|
272
|
+
@client.add_transaction_request('POST',nil,@patient1,"identifier=#{@patient0.identifier.first.system}|#{@patient0.identifier.first.value}")
|
273
|
+
reply = @client.end_transaction
|
274
|
+
|
275
|
+
# These IDs should not exist, but if they do, then we should delete this Patient during teardown.
|
276
|
+
if reply.resource.is_a?(FHIR::Bundle)
|
277
|
+
@badPatientId = FHIR::ResourceAddress.pull_out_id('Patient',reply.resource.entry[0].try(:response).try(:location))
|
278
|
+
@badPatientId = reply.resource.entry[0].try(:resource).try(:xmlId) if @badPatientId.nil?
|
279
|
+
end
|
280
|
+
|
281
|
+
assert((reply.code >= 400 && reply.code < 500), "Failed Transactions should return an HTTP 400 range response, found: #{reply.code}.", reply.body)
|
282
|
+
assert_resource_type(reply,FHIR::OperationOutcome)
|
283
|
+
end
|
284
|
+
|
285
|
+
# Test Transaction Processing ordering: DELETE, POST, PUT, GET
|
286
|
+
test 'XFER4','Transaction Processing Order of Operations' do
|
287
|
+
metadata {
|
288
|
+
links "#{REST_SPEC_LINK}#transaction"
|
289
|
+
links "#{BASE_SPEC_LINK}/observation.html"
|
290
|
+
requires resource: 'Observation', methods: ['create','read','delete']
|
291
|
+
requires resource: nil, methods: ['transaction-system']
|
292
|
+
validates resource: 'Observation', methods: ['create','read','delete']
|
293
|
+
validates resource: nil, methods: ['transaction-system']
|
294
|
+
}
|
295
|
+
skip unless @created_patient_record
|
296
|
+
|
297
|
+
# height observation
|
298
|
+
@obs3 = ResourceGenerator.minimal_observation('http://loinc.org','8302-2',177,'cm',@patient0.xmlId)
|
299
|
+
# weight observation
|
300
|
+
@obs4 = ResourceGenerator.minimal_observation('http://loinc.org','3141-9',105,'kg',@patient0.xmlId)
|
301
|
+
# give this *weight* observation the ID of the *height* observation created in XFER1
|
302
|
+
@obs4.xmlId = @obs0a.xmlId
|
303
|
+
|
304
|
+
@client.begin_transaction
|
305
|
+
# read the all the Patient's weight observations. This should happen last (fourth) and return 1 result.
|
306
|
+
@client.add_transaction_request('GET',"Observation?code=#{@obs0b.code.coding.first.system}|#{@obs0b.code.coding.first.code}&patient=Patient/#{@patient0.xmlId}")
|
307
|
+
# update the old height observation to be a weight... this should happen third.
|
308
|
+
@client.add_transaction_request('PUT',"Observation/#{@obs4.xmlId}",@obs4)
|
309
|
+
# create a new height observation... this should happen second.
|
310
|
+
@client.add_transaction_request('POST',nil,@obs3)
|
311
|
+
# delete the Patient's existing weight observation... this should happen first.
|
312
|
+
@client.add_transaction_request('DELETE',"Observation/#{@obs2.xmlId}") if @obs2 && !@obs2.xmlId.nil?
|
313
|
+
reply = @client.end_transaction
|
314
|
+
|
315
|
+
assert( ((200..299).include?(reply.code)), "Unexpected status code: #{reply.code}" )
|
316
|
+
warning{ assert_response_ok(reply) }
|
317
|
+
assert_bundle_response(reply)
|
318
|
+
assert_bundle_transactions_okay(reply)
|
319
|
+
|
320
|
+
count = (reply.resource.entry.first.resource.total rescue 0)
|
321
|
+
assert(count==1,"In a transaction, GET should execute last and in this case only return 1 result; found #{count}",reply.body)
|
322
|
+
searchResultId = (reply.resource.entry.first.resource.entry.first.resource.xmlId rescue nil)
|
323
|
+
assert(searchResultId==@obs2.xmlId,"The GET search returned the wrong result. Expected Observation/#{@obs2.xmlId} but found Observation/#{searchResultId}.",reply.body)
|
324
|
+
|
325
|
+
# set the IDs to whatever the server created
|
326
|
+
@obs3.xmlId = FHIR::ResourceAddress.pull_out_id('Observation',reply.resource.entry[2].try(:response).try(:location))
|
327
|
+
@obs3.xmlId = reply.resource.entry[2].try(:resource).try(:xmlId) if @obs3.xmlId.nil?
|
328
|
+
|
329
|
+
@obs4.xmlId = FHIR::ResourceAddress.pull_out_id('Observation',reply.resource.entry[1].try(:response).try(:location))
|
330
|
+
@obs4.xmlId = reply.resource.entry[1].try(:resource).try(:xmlId) if @obs4.xmlId.nil?
|
331
|
+
end
|
332
|
+
|
333
|
+
# If $everything operation, fetch patient record, and then use that bundle to update the record in a transaction
|
334
|
+
test 'XFER5','Fetch patient record and then present the record as an update transaction' do
|
335
|
+
metadata {
|
336
|
+
links "#{REST_SPEC_LINK}#transaction"
|
337
|
+
links "#{REST_SPEC_LINK}#other-bundles"
|
338
|
+
links "#{BASE_SPEC_LINK}/patient.html"
|
339
|
+
links "#{BASE_SPEC_LINK}/patient-operations.html#everything"
|
340
|
+
requires resource: 'Patient', methods: ['$everything']
|
341
|
+
requires resource: nil, methods: ['transaction-system']
|
342
|
+
validates resource: 'Patient', methods: ['$everything']
|
343
|
+
validates resource: nil, methods: ['transaction-system']
|
344
|
+
}
|
345
|
+
skip unless @created_patient_record
|
346
|
+
|
347
|
+
reply = @client.fetch_patient_record(@patient0.xmlId, nil, nil, 'GET')
|
348
|
+
assert_response_ok(reply)
|
349
|
+
assert_bundle_response(reply)
|
350
|
+
|
351
|
+
everything = reply.resource
|
352
|
+
|
353
|
+
@client.begin_transaction
|
354
|
+
@client.transaction_bundle = reply.resource
|
355
|
+
reply = @client.end_transaction
|
356
|
+
|
357
|
+
assert( ((200..299).include?(reply.code)), "Unexpected status code: #{reply.code}" )
|
358
|
+
warning{ assert_response_ok(reply) }
|
359
|
+
assert_bundle_response(reply)
|
360
|
+
assert_bundle_transactions_okay(reply)
|
361
|
+
|
362
|
+
# get the new IDs
|
363
|
+
@transferPatientId = nil
|
364
|
+
reply.resource.entry.each do |entry|
|
365
|
+
klass = entry.resource.class
|
366
|
+
entry_id = FHIR::ResourceAddress.pull_out_id(klass.name.demodulize, entry.try(:response).try(:location))
|
367
|
+
entry_id = entry.resource.xmlId if entry_id.nil?
|
368
|
+
@transferIds[klass] = [] if @transferIds[klass].nil?
|
369
|
+
@transferIds[klass] << entry_id
|
370
|
+
@transferPatientId = entry_id if(entry.resource.class == FHIR::Patient)
|
371
|
+
end
|
372
|
+
|
373
|
+
# check that the IDs and references were rewritten
|
374
|
+
everything.entry.each_with_index do |entry,index|
|
375
|
+
klass_name = entry.resource.class.name.demodulize
|
376
|
+
original_id = entry.resource.xmlId
|
377
|
+
transfer_location = (reply.resource.entry[index].response.location rescue nil)
|
378
|
+
transfer_id = FHIR::ResourceAddress.pull_out_id( klass_name, transfer_location) if !transfer_location.nil?
|
379
|
+
transfer_id = (reply.resource.entry[index].resource.xmlId rescue nil) if transfer_id.nil?
|
380
|
+
assert((original_id != transfer_id), "Resource ID was not rewritten: #{original_id}")
|
381
|
+
|
382
|
+
# if class is Observation check subject
|
383
|
+
assert( (reply.resource.entry[index].resource.subject==@transferPatientId), "Observation.subject Patient reference was not rewritten." ) if reply.resource.entry[index].resource.class==FHIR::Observation
|
384
|
+
# if class is Condition check patient
|
385
|
+
assert( (reply.resource.entry[index].resource.patient==@transferPatientId), "Condition.patient reference was not rewritten." ) if reply.resource.entry[index].resource.class==FHIR::Condition
|
386
|
+
end
|
387
|
+
end
|
388
|
+
|
389
|
+
# delete entire patient record
|
390
|
+
test 'XFER6','Delete an Unordered Patient Record as Transaction' do
|
391
|
+
metadata {
|
392
|
+
links "#{REST_SPEC_LINK}#transaction"
|
393
|
+
links "#{BASE_SPEC_LINK}/patient.html"
|
394
|
+
links "#{BASE_SPEC_LINK}/observation.html"
|
395
|
+
links "#{BASE_SPEC_LINK}/condition.html"
|
396
|
+
requires resource: 'Patient', methods: ['delete']
|
397
|
+
requires resource: 'Observation', methods: ['delete']
|
398
|
+
requires resource: 'Condition', methods: ['delete']
|
399
|
+
requires resource: nil, methods: ['transaction-system']
|
400
|
+
validates resource: 'Patient', methods: ['delete']
|
401
|
+
validates resource: 'Observation', methods: ['delete']
|
402
|
+
validates resource: 'Condition', methods: ['delete']
|
403
|
+
validates resource: nil, methods: ['transaction-system']
|
404
|
+
}
|
405
|
+
skip unless @created_patient_record
|
406
|
+
|
407
|
+
@client.begin_transaction
|
408
|
+
@client.add_transaction_request('DELETE', "Patient/#{@patient0.xmlId}") if @patient0 && !@patient0.xmlId.nil?
|
409
|
+
@client.add_transaction_request('DELETE', "Condition/#{@condition0.xmlId}") if @condition0 && !@condition0.xmlId.nil?
|
410
|
+
@client.add_transaction_request('DELETE', "Condition/#{@conditionId}") if @conditionId
|
411
|
+
@client.add_transaction_request('DELETE', "Observation/#{@obs4.xmlId}") if @obs4 && !@obs4.xmlId.nil?
|
412
|
+
@client.add_transaction_request('DELETE', "Observation/#{@obs3.xmlId}") if @obs3 && !@obs3.xmlId.nil?
|
413
|
+
@client.add_transaction_request('DELETE', "Observation/#{@obs0a.xmlId}") if @obs0a && !@obs0a.xmlId.nil?
|
414
|
+
reply = @client.end_transaction
|
415
|
+
|
416
|
+
assert( ((200..299).include?(reply.code)), "Unexpected status code: #{reply.code}" )
|
417
|
+
warning{ assert_response_ok(reply) }
|
418
|
+
assert_bundle_response(reply)
|
419
|
+
assert_bundle_transactions_okay(reply)
|
420
|
+
end
|
421
|
+
|
422
|
+
# delete entire patient record
|
423
|
+
test 'XFER7','Delete an Ordered Patient Record as Transaction' do
|
424
|
+
metadata {
|
425
|
+
links "#{REST_SPEC_LINK}#transaction"
|
426
|
+
links "#{BASE_SPEC_LINK}/patient.html"
|
427
|
+
links "#{BASE_SPEC_LINK}/observation.html"
|
428
|
+
links "#{BASE_SPEC_LINK}/condition.html"
|
429
|
+
requires resource: 'Patient', methods: ['delete']
|
430
|
+
requires resource: 'Observation', methods: ['delete']
|
431
|
+
requires resource: 'Condition', methods: ['delete']
|
432
|
+
requires resource: nil, methods: ['transaction-system']
|
433
|
+
validates resource: 'Patient', methods: ['delete']
|
434
|
+
validates resource: 'Observation', methods: ['delete']
|
435
|
+
validates resource: 'Condition', methods: ['delete']
|
436
|
+
validates resource: nil, methods: ['transaction-system']
|
437
|
+
}
|
438
|
+
skip unless @created_patient_record
|
439
|
+
|
440
|
+
@client.begin_transaction
|
441
|
+
@client.add_transaction_request('DELETE', "Observation/#{@obs4.xmlId}") if @obs4 && !@obs4.xmlId.nil?
|
442
|
+
@client.add_transaction_request('DELETE', "Observation/#{@obs3.xmlId}") if @obs3 && !@obs3.xmlId.nil?
|
443
|
+
@client.add_transaction_request('DELETE', "Observation/#{@obs0a.xmlId}") if @obs0a && !@obs0a.xmlId.nil?
|
444
|
+
@client.add_transaction_request('DELETE', "Condition/#{@condition0.xmlId}") if @condition0 && !@condition0.xmlId.nil?
|
445
|
+
@client.add_transaction_request('DELETE', "Condition/#{@conditionId}") if @conditionId
|
446
|
+
@client.add_transaction_request('DELETE', "Patient/#{@patient0.xmlId}") if @patient0 && !@patient0.xmlId.nil?
|
447
|
+
reply = @client.end_transaction
|
448
|
+
|
449
|
+
assert( ((200..299).include?(reply.code)), "Unexpected status code: #{reply.code}" )
|
450
|
+
warning{ assert_response_ok(reply) }
|
451
|
+
assert_bundle_response(reply)
|
452
|
+
assert_bundle_transactions_okay(reply)
|
453
|
+
end
|
454
|
+
|
455
|
+
# For a batch, there SHALL be no interdependencies between the different entries in the Bundle.
|
456
|
+
# Batch process entire patient record
|
457
|
+
test 'XFER10','Invalid Batch with Interdependencies' do
|
458
|
+
metadata {
|
459
|
+
links "#{REST_SPEC_LINK}#transaction"
|
460
|
+
links "#{BASE_SPEC_LINK}/patient.html"
|
461
|
+
links "#{BASE_SPEC_LINK}/observation.html"
|
462
|
+
requires resource: 'Patient', methods: ['create']
|
463
|
+
requires resource: 'Observation', methods: ['create']
|
464
|
+
requires resource: nil, methods: ['batch-system']
|
465
|
+
validates resource: 'Patient', methods: ['create']
|
466
|
+
validates resource: 'Observation', methods: ['create']
|
467
|
+
validates resource: nil, methods: ['batch-system']
|
468
|
+
}
|
469
|
+
|
470
|
+
@batch_patient = ResourceGenerator.minimal_patient("#{Time.now.to_i}",'Batch')
|
471
|
+
@batch_patient.xmlId = 'batchfoo' # assign an id so related resources can reference the patient
|
472
|
+
# height
|
473
|
+
@batch_obs = ResourceGenerator.minimal_observation('http://loinc.org','8302-2',900,'cm',@batch_patient.xmlId)
|
474
|
+
|
475
|
+
@client.begin_batch
|
476
|
+
@client.add_batch_request('POST',nil,@batch_patient)
|
477
|
+
@client.add_batch_request('POST',nil,@batch_obs)
|
478
|
+
reply = @client.end_batch
|
479
|
+
|
480
|
+
assert_bundle_response(reply)
|
481
|
+
assert_equal(2, reply.resource.entry.length, "Expected 2 Bundle entries but found #{reply.resource.entry.length}", reply.body)
|
482
|
+
|
483
|
+
patientCode = reply.resource.entry[0].try(:response).try(:status).try(:split).try(:first).try(:to_i)
|
484
|
+
assert((!patientCode.nil? && patientCode >= 200 && patientCode < 300), "The batch should have created a Patient.", reply.body)
|
485
|
+
# set the IDs to whatever the server created
|
486
|
+
@batch_patient.xmlId = FHIR::ResourceAddress.pull_out_id('Patient',reply.resource.entry[0].try(:response).try(:location))
|
487
|
+
@batch_patient.xmlId = (reply.resource.entry[0].resource.xmlId rescue nil) if @batch_patient.xmlId.nil?
|
488
|
+
|
489
|
+
obsCode = reply.resource.entry[1].try(:response).try(:status).try(:split).try(:first).try(:to_i)
|
490
|
+
# set the IDs to whatever the server created
|
491
|
+
@batch_obs.xmlId = FHIR::ResourceAddress.pull_out_id('Observation',reply.resource.entry[1].try(:response).try(:location))
|
492
|
+
@batch_obs.xmlId = (reply.resource.entry[1].resource.xmlId rescue nil) if @batch_obs.xmlId.nil?
|
493
|
+
assert((!obsCode.nil? && obsCode >= 400 && obsCode < 500), "The batch should have failed to create the Observation with a dependency on the Patient.", reply.body)
|
494
|
+
end
|
495
|
+
|
496
|
+
# Batch patient record
|
497
|
+
test 'XFER11','Create Patient Record and then Batch create and search Observations' do
|
498
|
+
metadata {
|
499
|
+
links "#{REST_SPEC_LINK}#transaction"
|
500
|
+
links "#{BASE_SPEC_LINK}/patient.html"
|
501
|
+
links "#{BASE_SPEC_LINK}/observation.html"
|
502
|
+
requires resource: 'Patient', methods: ['create']
|
503
|
+
requires resource: 'Observation', methods: ['create','search']
|
504
|
+
requires resource: nil, methods: ['batch-system']
|
505
|
+
validates resource: 'Patient', methods: ['create']
|
506
|
+
validates resource: 'Observation', methods: ['create','search']
|
507
|
+
validates resource: nil, methods: ['batch-system']
|
508
|
+
}
|
509
|
+
|
510
|
+
@batch_patient_2 = ResourceGenerator.minimal_patient("#{Time.now.to_i}",'Batch')
|
511
|
+
reply = @client.create @batch_patient_2
|
512
|
+
assert_response_ok(reply)
|
513
|
+
@batch_patient_2.xmlId = (reply.resource.try(:xmlId) || reply.id)
|
514
|
+
|
515
|
+
# height
|
516
|
+
@batch_obs_2 = ResourceGenerator.minimal_observation('http://loinc.org','8302-2',300,'cm',@batch_patient_2.xmlId)
|
517
|
+
# weight
|
518
|
+
@batch_obs_3 = ResourceGenerator.minimal_observation('http://loinc.org','3141-9',500,'kg',@batch_patient_2.xmlId)
|
519
|
+
|
520
|
+
@client.begin_batch
|
521
|
+
@client.add_batch_request('POST',nil,@batch_obs_2)
|
522
|
+
@client.add_batch_request('POST',nil,@batch_obs_3)
|
523
|
+
@client.add_transaction_request('GET',"Observation?patient=Patient/#{@batch_patient_2.xmlId}")
|
524
|
+
reply = @client.end_batch
|
525
|
+
|
526
|
+
assert( ((200..299).include?(reply.code)), "Unexpected status code: #{reply.code}" )
|
527
|
+
warning{ assert_response_ok(reply) }
|
528
|
+
assert_bundle_response(reply)
|
529
|
+
|
530
|
+
# set the IDs to whatever the server created
|
531
|
+
@batch_obs_2.xmlId = FHIR::ResourceAddress.pull_out_id('Observation',reply.resource.entry[0].try(:response).try(:location))
|
532
|
+
@batch_obs_2.xmlId = (reply.resource.entry[0].resource.xmlId rescue nil) if @batch_obs_2.xmlId.nil?
|
533
|
+
@batch_obs_3.xmlId = FHIR::ResourceAddress.pull_out_id('Observation',reply.resource.entry[1].try(:response).try(:location))
|
534
|
+
@batch_obs_3.xmlId = (reply.resource.entry[1].resource.xmlId rescue nil) if @batch_obs_3.xmlId.nil?
|
535
|
+
|
536
|
+
assert_equal(3, reply.resource.entry.length, "Expected 3 Bundle entries but found #{reply.resource.entry.length}", reply.body)
|
537
|
+
assert_bundle_transactions_okay(reply)
|
538
|
+
assert_equal(2, reply.resource.entry[-1].resource.entry.length, "Expected 2 search results but found #{reply.resource.entry[-1].resource.entry.length}", reply.body)
|
539
|
+
end
|
540
|
+
|
541
|
+
# Batch delete patient record
|
542
|
+
test 'XFER12','Delete an Ordered Patient Record as Batch' do
|
543
|
+
metadata {
|
544
|
+
links "#{REST_SPEC_LINK}#transaction"
|
545
|
+
links "#{BASE_SPEC_LINK}/patient.html"
|
546
|
+
links "#{BASE_SPEC_LINK}/observation.html"
|
547
|
+
requires resource: 'Patient', methods: ['delete']
|
548
|
+
requires resource: 'Observation', methods: ['delete']
|
549
|
+
requires resource: nil, methods: ['batch-system']
|
550
|
+
validates resource: 'Patient', methods: ['delete']
|
551
|
+
validates resource: 'Observation', methods: ['delete']
|
552
|
+
validates resource: nil, methods: ['batch-system']
|
553
|
+
}
|
554
|
+
skip unless ((@batch_patient_2 && !@batch_patient_2.xmlId.nil?) ||
|
555
|
+
(@batch_obs_2 && !@batch_obs_2.xmlId.nil?) ||
|
556
|
+
(@batch_obs_3 && !@batch_obs_3.xmlId.nil? ))
|
557
|
+
|
558
|
+
@client.begin_batch
|
559
|
+
@client.add_batch_request('DELETE', "Observation/#{@batch_obs_3.xmlId}") if @batch_obs_3 && !@batch_obs_3.xmlId.nil?
|
560
|
+
@client.add_batch_request('DELETE', "Observation/#{@batch_obs_2.xmlId}") if @batch_obs_2 && !@batch_obs_2.xmlId.nil?
|
561
|
+
@client.add_batch_request('DELETE', "Patient/#{@batch_patient_2.xmlId}") if @batch_patient_2 && !@batch_patient_2.xmlId.nil?
|
562
|
+
reply = @client.end_batch
|
563
|
+
|
564
|
+
assert( ((200..299).include?(reply.code)), "Unexpected status code: #{reply.code}" )
|
565
|
+
warning{ assert_response_ok(reply) }
|
566
|
+
assert_bundle_response(reply)
|
567
|
+
assert_bundle_transactions_okay(reply)
|
568
|
+
end
|
569
|
+
end
|
570
|
+
end
|
571
|
+
end
|