use of org.hl7.fhir.r4.model.Organization in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7ImmunizationFHIRConversionTest method testImmunizationAdministrationPlaceOrg1.
@Test
// Test priority of Immunization Performer sourcing is tested.
void testImmunizationAdministrationPlaceOrg1() 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.3.4 to Organization referenced by Encounter.serviceProvider; but bypassed for Immunization.performer because RXA.27.4 has priority
"PV1||O|^^^PlacePV1.3.4\r" + "ORC|||197027|||||||^Clerk^Myron|||||||RI2050\r" + // RXA.12 - RXA.26 not used
"RXA|0|1|20130531||48^HIB PRP-T^CVX||||||^^^PlaceRXA11|||||||||||||||" + // RXA.27 to Immunization Performer
"|^^^PlaceRXA274\r" + "OBX|1|CE|59784-9^Disease with presumed immunity^LN||\r";
List<Bundle.BundleEntryComponent> e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7VUXmessageRep);
// We expect two different organizations, one for Encounter.serviceProvider, one for Immunization.performer
List<Resource> organizations = ResourceUtils.getResourceList(e, ResourceType.Organization);
assertThat(organizations).hasSize(2);
Organization org1 = (Organization) organizations.get(0);
Organization org2 = (Organization) organizations.get(1);
// RXA.27.4
String orgId1 = org1.getId();
// RXA.27.4
assertThat(orgId1).isEqualTo("Organization/placerxa274");
// PV1.3.4
String orgId2 = org2.getId();
// PV1.3.4
assertThat(orgId2).isEqualTo("Organization/placepv1.3.4");
List<Resource> immunizations = ResourceUtils.getResourceList(e, ResourceType.Immunization);
assertThat(immunizations).hasSize(1);
Immunization imm = (Immunization) immunizations.get(0);
// RXA.27.4
assertThat(imm.getPerformer()).hasSize(1);
// RXA.27
assertThat(imm.getPerformerFirstRep().getActor().getReference()).isEqualTo(orgId1);
List<Resource> encounters = ResourceUtils.getResourceList(e, ResourceType.Encounter);
assertThat(encounters).hasSize(1);
Encounter enc = (Encounter) encounters.get(0);
// PV1.3.4
assertThat(enc.getServiceProvider().getReference()).isEqualTo(orgId2);
// Check for expected resources: Organizations (2), Immunization, Encounter, Patient
assertThat(e).hasSize(5);
}
use of org.hl7.fhir.r4.model.Organization in project hl7v2-fhir-converter by LinuxForHealth.
the class FHIRConverterTest method testCodingSystems.
@Test
/*
* This tests some of coding systems of interest or potential problems
*/
void testCodingSystems() throws FHIRException {
String hl7VUXmessageRep = "MSH|^~\\&|MYEHR2.5|RI88140101|KIDSNET_IFL|RIHEALTH|201305330||VXU^V04^VXU_V04|20130531RI881401010105|P|2.6|||AL|NE|764|ASCII||||||^4086::132:2A57:3C28^IPv6\r" + "EVN|A01|20130617154644||01\r" + "PID|1||12345678^^^MYEMR^MR||TestPatient^John|||M|\r" + "ORC|RE||197027|||||||^Clerk^Myron||MD67895^Pediatric^MARY^^^^MD^^RIA|||||RI2050\r" + // Test MVX
"RXA|0|1|20130528|20130529|48^HIB PRP-T^CVX|0.5|ML^^ISO+||00^new immunization record^NIP001|^Sticker^Nurse|^^^RI2050||||33k2a|20131210|PMC^sanofi^MVX|||CP|A\r" + // Test HL70162 & HL70163
"RXR|C28161^IM^NCIT^IM^INTRAMUSCULAR^HL70162|RT^right thigh^HL70163\r";
String json = ftv.convert(hl7VUXmessageRep, OPTIONS);
FHIRContext context = new FHIRContext();
IBaseResource bundleResource = context.getParser().parseResource(json);
assertThat(bundleResource).isNotNull();
Bundle b = (Bundle) bundleResource;
assertThat(b.getType()).isEqualTo(BundleType.COLLECTION);
assertThat(b.getId()).isNotNull();
List<BundleEntryComponent> e = b.getEntry();
List<Resource> obsResource = e.stream().filter(v -> ResourceType.Immunization == v.getResource().getResourceType()).map(BundleEntryComponent::getResource).collect(Collectors.toList());
assertThat(obsResource).hasSize(1);
Immunization immunization = (Immunization) obsResource.get(0);
// Check that organization identifier (MVX) has a system
Organization org = (Organization) immunization.getManufacturer().getResource();
List<Identifier> li = org.getIdentifier();
Identifier ident = li.get(0);
assertThat(ident.hasSystem()).isTrue();
assertThat(ident.getSystem()).isEqualTo("http://terminology.hl7.org/CodeSystem/MVX");
assertThat(ident.hasValue()).isTrue();
assertThat(ident.getValue()).isEqualTo("PMC");
// Check that route (HL70162) has a system
CodeableConcept route = immunization.getRoute();
assertThat(route.hasCoding()).isTrue();
List<Coding> codings = route.getCoding();
assertThat(codings.size()).isEqualTo(2);
Coding coding = codings.get(0);
// If the first one is not the one we want look at the second one.
if (coding.getCode().contains("C28161")) {
coding = codings.get(1);
}
assertThat(coding.hasSystem()).isTrue();
assertThat(coding.getSystem()).isEqualTo("http://terminology.hl7.org/CodeSystem/v2-0162");
// Check that site (HL70163) has a system
CodeableConcept site = immunization.getSite();
coding = site.getCodingFirstRep();
assertThat(coding.hasSystem()).isTrue();
assertThat(coding.getSystem()).isEqualTo("http://terminology.hl7.org/CodeSystem/v2-0163");
}
use of org.hl7.fhir.r4.model.Organization in project hl7v2-fhir-converter by LinuxForHealth.
the class HL7MessageModel method deduplicate.
// General deduplication utility. Currently only Organizations.
// Bundle is passed by reference and may be modified
private void deduplicate(Bundle bundle) {
List<BundleEntryComponent> entries = bundle.getEntry();
Iterator<BundleEntryComponent> i = entries.iterator();
while (i.hasNext()) {
// Safe traversal for removal
BundleEntryComponent entry = i.next();
// Currently only looking for duplicate Organizations, because their Urls and Id's are created from org data.
if (entry.getFullUrl().startsWith("Organization/") && duplicateFound(entry, entries)) {
// Safe removal
i.remove();
}
}
}
use of org.hl7.fhir.r4.model.Organization in project cqf-ruler by DBCG.
the class CareGapsProviderIT method testSubjectAndOrganization.
@SuppressWarnings("java:S5778")
@Test
public void testSubjectAndOrganization() throws Exception {
Parameters params = new Parameters();
params.addParameter().setName("periodStart").setValue(new StringType(periodStartValid));
params.addParameter().setName("periodEnd").setValue(new StringType(periodEndValid));
params.addParameter().setName("subject").setValue(new StringType(subjectPatientValid));
params.addParameter().setName("status").setValue(new StringType(statusValid));
params.addParameter().setName("measureId").setValue(new StringType(measureIdValid));
params.addParameter().setName("organization").setValue(new StringType(organizationValid));
assertThrows(InternalErrorException.class, () -> {
getClient().operation().onType(Measure.class).named("$care-gaps").withParameters(params).useHttpGet().returnResourceType(Parameters.class).execute();
});
}
use of org.hl7.fhir.r4.model.Organization in project cqf-ruler by DBCG.
the class CareGapsProviderIT method testOrganizationOnly.
@Test
public void testOrganizationOnly() throws Exception {
Parameters params = new Parameters();
params.addParameter().setName("periodStart").setValue(new StringType(periodStartValid));
params.addParameter().setName("periodEnd").setValue(new StringType(periodEndValid));
params.addParameter().setName("status").setValue(new StringType(statusValid));
params.addParameter().setName("measureId").setValue(new StringType(measureIdValid));
params.addParameter().setName("organization").setValue(new StringType(organizationValid));
assertThrows(InternalErrorException.class, () -> {
getClient().operation().onType(Measure.class).named("$care-gaps").withParameters(params).useHttpGet().returnResourceType(Parameters.class).execute();
});
// TODO: implement organization
// assertDoesNotThrow(() -> {
// getClient().operation().onType(Measure.class).named("$care-gaps")
// .withParameters(params)
// .useHttpGet()
// .returnResourceType(Parameters.class)
// .execute();
// });
}
Aggregations