use of org.hl7.gravity.refimpl.sdohexchange.sdohmappings.System 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.gravity.refimpl.sdohexchange.sdohmappings.System 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.gravity.refimpl.sdohexchange.sdohmappings.System in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7MedicationRequestFHIRConversionTest method testMedicationRequestReasonCode.
@Test
void testMedicationRequestReasonCode() {
// Reason code from RXO.20, should ignore ORC.16
String hl7message = "MSH|^~\\&||||||S1|PPR^PC1||T|2.6|||||||||\r" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\r" + "PV1||I||||||||||||||||||||||||||||||||||||||||||\r" + "PRB|AD|20141015103243|15777000^Prediabetes (disorder)^SNM|654321^^OtherSoftware.ProblemOID|||||\r" + // ORC.16 purposely present to be ignored because RXO.20 is present
"ORC|NW|||||||||||||||4338008^Wheezing^PRN\r" + "OBR|1|||555|||20170825010500||||||||||||||||||F\r" + // RXO.2 through RXO.35 otherwise purposely empty
"RXO|65862-063-01^METOPROLOL TARTRATE^NDC|||||||||||||||||||134006\r";
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);
assertThat(medicationRequest.getReasonCode()).hasSize(1);
assertThat(medicationRequest.getReasonCodeFirstRep().getCoding()).hasSize(1);
// RXO.20.1
assertThat(medicationRequest.getReasonCodeFirstRep().getCodingFirstRep().getCode()).isEqualTo("134006");
// No RXO.20.2
assertThat(medicationRequest.getReasonCodeFirstRep().getCodingFirstRep().getDisplay()).isNull();
// No RXO.20.3
assertThat(medicationRequest.getReasonCodeFirstRep().getCodingFirstRep().getSystem()).isNull();
// Reason code from RXE.27. Ignores ORC.16.
hl7message = "MSH|^~\\&||||||S1|RDE^O11||T|2.6|||||||||\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + // ORC.16 purposely present to be ignored because RXE.27 is present
"ORC|NW|||||||||||||||4338008^Wheezing^PRN\n" + // RXE.6 through RXE.44 otherwise purposely empty
"RXE|^Q24H&0600^^20210330144208^^ROU|DUONEB3INH^3 ML PLAS CONT : IPRATROPIUM-ALBUTEROL 0.5-2.5 (3) MG/3ML IN SOLN^ADS|3||mL||||||||||||||||||||||Wheezing^Wheezing^PRN|||||||||||||\r";
e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
medicationRequestList = ResourceUtils.getResourceList(e, ResourceType.MedicationRequest);
assertThat(medicationRequestList).hasSize(1);
medicationRequest = ResourceUtils.getResourceMedicationRequest(medicationRequestList.get(0), ResourceUtils.context);
assertThat(medicationRequest.getReasonCode()).hasSize(1);
assertThat(medicationRequest.getReasonCodeFirstRep().getCoding()).hasSize(1);
// RXE.27
assertThat(medicationRequest.getReasonCodeFirstRep().getCodingFirstRep().getCode()).isEqualTo("Wheezing");
// RXE.27
assertThat(medicationRequest.getReasonCodeFirstRep().getCodingFirstRep().getDisplay()).isEqualTo("Wheezing");
// RXE.27
assertThat(medicationRequest.getReasonCodeFirstRep().getCodingFirstRep().getSystem()).isEqualTo("urn:id:PRN");
// Reason code from ORC.16 (when RXE.27 is not present)
hl7message = "MSH|^~\\&||||||S1|RDE^O11||T|2.6|||||||||\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + // ORC.16 to reason code
"ORC|NW|||||||||||||||4338008^Wheezing^PRN\n" + // RXE.6 through RXE.44 purposely empty
"RXE|^Q24H&0600^^20210330144208^^ROU|DUONEB3INH^3 ML PLAS CONT : IPRATROPIUM-ALBUTEROL 0.5-2.5 (3) MG/3ML IN SOLN^ADS|3||mL|||||||||||||||||||||||||||||||||||\n";
e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
medicationRequestList = ResourceUtils.getResourceList(e, ResourceType.MedicationRequest);
assertThat(medicationRequestList).hasSize(1);
medicationRequest = ResourceUtils.getResourceMedicationRequest(medicationRequestList.get(0), ResourceUtils.context);
assertThat(medicationRequest.getReasonCode()).hasSize(1);
assertThat(medicationRequest.getReasonCodeFirstRep().getCoding()).hasSize(1);
// ORC.16.1
assertThat(medicationRequest.getReasonCodeFirstRep().getCodingFirstRep().getCode()).isEqualTo("4338008");
// ORC.16.2
assertThat(medicationRequest.getReasonCodeFirstRep().getCodingFirstRep().getDisplay()).isEqualTo("Wheezing");
// ORC.16.3 (unknown system)
assertThat(medicationRequest.getReasonCodeFirstRep().getCodingFirstRep().getSystem()).isEqualTo("urn:id:PRN");
}
use of org.hl7.gravity.refimpl.sdohexchange.sdohmappings.System in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7IdentifierFHIRConversionTest method medicationRequestIdentifierTest3.
@Test
void medicationRequestIdentifierTest3() throws IOException {
// Test: Visit number from MSH-7, extID from RXE-2
String medicationRequest = "MSH|^~\\&|PROSLOV|MYHOSPITAL|WHIA|IBM|20170215080000||OMP^O09|MSGID005520|T|2.6|||AL|NE|764|ASCII||||||^4086::132:2A57:3C28^IPv6\r" + "PID|1||000054321^^^MRN\r" + "PV1||I||||||||SUR||||||||S||A|||||||||||||||||||SF|K||||20170215080000\r" + "ORC|NW||CD2017071101^RX|||E|10^BID^D4^^^R||20170215080000\r" + "RXO|^DOCUSATE SODIUM 100 MG CAPSULE|100||mg|||||G||10||5|\r";
MedicationRequest medReq = ResourceUtils.getMedicationRequest(ftv, medicationRequest);
// Expect 3 identifiers
assertThat(medReq.hasIdentifier()).isTrue();
assertThat(medReq.getIdentifier()).hasSize(3);
List<Identifier> identifiers = medReq.getIdentifier();
// Match the id's to position; we can't depend on an order.
int posVN = getIdentifierPositionByValue("20170215080000", identifiers);
assertThat(posVN).isNotSameAs(-1);
int posExtId = getIdentifierPositionByValue("DOCUSATE SODIUM 100 MG CAPSULE", identifiers);
assertThat(posExtId).isNotSameAs(-1);
int posRX = getIdentifierPositionByValue("CD2017071101", identifiers);
assertThat(posRX).isNotSameAs(-1);
// Identifier 1: Visit number
Identifier identifier = medReq.getIdentifier().get(posVN);
String value = identifier.getValue();
String system = identifier.getSystem();
// MSH-7
assertThat(value).isEqualTo("20170215080000");
assertThat(system).isNull();
CodeableConcept type = identifier.getType();
DatatypeUtils.checkCommonCodeableConceptAssertions(type, "VN", "Visit number", "http://terminology.hl7.org/CodeSystem/v2-0203", null);
// Identifier 2: extID based on RXO-1.2
identifier = medReq.getIdentifier().get(posExtId);
value = identifier.getValue();
system = identifier.getSystem();
// RXO-1.2
assertThat(value).isEqualTo("DOCUSATE SODIUM 100 MG CAPSULE");
assertThat(system).isEqualTo("urn:id:extID");
// Identifier 3: RX
identifier = medReq.getIdentifier().get(posRX);
value = identifier.getValue();
system = identifier.getSystem();
// ORC.3.1
assertThat(value).isEqualTo("CD2017071101");
// ORC-3.2 any whitespace gets replaced with underscores
assertThat(system).isEqualTo("urn:id:RX");
type = identifier.getType();
DatatypeUtils.checkCommonCodeableConceptAssertions(type, "FILL", "Filler Identifier", "http://terminology.hl7.org/CodeSystem/v2-0203", null);
}
use of org.hl7.gravity.refimpl.sdohexchange.sdohmappings.System in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7IdentifierFHIRConversionTest method conditionDg1IdentifierTest3.
@Test
void conditionDg1IdentifierTest3() {
String withDG132 = "MSH|^~\\&|||||201610015080000||ADT^A01^ADT_A01|64322|P|2.6|123|456|ER|AL|USA|ASCII|en|2.6||||||\r" + "PID|||10290^^^WEST^MR||||20040530|M||||||||||||||||||||||N\n" + "PV1||I||||||||SUR||||||||S||A|||||||||||||||||||SF|K||||20170215080000\n" + "DG1|1|ICD10|^Ovarian Cancer|Test|20210322154449|A|E123|R45|Y|J76|C|15|1458.98||1|123^DOE^JOHN^A^|C|Y|20210322154326||S1234|Parent Diagnosis|Value345|Group567|DiagnosisG45|Y\r";
Condition condition = ResourceUtils.getCondition(ftv, withDG132);
// Expect 2 identifiers
assertThat(condition.hasIdentifier()).isTrue();
assertThat(condition.getIdentifier()).hasSize(2);
List<Identifier> identifiers = condition.getIdentifier();
// Match the id's to position; we can't depend on an order.
int posVN = getIdentifierPositionByValue("201610015080000", identifiers);
assertThat(posVN).isNotSameAs(-1);
int posExtId = getIdentifierPositionByValue("Ovarian Cancer", identifiers);
assertThat(posExtId).isNotSameAs(-1);
// Identifier 1: Visit number
Identifier identifier = condition.getIdentifier().get(posVN);
String value = identifier.getValue();
String system = identifier.getSystem();
// MSH.7
assertThat(value).isEqualTo("201610015080000");
assertThat(system).isNull();
CodeableConcept type = identifier.getType();
DatatypeUtils.checkCommonCodeableConceptAssertions(type, "VN", "Visit number", "http://terminology.hl7.org/CodeSystem/v2-0203", null);
// Identifier 3: DG1.3.2
identifier = condition.getIdentifier().get(posExtId);
value = identifier.getValue();
system = identifier.getSystem();
// DG1.3.2
assertThat(value).isEqualTo("Ovarian Cancer");
assertThat(system).isEqualTo("urn:id:extID");
}
Aggregations