use of org.hl7.fhir.utilities.validation.ValidationMessage.Source in project kindling by HL7.
the class Publisher method initialize.
private boolean initialize(String folder) throws Exception {
HierarchicalTableGenerator.ACTIVE_TABLES = true;
page.setDefinitions(new Definitions());
page.getWorkerContext().setCanRunWithoutTerminology(!web);
page.log("Checking Source for " + folder, LogMessageType.Process);
List<String> errors = new ArrayList<String>();
Utilities.checkFolder(page.getFolders().rootDir, errors);
if (checkFile("required", page.getFolders().rootDir, "publish.ini", errors, "all")) {
checkFile("required", page.getFolders().srcDir, "navigation.xml", errors, "all");
page.setIni(new IniFile(page.getFolders().rootDir + "publish.ini"));
page.setVersion(FHIRVersion.fromCode(page.getIni().getStringProperty("FHIR", "version")));
prsr = new SourceParser(page, folder, page.getDefinitions(), web, page.getVersion(), page.getWorkerContext(), page.getGenDate(), page, fpUsages, isCIBuild);
prsr.checkConditions(errors, dates);
page.setRegistry(prsr.getRegistry());
page.getDiffEngine().loadFromIni(prsr.getIni());
for (String s : page.getIni().getPropertyNames("special-pages")) page.getDefinitions().getStructuralPages().add(s);
Utilities.checkFolder(page.getFolders().xsdDir, errors);
checkFile("required", page.getFolders().srcDir, "hierarchy.xml", errors, "all");
checkFile("required", page.getFolders().srcDir, "fhir-all.xsd", errors, "all");
checkFile("required", page.getFolders().templateDir, "template.html", errors, "all");
checkFile("required", page.getFolders().templateDir, "template-book.html", errors, "all");
checkFile("required", page.getFolders().srcDir, "mappingSpaces.xml", errors, "all");
if (page.getIni().getPropertyNames("support") != null)
for (String n : page.getIni().getPropertyNames("support")) checkFile("support", page.getFolders().srcDir, n, errors, "all");
for (String n : page.getIni().getPropertyNames("images")) checkFile("image", page.getFolders().imgDir, n, errors, "all");
for (String n : page.getIni().getPropertyNames("schema")) checkFile("schema", page.getFolders().srcDir, n, errors, "all");
for (String n : page.getIni().getPropertyNames("pages")) checkFile("page", page.getFolders().srcDir, n, errors, "page-" + n);
for (String n : page.getIni().getPropertyNames("files")) checkFile("file", page.getFolders().rootDir, n, errors, "page-" + n);
}
if (checkFile("translations", page.getFolders().rootDir + "implementations" + File.separator, "translations.xml", errors, null)) {
// schema check
XmlValidator xv = new XmlValidator(page.getValidationErrors(), page.getFolders().rootDir + "implementations", Utilities.path(page.getFolders().rootDir, "tools", "schematron"), new String[] { "translations.xsd" });
xv.checkBySchema(Utilities.path(page.getFolders().rootDir, "implementations", "translations.xml"), true);
Utilities.copyFile(page.getFolders().rootDir + "implementations" + File.separator + "translations.xml", page.getFolders().dstDir + "translations.xml");
page.getTranslations().setLang("en");
page.getTranslations().load(page.getFolders().rootDir + "implementations" + File.separator + "translations.xml");
}
if (errors.size() > 0)
page.log("Unable to publish FHIR specification:", LogMessageType.Error);
for (String e : errors) {
page.log(e, LogMessageType.Error);
}
return errors.size() == 0;
}
use of org.hl7.fhir.utilities.validation.ValidationMessage.Source in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7PatientFHIRConversionTest method patient_deceased_conversion_test1.
/**
* In order to generate messageHeader resource, MSH should have MSH.24.2 as this is required
* attribute for source attribute, and source is required for MessageHeader resource.
*/
@Test
void patient_deceased_conversion_test1() {
String patientMsgDeceasedEmpty = "MSH|^~\\&|MIICEHRApplication|MIIC|MIIC|MIIC|201705130822||VXU^V04^VXU_V04|test1100|P|2.5.1|||AL|AL|||||Z22^CDCPHINVS|^^^^^MIIC^SR^^^MIIC|MIIC\n" + "PID|1||12345678^^^^MR|ALTID|Mouse^Mickey^J^III^^^|Mother^Micky|20060504|M|Alias^Alias|2106-3^White^ HL70005|12345 testing ave^^Minneapolis^MN^55407^^^^MN053|USAA|^PRN^^^PH^555^5555555|^PRN^^^PH^555^666666|english|married|bhuddist|1234567_account|111-22-3333|||2186-5^not Hispanic or Latino^CDCREC|Born in USA|Y|2|USA||||\n";
String patientMsgNotDeadBooleanN = "MSH|^~\\&|MIICEHRApplication|MIIC|MIIC|MIIC|201705130822||VXU^V04^VXU_V04|test1100|P|2.5.1|||AL|AL|||||Z22^CDCPHINVS|^^^^^MIIC^SR^^^MIIC|MIIC\n" + "PID|1||12345678^^^^MR|ALTID|Mouse^Mickey^J^III^^^|Mother^Micky|20060504|M|Alias^Alias|2106-3^White^ HL70005|12345 testing ave^^Minneapolis^MN^55407^^^^MN053|USAA|^PRN^^^PH^555^5555555|^PRN^^^PH^555^666666|english|married|bhuddist|1234567_account|111-22-3333|||2186-5^not Hispanic or Latino^CDCREC|Born in USA|Y|2|USA||||N\n";
String patientMsgDeceasedDateOnlyYYYY = "MSH|^~\\&|MIICEHRApplication|MIIC|MIIC|MIIC|201705130822||VXU^V04^VXU_V04|test1100|P|2.5.1|||AL|AL|||||Z22^CDCPHINVS|^^^^^MIIC^SR^^^MIIC|MIIC\n" + "PID|1||12345678^^^^MR|ALTID|Mouse^Mickey^J^III^^^|Mother^Micky|20060504|M|Alias^Alias|2106-3^White^ HL70005|12345 testing ave^^Minneapolis^MN^55407^^^^MN053|USAA|^PRN^^^PH^555^5555555|^PRN^^^PH^555^666666|english|married|bhuddist|1234567_account|111-22-3333|||2186-5^not Hispanic or Latino^CDCREC|Born in USA|Y|2|USA|||2006|\n";
String patientMsgDeceasedDateOnlyYYYYMM = "MSH|^~\\&|MIICEHRApplication|MIIC|MIIC|MIIC|201705130822||VXU^V04^VXU_V04|test1100|P|2.5.1|||AL|AL|||||Z22^CDCPHINVS|^^^^^MIIC^SR^^^MIIC|MIIC\n" + "PID|1||12345678^^^^MR|ALTID|Mouse^Mickey^J^III^^^|Mother^Micky|20060504|M|Alias^Alias|2106-3^White^ HL70005|12345 testing ave^^Minneapolis^MN^55407^^^^MN053|USAA|^PRN^^^PH^555^5555555|^PRN^^^PH^555^666666|english|married|bhuddist|1234567_account|111-22-3333|||2186-5^not Hispanic or Latino^CDCREC|Born in USA|Y|2|USA|||200611|\n";
Patient patientObjDeceasedEmpty = PatientUtils.createPatientFromHl7Segment(ftv, patientMsgDeceasedEmpty);
assertThat(patientObjDeceasedEmpty.hasDeceased()).isFalse();
assertThat(patientObjDeceasedEmpty.hasDeceasedBooleanType()).isFalse();
assertThat(patientObjDeceasedEmpty.hasDeceasedDateTimeType()).isFalse();
Patient patientObjNotDeadBooleanN = PatientUtils.createPatientFromHl7Segment(ftv, patientMsgNotDeadBooleanN);
assertThat(patientObjNotDeadBooleanN.hasDeceased()).isTrue();
assertThat(patientObjNotDeadBooleanN.hasDeceasedBooleanType()).isTrue();
assertThat(patientObjNotDeadBooleanN.getDeceasedBooleanType().booleanValue()).isFalse();
Patient patientObjDeceasedDateOnlyYYYY = PatientUtils.createPatientFromHl7Segment(ftv, patientMsgDeceasedDateOnlyYYYY);
assertThat(patientObjDeceasedDateOnlyYYYY.hasDeceased()).isTrue();
assertThat(patientObjDeceasedDateOnlyYYYY.hasDeceasedDateTimeType()).isTrue();
assertThat(patientObjDeceasedDateOnlyYYYY.hasDeceasedBooleanType()).isFalse();
assertThat(patientObjDeceasedDateOnlyYYYY.getDeceasedDateTimeType().asStringValue()).isEqualTo("2006");
Patient patientObjDeceasedDateOnlyYYYYMM = PatientUtils.createPatientFromHl7Segment(ftv, patientMsgDeceasedDateOnlyYYYYMM);
assertThat(patientObjDeceasedDateOnlyYYYYMM.hasDeceased()).isTrue();
assertThat(patientObjDeceasedDateOnlyYYYYMM.hasDeceasedDateTimeType()).isTrue();
assertThat(patientObjDeceasedDateOnlyYYYYMM.hasDeceasedBooleanType()).isFalse();
assertThat(patientObjDeceasedDateOnlyYYYYMM.getDeceasedDateTimeType().asStringValue()).isEqualTo("2006-11");
// More related tests in patient_deceased_conversion_test2
}
use of org.hl7.fhir.utilities.validation.ValidationMessage.Source in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7NoteFHIRConverterTest method testMedicationRequestNoteCreation.
// 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")
@ParameterizedTest
@MethodSource("parmsTestMedicationRequestNoteCreation")
void testMedicationRequestNoteCreation(String message, String medicalRequestSegments) {
// Minimal valid ORC message. Requires RXO and RXR segments.
String hl7message = "MSH|^~\\&||||IBM|20210101000000||" + message + "|MSGID|T|2.6\n" + "PID|||1234||DOE^JANE^|||F||||||||||||||||||||||\n" + "PV1||I||||||||||||||||||||||||||||||||||||||||||\n" + "ORC|OP|1234|1234|0827||||||||||||||||||||\n" + // May be RXO or RXO+RXE values from parmsTestMedicationRequestNoteCreation
medicalRequestSegments + "NTE|1|O|TEST MedReq NOTE AA line 1||Pract1ID^Pract1Last^Pract1First|\n" + "NTE|2|O|TEST NOTE AA line 2|\n" + "NTE|3|O|TEST NOTE AA line 3|\n" + "OBX|1|NM|17985^GLYCOHEMOGLOBIN HGB A1C^LRR^^^^^^GLYCOHEMOGLOBIN HGB A1C||5.6|%|<6.0||||F||||||||||||||\n" + // GLYCOHEMOGLOBIN Observation NTE has a practitioner reference in NTE.5. Note in second NTE. The first valid NTE.5 is used.
"NTE|1|L|TEST OBXa NOTE BB line 1|\n" + "NTE|2|L|TEST NOTE BB line 2||Pract2ID^Pract2Last^Pract2First|\n" + "NTE|3|L|TEST NOTE BB line 3|\n" + "OBX|2|NM|17853^MEAN BLOOD GLUCOSE^LRR^^^^^^MEAN BLOOD GLUCOSE||114.02|mg/dL|||||F||||||||||||||\n" + // Glucose Observation NTE has no practitioner reference in NTE.5
"NTE|1|L|TEST OBXb NOTE CC line 1|\n" + "NTE|2|L|TEST NOTE CC line 2|\n" + // Test that blank lines are preserved.
"NTE|3|L| |\n" + "NTE|4|L|TEST NOTE CC line 4|\n";
List<BundleEntryComponent> e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
// Expect MedicationRequest containing NTE for RXO or RXE
List<Resource> medicationRequests = ResourceUtils.getResourceList(e, ResourceType.MedicationRequest);
assertThat(medicationRequests).hasSize(1);
MedicationRequest medicationRequest = ResourceUtils.getResourceMedicationRequest(medicationRequests.get(0), ResourceUtils.context);
assertThat(medicationRequest.hasNote()).isTrue();
assertThat(medicationRequest.getNote()).hasSize(1);
// NOTE: the note contains an Annotation, which contains a MarkdownType that has the string.
// Must use getTextElement().getValueAsString() to see untrimmed contents.
assertThat(medicationRequest.getNote().get(0).getTextElement().getValueAsString()).isEqualTo("TEST MedReq NOTE AA line 1 \nTEST NOTE AA line 2 \nTEST NOTE AA line 3");
assertThat(medicationRequest.getNote().get(0).hasAuthorReference()).isTrue();
String practitionerServReqRefId = medicationRequest.getNote().get(0).getAuthorReference().getReference();
// Two observations. One has GLYCOHEMOGLOBIN and notes BB, One has GLUCOSE and notes CC
List<Resource> observations = ResourceUtils.getResourceList(e, ResourceType.Observation);
// Should be 2 for ORU and ORM
assertThat(observations).hasSize(2);
Observation obsGlucose = ResourceUtils.getResourceObservation(observations.get(0), ResourceUtils.context);
Observation obsHemoglobin = ResourceUtils.getResourceObservation(observations.get(1), ResourceUtils.context);
// Figure out which is first and reassign if needed for testing
if (obsGlucose.getCode().getText() != "MEAN BLOOD GLUCOSE") {
Observation temp = obsGlucose;
obsGlucose = obsHemoglobin;
obsHemoglobin = temp;
}
// Validate the note contents and references
assertThat(obsHemoglobin.hasNote()).isTrue();
assertThat(obsHemoglobin.getNote()).hasSize(1);
assertThat(obsHemoglobin.getNote().get(0).getTextElement().getValueAsString()).isEqualTo("TEST OBXa NOTE BB line 1 \nTEST NOTE BB line 2 \nTEST NOTE BB line 3");
assertThat(obsHemoglobin.getNote().get(0).hasAuthorReference()).isTrue();
String practitionerObsHemoglobinRefId = obsHemoglobin.getNote().get(0).getAuthorReference().getReference();
assertThat(obsGlucose.hasNote()).isTrue();
assertThat(obsGlucose.getNote()).hasSize(1);
assertThat(obsGlucose.getNote().get(0).getTextElement().getValueAsString()).isEqualTo(// Test that blank lines are preserved.
"TEST OBXb NOTE CC line 1 \nTEST NOTE CC line 2 \n \nTEST NOTE CC line 4");
assertThat(obsGlucose.getNote().get(0).hasAuthorReference()).isFalse();
// Two Practitioners, one for the serviceRequest, one for the GLYCOHEMOGLOBIN Observation
List<Resource> practitioners = ResourceUtils.getResourceList(e, ResourceType.Practitioner);
assertThat(practitioners).hasSize(2);
Practitioner practitionerServReq = ResourceUtils.getResourcePractitioner(practitioners.get(0), ResourceUtils.context);
Practitioner practitionerObsHemoglobin = ResourceUtils.getResourcePractitioner(practitioners.get(1), ResourceUtils.context);
// Adjust to correct practitioner if needed
if (!practitionerServReq.getIdentifierFirstRep().getValue().contentEquals("Pract1ID")) {
Practitioner temp = practitionerObsHemoglobin;
practitionerObsHemoglobin = practitionerServReq;
practitionerServReq = temp;
}
// Check the values for the Practitioners and validate match to references.
assertThat(practitionerServReq.getIdentifier()).hasSize(1);
assertThat(practitionerServReq.getIdentifierFirstRep().getValue()).isEqualTo("Pract1ID");
assertThat(practitionerServReq.getName()).hasSize(1);
assertThat(practitionerServReq.getNameFirstRep().getText()).isEqualTo("Pract1First Pract1Last");
// Check the cross-reference
assertThat(practitionerServReq.getId()).isEqualTo(practitionerServReqRefId);
// Sanity check to confirm data corruption in meta content has not returned.
CodeableConcept ccSourceEventTrigger = (CodeableConcept) practitionerServReq.getMeta().getExtensionByUrl("http://ibm.com/fhir/cdm/StructureDefinition/source-event-trigger").getValue();
assertThat(ccSourceEventTrigger.hasText()).isFalse();
assertThat(practitionerObsHemoglobin.getIdentifier()).hasSize(1);
assertThat(practitionerObsHemoglobin.getIdentifierFirstRep().getValue()).isEqualTo("Pract2ID");
assertThat(practitionerObsHemoglobin.getName()).hasSize(1);
assertThat(practitionerObsHemoglobin.getNameFirstRep().getText()).isEqualTo("Pract2First Pract2Last");
// Check the cross-reference
assertThat(practitionerObsHemoglobin.getId()).isEqualTo(practitionerObsHemoglobinRefId);
}
use of org.hl7.fhir.utilities.validation.ValidationMessage.Source in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7NoteFHIRConverterTest method testNoteCreationServiceRequestMutipleOBX.
// 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")
@ParameterizedTest
@MethodSource("provideParmsForNoteCreationServiceRequestMutipleOBX")
void testNoteCreationServiceRequestMutipleOBX(String message, int numExpectedDiagnosticReports) {
String hl7ORU = "MSH|^~\\&|||||20180924152907||" + message + "|213|T|2.3.1|||||||||||\n" + "PID|||Pract1ID^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + // "NTE|1|O|TEST NOTE DD line 1|\n" + "NTE|2|O|TEST NOTE DD line 2 |\n" + "NTE|3|O|TEST NOTE D line 3|\n"
"PV1|1|I||||||||||||||||||||||||||||||||||||||||||20180924152707|\n" + "ORC|RE|248648498^|248648498^|ML18267-C00001^Beaker|||||||||||||||||||||||||||\n" + "OBR|1|248648498^|248648498^|83036E^HEMOGLOBIN A1C^PACSEAP^^^^^^HEMOGLOBIN A1C||||||||||||||||||||||||||||||||||||\n" + // ServiceRequest NTE has a practitioner reference in NTE.5
"NTE|1|O|TEST ORC/OBR NOTE AA line 1||Pract1ID^Pract1Last^Pract1First|\n" + "NTE|2|O|TEST NOTE AA line 2|\n" + "NTE|3|O|TEST NOTE AA line 3|\n" + "OBX|1|NM|17985^GLYCOHEMOGLOBIN HGB A1C^LRR^^^^^^GLYCOHEMOGLOBIN HGB A1C||5.6|%|<6.0||||F||||||||||||||\n" + // GLYCOHEMOGLOBIN Observation NTE has a practitioner reference in NTE.5. Note in second NTE. The first valied NTE.5 is used.
"NTE|1|L|TEST OBXa NOTE BB line 1|\n" + "NTE|2|L|TEST NOTE BB line 2||Pract2ID^Pract2Last^Pract2First|\n" + "NTE|3|L|TEST NOTE BB line 3|\n" + "OBX|2|NM|17853^MEAN BLOOD GLUCOSE^LRR^^^^^^MEAN BLOOD GLUCOSE||114.02|mg/dL|||||F||||||||||||||\n" + // Glucose Observation NTE has no practitioner reference in NTE.5
"NTE|1|L|TEST OBXb NOTE CC line 1|\n" + "NTE|2|L|TEST NOTE CC line 2|\n" + // Test that blank lines are preserved.
"NTE|3|L| |\n" + "NTE|4|L|TEST NOTE CC line 4|\n";
List<BundleEntryComponent> e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7ORU);
List<Resource> diagnosticReports = ResourceUtils.getResourceList(e, ResourceType.DiagnosticReport);
// DiagnosticReport expected for ORU, but not for ORM
// From the OBR in the ORU test case
assertThat(diagnosticReports).hasSize(numExpectedDiagnosticReports);
// One ServiceRequest contains NTE for ORC/OBR
List<Resource> serviceRequests = ResourceUtils.getResourceList(e, ResourceType.ServiceRequest);
assertThat(serviceRequests).hasSize(1);
ServiceRequest serviceRequest = ResourceUtils.getResourceServiceRequest(serviceRequests.get(0), ResourceUtils.context);
assertThat(serviceRequest.hasNote()).isTrue();
assertThat(serviceRequest.getNote()).hasSize(1);
// Processing adds " \n" two spaces and a line feed between each line.
// NOTE: the note contains an Annotation, which contains a MarkdownType that has the string.
// Must use getTextElement().getValueAsString() to see untrimmed contents.
assertThat(serviceRequest.getNote().get(0).getTextElement().getValueAsString()).isEqualTo("TEST ORC/OBR NOTE AA line 1 \nTEST NOTE AA line 2 \nTEST NOTE AA line 3");
assertThat(serviceRequest.getNote().get(0).hasAuthorReference()).isTrue();
String practitionerServReqRefId = serviceRequest.getNote().get(0).getAuthorReference().getReference();
// Two observations. One has GLYCOHEMOGLOBIN and notes BB, One has GLUCOSE and notes CC
List<Resource> observations = ResourceUtils.getResourceList(e, ResourceType.Observation);
// Should be 2 for ORU and ORM
assertThat(observations).hasSize(2);
Observation obsGlucose = ResourceUtils.getResourceObservation(observations.get(0), ResourceUtils.context);
Observation obsHemoglobin = ResourceUtils.getResourceObservation(observations.get(1), ResourceUtils.context);
// Figure out which is first and reassign if needed for testing
if (obsGlucose.getCode().getText() != "MEAN BLOOD GLUCOSE") {
Observation temp = obsGlucose;
obsGlucose = obsHemoglobin;
obsHemoglobin = temp;
}
// Validate the note contents and references
assertThat(obsHemoglobin.hasNote()).isTrue();
assertThat(obsHemoglobin.getNote()).hasSize(1);
assertThat(obsHemoglobin.getNote().get(0).getTextElement().getValueAsString()).isEqualTo("TEST OBXa NOTE BB line 1 \nTEST NOTE BB line 2 \nTEST NOTE BB line 3");
assertThat(obsHemoglobin.getNote().get(0).hasAuthorReference()).isTrue();
String practitionerObsHemoglobinRefId = obsHemoglobin.getNote().get(0).getAuthorReference().getReference();
assertThat(obsGlucose.hasNote()).isTrue();
assertThat(obsGlucose.getNote()).hasSize(1);
assertThat(obsGlucose.getNote().get(0).getTextElement().getValueAsString()).isEqualTo(// Test that blank lines are preserved.
"TEST OBXb NOTE CC line 1 \nTEST NOTE CC line 2 \n \nTEST NOTE CC line 4");
assertThat(obsGlucose.getNote().get(0).hasAuthorReference()).isFalse();
// Two Practitioners, one for the serviceRequest, one for the GLYCOHEMOGLOBIN Observation
List<Resource> practitioners = ResourceUtils.getResourceList(e, ResourceType.Practitioner);
assertThat(practitioners).hasSize(2);
Practitioner practitionerServReq = ResourceUtils.getResourcePractitioner(practitioners.get(0), ResourceUtils.context);
Practitioner practitionerObsHemoglobin = ResourceUtils.getResourcePractitioner(practitioners.get(1), ResourceUtils.context);
// Adjust to correct practitioner if needed
if (!practitionerServReq.getIdentifierFirstRep().getValue().contentEquals("Pract1ID")) {
Practitioner temp = practitionerObsHemoglobin;
practitionerObsHemoglobin = practitionerServReq;
practitionerServReq = temp;
}
// Check the values for the Practitioners and validate match to references.
assertThat(practitionerServReq.getIdentifier()).hasSize(1);
assertThat(practitionerServReq.getIdentifierFirstRep().getValue()).isEqualTo("Pract1ID");
assertThat(practitionerServReq.getName()).hasSize(1);
assertThat(practitionerServReq.getNameFirstRep().getText()).isEqualTo("Pract1First Pract1Last");
// Check the cross-reference
assertThat(practitionerServReq.getId()).isEqualTo(practitionerServReqRefId);
// Sanity check to confirm data corruption in meta content has not returned.
CodeableConcept ccSourceEventTrigger = (CodeableConcept) practitionerServReq.getMeta().getExtensionByUrl("http://ibm.com/fhir/cdm/StructureDefinition/source-event-trigger").getValue();
assertThat(ccSourceEventTrigger.hasText()).isFalse();
assertThat(practitionerObsHemoglobin.getIdentifier()).hasSize(1);
assertThat(practitionerObsHemoglobin.getIdentifierFirstRep().getValue()).isEqualTo("Pract2ID");
assertThat(practitionerObsHemoglobin.getName()).hasSize(1);
assertThat(practitionerObsHemoglobin.getNameFirstRep().getText()).isEqualTo("Pract2First Pract2Last");
// Check the cross-reference
assertThat(practitionerObsHemoglobin.getId()).isEqualTo(practitionerObsHemoglobinRefId);
}
use of org.hl7.fhir.utilities.validation.ValidationMessage.Source 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();
}
Aggregations