From 50cb983a41bcc6fd09af10f63879c52a12e98727 Mon Sep 17 00:00:00 2001 From: Clement Hennequin Date: Mon, 25 Nov 2024 11:37:27 -0500 Subject: [PATCH] Infrastructure progress for ERR-5 code 3 --- .../kernal/logic/IncomingMessageHandler.java | 50 +++++++------- .../logic/IncomingMessageHandlerR4.java | 16 ++--- .../logic/IncomingMessageHandlerR5.java | 16 ++--- .../iis/kernal/logic/ProcessingException.java | 37 +++++++--- .../iis/kernal/logic/ack/IisHL7Util.java | 4 ++ .../iis/kernal/logic/ack/IisReportable.java | 47 +++++++------ .../kernal/logic/ack/ProcessingResult.java | 67 +++++++++++++++++++ .../kernal/mapping/VxuToBundleExperiment.java | 8 +-- .../iis/kernal/servlet/SoapController.java | 2 +- 9 files changed, 172 insertions(+), 75 deletions(-) create mode 100644 src/main/java/org/immregistries/iis/kernal/logic/ack/ProcessingResult.java diff --git a/src/main/java/org/immregistries/iis/kernal/logic/IncomingMessageHandler.java b/src/main/java/org/immregistries/iis/kernal/logic/IncomingMessageHandler.java index 8187913f..9d6619a1 100644 --- a/src/main/java/org/immregistries/iis/kernal/logic/IncomingMessageHandler.java +++ b/src/main/java/org/immregistries/iis/kernal/logic/IncomingMessageHandler.java @@ -353,7 +353,7 @@ public Date parseDateWarn(String dateString, String errorMessage, String segment return parseDateInternal(dateString, strict); } catch (ParseException e) { if (errorMessage != null) { - ProcessingException pe = new ProcessingException(errorMessage + ": " + e.getMessage(), segmentId, segmentRepeat, fieldPosition, IisReportableSeverity.WARN.getCode()); + ProcessingException pe = new ProcessingException(errorMessage + ": " + e.getMessage(), segmentId, segmentRepeat, fieldPosition, IisReportableSeverity.WARN); iisReportableList.add(IisReportable.fromProcessingException(pe)); } } @@ -416,7 +416,7 @@ public String processQBP(Tenant tenant, HL7Reader reader, String messageReceived String patientNameMiddle = reader.getValue(4, 3); if (ProcessingFlavor.MOONFRUIT.isActive() && StringUtils.defaultString(patientNameFirst).startsWith("S") || StringUtils.defaultString(patientNameFirst).startsWith("A")) { - throw new ProcessingException("Immunization History cannot be Accepted because of patient's consent status", "PID", 0, 0, "W"); + throw new ProcessingException("Immunization History cannot be Accepted because of patient's consent status", "PID", 0, 0, IisReportableSeverity.WARN); } boolean strictDate = false; @@ -491,7 +491,7 @@ public String buildRSP(HL7Reader reader, String messageReceived, PatientMaster p MqeMessageServiceResponse mqeMessageServiceResponse = mqeMessageService.processMessage(messageReceived); boolean sendInformations = true; if (ProcessingFlavor.STARFRUIT.isActive() && StringUtils.defaultString(patientMaster.getNameFirst()).startsWith("S") || StringUtils.defaultString(patientMaster.getNameFirst()).startsWith("A")) { - iisReportables.add(IisReportable.fromProcessingException(new ProcessingException("Immunization History cannot be shared because of patient's consent status", "PID", 0, 0, "N"))); + iisReportables.add(IisReportable.fromProcessingException(new ProcessingException("Immunization History cannot be shared because of patient's consent status", "PID", 0, 0, IisReportableSeverity.NOTICE))); sendInformations = false; } IGenericClient fhirClient = repositoryClientFactory.getFhirClient(); @@ -940,17 +940,17 @@ public int readAndCreateObservations(HL7Reader reader, List iisRe CodeMap codeMap = CodeMapManager.getCodeMap(); Code contraCode = codeMap.getCodeForCodeset(CodesetType.CONTRAINDICATION_OR_PRECAUTION, observationReported.getValueCode()); if (contraCode == null) { - ProcessingException pe = new ProcessingException("Unrecognized contraindication or precaution", "OBX", obxCount, 5, IisReportableSeverity.WARN.getCode()); + ProcessingException pe = new ProcessingException("Unrecognized contraindication or precaution", "OBX", obxCount, 5, IisReportableSeverity.WARN); iisReportableList.add(IisReportable.fromProcessingException(pe)); } if (observationReported.getObservationDate() != null) { Date today = new Date(); if (observationReported.getObservationDate().after(today)) { - ProcessingException pe = new ProcessingException("Contraindication or precaution observed in the future", "OBX", obxCount, 5, IisReportableSeverity.WARN.getCode()); + ProcessingException pe = new ProcessingException("Contraindication or precaution observed in the future", "OBX", obxCount, 5, IisReportableSeverity.WARN); iisReportableList.add(IisReportable.fromProcessingException(pe)); } if (patientReported.getBirthDate() != null && observationReported.getObservationDate().before(patientReported.getBirthDate())) { - ProcessingException pe = new ProcessingException("Contraindication or precaution observed before patient was born", "OBX", obxCount, 14, IisReportableSeverity.WARN.getCode()); + ProcessingException pe = new ProcessingException("Contraindication or precaution observed before patient was born", "OBX", obxCount, 14, IisReportableSeverity.WARN); iisReportableList.add(IisReportable.fromProcessingException(pe)); } } @@ -1140,7 +1140,7 @@ public PatientReported processPatientFhirAgnostic(HL7Reader reader, List groupPatientIds = (ArrayList) request.getAttribute("groupPatientIds"); diff --git a/src/main/java/org/immregistries/iis/kernal/logic/IncomingMessageHandlerR4.java b/src/main/java/org/immregistries/iis/kernal/logic/IncomingMessageHandlerR4.java index 996529c4..6c9c0f52 100644 --- a/src/main/java/org/immregistries/iis/kernal/logic/IncomingMessageHandlerR4.java +++ b/src/main/java/org/immregistries/iis/kernal/logic/IncomingMessageHandlerR4.java @@ -191,7 +191,7 @@ public String processVXU(Tenant tenant, HL7Reader reader, String message, Organi } Code cvxCode = codeMap.getRelatedCode(ndcCode, CodesetType.VACCINATION_CVX_CODE); if (cvxCode == null) { - ProcessingException pe = new ProcessingException("Unrecognized NDC " + vaccineNdcCode, "RXA", rxaCount, 5, IisReportableSeverity.WARN.getCode()); + ProcessingException pe = new ProcessingException("Unrecognized NDC " + vaccineNdcCode, "RXA", rxaCount, 5, IisReportableSeverity.WARN); ; iisReportableList.add(IisReportable.fromProcessingException(pe)); } else { @@ -199,7 +199,7 @@ public String processVXU(Tenant tenant, HL7Reader reader, String message, Organi vaccineCvxCode = cvxCode.getValue(); } else if (!vaccineCvxCode.equals(cvxCode.getValue())) { // NDC doesn't map to the CVX code that was submitted! - ProcessingException pe = new ProcessingException("NDC " + vaccineNdcCode + " maps to " + cvxCode.getValue() + " but CVX " + vaccineCvxCode + " was also reported, preferring CVX code", "RXA", rxaCount, 5, IisReportableSeverity.WARN.getCode()); + ProcessingException pe = new ProcessingException("NDC " + vaccineNdcCode + " maps to " + cvxCode.getValue() + " but CVX " + vaccineCvxCode + " was also reported, preferring CVX code", "RXA", rxaCount, 5, IisReportableSeverity.WARN); iisReportableList.add(IisReportable.fromProcessingException(pe)); } } @@ -210,7 +210,7 @@ public String processVXU(Tenant tenant, HL7Reader reader, String message, Organi if (cptCode != null) { Code cvxCode = codeMap.getRelatedCode(cptCode, CodesetType.VACCINATION_CVX_CODE); if (cvxCode == null) { - ProcessingException pe = new ProcessingException("Unrecognized CPT " + cptCode, "RXA", rxaCount, 5, IisReportableSeverity.WARN.getCode()); + ProcessingException pe = new ProcessingException("Unrecognized CPT " + cptCode, "RXA", rxaCount, 5, IisReportableSeverity.WARN); ; iisReportableList.add(IisReportable.fromProcessingException(pe)); } else { @@ -218,7 +218,7 @@ public String processVXU(Tenant tenant, HL7Reader reader, String message, Organi vaccineCvxCode = cvxCode.getValue(); } else if (!vaccineCvxCode.equals(cvxCode.getValue())) { // CPT doesn't map to the CVX code that was submitted! - ProcessingException pe = new ProcessingException("CPT " + vaccineCptCode + " maps to " + cvxCode.getValue() + " but CVX " + vaccineCvxCode + " was also reported, preferring CVX code", "RXA", rxaCount, 5, IisReportableSeverity.WARN.getCode()); + ProcessingException pe = new ProcessingException("CPT " + vaccineCptCode + " maps to " + cvxCode.getValue() + " but CVX " + vaccineCvxCode + " was also reported, preferring CVX code", "RXA", rxaCount, 5, IisReportableSeverity.WARN); ; iisReportableList.add(IisReportable.fromProcessingException(pe)); } @@ -308,7 +308,7 @@ public String processVXU(Tenant tenant, HL7Reader reader, String message, Organi Code refusalCode = codeMap.getCodeForCodeset(CodesetType.VACCINATION_REFUSAL, vaccinationReported.getRefusalReasonCode()); if (refusalCode == null) { ProcessingException pe = new ProcessingException("Unrecognized refusal reason", "RXA", rxaCount, 18); - pe.setErrorCode(IisReportableSeverity.WARN.getCode()); + pe.setErrorCode(IisReportableSeverity.WARN); iisReportableList.add(IisReportable.fromProcessingException(pe)); } } @@ -334,7 +334,7 @@ public String processVXU(Tenant tenant, HL7Reader reader, String message, Organi } if (ProcessingFlavor.HOTSAUCE.isActive() && random.nextBoolean()) { - throw new ProcessingException("Vaccination randomly rejected, Patient Accepted", "RXR", 0, 0, "N"); + throw new ProcessingException("Vaccination randomly rejected, Patient Accepted", "RXR", 0, 0, IisReportableSeverity.NOTICE); } @@ -348,7 +348,7 @@ public String processVXU(Tenant tenant, HL7Reader reader, String message, Organi if (!fundingEligibility.equals("")) { Code fundingEligibilityCode = codeMap.getCodeForCodeset(CodesetType.FINANCIAL_STATUS_CODE, fundingEligibility); if (fundingEligibilityCode == null) { - ProcessingException pe = new ProcessingException("Funding eligibility '" + fundingEligibility + "' was not recognized", "OBX", tempObxCount, 5, IisReportableSeverity.WARN.getCode()); + ProcessingException pe = new ProcessingException("Funding eligibility '" + fundingEligibility + "' was not recognized", "OBX", tempObxCount, 5, IisReportableSeverity.WARN); ; iisReportableList.add(IisReportable.fromProcessingException(pe)); } else { @@ -360,7 +360,7 @@ public String processVXU(Tenant tenant, HL7Reader reader, String message, Organi if (!fundingSource.equals("")) { Code fundingSourceCode = codeMap.getCodeForCodeset(CodesetType.VACCINATION_FUNDING_SOURCE, fundingSource); if (fundingSourceCode == null) { - ProcessingException pe = new ProcessingException("Funding source '" + fundingSource + "' was not recognized", "OBX", tempObxCount, 5, IisReportableSeverity.WARN.getCode()); + ProcessingException pe = new ProcessingException("Funding source '" + fundingSource + "' was not recognized", "OBX", tempObxCount, 5, IisReportableSeverity.WARN); ; iisReportableList.add(IisReportable.fromProcessingException(pe)); } else { diff --git a/src/main/java/org/immregistries/iis/kernal/logic/IncomingMessageHandlerR5.java b/src/main/java/org/immregistries/iis/kernal/logic/IncomingMessageHandlerR5.java index c5a49475..d38fab9c 100644 --- a/src/main/java/org/immregistries/iis/kernal/logic/IncomingMessageHandlerR5.java +++ b/src/main/java/org/immregistries/iis/kernal/logic/IncomingMessageHandlerR5.java @@ -191,14 +191,14 @@ public String processVXU(Tenant tenant, HL7Reader reader, String message, Organi } Code cvxCode = codeMap.getRelatedCode(ndcCode, CodesetType.VACCINATION_CVX_CODE); if (cvxCode == null) { - ProcessingException pe = new ProcessingException("Unrecognized NDC " + vaccineNdcCode, "RXA", rxaCount, 5, IisReportableSeverity.WARN.getCode()); + ProcessingException pe = new ProcessingException("Unrecognized NDC " + vaccineNdcCode, "RXA", rxaCount, 5, IisReportableSeverity.WARN); iisReportableList.add(IisReportable.fromProcessingException(pe)); } else { if (vaccineCvxCode.equals("")) { vaccineCvxCode = cvxCode.getValue(); } else if (!vaccineCvxCode.equals(cvxCode.getValue())) { // NDC doesn't map to the CVX code that was submitted! - ProcessingException pe = new ProcessingException("NDC " + vaccineNdcCode + " maps to " + cvxCode.getValue() + " but CVX " + vaccineCvxCode + " was also reported, preferring CVX code", "RXA", rxaCount, 5, IisReportableSeverity.WARN.getCode()); + ProcessingException pe = new ProcessingException("NDC " + vaccineNdcCode + " maps to " + cvxCode.getValue() + " but CVX " + vaccineCvxCode + " was also reported, preferring CVX code", "RXA", rxaCount, 5, IisReportableSeverity.WARN); iisReportableList.add(IisReportable.fromProcessingException(pe)); } } @@ -209,7 +209,7 @@ public String processVXU(Tenant tenant, HL7Reader reader, String message, Organi if (cptCode != null) { Code cvxCode = codeMap.getRelatedCode(cptCode, CodesetType.VACCINATION_CVX_CODE); if (cvxCode == null) { - ProcessingException pe = new ProcessingException("Unrecognized CPT " + cptCode, "RXA", rxaCount, 5, IisReportableSeverity.WARN.getCode()); + ProcessingException pe = new ProcessingException("Unrecognized CPT " + cptCode, "RXA", rxaCount, 5, IisReportableSeverity.WARN); ; iisReportableList.add(IisReportable.fromProcessingException(pe)); } else { @@ -217,7 +217,7 @@ public String processVXU(Tenant tenant, HL7Reader reader, String message, Organi vaccineCvxCode = cvxCode.getValue(); } else if (!vaccineCvxCode.equals(cvxCode.getValue())) { // CPT doesn't map to the CVX code that was submitted! - ProcessingException pe = new ProcessingException("CPT " + vaccineCptCode + " maps to " + cvxCode.getValue() + " but CVX " + vaccineCvxCode + " was also reported, preferring CVX code", "RXA", rxaCount, 5, IisReportableSeverity.WARN.getCode()); + ProcessingException pe = new ProcessingException("CPT " + vaccineCptCode + " maps to " + cvxCode.getValue() + " but CVX " + vaccineCvxCode + " was also reported, preferring CVX code", "RXA", rxaCount, 5, IisReportableSeverity.WARN); ; iisReportableList.add(IisReportable.fromProcessingException(pe)); } @@ -307,7 +307,7 @@ public String processVXU(Tenant tenant, HL7Reader reader, String message, Organi Code refusalCode = codeMap.getCodeForCodeset(CodesetType.VACCINATION_REFUSAL, vaccinationReported.getRefusalReasonCode()); if (refusalCode == null) { ProcessingException pe = new ProcessingException("Unrecognized refusal reason", "RXA", rxaCount, 18); - pe.setErrorCode(IisReportableSeverity.WARN.getCode()); + pe.setErrorCode(IisReportableSeverity.WARN); iisReportableList.add(IisReportable.fromProcessingException(pe)); } } @@ -333,7 +333,7 @@ public String processVXU(Tenant tenant, HL7Reader reader, String message, Organi } if (ProcessingFlavor.HOTSAUCE.isActive() && random.nextBoolean()) { - throw new ProcessingException("Vaccination randomly rejected, Patient Accepted", "RXR", 0, 0, "N"); + throw new ProcessingException("Vaccination randomly rejected, Patient Accepted", "RXR", 0, 0, IisReportableSeverity.NOTICE); } @@ -347,7 +347,7 @@ public String processVXU(Tenant tenant, HL7Reader reader, String message, Organi if (!fundingEligibility.equals("")) { Code fundingEligibilityCode = codeMap.getCodeForCodeset(CodesetType.FINANCIAL_STATUS_CODE, fundingEligibility); if (fundingEligibilityCode == null) { - ProcessingException pe = new ProcessingException("Funding eligibility '" + fundingEligibility + "' was not recognized", "OBX", tempObxCount, 5, IisReportableSeverity.WARN.getCode()); + ProcessingException pe = new ProcessingException("Funding eligibility '" + fundingEligibility + "' was not recognized", "OBX", tempObxCount, 5, IisReportableSeverity.WARN); ; iisReportableList.add(IisReportable.fromProcessingException(pe)); } else { @@ -359,7 +359,7 @@ public String processVXU(Tenant tenant, HL7Reader reader, String message, Organi if (!fundingSource.equals("")) { Code fundingSourceCode = codeMap.getCodeForCodeset(CodesetType.VACCINATION_FUNDING_SOURCE, fundingSource); if (fundingSourceCode == null) { - ProcessingException pe = new ProcessingException("Funding source '" + fundingSource + "' was not recognized", "OBX", tempObxCount, 5, IisReportableSeverity.WARN.getCode()); + ProcessingException pe = new ProcessingException("Funding source '" + fundingSource + "' was not recognized", "OBX", tempObxCount, 5, IisReportableSeverity.WARN); ; iisReportableList.add(IisReportable.fromProcessingException(pe)); } else { diff --git a/src/main/java/org/immregistries/iis/kernal/logic/ProcessingException.java b/src/main/java/org/immregistries/iis/kernal/logic/ProcessingException.java index 11945f55..872660ca 100644 --- a/src/main/java/org/immregistries/iis/kernal/logic/ProcessingException.java +++ b/src/main/java/org/immregistries/iis/kernal/logic/ProcessingException.java @@ -2,6 +2,7 @@ import org.immregistries.iis.kernal.logic.ack.IisReportable; import org.immregistries.iis.kernal.logic.ack.IisReportableSeverity; +import org.immregistries.mqe.hl7util.model.CodedWithExceptions; import org.immregistries.mqe.hl7util.model.Hl7Location; @SuppressWarnings("serial") @@ -10,7 +11,8 @@ public class ProcessingException extends Exception { private String segmentId = ""; private int segmentRepeat = 0; private int fieldPosition = 0; - private String errorCode = IisReportableSeverity.ERROR.getCode(); + private IisReportableSeverity errorCode = IisReportableSeverity.ERROR; + private CodedWithExceptions applicationErrorCode = new CodedWithExceptions(); public String getSegmentId() { return segmentId; @@ -32,14 +34,23 @@ public ProcessingException(String message, String segmentId, int segmentRepeat, this.fieldPosition = fieldPosition; } + public ProcessingException(String message, String segmentId, int segmentRepeat, + int fieldPosition, IisReportableSeverity errorCode) { + this(message, segmentId, segmentRepeat, fieldPosition); + this.errorCode = errorCode; + } public ProcessingException(String message, String segmentId, int segmentRepeat, - int fieldPosition, String errorCode) { - super(message); - this.segmentId = segmentId; - this.segmentRepeat = segmentRepeat; - this.fieldPosition = fieldPosition; + int fieldPosition, CodedWithExceptions applicationErrorCode) { + this(message, segmentId, segmentRepeat, fieldPosition); + this.applicationErrorCode = applicationErrorCode; + } + + public ProcessingException(String message, String segmentId, int segmentRepeat, + int fieldPosition, IisReportableSeverity errorCode, CodedWithExceptions applicationErrorCode) { + this(message, segmentId, segmentRepeat, fieldPosition); this.errorCode = errorCode; + this.applicationErrorCode = applicationErrorCode; } private ProcessingException(IisReportable iisReportable) { @@ -48,15 +59,16 @@ private ProcessingException(IisReportable iisReportable) { this.segmentId = hl7Location.getSegmentId(); this.segmentRepeat = hl7Location.getFieldRepetition(); this.fieldPosition = hl7Location.getFieldPosition(); - this.errorCode = iisReportable.getSeverity().getCode(); + this.errorCode = iisReportable.getSeverity(); + this.applicationErrorCode = iisReportable.getApplicationErrorCode(); } - public String getErrorCode() { + public IisReportableSeverity getErrorCode() { return errorCode; } - public void setErrorCode(String errorCode) { + public void setErrorCode(IisReportableSeverity errorCode) { this.errorCode = errorCode; } @@ -65,4 +77,11 @@ public static ProcessingException fromIisReportable(IisReportable iisReportable) } + public CodedWithExceptions getApplicationErrorCode() { + return applicationErrorCode; + } + + public void setApplicationErrorCode(CodedWithExceptions applicationErrorCode) { + this.applicationErrorCode = applicationErrorCode; + } } diff --git a/src/main/java/org/immregistries/iis/kernal/logic/ack/IisHL7Util.java b/src/main/java/org/immregistries/iis/kernal/logic/ack/IisHL7Util.java index 5270aa25..d6069b09 100644 --- a/src/main/java/org/immregistries/iis/kernal/logic/ack/IisHL7Util.java +++ b/src/main/java/org/immregistries/iis/kernal/logic/ack/IisHL7Util.java @@ -99,6 +99,7 @@ public static String makeAckMessage(String ackType, String severityLevel, String SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssZ"); String messageDate = sdf.format(new Date()); + String profileExtension = ackData.getProfileExtension(); // MSH ack.append("MSH|^~\\&"); ack.append("|" + ackData.getSendingApplication()); // MSH-3 Sending @@ -126,6 +127,9 @@ public static String makeAckMessage(String ackType, String severityLevel, String ack.append("|"); // MSH-19 ack.append("|"); // MSH-20 ack.append("|Z23^CDCPHINVS"); // MSH-21 TODO chANGE FOR advanced + if (StringUtils.isNotBlank(profileExtension)) { + ack.append("~").append(profileExtension).append("^CDCPHINVS"); + } ack.append("|\r"); // ack.append("SFT|" + SoftwareVersion.VENDOR + "|" + // SoftwareVersion.VERSION + "|" + SoftwareVersion.PRODUCT + "|" + diff --git a/src/main/java/org/immregistries/iis/kernal/logic/ack/IisReportable.java b/src/main/java/org/immregistries/iis/kernal/logic/ack/IisReportable.java index 78643aa9..c1c2addb 100644 --- a/src/main/java/org/immregistries/iis/kernal/logic/ack/IisReportable.java +++ b/src/main/java/org/immregistries/iis/kernal/logic/ack/IisReportable.java @@ -48,22 +48,7 @@ public IisReportable(Reportable reportable) { // source = ReportableSource.IIS; // } - private IisReportable(ProcessingException processingException) { - Hl7Location location = new Hl7Location(); - location.setSegmentId(processingException.getSegmentId()); - location.setFieldRepetition(processingException.getSegmentRepeat()); - location.setFieldPosition(processingException.getFieldPosition()); - hl7LocationList = List.of(location); - hl7ErrorCode = new CodedWithExceptions(); - hl7ErrorCode.setIdentifier("101"); - hl7ErrorCode.setNameOfCodingSystem("HL70357"); - hl7ErrorCode.setText("Required field missing"); - severity = IisReportableSeverity.findByCode(processingException.getErrorCode()); - applicationErrorCode = new CodedWithExceptions(); - reportedMessage = processingException.getLocalizedMessage(); - diagnosticMessage = processingException.getMessage(); - source = ReportableSource.IIS; - } + public CodedWithExceptions getApplicationErrorCode() { return applicationErrorCode; @@ -121,9 +106,6 @@ public void setSource(ReportableSource source) { this.source = source; } - public static IisReportable fromProcessingException(ProcessingException processingException) { - return new IisReportable(processingException); - } public static Hl7Location readErrorLocation(String path, String segmentid) { Hl7Location errorLocation = new Hl7Location(); @@ -217,4 +199,31 @@ public boolean isWarning() { return IisReportableSeverity.WARN.equals(this.severity); } + private IisReportable(ProcessingException processingException) { + Hl7Location location = new Hl7Location(); + location.setSegmentId(processingException.getSegmentId()); + location.setFieldRepetition(processingException.getSegmentRepeat()); + location.setFieldPosition(processingException.getFieldPosition()); + hl7LocationList = List.of(location); + hl7ErrorCode = new CodedWithExceptions(); + hl7ErrorCode.setIdentifier("101"); + hl7ErrorCode.setNameOfCodingSystem("HL70357"); + hl7ErrorCode.setText("Required field missing"); + severity = processingException.getErrorCode(); + applicationErrorCode = new CodedWithExceptions(); + reportedMessage = processingException.getLocalizedMessage(); + diagnosticMessage = processingException.getMessage(); + source = ReportableSource.IIS; + } + + public static IisReportable fromProcessingException(ProcessingException processingException) { + return new IisReportable(processingException); + } + + + public static IisReportable fromProcessingException(ProcessingResult processingResult) { + return new IisReportable(); + } + + } diff --git a/src/main/java/org/immregistries/iis/kernal/logic/ack/ProcessingResult.java b/src/main/java/org/immregistries/iis/kernal/logic/ack/ProcessingResult.java new file mode 100644 index 00000000..1e841997 --- /dev/null +++ b/src/main/java/org/immregistries/iis/kernal/logic/ack/ProcessingResult.java @@ -0,0 +1,67 @@ +package org.immregistries.iis.kernal.logic.ack; + +public enum ProcessingResult { +// +// ILLOGICAL_DATE_ERROR("1", "Original", "Illogical Date error", "11/5/14", "Not Specific", "Low", "Not recommended for use. Use a more granular application error instead.", "Date conflicts with another date in the message.", "n/a", "n/a", "", "", "", "", "", "", "", "", "", "Existed before 2/18/2020", "", "", "", "", ""), +// INVALID_DATE("2", "Original", "Invalid Date", "11/5/14", "Not Specific", "Low", "DT and DTM data types", " including formatting issues (not enough digit", " etc)", " bad characters and invalid values (eg. 20161342) but not conflicting dates (future dates", " etc) which will have more granular errors.", "Date is not valid or lacks required precision.", "Interface Analyst", "Review interface configuration or data base contents", "", "", "", "", "", "", "", "", "", "Existed before 2/18/2020", "", "", "", "", ""), +// ILLOGICAL_VALUE_ERROR("3", "Original", "Illogical Value Error", "11/5/14", "Not Specific", "Low", "Not recommended for use. Use a more granular application error instead.", "The value conflicts with other data in the message", "n/a", "n/a", "", "", "", "", "", "", "", "", "", "Existed before 2/18/2020", "", "", "", "", ""), +// INVALID_VALUE("4", "Original", "Invalid Value", "11/5/14", "Not Specific", "Low", "Number and text type data types", "The value is not valid. This applies for fields that are not associated with a table of values.", "Interface Analyst", "Review interface configuration or data base contents", "", "", "", "", "", "", "", "", "", "Existed before 2/18/2020", "", "", "", "", ""), +// TABLE_VALUE_NOT_FOUND("5", "Original", "Table value not found", "11/5/14", "Not Specific", "Low", "CE", " CNE", " CWE", " IS", " ID and PT data types", " this is a code mapping error.", "Indicates that the coded value is not found in the associated table. ", "Interface Analyst", "Review interface configuration or mapping tables", "", "", "", "", "", "", "", "", "", "Existed before 2/18/2020", "", "", "", "", ""), +// REQUIRED_OBSERVATION_MISSING("6", "Original", "Required observation missing", "11/5/14", "Not Specific", "Low", "Not recommended for use. Use a more granular application error instead.", "A required observation", " such as VFC eligibility status", " is missing.", "n/a", "n/a", "", "", "", "", "", "", "", "", "", "Existed before 2/18/2020", "", "", "", "", ""), +// REQUIRED_DATA_MISSING("7", "Original", "Required Data Missing", "11/5/14", "Not Specific", "Low", "Any critical field", "This error would be applied at the application level and may be used when data is sent but could not be interpreted.", "Interface Analyst", "Review interface configuration or mapping tables", "", "", "", "", "", "", "", "", "", "Existed before 2/18/2020", "", "", "", "", ""), +// CONFLICTING_START_AND_END_DATE_OF_ADMINISTRATION("2000", "Conflicting Data", "Conflicting Start and End Date of Administration", "10/23/17", "Active", "Low", "RXA-3;RXA-4", "Indicates that the dates in RXA-3 and RXA-4 are not identical.", "Interface Analyst", "Review interface configuration or data base contents", "", "", "", "MAY", "MAY", "", "MAY", "MAY", "MAY", "Existed before 2/18/2020", "", "", "", "", ""), +// CONFLICTING_ADMINISTRATION_DATE_AND_EXPIRATION_DATE("2001", "Conflicting Data", "Conflicting Administration Date and Expiration Date", "10/23/17", "Active", "Medium", "RXA-3;RXA-16", "Indicates a conflict between the administration date in RXA-3 and the expiration date in RXA-16. In other words it indicates that an expired vaccine was administered.", "Clinical team", "Review patient record to confirm accuracy of dates (and recall patient if necessary)", "", "", "SHOULD", "SHOULD NOT", "SHOULD", "MAY", "SHOULD NOT", "MAY", "MAY", "Existed before 2/18/2020", "Added Business rule", "", "", "", "BR 118 - DQA2013 - BR118 Vaccination Encounter Date should not be after the lot number expiration date."), +// String code; // Code +// String classCode; // Class +// String concept; // Concept +// String published; // Published +// String status; // Status +// String implementationPriority; // Implementation Priority +// String appliesTo; // Applies to +// String description; // Description +// String actor; // Actor +// String actionByActor; // Action by Actor +// String question; // Question +// String dataQualityIncomingOngoingAssessment; // Data Quality Incoming/Ongoing Assessment +// String iisDetectsIssue; // IIS Detects Issue +// String iisActionCreateErrWithErrorEInErr4; // IIS Action - Create ERR with Error (E) in ERR-4 +// String iisActionCreateErrWithWarningWInErr4; // IIS Action - Create ERR with Warning (W) in ERR-4 +// String iisActionCreateErrWithNoticeNInErr4; // IIS Action - Create ERR with Notice (N) in ERR-4 +// String iisActionCreateErrWithInformationalIInErr4; // IIS Action - Create ERR with Informational (I) in ERR-4 +// String iisActionDetectOnly; // IIS Action - Detect Only +// String iisActionDoNotDetect; // IIS Action - Do Not Detect +// String codeSource; // Code Source +// String groupNotes; // Group Notes +// String newCodeCreatedByGroup; // New Code Created by Group +// String crossReferencedCode; // Cross Referenced Code +// String createdDate; // Created Date +// String businessRule; // Business Rule +// +// ProcessingResult(String code, String classCode, String concept, String published, String status, String implementationPriority, String appliesTo, String description, String actor, String actionByActor, String question, String dataQualityIncomingOngoingAssessment, String iisDetectsIssue, String iisActionCreateErrWithErrorEInErr4, String iisActionCreateErrWithWarningWInErr4, String iisActionCreateErrWithNoticeNInErr4, String iisActionCreateErrWithInformationalIInErr4, String iisActionDetectOnly, String iisActionDoNotDetect, String codeSource, String groupNotes, String newCodeCreatedByGroup, String crossReferencedCode, String createdDate, String businessRule) { +// this.code = code; +// this.classCode = classCode; +// this.concept = concept; +// this.published = published; +// this.status = status; +// this.implementationPriority = implementationPriority; +// this.appliesTo = appliesTo; +// this.description = description; +// this.actor = actor; +// this.actionByActor = actionByActor; +// this.question = question; +// this.dataQualityIncomingOngoingAssessment = dataQualityIncomingOngoingAssessment; +// this.iisDetectsIssue = iisDetectsIssue; +// this.iisActionCreateErrWithErrorEInErr4 = iisActionCreateErrWithErrorEInErr4; +// this.iisActionCreateErrWithWarningWInErr4 = iisActionCreateErrWithWarningWInErr4; +// this.iisActionCreateErrWithNoticeNInErr4 = iisActionCreateErrWithNoticeNInErr4; +// this.iisActionCreateErrWithInformationalIInErr4 = iisActionCreateErrWithInformationalIInErr4; +// this.iisActionDetectOnly = iisActionDetectOnly; +// this.iisActionDoNotDetect = iisActionDoNotDetect; +// this.codeSource = codeSource; +// this.groupNotes = groupNotes; +// this.newCodeCreatedByGroup = newCodeCreatedByGroup; +// this.crossReferencedCode = crossReferencedCode; +// this.createdDate = createdDate; +// this.businessRule = businessRule; +// } +} diff --git a/src/main/java/org/immregistries/iis/kernal/mapping/VxuToBundleExperiment.java b/src/main/java/org/immregistries/iis/kernal/mapping/VxuToBundleExperiment.java index 1bee7e1d..49f0a99e 100644 --- a/src/main/java/org/immregistries/iis/kernal/mapping/VxuToBundleExperiment.java +++ b/src/main/java/org/immregistries/iis/kernal/mapping/VxuToBundleExperiment.java @@ -78,7 +78,7 @@ public Bundle convert(String message, ProcessingException pe = new ProcessingException( "Patient phone telecommunication type must be PRN ", "PID", 1, 13); if (!processingFlavorSet.contains(ProcessingFlavor.QUINZE)) { - pe.setErrorCode(IisReportableSeverity.WARN.getCode()); + pe.setErrorCode(IisReportableSeverity.WARN); } processingExceptionList.add(pe); } @@ -98,15 +98,13 @@ public Bundle convert(String message, } if (invalidCharFound) { ProcessingException pe = new ProcessingException( - "Patient phone number has unexpected character: " + invalidChar, "PID", 1, 13); - pe.setErrorCode(IisReportableSeverity.WARN.getCode()); + "Patient phone number has unexpected character: " + invalidChar, "PID", 1, 13, IisReportableSeverity.WARN); processingExceptionList.add(pe); } if (countNums != 10 || phone.getValue().startsWith("555") || phone.getValue().startsWith("0") || phone.getValue().startsWith("1")) { ProcessingException pe = new ProcessingException( - "Patient phone number does not appear to be valid", "PID", 1, 13); - pe.setErrorCode(IisReportableSeverity.WARN.getCode()); + "Patient phone number does not appear to be valid", "PID", 1, 13, IisReportableSeverity.WARN); processingExceptionList.add(pe); } } diff --git a/src/main/java/org/immregistries/iis/kernal/servlet/SoapController.java b/src/main/java/org/immregistries/iis/kernal/servlet/SoapController.java index 13f72cce..efebda65 100644 --- a/src/main/java/org/immregistries/iis/kernal/servlet/SoapController.java +++ b/src/main/java/org/immregistries/iis/kernal/servlet/SoapController.java @@ -56,7 +56,7 @@ public void process(SubmitSingleMessage ssm, PrintWriter out) throws Fault { for (String msh : messages) { if (!msh.isBlank()) { ackBuilder.append(handler.process("MSH|^~\\&|" + msh, tenant, null)); - ackBuilder.append("\r\n"); + ackBuilder.append("\n"); } } ack = ackBuilder.toString();