Search in sources :

Example 51 with MR

use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR in project hl7v2-fhir-converter by LinuxForHealth.

the class Hl7MedicationRequestFHIRConversionTest method dosageInstructionTestDoseQuantityRXE.

@Test
void dosageInstructionTestDoseQuantityRXE() {
    // Test dosageInstruction.DoseQuantity RXE.3 using RXE segment, no range
    String hl7message = "MSH|^~\\&||||||S1|RDE^O11||T|2.6|||||||||\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "ORC|NW|||||E|||||||||||||||||||||||I\n" + // RXE.6 through RXE.44 not used.
    "RXE||DUONEB3INH^3 ML PLAS CONT : IPRATROPIUM-ALBUTEROL 0.5-2.5 (3) MG/3ML IN SOLN^ADS|3||mL|||||||||||||||||||||||||||||\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);
    Quantity doseQuantity = medicationRequest.getDosageInstructionFirstRep().getDoseAndRateFirstRep().getDoseQuantity();
    // dosageInstruction.doseAndRate.doseQuantity RXE.3
    // RXE.3
    assertThat(doseQuantity.getValue()).hasToString("3.0");
    // RXE.5.1
    assertThat(doseQuantity.getUnit()).isEqualTo("mL");
    // default
    assertThat(doseQuantity.getSystem()).isEqualTo("http://unitsofmeasure.org");
    // 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) Quantity(org.hl7.fhir.r4.model.Quantity) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 52 with MR

use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR 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 53 with MR

use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR 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 54 with MR

use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR 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 55 with MR

use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR 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)

Aggregations

Test (org.junit.jupiter.api.Test)126 Resource (org.hl7.fhir.r4.model.Resource)86 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)83 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)58 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)40 Patient (org.hl7.fhir.r4.model.Patient)36 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)35 Identifier (org.hl7.fhir.r4.model.Identifier)30 Bundle (org.hl7.fhir.r4.model.Bundle)29 MedicationRequest (org.hl7.fhir.r4.model.MedicationRequest)22 Immunization (org.hl7.fhir.r4.model.Immunization)19 Encounter (org.hl7.fhir.r4.model.Encounter)18 Coding (org.hl7.fhir.r4.model.Coding)16 Observation (org.hl7.fhir.r4.model.Observation)15 Organization (org.hl7.fhir.r4.model.Organization)15 ServiceRequest (org.hl7.fhir.r4.model.ServiceRequest)15 ValueSource (org.junit.jupiter.params.provider.ValueSource)14 ResourceModel (io.github.linuxforhealth.api.ResourceModel)13 Reference (org.hl7.fhir.r4.model.Reference)13 Extension (org.hl7.fhir.r4.model.Extension)11