Skip to content

Commit

Permalink
HL7 Service: Suppress Patient Updates by HL7 Messages of specified ty…
Browse files Browse the repository at this point in the history
…pes #4626
  • Loading branch information
vrindanayak committed Dec 5, 2024
1 parent 07dea3b commit ae770ac
Show file tree
Hide file tree
Showing 13 changed files with 110 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Generated by Apache Directory Studio on November 19, 2024, 2:23:52 PM
# Generated by Apache Directory Studio on December 5, 2024, 3:25:00 PM

# SCHEMA "DCM4CHEE-ARCHIVE"
dn: cn=dcm4chee-archive, ou=schema
objectclass: metaSchema
objectclass: top
cn: dcm4chee-archive
m-dependencies: dcm4che
m-dependencies: system
m-dependencies: dicom

dn: ou=attributetypes, cn=dcm4chee-archive, ou=schema
Expand Down Expand Up @@ -6500,6 +6501,19 @@ m-equality: caseExactMatch
m-syntax: 1.3.6.1.4.1.1466.115.121.1.15
m-singleValue: TRUE

dn: m-oid=1.2.40.0.13.1.15.110.3.487, ou=attributetypes, cn=dcm4chee-archive, ou
=schema
objectclass: metaAttributeType
objectclass: metaTop
objectclass: top
m-oid: 1.2.40.0.13.1.15.110.3.487
m-name: hl7NoPatientUpdateMessageType
m-description: Patient record will be not be updated by HL7 messages of specifie
d Message Type(s) (MessageType^TriggerEvent).
m-equality: caseExactMatch
m-substr: caseExactSubstringsMatch
m-syntax: 1.3.6.1.4.1.1466.115.121.1.15

dn: ou=comparators, cn=dcm4chee-archive, ou=schema
objectclass: organizationalUnit
objectclass: top
Expand Down Expand Up @@ -6585,6 +6599,7 @@ m-may: hl7ErrorLogFilePattern
m-may: hl7OutgoingLogFilePattern
m-may: hl7OutgoingErrorLogFilePattern
m-may: hl7NoPatientCreateMessageType
m-may: hl7NoPatientUpdateMessageType
m-may: hl7UseNullValue
m-may: hl7ImportReportAdjustIUID
m-may: hl7PrimaryAssigningAuthorityOfPatientID
Expand Down Expand Up @@ -7350,6 +7365,7 @@ m-may: hl7ErrorLogFilePattern
m-may: hl7OutgoingLogFilePattern
m-may: hl7OutgoingErrorLogFilePattern
m-may: hl7NoPatientCreateMessageType
m-may: hl7NoPatientUpdateMessageType
m-may: dcmUnzipVendorDataToURI
m-may: dcmPurgeQueueMessagePollingInterval
m-may: dcmPurgeQueueMessageFetchSize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2371,6 +2371,11 @@ attributeTypes: ( 1.2.40.0.13.1.15.110.3.486 NAME 'dcmCheckExistFilePath'
EQUALITY caseExactMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
attributeTypes: ( 1.2.40.0.13.1.15.110.3.487 NAME 'hl7NoPatientUpdateMessageType'
DESC 'Patient record will be not be updated by HL7 messages of specified Message Type(s) (MessageType^TriggerEvent).'
EQUALITY caseExactMatch
SUBSTR caseExactSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
objectClasses: ( 1.2.40.0.13.1.15.110.4.4 NAME 'dcmArchiveDevice'
DESC 'DICOM Archive Device related information'
SUP top AUXILIARY
Expand Down Expand Up @@ -2532,6 +2537,7 @@ objectClasses: ( 1.2.40.0.13.1.15.110.4.4 NAME 'dcmArchiveDevice'
hl7OutgoingLogFilePattern $
hl7OutgoingErrorLogFilePattern $
hl7NoPatientCreateMessageType $
hl7NoPatientUpdateMessageType $
dcmUnzipVendorDataToURI $
dcmPurgeQueueMessagePollingInterval $
dcmPurgeQueueMessageFetchSize $
Expand Down Expand Up @@ -2837,6 +2843,7 @@ objectClasses: ( 1.2.40.0.13.1.15.110.4.11 NAME 'dcmArchiveHL7Application'
hl7OutgoingLogFilePattern $
hl7OutgoingErrorLogFilePattern $
hl7NoPatientCreateMessageType $
hl7NoPatientUpdateMessageType $
hl7UseNullValue $
hl7ImportReportAdjustIUID $
hl7PrimaryAssigningAuthorityOfPatientID $
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2847,6 +2847,12 @@ attributetype ( 1.2.40.0.13.1.15.110.3.486 NAME 'dcmCheckExistFilePath'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )

attributetype ( 1.2.40.0.13.1.15.110.3.487 NAME 'hl7NoPatientUpdateMessageType'
DESC 'Patient record will be not be updated by HL7 messages of specified Message Type(s) (MessageType^TriggerEvent).'
EQUALITY caseExactMatch
SUBSTR caseExactSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )

objectclass ( 1.2.40.0.13.1.15.110.4.4 NAME 'dcmArchiveDevice'
DESC 'DICOM Archive Device related information'
SUP top AUXILIARY
Expand Down Expand Up @@ -3008,6 +3014,7 @@ objectclass ( 1.2.40.0.13.1.15.110.4.4 NAME 'dcmArchiveDevice'
hl7OutgoingLogFilePattern $
hl7OutgoingErrorLogFilePattern $
hl7NoPatientCreateMessageType $
hl7NoPatientUpdateMessageType $
dcmUnzipVendorDataToURI $
dcmPurgeQueueMessagePollingInterval $
dcmPurgeQueueMessageFetchSize $
Expand Down Expand Up @@ -3316,6 +3323,7 @@ objectclass ( 1.2.40.0.13.1.15.110.4.11 NAME 'dcmArchiveHL7Application'
hl7OutgoingLogFilePattern $
hl7OutgoingErrorLogFilePattern $
hl7NoPatientCreateMessageType $
hl7NoPatientUpdateMessageType $
hl7UseNullValue $
hl7ImportReportAdjustIUID $
hl7PrimaryAssigningAuthorityOfPatientID $
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2370,6 +2370,11 @@ olcAttributeTypes: ( 1.2.40.0.13.1.15.110.3.486 NAME 'dcmCheckExistFilePath'
EQUALITY caseExactMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
olcAttributeTypes: ( 1.2.40.0.13.1.15.110.3.487 NAME 'hl7NoPatientUpdateMessageType'
DESC 'Patient record will be not be updated by HL7 messages of specified Message Type(s) (MessageType^TriggerEvent).'
EQUALITY caseExactMatch
SUBSTR caseExactSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
olcObjectClasses: ( 1.2.40.0.13.1.15.110.4.4 NAME 'dcmArchiveDevice'
DESC 'DICOM Archive Device related information'
SUP top AUXILIARY
Expand Down Expand Up @@ -2531,6 +2536,7 @@ olcObjectClasses: ( 1.2.40.0.13.1.15.110.4.4 NAME 'dcmArchiveDevice'
hl7OutgoingLogFilePattern $
hl7OutgoingErrorLogFilePattern $
hl7NoPatientCreateMessageType $
hl7NoPatientUpdateMessageType $
dcmUnzipVendorDataToURI $
dcmPurgeQueueMessagePollingInterval $
dcmPurgeQueueMessageFetchSize $
Expand Down Expand Up @@ -2836,6 +2842,7 @@ olcObjectClasses: ( 1.2.40.0.13.1.15.110.4.11 NAME 'dcmArchiveHL7Application'
hl7OutgoingLogFilePattern $
hl7OutgoingErrorLogFilePattern $
hl7NoPatientCreateMessageType $
hl7NoPatientUpdateMessageType $
hl7UseNullValue $
hl7ImportReportAdjustIUID $
hl7PrimaryAssigningAuthorityOfPatientID $
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ protected void storeTo(Device device, JsonWriter writer) {
writer.writeNotNullOrDef("hl7ScheduledStationAETInOrder", arcDev.getHL7ScheduledStationAETInOrder(),
null);
writer.writeNotEmpty("hl7NoPatientCreateMessageType", arcDev.getHL7NoPatientCreateMessageTypes());
writer.writeNotEmpty("hl7NoPatientUpdateMessageType", arcDev.getHL7NoPatientUpdateMessageTypes());
writer.writeNotNullOrDef("dcmAuditUnknownStudyInstanceUID",
arcDev.getAuditUnknownStudyInstanceUID(), ArchiveDeviceExtension.AUDIT_UNKNOWN_STUDY_INSTANCE_UID);
writer.writeNotNullOrDef("dcmAuditUnknownPatientID",
Expand Down Expand Up @@ -1973,6 +1974,9 @@ private void loadFrom(ArchiveDeviceExtension arcDev, JsonReader reader, Configur
case "hl7NoPatientCreateMessageType":
arcDev.setHL7NoPatientCreateMessageTypes(reader.stringArray());
break;
case "hl7NoPatientUpdateMessageType":
arcDev.setHL7NoPatientUpdateMessageTypes(reader.stringArray());
break;
case "dcmAuditUnknownStudyInstanceUID":
arcDev.setAuditUnknownStudyInstanceUID(reader.stringValue());
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public void storeTo(HL7Application hl7App, Device device, JsonWriter writer) {
writer.writeNotNullOrDef("hl7ScheduledProtocolCodeInOrder", ext.getHL7ScheduledProtocolCodeInOrder(), null);
writer.writeNotNullOrDef("hl7ScheduledStationAETInOrder", ext.getHL7ScheduledStationAETInOrder(), null);
writer.writeNotEmpty("hl7NoPatientCreateMessageType", ext.getHL7NoPatientCreateMessageTypes());
writer.writeNotEmpty("hl7NoPatientUpdateMessageType", ext.getHL7NoPatientUpdateMessageTypes());
writer.writeNotNull("hl7UseNullValue", ext.getHL7UseNullValue());
writer.writeNotNullOrDef("hl7PrimaryAssigningAuthorityOfPatientID",
ext.getHL7PrimaryAssigningAuthorityOfPatientID(), null);
Expand Down Expand Up @@ -171,6 +172,9 @@ private void loadFrom(ArchiveHL7ApplicationExtension ext, JsonReader reader, Con
case "hl7NoPatientCreateMessageType":
ext.setHL7NoPatientCreateMessageTypes(reader.stringArray());
break;
case "hl7NoPatientUpdateMessageType":
ext.setHL7NoPatientUpdateMessageTypes(reader.stringArray());
break;
case "hl7UseNullValue":
ext.setHL7UseNullValue(reader.booleanValue());
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,8 @@ protected void storeTo(ConfigurationChanges.ModifiedObject ldapObj, Device devic
ext.getHL7ScheduledStationAETInOrder(), null);
LdapUtils.storeNotEmpty(ldapObj, attrs, "hl7NoPatientCreateMessageType",
ext.getHL7NoPatientCreateMessageTypes());
LdapUtils.storeNotEmpty(ldapObj, attrs, "hl7NoPatientUpdateMessageType",
ext.getHL7NoPatientUpdateMessageTypes());
LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dcmAuditUnknownStudyInstanceUID",
ext.getAuditUnknownStudyInstanceUID(), ArchiveDeviceExtension.AUDIT_UNKNOWN_STUDY_INSTANCE_UID);
LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dcmAuditUnknownPatientID",
Expand Down Expand Up @@ -812,6 +814,7 @@ protected void loadFrom(Device device, Attributes attrs) throws NamingException
ext.setHL7ScheduledStationAETInOrder(LdapUtils.enumValue(ScheduledStationAETInOrder.class,
attrs.get("hl7ScheduledStationAETInOrder"), null));
ext.setHL7NoPatientCreateMessageTypes(LdapUtils.stringArray(attrs.get("hl7NoPatientCreateMessageType")));
ext.setHL7NoPatientUpdateMessageTypes(LdapUtils.stringArray(attrs.get("hl7NoPatientUpdateMessageType")));
ext.setAuditUnknownStudyInstanceUID(LdapUtils.stringValue(
attrs.get("dcmAuditUnknownStudyInstanceUID"), ArchiveDeviceExtension.AUDIT_UNKNOWN_STUDY_INSTANCE_UID));
ext.setAuditUnknownPatientID(LdapUtils.stringValue(
Expand Down Expand Up @@ -1370,6 +1373,8 @@ protected void storeDiffs(ConfigurationChanges.ModifiedObject ldapObj, Device pr
aa.getHL7ScheduledStationAETInOrder(), bb.getHL7ScheduledStationAETInOrder(), null);
LdapUtils.storeDiff(ldapObj, mods, "hl7NoPatientCreateMessageType",
aa.getHL7NoPatientCreateMessageTypes(), bb.getHL7NoPatientCreateMessageTypes());
LdapUtils.storeDiff(ldapObj, mods, "hl7NoPatientUpdateMessageType",
aa.getHL7NoPatientUpdateMessageTypes(), bb.getHL7NoPatientUpdateMessageTypes());
LdapUtils.storeDiffObject(ldapObj, mods, "dcmAuditUnknownStudyInstanceUID",
aa.getAuditUnknownStudyInstanceUID(), bb.getAuditUnknownStudyInstanceUID(),
ArchiveDeviceExtension.AUDIT_UNKNOWN_STUDY_INSTANCE_UID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public void storeTo(ConfigurationChanges.ModifiedObject ldapObj, HL7Application
LdapUtils.storeNotNullOrDef(ldapObj, attrs, "hl7ScheduledStationAETInOrder",
ext.getHL7ScheduledStationAETInOrder(), null);
LdapUtils.storeNotEmpty(ldapObj, attrs, "hl7NoPatientCreateMessageType", ext.getHL7NoPatientCreateMessageTypes());
LdapUtils.storeNotEmpty(ldapObj, attrs, "hl7NoPatientUpdateMessageType", ext.getHL7NoPatientUpdateMessageTypes());
LdapUtils.storeNotNullOrDef(ldapObj, attrs, "hl7UseNullValue", ext.getHL7UseNullValue(), null);
LdapUtils.storeNotNullOrDef(ldapObj, attrs, "hl7PrimaryAssigningAuthorityOfPatientID",
ext.getHL7PrimaryAssigningAuthorityOfPatientID(), null);
Expand Down Expand Up @@ -168,6 +169,7 @@ public void loadFrom(HL7Application hl7App, Attributes attrs)
ext.setHL7ScheduledStationAETInOrder(LdapUtils.enumValue(ScheduledStationAETInOrder.class,
attrs.get("hl7ScheduledStationAETInOrder"), null));
ext.setHL7NoPatientCreateMessageTypes(LdapUtils.stringArray(attrs.get("hl7NoPatientCreateMessageType")));
ext.setHL7NoPatientUpdateMessageTypes(LdapUtils.stringArray(attrs.get("hl7NoPatientUpdateMessageType")));
ext.setHL7UseNullValue(LdapUtils.booleanValue(attrs.get("hl7UseNullValue"), null));
ext.setHL7PrimaryAssigningAuthorityOfPatientID(LdapArchiveConfiguration.toIssuer(
LdapUtils.stringValue(attrs.get("hl7PrimaryAssigningAuthorityOfPatientID"), null)));
Expand Down Expand Up @@ -262,6 +264,8 @@ public void storeDiffs(ConfigurationChanges.ModifiedObject ldapObj, HL7Applicati
aa.getHL7ScheduledStationAETInOrder(), bb.getHL7ScheduledStationAETInOrder(), null);
LdapUtils.storeDiff(ldapObj, mods, "hl7NoPatientCreateMessageType",
aa.getHL7NoPatientCreateMessageTypes(), bb.getHL7NoPatientCreateMessageTypes());
LdapUtils.storeDiff(ldapObj, mods, "hl7NoPatientUpdateMessageType",
aa.getHL7NoPatientUpdateMessageTypes(), bb.getHL7NoPatientUpdateMessageTypes());
LdapUtils.storeDiffObject(ldapObj, mods, "hl7UseNullValue",
aa.getHL7UseNullValue(), bb.getHL7UseNullValue(), null);
LdapUtils.storeDiffObject(ldapObj, mods, "hl7PrimaryAssigningAuthorityOfPatientID",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ public class ArchiveDeviceExtension extends DeviceExtension {
private final List<MWLIdleTimeout> mwlIdleTimeoutList = new ArrayList<>();
private final List<MWLImport> mwlImportList = new ArrayList<>();
private final LinkedHashSet<String> hl7NoPatientCreateMessageTypes = new LinkedHashSet<>();
private final LinkedHashSet<String> hl7NoPatientUpdateMessageTypes = new LinkedHashSet<>();
private final Map<String,String> xRoadProperties = new HashMap<>();
private final Map<String,String> impaxReportProperties = new HashMap<>();
private final Map<String, String> importReportTemplateParams = new HashMap<>();
Expand Down Expand Up @@ -1808,6 +1809,19 @@ public boolean isHL7NoPatientCreateMessageType(String messageType) {
return hl7NoPatientCreateMessageTypes.contains(messageType);
}

public String[] getHL7NoPatientUpdateMessageTypes() {
return hl7NoPatientUpdateMessageTypes.toArray(new String[0]);
}

public void setHL7NoPatientUpdateMessageTypes(String... messageTypes) {
hl7NoPatientUpdateMessageTypes.clear();
hl7NoPatientUpdateMessageTypes.addAll(Arrays.asList(messageTypes));
}

public boolean isHL7NoPatientUpdateMessageType(String messageType) {
return hl7NoPatientUpdateMessageTypes.contains(messageType);
}

public Map<String, String> getXRoadProperties() {
return xRoadProperties;
}
Expand Down Expand Up @@ -3896,6 +3910,8 @@ public void reconfigure(DeviceExtension from) {
hl7OrderSPSStatuses.putAll(arcdev.hl7OrderSPSStatuses);
hl7NoPatientCreateMessageTypes.clear();
hl7NoPatientCreateMessageTypes.addAll(arcdev.hl7NoPatientCreateMessageTypes);
hl7NoPatientUpdateMessageTypes.clear();
hl7NoPatientUpdateMessageTypes.addAll(arcdev.hl7NoPatientUpdateMessageTypes);
compressionRules.clear();
compressionRules.addAll(arcdev.compressionRules);
studyRetentionPolicies.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public class ArchiveHL7ApplicationExtension extends HL7ApplicationExtension{
private final ArrayList<HL7StudyRetentionPolicy> hl7StudyRetentionPolicies = new ArrayList<>();
private final EnumMap<SPSStatus,HL7OrderSPSStatus> hl7OrderSPSStatuses = new EnumMap<>(SPSStatus.class);
private final LinkedHashSet<String> hl7NoPatientCreateMessageTypes = new LinkedHashSet<>();
private final LinkedHashSet<String> hl7NoPatientUpdateMessageTypes = new LinkedHashSet<>();
private final Map<String, String> importReportTemplateParams = new HashMap<>();

public ArchiveDeviceExtension getArchiveDeviceExtension() {
Expand Down Expand Up @@ -153,6 +154,8 @@ public void reconfigure(HL7ApplicationExtension src) {
hl7OrderSPSStatuses.putAll(arcapp.hl7OrderSPSStatuses);
hl7NoPatientCreateMessageTypes.clear();
hl7NoPatientCreateMessageTypes.addAll(arcapp.hl7NoPatientCreateMessageTypes);
hl7NoPatientUpdateMessageTypes.clear();
hl7NoPatientUpdateMessageTypes.addAll(arcapp.hl7NoPatientUpdateMessageTypes);
importReportTemplateParams.clear();
importReportTemplateParams.putAll(arcapp.importReportTemplateParams);
}
Expand Down Expand Up @@ -287,6 +290,21 @@ public boolean isHL7NoPatientCreateMessageType(String messageType) {
: hl7NoPatientCreateMessageTypes.contains(messageType);
}

public String[] getHL7NoPatientUpdateMessageTypes() {
return hl7NoPatientUpdateMessageTypes.toArray(new String[0]);
}

public void setHL7NoPatientUpdateMessageTypes(String... messageTypes) {
hl7NoPatientUpdateMessageTypes.clear();
hl7NoPatientUpdateMessageTypes.addAll(Arrays.asList(messageTypes));
}

public boolean isHL7NoPatientUpdateMessageType(String messageType) {
return hl7NoPatientUpdateMessageTypes.isEmpty()
? getArchiveDeviceExtension().isHL7NoPatientUpdateMessageType(messageType)
: hl7NoPatientUpdateMessageTypes.contains(messageType);
}

public Boolean getHL7UseNullValue() {
return hl7UseNullValue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ public interface PatientMgtContext {

boolean isNoPatientCreate();

boolean isNoPatientUpdate();

Collection<IDWithIssuer> getPatientIDs();

Attributes getAttributes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,16 @@ public boolean isNoPatientCreate() {
return arcHL7App != null && arcHL7App.isHL7NoPatientCreateMessageType(msg.msh().getMessageType());
}

@Override
public boolean isNoPatientUpdate() {
if (hl7app == null)
return false;

ArchiveHL7ApplicationExtension arcHL7App =
hl7app.getHL7ApplicationExtension(ArchiveHL7ApplicationExtension.class);
return arcHL7App != null && arcHL7App.isHL7NoPatientUpdateMessageType(msg.msh().getMessageType());
}

@Override
public Collection<IDWithIssuer> getPatientIDs() {
return patientIDs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ public Patient updatePatient(PatientMgtContext ctx)
}
return createPatient(ctx);
}
if (ctx.isNoPatientUpdate()) {
logSuppressPatientUpdate(ctx);
return pat;
}
updatePatient(pat, ctx);
return pat;
}
Expand All @@ -149,6 +153,10 @@ private void logSuppressPatientCreate(PatientMgtContext ctx) {
LOG.info("{}: Suppress creation of Patient[id={}] by {}", ctx, ctx.getPatientIDs(), ctx.getUnparsedHL7Message().msh());
}

private void logSuppressPatientUpdate(PatientMgtContext ctx) {
LOG.info("{}: Suppress update of Patient[id={}] by {}", ctx, ctx.getPatientIDs(), ctx.getUnparsedHL7Message().msh());
}

public Patient findPatient(Collection<IDWithIssuer> pids) {
Collection<Patient> list = findPatients(pids);
if (list.isEmpty())
Expand Down

0 comments on commit ae770ac

Please sign in to comment.