use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7ImmunizationFHIRConversionTest method testImmunizationReasonImmune.
@Test
void testImmunizationReasonImmune() throws IOException {
// Status reason is IMMUNE when OBX.3 is 59784-9, and RXA.18 and RXA.20 not provided
String hl7VUXmessageRep = "MSH|^~\\&|EHR|12345^SiteName|MIIS|99990|20140701041038||VXU^V04^VXU_V04|MSG.Valid_01|P|2.6|||\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\r" + "ORC|||197027|||||||^Clerk^Myron|||||||RI2050\r" + "RXA|0|1|20130531||48^HIB PRP-T^CVX\r" + "OBX|1|CE|59784-9^Disease with presumed immunity^LN|1|V02^VFC eligible Medicaid/MedicaidManaged Care^HL70064\r";
Immunization immunization = ResourceUtils.getImmunization(ftv, hl7VUXmessageRep);
// Status defaults to completed
assertThat(immunization.getStatus().getDisplay()).isEqualTo("completed");
assertThat(immunization.hasStatusReason()).isTrue();
assertThat(immunization.getStatusReason().getCoding()).hasSize(2);
// From OBX.3==59784-9
assertThat(immunization.getStatusReason().getCoding().get(0).getCode()).isEqualTo("IMMUNE");
assertThat(immunization.getStatusReason().getCoding().get(0).getSystem()).isEqualTo("http://terminology.hl7.org/CodeSystem/v3-ActReason");
assertThat(immunization.getStatusReason().getCoding().get(0).getDisplay()).isEqualTo("immunity");
assertThat(immunization.getStatusReason().getCoding().get(1).getCode()).isEqualTo("59784-9");
assertThat(immunization.getStatusReason().getCoding().get(1).getSystem()).isEqualTo("http://loinc.org");
assertThat(immunization.getStatusReason().getCoding().get(1).getDisplay()).isEqualTo("Disease with presumed immunity");
assertThat(immunization.getStatusReason().getText()).isEqualTo("Disease with presumed immunity");
}
use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7ImmunizationFHIRConversionTest method testImmunizationAdministrationPlaceOrg3.
@Test
// Third test of priority of Immunization Performer sourcing.
void testImmunizationAdministrationPlaceOrg3() throws IOException {
String hl7VUXmessageRep = "MSH|^~\\&|||||20140701041038||VXU^V04^VXU_V04|MSG.Valid_01|P|2.6|||\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\r" + // PV1 purposely missing
"ORC|||197027|||||||^Clerk^Myron|||||||RI2050\r" + // RXA.11.4 present and takes priority because there is no RXA.27 nor PV1.3.4
"RXA|0|1|20130531||48^HIB PRP-T^CVX||||||^^^PlaceRXA11|||||||||||||||" + "OBX|1|CE|59784-9^Disease with presumed immunity^LN||\r";
// TENANT prepend is passed through the options.
ConverterOptions customOptionsWithTenant = new Builder().withValidateResource().withPrettyPrint().withProperty("TENANT", "TenantId").build();
List<BundleEntryComponent> e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7VUXmessageRep, customOptionsWithTenant);
// We expect two different organizations, one for Encounter.serviceProvider, one for Immunization.performer
List<Resource> organizations = ResourceUtils.getResourceList(e, ResourceType.Organization);
assertThat(organizations).hasSize(1);
Organization org = (Organization) organizations.get(0);
String orgId = org.getId();
// RXA.11.4 + tenantid
assertThat(orgId).isEqualTo("Organization/tenantid.placerxa11");
List<Resource> immunizations = ResourceUtils.getResourceList(e, ResourceType.Immunization);
assertThat(immunizations).hasSize(1);
Immunization imm = (Immunization) immunizations.get(0);
// RXA.11.4
assertThat(imm.getPerformer()).hasSize(1);
// RXA.11.4 + tenantid
assertThat(imm.getPerformerFirstRep().getActor().getReference()).isEqualTo(orgId);
List<Resource> encounters = ResourceUtils.getResourceList(e, ResourceType.Encounter);
assertThat(encounters).isEmpty();
// Check for expected resources: Organization, Immunization, Patient
assertThat(e).hasSize(3);
}
use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7ImmunizationFHIRConversionTest method testImmunizationUsePATOBJ.
@Test
void testImmunizationUsePATOBJ() throws IOException {
// Test should only return RXA.10, ORC.12 is empty
// If RXA.20 is RE but RXA.18 is blank then we use PATOBJ from v3ActReason
String hl7VUXmessageRep = "MSH|^~\\&|EHR|12345^SiteName|MIIS|99990|20140701041038||VXU^V04^VXU_V04|MSG.Valid_01|P|2.6|||\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\r" + "ORC|RE||197027||PA|||||^Clerk^Myron|||||||RI2050\r" + "RXA|||20130531||48^HIB PRP-T^CVX|0.5|ML^^UCUM||||||||||||00^refusal|RE\r" + "OBX|1|CWE|30963-3^ VACCINE FUNDING SOURCE^LN|1|V02^VFC eligible Medicaid/MedicaidManaged Care^HL70064\r";
Immunization immunization = ResourceUtils.getImmunization(ftv, hl7VUXmessageRep);
assertThat(immunization.hasReasonCode()).isTrue();
assertThat(immunization.getReasonCodeFirstRep().getCodingFirstRep().getCode()).isEqualTo("00");
assertThat(immunization.getReasonCodeFirstRep().getCodingFirstRep().getDisplay()).isEqualTo("refusal");
assertThat(immunization.getReasonCodeFirstRep().getCodingFirstRep().getSystem()).isNull();
assertThat(immunization.getReasonCodeFirstRep().getText()).isEqualTo("refusal");
assertThat(immunization.getStatus().getDisplay()).isEqualTo("not-done");
assertThat(immunization.hasStatusReason()).isTrue();
// If RXA.20 is RE but RXA.18 is blank then we use PATOBJ from v3ActReason
assertThat(immunization.getStatusReason().getCodingFirstRep().getCode()).isEqualTo("PATOBJ");
assertThat(immunization.getStatusReason().getCodingFirstRep().getSystem()).isEqualTo("http://terminology.hl7.org/CodeSystem/v3-ActReason");
assertThat(immunization.getStatusReason().getCodingFirstRep().getDisplay()).isEqualTo("Patient Refusal");
// dose Quantity with a known system
assertThat(immunization.hasDoseQuantity()).isTrue();
assertThat(immunization.getDoseQuantity().getValue()).hasToString("0.5");
assertThat(immunization.getDoseQuantity().getUnit()).isEqualTo("ML");
assertThat(immunization.getDoseQuantity().getSystem()).isEqualTo("http://unitsofmeasure.org");
// If OBX.3 is 30963-3 the OBX.5 is for funding source
DatatypeUtils.checkCommonCodeableConceptAssertions(immunization.getFundingSource(), "V02", "VFC eligible Medicaid/MedicaidManaged Care", "https://phinvads.cdc.gov/vads/ViewCodeSystem.action?id=2.16.840.1.113883.12.64#", "VFC eligible Medicaid/MedicaidManaged Care");
assertThat(immunization.hasProgramEligibility()).isFalse();
assertThat(immunization.hasReaction()).isFalse();
}
use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7ImmunizationFHIRConversionTest method testImmunizationReturnOnlyRXA10.
@Test
void testImmunizationReturnOnlyRXA10() throws IOException {
// Test should only return RXA.10, ORC.12 is empty
// ORC.9 (Backup for RXA.22) has recorded date
// RXA.18 is not empty which signals that the status is not-done. ORC.5 is here to show precedence
// Since status is "not-done" we show the Status reason (RXA.18)
String hl7VUXmessageRep = "MSH|^~\\&|EHR|12345^SiteName|MIIS|99990|20140701041038||VXU^V04^VXU_V04|MSG.Valid_01|P|2.6|||\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\r" + "ORC|RE||197027||CP||||20120901041038|^Clerk^Myron|||||||\r" + "RXA|||20130531||48^HIB PRP-T^CVX|0.5|ML^^^|||^Sticker^Nurse||||||||00^Patient refusal^NIP002|||\r" + "OBX|1|CWE|64994-7^vaccine fund pgm elig cat^LN|1|V02^VFC eligible Medicaid/MedicaidManaged Care^HL70064\r";
Immunization immunization = ResourceUtils.getImmunization(ftv, hl7VUXmessageRep);
assertThat(immunization.getPerformer()).hasSize(1);
DatatypeUtils.checkCommonCodingAssertions(immunization.getPerformer().get(0).getFunction().getCodingFirstRep(), "AP", "Administering Provider", "http://terminology.hl7.org/CodeSystem/v2-0443", // RXA.10
null);
assertThat(immunization.getPerformer().get(0).getFunction().hasText()).isFalse();
// RXA.18 is not empty which signals that the status is not-done. ORC.5 is here to show precedence
assertThat(immunization.getStatus().getDisplay()).isEqualTo("not-done");
// if status is "not-done" we show the Status reason
assertThat(immunization.hasStatusReason()).isTrue();
assertThat(immunization.getStatusReason().getCodingFirstRep().getCode()).isEqualTo("00");
assertThat(immunization.getStatusReason().getCodingFirstRep().getSystem()).isEqualTo("urn:id:NIP002");
assertThat(immunization.getStatusReason().getCodingFirstRep().getDisplay()).isEqualTo("Patient refusal");
// ORC.9
assertThat(immunization.hasRecorded()).isTrue();
// ORC.9
assertThat(immunization.getRecordedElement().toString()).contains("2012-09-01");
// dose Quantity without a system
assertThat(immunization.hasDoseQuantity()).isTrue();
assertThat(immunization.getDoseQuantity().getValue()).hasToString("0.5");
assertThat(immunization.getDoseQuantity().getUnit()).isEqualTo("ML");
assertThat(immunization.getDoseQuantity().getSystem()).isNull();
assertThat(immunization.getDoseQuantity().getCode()).isNull();
DatatypeUtils.checkCommonCodeableConceptAssertions(immunization.getProgramEligibilityFirstRep(), "V02", "VFC eligible Medicaid/MedicaidManaged Care", "https://phinvads.cdc.gov/vads/ViewCodeSystem.action?id=2.16.840.1.113883.12.64#", "VFC eligible Medicaid/MedicaidManaged Care");
assertThat(immunization.hasFundingSource()).isFalse();
assertThat(immunization.hasReaction()).isFalse();
}
use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7ImmunizationFHIRConversionTest method testImmunizationDefaultCompletedMEDPRECStatusReason.
@Test
void testImmunizationDefaultCompletedMEDPRECStatusReason() throws IOException {
// Status defaults to completed RXA.20, RXA.18 and ORC.5 are empty
// Status reason is MEDPREC when OBX.3 is 30945-0 RXA.18 and RXA.20 not provided
String hl7VUXmessageRep = "MSH|^~\\&|MYEHR2.5|RI88140101|KIDSNET_IFL|RIHEALTH|20130531||VXU^V04^VXU_V04|20130531RI881401010105|P|2.5.1|||NE|AL||||||RI543763\r" + "PID|1||12345^^^^MR||TestPatient^Jane^^^^^L||||||\r" + "ORC|||197027|||||||^Clerk^Myron|||||||RI2050\r" + "RXA|0|1|20130531||48^HIB PRP-T^CVX|999|||1|\r" + "OBX|1|CE|30945-0^contraindication^LN|1|V02^VFC eligible Medicaid/MedicaidManaged Care^HL70064||||||F||||||\r";
Immunization immunization = ResourceUtils.getImmunization(ftv, hl7VUXmessageRep);
// Status defaults to completed
assertThat(immunization.getStatus().getDisplay()).isEqualTo("completed");
assertThat(immunization.hasStatusReason()).isTrue();
assertThat(immunization.getStatusReason().getCoding()).hasSize(2);
assertThat(immunization.getStatusReason().getCoding().get(0).getCode()).isEqualTo("MEDPREC");
assertThat(immunization.getStatusReason().getCoding().get(0).getSystem()).isEqualTo("http://terminology.hl7.org/CodeSystem/v3-ActReason");
assertThat(immunization.getStatusReason().getCoding().get(0).getDisplay()).isEqualTo("medical precaution");
assertThat(immunization.getStatusReason().getCoding().get(1).getCode()).isEqualTo("30945-0");
assertThat(immunization.getStatusReason().getCoding().get(1).getSystem()).isEqualTo("http://loinc.org");
assertThat(immunization.getStatusReason().getCoding().get(1).getDisplay()).isEqualTo("contraindication");
assertThat(immunization.getStatusReason().getText()).isEqualTo("contraindication");
}
Aggregations