Search in sources :

Example 61 with BundleEntryComponent

use of org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent in project hl7v2-fhir-converter by LinuxForHealth.

the class Hl7MedicationRequestFHIRConversionTest method dosageInstructionTestRouteRXE.

@Test
void dosageInstructionTestRouteRXE() {
    // Test dosageInstruction.Route (RXE.6)
    String hl7message = "MSH|^~\\&||||||S1|RDE^O11||T|2.6|||||||||\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "ORC|NW|||||E|||||||||||||||||||||||I\n" + "RXE||DUONEB3INH^3 ML PLAS CONT : IPRATROPIUM-ALBUTEROL 0.5-2.5 (3) MG/3ML IN SOLN^ADS|||" + // RXE.6 to route
    "|6064005||||||||||||||||||||||||||||||||||\n";
    List<BundleEntryComponent> e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
    List<Resource> medicationRequestList = ResourceUtils.getResourceList(e, ResourceType.MedicationRequest);
    // Confirm that one medicationRequest was created.
    assertThat(medicationRequestList).hasSize(1);
    MedicationRequest medicationRequest = ResourceUtils.getResourceMedicationRequest(medicationRequestList.get(0), ResourceUtils.context);
    CodeableConcept route = medicationRequest.getDosageInstructionFirstRep().getRoute();
    // dosageInstruction.route (RXE.6)
    // 6.1
    assertThat(route.getCodingFirstRep().getCode()).isEqualTo("6064005");
    // 6.2
    assertThat(route.getCodingFirstRep().getDisplay()).isNull();
    // 6.3
    assertThat(route.getCodingFirstRep().getSystem()).isNull();
    // 6.2
    assertThat(route.getText()).isNull();
    // Verify no extraneous resources
    // Expect MedicationRequest, Patient
    assertThat(e).hasSize(2);
}
Also used : MedicationRequest(org.hl7.fhir.r4.model.MedicationRequest) BundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent) Resource(org.hl7.fhir.r4.model.Resource) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 62 with BundleEntryComponent

use of org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent in project hl7v2-fhir-converter by LinuxForHealth.

the class Hl7MedicationRequestFHIRConversionTest method dosageInstructionTestTextRXE.

@Test
void dosageInstructionTestTextRXE() {
    // Test dosageInstruction.text (RXE.21)
    String hl7message = "MSH|^~\\&||||||S1|RDE^O11||T|2.6|||||||||\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "ORC|NW|||||E|||||||||||||||||||||||I\n" + "RXE||DUONEB3INH^3 ML PLAS CONT : IPRATROPIUM-ALBUTEROL 0.5-2.5 (3) MG/3ML IN SOLN^ADS||||||||||||||||||" + // RXE.21 to dosageInstruction.text
    "|333^Take 1 tablet by mouth every 6 (six) hours.|||||||||||||||||||\n";
    List<BundleEntryComponent> e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
    List<Resource> medicationRequestList = ResourceUtils.getResourceList(e, ResourceType.MedicationRequest);
    // Confirm that one medicationRequest was created.
    assertThat(medicationRequestList).hasSize(1);
    MedicationRequest medicationRequest = ResourceUtils.getResourceMedicationRequest(medicationRequestList.get(0), ResourceUtils.context);
    String txt = medicationRequest.getDosageInstructionFirstRep().getText();
    // dosageInstruction.text (RXE.21.1 and 21.2 separated by a ':')
    assertThat(txt).isEqualTo("333:Take 1 tablet by mouth every 6 (six) hours.");
    // Verify no extraneous resources
    // Expect MedicationRequest, Patient
    assertThat(e).hasSize(2);
}
Also used : MedicationRequest(org.hl7.fhir.r4.model.MedicationRequest) BundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent) Resource(org.hl7.fhir.r4.model.Resource) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 63 with BundleEntryComponent

use of org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent in project hl7v2-fhir-converter by LinuxForHealth.

the class Hl7MedicationRequestFHIRConversionTest method test_medicationCodeableConcept_and_intent_in_OMP_and_ORM.

// Tests medication request fields MedicationCodeableConcept and Intent.
// Tests with supported message types ORM-O01, OMP-O09.
// With just the RXO segment -- these message types don't support RXE.
@ParameterizedTest
@ValueSource(strings = { "MSH|^~\\&||||||S1|OMP^O09||T|2.6|||||||||\r", // --UNCOMMENT BELOW WHEN CONVERTER SUPPORTS THIS MESSAGE TYPE--
"MSH|^~\\&||||||S1|ORM^O01||T|2.6|||||||||\r" })
void test_medicationCodeableConcept_and_intent_in_OMP_and_ORM(String msh) {
    String hl7message = msh + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "ORC|NW|F800006^OE|P800006^RX|||E|10^BID^D4^^^R||\n" + "RXO|RX800006^Test15 SODIUM 100 MG CAPSULE^NDC||100||mg|||||G||10||5\n";
    List<BundleEntryComponent> e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
    List<Resource> medicationRequestList = ResourceUtils.getResourceList(e, ResourceType.MedicationRequest);
    assertThat(medicationRequestList).hasSize(1);
    MedicationRequest medicationRequest = ResourceUtils.getResourceMedicationRequest(medicationRequestList.get(0), ResourceUtils.context);
    // Verify authored on is not present
    assertThat(medicationRequest.getAuthoredOn()).isNull();
    // Verify intent is set correctly (Hardcoded for all MedicalRequests in template)
    String intent = medicationRequest.getIntent().toString();
    assertThat(intent).isEqualTo("ORDER");
    // Very medicationCodeableConcept is set correctly (RXO.1)
    assertThat(medicationRequest.hasMedicationCodeableConcept()).isTrue();
    CodeableConcept medCC = medicationRequest.getMedicationCodeableConcept();
    assertThat(medCC.getText()).isEqualTo("Test15 SODIUM 100 MG CAPSULE");
    assertThat(medCC.getCoding().get(0).getSystem()).isEqualTo("http://hl7.org/fhir/sid/ndc");
    assertThat(medCC.getCoding().get(0).getCode()).isEqualTo("RX800006");
    assertThat(medCC.getCoding().get(0).getDisplay()).isEqualTo("Test15 SODIUM 100 MG CAPSULE");
}
Also used : MedicationRequest(org.hl7.fhir.r4.model.MedicationRequest) BundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent) Resource(org.hl7.fhir.r4.model.Resource) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 64 with BundleEntryComponent

use of org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent in project hl7v2-fhir-converter by LinuxForHealth.

the class Hl7MedicationRequestFHIRConversionTest method test_medicationCodeableConcept_and_intent_in_PPR.

// Tests medication request fields MedicationCodeableConcept and Intent.
// Tests with supported message types PPR-PC1, PPR-PC2, PPR-PC3
// With just the RXO segment -- these message types don't support RXE.
@ParameterizedTest
@ValueSource(strings = { "MSH|^~\\&||||||S1|PPR^PC1||T|2.6|||||||||\r" // --UNCOMMENT BELOW WHEN CONVERTER SUPPORTS THIS MESSAGE TYPE--
// "MSH|^~\\&||||||S1|PPR^PC2||T|2.6|||||||||\r",
// "MSH|^~\\&||||||S1|PPR^PC3||T|2.6|||||||||\r",
})
void test_medicationCodeableConcept_and_intent_in_PPR(String msh) {
    String hl7message = msh + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "PRB|AD|20140610234741|^oxygenase|Problem_000054321_20190606193536||20140610234741\n" + "ORC|NW|F800006^OE|P800006^RX|||E|10^BID^D4^^^R||\n" + "OBR|1|||555|||20170825010500||||||||||||||||||F\r" + "RXO|RX800006^Test15 SODIUM 100 MG CAPSULE^NDC||100||mg|||||G||10||5\n";
    List<BundleEntryComponent> e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
    List<Resource> medicationRequestList = ResourceUtils.getResourceList(e, ResourceType.MedicationRequest);
    assertThat(medicationRequestList).hasSize(1);
    MedicationRequest medicationRequest = ResourceUtils.getResourceMedicationRequest(medicationRequestList.get(0), ResourceUtils.context);
    // Verify authored on is not present
    assertThat(medicationRequest.getAuthoredOn()).isNull();
    // Verify intent is set correctly
    String intent = medicationRequest.getIntent().toString();
    assertThat(intent).isEqualTo("ORDER");
    // Very medicationCodeableConcept is set correctly
    assertThat(medicationRequest.hasMedicationCodeableConcept()).isTrue();
    CodeableConcept medCC = medicationRequest.getMedicationCodeableConcept();
    assertThat(medCC.getText()).isEqualTo("Test15 SODIUM 100 MG CAPSULE");
    assertThat(medCC.getCoding().get(0).getSystem()).isEqualTo("http://hl7.org/fhir/sid/ndc");
    assertThat(medCC.getCoding().get(0).getCode()).isEqualTo("RX800006");
    assertThat(medCC.getCoding().get(0).getDisplay()).isEqualTo("Test15 SODIUM 100 MG CAPSULE");
}
Also used : MedicationRequest(org.hl7.fhir.r4.model.MedicationRequest) BundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent) Resource(org.hl7.fhir.r4.model.Resource) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 65 with BundleEntryComponent

use of org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent in project hl7v2-fhir-converter by LinuxForHealth.

the class Hl7MedicationRequestFHIRConversionTest method dosageInstructionTestRouteRXO.

@Test
void dosageInstructionTestRouteRXO() {
    // Test dosageInstruction.Route (RXO.5)
    String hl7message = "MSH|^~\\\\&|||||20210101000000||OMP^O09|MSGID|T|2.6\n" + "PID|||1234||DOE^JANE^|||F||||||||||||||||||||||\n" + "PV1||I||||||||||||||||||||||||||||||||||||||||||\n" + "ORC|OP||||||||||||||||||||||\n" + "RXO|00054418425^Dexamethasone 4 MG Oral Tablet^NDC^^^^^^dexamethasone (DECADRON) 4 MG TABS|||" + // RXO.5 to dosageInstruction.Route
    "|6064005^Topical route^http://snomed.info/sct|||||||||||||||||\n";
    List<BundleEntryComponent> e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
    List<Resource> medicationRequestList = ResourceUtils.getResourceList(e, ResourceType.MedicationRequest);
    // Confirm that one medicationRequest was created.
    assertThat(medicationRequestList).hasSize(1);
    MedicationRequest medicationRequest = ResourceUtils.getResourceMedicationRequest(medicationRequestList.get(0), ResourceUtils.context);
    CodeableConcept route = medicationRequest.getDosageInstructionFirstRep().getRoute();
    // dosageInstruction.route (RXO.5)
    // 5.1
    assertThat(route.getCodingFirstRep().getCode()).isEqualTo("6064005");
    // 5.2
    assertThat(route.getCodingFirstRep().getDisplay()).isEqualTo("Topical route");
    // 5.3
    assertThat(route.getCodingFirstRep().getSystem()).isEqualTo("http://snomed.info/sct");
    // 5.2
    assertThat(route.getText()).isEqualTo("Topical route");
    // Verify no extraneous resources
    // Expect MedicationRequest, Patient, and Encounter
    assertThat(e).hasSize(3);
}
Also used : MedicationRequest(org.hl7.fhir.r4.model.MedicationRequest) BundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent) Resource(org.hl7.fhir.r4.model.Resource) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)265 Resource (org.hl7.fhir.r4.model.Resource)167 Test (org.junit.jupiter.api.Test)126 Bundle (org.hl7.fhir.r4.model.Bundle)116 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)96 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)88 ArrayList (java.util.ArrayList)67 Date (java.util.Date)52 Reference (org.hl7.fhir.r4.model.Reference)52 BundleEntryComponent (org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent)51 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)42 Patient (org.hl7.fhir.r4.model.Patient)37 IOException (java.io.IOException)36 Observation (org.hl7.fhir.r4.model.Observation)36 Test (org.junit.Test)35 BundleEntryComponent (org.hl7.fhir.r5.model.Bundle.BundleEntryComponent)34 MedicationRequest (org.hl7.fhir.r4.model.MedicationRequest)33 Condition (org.hl7.fhir.r4.model.Condition)32 HashMap (java.util.HashMap)31 Encounter (org.hl7.fhir.r4.model.Encounter)31