use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR in project cqf-ruler by DBCG.
the class SubmitDataProviderIT method testSubmitData.
@Test
public void testSubmitData() {
// Create a MR and a resource
MeasureReport mr = newResource(MeasureReport.class, "test-mr");
Observation obs = newResource(Observation.class, "test-obs");
// Submit it
mySubmitDataProvider.submitData(new SystemRequestDetails(), new IdType("Measure", "test-m"), mr, Lists.newArrayList(obs));
// Check if they made it to the db
Observation savedObs = read(obs.getIdElement());
assertNotNull(savedObs);
MeasureReport savedMr = read(mr.getIdElement());
assertNotNull(savedMr);
}
use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR in project cqf-ruler by DBCG.
the class SubmitDataProviderIT method testSubmitDataNoId.
@Test
public void testSubmitDataNoId() {
// Create a MR and a resource
MeasureReport mr = newResource(MeasureReport.class).setMeasure("Measure/123");
Observation obs = newResource(Observation.class).setValue(new StringType("ABC"));
// Submit it
mySubmitDataProvider.submitData(new SystemRequestDetails(), new IdType("Measure", "123"), mr, Lists.newArrayList(obs));
// Check if they made it to the db
Observation savedObs = search(Observation.class, Searches.all()).single();
assertNotNull(savedObs);
assertEquals("ABC", savedObs.getValue().primitiveValue());
MeasureReport savedMr = search(MeasureReport.class, Searches.all()).single();
assertNotNull(savedMr);
assertEquals("Measure/123", savedMr.getMeasure());
}
use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR in project hl7v2-fhir-converter by LinuxForHealth.
the class FHIRConverterTest method test_dosage_output.
@Test
void test_dosage_output() throws IOException {
String hl7message = "MSH|^~\\&|MyEMR|DE-000001| |CAIRLO|20160701123030-0700||VXU^V04^VXU_V04|CA0001|P|2.6|||ER|AL|||||Z22^CDCPHINVS|DE-000001\r" + "PID|1||PA123456^^^MYEMR^MR||JONES^GEORGE^M^JR^^^L|MILLER^MARTHA^G^^^^M|20140227|M||2106-3^WHITE^CDCREC|1234 W FIRST ST^^BEVERLY HILLS^CA^90210^^H||^PRN^PH^^^555^5555555||ENG^English^HL70296|||||||2186-5^ not Hispanic or Latino^CDCREC||Y|2\r" + "ORC|RE||197023^CMC|||||||^Clark^Dave||1234567890^Smith^Janet^^^^^^NPPES^L^^^NPI^^^^^^^^MD\r" + "RXA|0|1|20140730||08^HEPB-PEDIATRIC/ADOLESCENT^CVX|.5|mL^mL^UCUM||00^NEW IMMUNIZATION RECORD^NIP001|1234567890^Smith^Janet^^^^^^NPPES^^^^NPI^^^^^^^^MD |^^^DE-000001||||0039F|20200531|MSD^MERCK^MVX|||CP|A";
String json = ftv.convert(hl7message, OPTIONS);
FHIRContext context = new FHIRContext();
IBaseResource bundleResource = context.getParser().parseResource(json);
assertThat(bundleResource).isNotNull();
Bundle b = (Bundle) bundleResource;
List<BundleEntryComponent> e = b.getEntry();
List<Resource> immunization = e.stream().filter(v -> ResourceType.Immunization == v.getResource().getResourceType()).map(BundleEntryComponent::getResource).collect(Collectors.toList());
assertThat(immunization).hasSize(1);
String s = context.getParser().encodeResourceToString(immunization.get(0));
Class<? extends IBaseResource> klass = Immunization.class;
Immunization expectDoseQuantity = (Immunization) context.getParser().parseResource(klass, s);
assertThat(expectDoseQuantity.hasDoseQuantity()).isTrue();
Quantity dosage = expectDoseQuantity.getDoseQuantity();
BigDecimal value = dosage.getValue();
String unit = dosage.getUnit();
assertThat(value).isEqualTo(BigDecimal.valueOf(.5));
assertThat(unit).isEqualTo("mL");
}
use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR in project hl7v2-fhir-converter by LinuxForHealth.
the class MedicationFHIRConverterTest method practitonerCreatedForRXA.
// Tests that we create a practitioner from the RXA segment in hl7 message.
// This uses the Performer resource (specifically actor)
@Test
void practitonerCreatedForRXA() {
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" + "NK1|1|mother^patient|MTH^Mother^HL70063|5 elm st^^boston^MA^01234^^P|781-999-9999^PRN^PH^^1^781^9999999|||||||||||||||||01^No reminder/recall^HL70215\r" + "PV1|1|R||||||||||||||||||V01^20120901041038\r" + "IN1|1||8|Aetna Inc\r" + "ORC|RE||4242546^NameSpaceID||||||||||||||\r" + "RXA|0|1|20140701041038|20140701041038|48^HPV, quadrivalent^CVX|0.5|ml^MilliLiter [SI Volume Units]^UCUM||00^New Immunization^NIP001|NPI001^LastName^ClinicianFirstName^^^^Title^^AssigningAuthority|14509||||L987||MSD^Merck^MVX|||CP||20120901041038\r" + "RXR|C28161^Intramuscular^NCIT|LA^Leftarm^HL70163\r" + "OBX|1|CE|30963-3^ VACCINE FUNDING SOURCE^LN|1|VXC2^STATE FUNDS^HL70396||||||F|||20120901041038\r" + "OBX|2|CE|64994-7^Vaccine funding program eligibility category^LN|1|V01^Not VFC^HL70064||||||F|||20140701041038\r" + "OBX|3|TS|29768-9^DATE VACCINE INFORMATION STATEMENT PUBLISHED^LN|1|20010711||||||F|||20120720101321\r" + "OBX|4|TS|29769-7^DATE VACCINE INFORMATION STATEMENT PRESENTED^LN|1|19901207||||||F|||20140701041038\r";
List<BundleEntryComponent> e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
// Find the practitioner from the FHIR bundle.
List<Resource> practitionerResource = e.stream().filter(v -> ResourceType.Practitioner == v.getResource().getResourceType()).map(BundleEntryComponent::getResource).collect(Collectors.toList());
// Verify we have one practitioner
assertThat(practitionerResource).hasSize(1);
// Get practitioner Resource
Resource practitioner = practitionerResource.get(0);
// Verify name text, family, and given are set correctly.
Base name = ResourceUtils.getValue(practitioner, "name");
assertThat(ResourceUtils.getValueAsString(name, "text")).isEqualTo("ClinicianFirstName LastName");
assertThat(ResourceUtils.getValueAsString(name, "family")).isEqualTo("LastName");
assertThat(ResourceUtils.getValueAsString(name, "given")).isEqualTo("ClinicianFirstName");
// Verify asserter identifier is set correctly.
Base identifier = ResourceUtils.getValue(practitioner, "identifier");
assertThat(ResourceUtils.getValueAsString(identifier, "value")).isEqualTo("NPI001");
}
use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR in project hl7v2-fhir-converter by LinuxForHealth.
the class HL7OMLMessageTest method testOMLO21MinimumMessageWithOrderWithoutObservation.
@Test
@Disabled
public // Note that even though the HL7 message definition does not require PID, it is necessary so that the resulting FHIR ServiceRequests pass FHIR validation.
void testOMLO21MinimumMessageWithOrderWithoutObservation() 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";
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> serviceResource = ResourceUtils.getResourceList(e, ResourceType.ServiceRequest);
// from ORC
assertThat(serviceResource).hasSize(1);
// Confirm that there are no extra resources
assertThat(e.size()).isEqualTo(2);
}
Aggregations