use of org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7ObservationFHIRConversionTest method testObservationSTMultiplePartsResult.
@Test
void testObservationSTMultiplePartsResult() throws IOException {
String hl7message = baseMessage + "OBX|1|ST|^Type of protein feed^L||HYPERDYNAMIC LV SYSTOLIC FUNCTION, VISUAL EF 80%~Fifth line, as part of a repeated field||||||F||";
List<BundleEntryComponent> e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
List<Resource> obsResource = ResourceUtils.getResourceList(e, ResourceType.Observation);
assertThat(obsResource).hasSize(1);
Observation obs = (Observation) obsResource.get(0);
assertThat(obs.getValueStringType()).isNotNull();
StringType q = obs.getValueStringType();
assertThat(q.asStringValue()).isEqualTo("HYPERDYNAMIC LV SYSTOLIC FUNCTION, VISUAL EF 80%. Fifth line, as part of a repeated field.");
}
use of org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7ObservationFHIRConversionTest method testObservationSN_valueQuantity_missing_comparator_result.
@Test
void testObservationSN_valueQuantity_missing_comparator_result() throws IOException {
String hl7message = baseMessage + "OBX|1|SN|1554-5^GLUCOSE||^182|mg/dl|70_105||||F";
List<BundleEntryComponent> e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
List<Resource> obsResource = ResourceUtils.getResourceList(e, ResourceType.Observation);
assertThat(obsResource).hasSize(1);
Observation obs = (Observation) obsResource.get(0);
// Check valueQuantity
assertNotNull(obs.getValueQuantity());
Quantity q = obs.getValueQuantity();
// code only set if system exists
assertNull(q.getCode());
assertEquals("mg/dl", q.getUnit());
assertNull(q.getSystem());
assertEquals(182, q.getValue().floatValue());
// no comparator passed in
assertNull(q.getComparator());
// Check referenceRange
assertTrue(obs.hasReferenceRange());
assertThat(obs.getReferenceRange()).hasSize(1);
ObservationReferenceRangeComponent range = obs.getReferenceRangeFirstRep();
assertNotNull(range);
assertTrue(range.hasHigh());
assertTrue(range.hasLow());
Quantity high = range.getHigh();
// uses OBX.6.1 for units not text in string
assertEquals("mg/dl", high.getUnit());
assertEquals(105f, high.getValue().floatValue());
Quantity low = range.getLow();
// uses OBX.6.1 for units not text in string
assertEquals("mg/dl", low.getUnit());
assertEquals(70f, low.getValue().floatValue());
assertEquals("70_105", range.getText());
}
use of org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7MedicationRequestFHIRConversionTest method dosageInstructionTestRateQuantityRXO.
@Test
void dosageInstructionTestRateQuantityRXO() {
// Test dosageInstruction.rateQuantity where RXO.21 exists and RXO.17 does not exist -> use RXO segment, no range
String hl7message = "MSH|^~\\\\&|||||20210101000000||OMP^O09|MSGID|T|2.6\n" + "PID|||1234||DOE^JANE^|||F||||||||||||||||||||||\n" + "PV1||||||||||||||||||||||||||||||||||||||||||||\n" + "ORC|OP||||||||||||||||||||||\n" + // RXO.22.3 purposely empty to check that default system is used
"RXO|00054418425^Dexamethasone 4 MG Oral Tablet^NDC||||||||||||||||||||6|PC||||||||\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 rateQuantity = medicationRequest.getDosageInstructionFirstRep().getDoseAndRateFirstRep().getRateQuantity();
// dosageInstruction.doseAndRate.rateQuantity RXO.21
// RXO.21
assertThat(rateQuantity.getValue()).hasToString("6.0");
// RXO.22.1
assertThat(rateQuantity.getUnit()).isEqualTo("PC");
// default
assertThat(rateQuantity.getSystem()).isEqualTo("http://unitsofmeasure.org");
// Verify no extraneous resources
// Expect MedicationRequest, and Patient
assertThat(e).hasSize(2);
}
use of org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7MedicationRequestFHIRConversionTest method dosageInstructionTestRateQuantityRXE.
@Test
void dosageInstructionTestRateQuantityRXE() {
// Test dosageInstruction.rateQuantity where RXE.23 exists and RXE.22 does not exist -> use 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||DUONEB3INH^3 ML PLAS CONT : IPRATROPIUM-ALBUTEROL 0.5-2.5 (3) MG/3ML IN SOLN^ADS|||||||||||||||||||" + // RXE.24.3 purposely empty to check that default system is used
"||7|PC^^http://unitsofmeasure.org||||||||||||||||\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 rateQuantity = medicationRequest.getDosageInstructionFirstRep().getDoseAndRateFirstRep().getRateQuantity();
// dosageInstruction.doseAndRate.rateQuantity RXE.23
// RXO.23
assertThat(rateQuantity.getValue()).hasToString("7.0");
// RXO.24.1
assertThat(rateQuantity.getUnit()).isEqualTo("PC");
// RXO.24.3
assertThat(rateQuantity.getSystem()).isEqualTo("http://unitsofmeasure.org");
// Verify no extraneous resources
// Expect MedicationRequest, and Patient
assertThat(e).hasSize(2);
}
use of org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent 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);
}
Aggregations