use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7VXUMessageTest method test_VXU_with_minimum_patient_group_plus_multiple_order_groups.
// Suppress warnings about too many assertions in a test. Justification: creating a FHIR message is very costly; we need to check many asserts per creation for efficiency.
@java.lang.SuppressWarnings("squid:S5961")
@Test
void test_VXU_with_minimum_patient_group_plus_multiple_order_groups() throws IOException {
String hl7message = "MSH|^~\\&|EHR|12345^SiteName|MIIS|99990|20140701041038||VXU^V04^VXU_V04|MSG.Valid_01|P|2.6|||\r" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\r" + "PV1|1|R||||||||||||||||||V01^20120901041038\r" + "ORC|RE||4242546^NameSpaceID||||||||||||||\r" + "RXA|0|1|20140701041038|20140701041038|48^HPV, quadrivalent^CVX|0.5|ml^MilliLiter [SI Volume Units]^UCUM||||14509|||||||||CP||\r" + "OBX|1|CWE|31044-1^Immunization reaction^LN|1|VXC12^fever of >40.5C within 48 hrs.^CDCPHINVS||||||F|||20120901041038\r" + "OBX|2|CWE|31044-1^Immunization reaction^LN|1|VXC14^Rash within 14 days of dose^CDCPHINVS||||||F|||20140701041038\r" + "ORC|RE||4242546^NameSpaceID||||||||||||||\r" + "RXA|0|1|20140701041038|20140701041038|48^HPV, quadrivalent^CVX|0.5|ml^MilliLiter [SI Volume Units]^UCUM||||14509|||||||||CP||\r" + "RXR|C28161^Intramuscular^NCIT||||\r" + "OBX|1|CWE|31044-1^Immunization reaction^LN|1|39579001^Anaphylaxis (disorder)^SCT||||||F|||20120901041038\r" + "OBX|2|TS|29768-9^DATE VACCINE INFORMATION STATEMENT PUBLISHED^LN|1|20010711||||||F|||20120720101321\r";
List<Bundle.BundleEntryComponent> e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
// Validate that the correct resources are created
List<Resource> patient = ResourceUtils.getResourceList(e, ResourceType.Patient);
assertThat(patient).hasSize(1);
List<Resource> enc = ResourceUtils.getResourceList(e, ResourceType.Encounter);
assertThat(enc).hasSize(1);
List<Resource> immu = ResourceUtils.getResourceList(e, ResourceType.Immunization);
assertThat(immu).hasSize(2);
List<Resource> obs = ResourceUtils.getResourceList(e, ResourceType.Observation);
assertThat(obs).hasSize(3);
// verify that the correct Observations are associated with the correct Immunizations.
// The first two reaction details come from the first immunization resource.
// Too confirm both observations match we compare the IDs of the reaction detail and the actual observation resource id
// The first two sets of assertions are from the first RXA segment
Immunization resource = ResourceUtils.getResourceImmunization(immu.get(0), ResourceUtils.context);
List<Resource> observations = ResourceUtils.getResourceList(e, ResourceType.Observation);
String reactionDetail = resource.getReactionFirstRep().getDetail().getReference();
Observation obsResource = ResourceUtils.getResourceObservation(observations.get(0), ResourceUtils.context);
assertThat(obsResource.getId()).isEqualTo(reactionDetail);
assertThat(obsResource.getCode().getCodingFirstRep().getDisplay()).isEqualTo("fever of >40.5C within 48 hrs.");
assertThat(obsResource.getCode().getCodingFirstRep().getCode()).isEqualTo("VXC12");
assertThat(obsResource.getCode().getCodingFirstRep().getSystem()).isEqualTo("urn:id:CDCPHINVS");
assertThat(obsResource.getCode().getText()).isEqualTo("fever of >40.5C within 48 hrs.");
assertThat(obsResource.getIdentifierFirstRep().getValue()).isEqualTo("4242546-VXC12-CDCPHINVS");
// Expecting only the above resources, no extras!
assertThat(obsResource.getIdentifierFirstRep().getSystem()).isEqualTo("urn:id:extID");
reactionDetail = resource.getReaction().get(1).getDetail().getReference();
obsResource = ResourceUtils.getResourceObservation(observations.get(1), ResourceUtils.context);
assertThat(obsResource.getId()).isEqualTo(reactionDetail);
assertThat(obsResource.getCode().getCodingFirstRep().getDisplay()).isEqualTo("Rash within 14 days of dose");
assertThat(obsResource.getCode().getCodingFirstRep().getCode()).isEqualTo("VXC14");
assertThat(obsResource.getCode().getCodingFirstRep().getSystem()).isEqualTo("urn:id:CDCPHINVS");
assertThat(obsResource.getCode().getText()).isEqualTo("Rash within 14 days of dose");
assertThat(obsResource.getIdentifierFirstRep().getValue()).isEqualTo("4242546-VXC14-CDCPHINVS");
assertThat(obsResource.getIdentifierFirstRep().getSystem()).isEqualTo("urn:id:extID");
assertThat(e).hasSize(7);
// The second set of assertions are from the second RXA segment
resource = ResourceUtils.getResourceImmunization(immu.get(1), ResourceUtils.context);
reactionDetail = resource.getReaction().get(0).getDetail().getReference();
obsResource = ResourceUtils.getResourceObservation(observations.get(2), ResourceUtils.context);
assertThat(obsResource.getId()).isEqualTo(reactionDetail);
assertThat(obsResource.getCode().getCodingFirstRep().getDisplay()).isEqualTo("Anaphylaxis (disorder)");
assertThat(obsResource.getCode().getCodingFirstRep().getCode()).isEqualTo("39579001");
assertThat(obsResource.getCode().getCodingFirstRep().getSystem()).isEqualTo("http://snomed.info/sct");
assertThat(obsResource.getCode().getText()).isEqualTo("Anaphylaxis (disorder)");
assertThat(obsResource.getIdentifierFirstRep().getValue()).isEqualTo("4242546-39579001-SCT");
assertThat(obsResource.getIdentifierFirstRep().getSystem()).isEqualTo("urn:id:extID");
}
use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR in project hl7v2-fhir-converter by LinuxForHealth.
the class HL7OMLMessageTest method testOMLO21WithAllergy.
@Test
public void testOMLO21WithAllergy() throws IOException {
String hl7message = "MSH|^~\\&||Test System|||20210917110100||OML^O21^OML_O21|||2.6\r" + "PID|1||7659afb9-0dfc-d744-1f40-5b9314807108^^^^MR||Feeney^Sam^^^^^L|||M||||||||\r" + "AL1|1|DRUG|00000741^OXYCODONE||HYPOTENSION\r" + "AL1|2|DRUG|00001433^TRAMADOL||SEIZURES~VOMITING\r" + "ORC|NW|8125550e-04db-11ec-a9a8-086d41d421ca^^ID^UUID||||||||||\r" + "OBR|1|8125550e-04db-11ec-a9a8-086d41d421ca^^ID^UUID||58410-2^CBC panel - Blood by Automated count^LN||||||||||||\r" + "AL1|1|DA|1605^acetaminophen^L|MO|Muscle Pain~hair loss\r";
String json = ftv.convert(hl7message, OPTIONS_PRETTYPRINT);
assertThat(json).isNotBlank();
IBaseResource bundleResource = context.getParser().parseResource(json);
assertThat(bundleResource).isNotNull();
Bundle b = (Bundle) bundleResource;
List<BundleEntryComponent> e = b.getEntry();
List<Resource> patientResource = ResourceUtils.getResourceList(e, ResourceType.Patient);
// from PID
assertThat(patientResource).hasSize(1);
List<Resource> allergyResource = ResourceUtils.getResourceList(e, ResourceType.AllergyIntolerance);
// from AL1
assertThat(allergyResource).hasSize(3);
List<Resource> serviceResource = ResourceUtils.getResourceList(e, ResourceType.ServiceRequest);
// from ORC
assertThat(serviceResource).hasSize(1);
List<Resource> diagnosticresource = ResourceUtils.getResourceList(e, ResourceType.DiagnosticReport);
// from OBR
assertThat(diagnosticresource).hasSize(1);
// Confirm that there are no extra resources
assertThat(e.size()).isEqualTo(6);
}
use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR in project hl7v2-fhir-converter by LinuxForHealth.
the class HL7OMLMessageTest method testOMLO21WithPatientAndOrderWithPriorOrder.
@Test
public void testOMLO21WithPatientAndOrderWithPriorOrder() throws IOException {
String hl7message = "MSH|^~\\&||Test System|||20210917110100||OML^O21^OML_O21|||2.6\r" + "PID|1||7659afb9-0dfc-d744-1f40-5b9314807108^^^^MR||Feeney^Sam^^^^^L|||M||||||||\r" + "ORC|NW|8125550e-04db-11ec-a9a8-086d41d421ca^^ID^UUID|||||||\r" + "OBR|1|8125550e-04db-11ec-a9a8-086d41d421ca^^ID^UUID||58410-2^CBC panel - Blood by Automated count^LN||||||||||||\r" + "DG1|1||A013^Paratyphoid fever C^I10C|||A|||||||||1\r" + "ORC|NW|8125550e-04db-11ec-a9a8-086d41d421cb^^ID^UUID|||||||\r" + "OBR|2|8125550e-04db-11ec-a9a8-086d41d421cb^^ID^UUID||57698-3^Lipid panel with direct LDL - Serum or Plasma^LN||||||||||||\r" + "DG1|1||A001^Cholera due to Vibrio cholerae 01, biovar eltor^I10C|||A|||||||||1\r";
String json = ftv.convert(hl7message, OPTIONS_PRETTYPRINT);
assertThat(json).isNotBlank();
IBaseResource bundleResource = context.getParser().parseResource(json);
assertThat(bundleResource).isNotNull();
Bundle b = (Bundle) bundleResource;
assertThat(b.getType()).isEqualTo(BundleType.COLLECTION);
List<BundleEntryComponent> e = b.getEntry();
List<Resource> patientResource = ResourceUtils.getResourceList(e, ResourceType.Patient);
// from PID
assertThat(patientResource).hasSize(1);
List<Resource> diagnosisResource = ResourceUtils.getResourceList(e, ResourceType.Condition);
// from DG1
assertThat(diagnosisResource).hasSize(2);
List<Resource> serviceResource = ResourceUtils.getResourceList(e, ResourceType.ServiceRequest);
// from ORC
assertThat(serviceResource).hasSize(2);
List<Resource> diagnosticresource = ResourceUtils.getResourceList(e, ResourceType.DiagnosticReport);
// from OBR
assertThat(diagnosticresource).hasSize(2);
DiagnosticReport diag = ResourceUtils.getResourceDiagnosticReport(diagnosticresource.get(0), context);
Reference ref = diag.getSubject();
assertThat(ref.isEmpty()).isFalse();
// Confirm that there are no extra resources
assertThat(e.size()).isEqualTo(7);
}
use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR in project hl7v2-fhir-converter by LinuxForHealth.
the class HL7OMLMessageTest method testOMLO21WithSpecimen.
@Test
public void testOMLO21WithSpecimen() throws IOException {
String hl7message = "MSH|^~\\&||Test System|||20210917110100||OML^O21^OML_O21|||2.6\r" + "PID|1||7659afb9-0dfc-d744-1f40-5b9314807108^^^^MR||Feeney^Sam^^^^^L|||M||||||||\r" + "ORC|NW|8125550e-04db-11ec-a9a8-086d41d421ca^^ID^UUID||||||||||\r" + "OBR|1|8125550e-04db-11ec-a9a8-086d41d421ca^^ID^UUID||58410-2^CBC panel - Blood by Automated count^LN||||||||||||\r" + "SPM|1|SpecimenID||BLD|||||||P||||||201410060535|201410060821||Y||||||1\r";
String json = ftv.convert(hl7message, OPTIONS_PRETTYPRINT);
assertThat(json).isNotBlank();
IBaseResource bundleResource = context.getParser().parseResource(json);
assertThat(bundleResource).isNotNull();
Bundle b = (Bundle) bundleResource;
List<BundleEntryComponent> e = b.getEntry();
List<Resource> patientResource = ResourceUtils.getResourceList(e, ResourceType.Patient);
// from PID
assertThat(patientResource).hasSize(1);
List<Resource> specimenResource = ResourceUtils.getResourceList(e, ResourceType.Specimen);
// from SPM
assertThat(specimenResource).hasSize(1);
List<Resource> serviceResource = ResourceUtils.getResourceList(e, ResourceType.ServiceRequest);
// from ORC
assertThat(serviceResource).hasSize(1);
List<Resource> diagnosticresource = ResourceUtils.getResourceList(e, ResourceType.DiagnosticReport);
// from OBR
assertThat(diagnosticresource).hasSize(1);
// Verify the specimen reference
DiagnosticReport diag = ResourceUtils.getResourceDiagnosticReport(diagnosticresource.get(0), context);
List<Reference> spmRef = diag.getSpecimen();
assertThat(spmRef.isEmpty()).isFalse();
// from SPM
assertThat(spmRef).hasSize(1);
assertThat(spmRef.get(0).isEmpty()).isFalse();
// Confirm that there are no extra resources
assertThat(e.size()).isEqualTo(4);
}
use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR in project hl7v2-fhir-converter by LinuxForHealth.
the class CodeableConceptTest method testSimilarCWEToCodeableConcepts.
@ParameterizedTest
@MethodSource("parmsTestSimilarCWEInputs")
void testSimilarCWEToCodeableConcepts(String cwe, String code, String display, String system, String text) {
// See inputs and test explanation above
String patientWithCodeableConcept = "MSH|^~\\&|MIICEHRApplication|MIIC|MIIC|MIIC|201705130822||VXU^V04^VXU_V04|test1100|P|2.5.1|||AL|AL|||||Z22^CDCPHINVS|^^^^^MIIC^SR^^^MIIC|MIIC\n" + // Test text only race
"PID|1||12345678^^^^MR||TestPatientLastName^Jane^|||||" + cwe + "\n";
Patient patient = PatientUtils.createPatientFromHl7Segment(ftv, patientWithCodeableConcept);
assertThat(patient.hasExtension()).isTrue();
List<Extension> extensions = patient.getExtensionsByUrl(UrlLookup.getExtensionUrl("race"));
assertThat(extensions).isNotNull();
assertThat(extensions.size()).isEqualTo(1);
assertThat(extensions.get(0).hasValue()).isTrue();
CodeableConcept ccW = (CodeableConcept) extensions.get(0).getValue();
DatatypeUtils.checkCommonCodeableConceptAssertions(ccW, code, display, system, text);
}
Aggregations