| Normalizing and Mapping ADT Data / Mapping ADT Events | |
This section provides several examples of ADT event mappings from the adt-map.xml file.
The file has the following structure:
<?xml version="1.0" encoding="UTF-8"?> <adt-event-map> <event key="event_id"> <-- Define mapping rule here --></event> <event key="event_id"> <-- Define mapping rule here --></event> <event key="event_id"> <-- Define mapping rule here --></event> <event key="event_id"> <-- Define mapping rule here --></event> </adt-event-map>
<!-- A01 - Admit/Visit Notification -->
<event key="A01">
//Log the A01 event.
log.info("ADMIT: Patient '"+patient.getPatientId()+"'
to '"+l1.getLocationId()+"'.");
//If patient is already assigned to that location, log a warning.
if (l1.getPatientId() != null &&
!l1.getPatientId().equals(patient.getPatientId()))
{
log.warn("ADMIT: Patient '" + patient.getPatientId() + "'
to '" + l1.getLocationId() + "' : patient '" +
l1.getPatientId() + "' already assigned this location!");
}
//Set the patient location
patient.setLocationId(l1.getLocationId());
//Set the patient ID for the location
l1.setPatientId(patient.getPatientId());
</event>
<!-- A02 - Transfer a Patient -->
<event key="A02">
//Log the A02 event.
log.info("TRANSFER: Patient '"+patient.getPatientId()+"'
from '"+l2.getLocationId()+"' to '"+l1.getLocationId()+"'.");
//If patient in prior location is not equal to the transferred patient,
//log a warning.
if (l2.getLocationId()!= null &&
l2.getPatientId() != null &&
!l2.getPatientId().equals(patient.getPatientId()))
{
log.warn("TRANSFER: Patient '"+patient.getPatientId()+"'
from '"+l2.getLocationId()+"' : patient '"+l2.getPatientId()+"'
in room not equal to transfer!");
}
//If patient is already assigned to that location, log a warning.
if (l1.getLocationId()!= null &&
l1.getPatientId() != null &&
!l1.getPatientId().equals(patient.getPatientId()))
{
log.warn("TRANSFER: Patient '"+patient.getPatientId()+"'
to '"+l1.getLocationId()+"' : patient '"+l1.getPatientId()+"'
already assigned this location!");
}
//Set patient's prior location
patient.setPriorLocationId(l2.getLocationId());
//Set patient's new location
patient.setLocationId(l1.getLocationId());
//Set prior patient ID for prior location
l2.setPriorPatientId(patient.getPatientId());
//Clear patient ID for prior location
l2.setPatientId(null);
//Set patient ID for new location
l1.setPatientId(patient.getPatientId());
</event>
<!-- A03 - Discharge/End Visit -->
<event key="A03">
//Log the A03 event.
log.info("DISCHARGE: Patient '"+patient.getPatientId()+"'
from '"+l1.getLocationId()+"'.");
//If patient already discharged, do nothing.
if (patient.getLocationId() == null &&
patient.getPriorLocationId()!= null &&
patient.getPriorLocationId().equals(l1.getLocationId()))
{
log.debug("DISCHARGE: Patient '"+patient.getPatientId()+"'
from '"+l1.getLocationId()+"' ... already discharged (duplicate
discharge or outpatient disposition).");
return;
}
//If patient never assigned to location, do nothing.
if (patient.getLocationId() == null)
{
log.debug("DISCHARGE: Patient '"+patient.getPatientId()+"'
from '"+l1.getLocationId()+"' ... was never assigned to the room.");
return;
}
//If patient in location not equal to discharge patient,
//log a warning.
if (l1.getPatientId()!= null &&
!l1.getPatientId().equals(patient.getPatientId()))
{
log.warn("DISCHARGE: Patient '"+patient.getPatientId()+"'
from '"+l1.getLocationId()+"' : patient '"+l1.getPatientId()+"'
in room not equal to discharge!");
}
//Set patient's prior location
patient.setPriorLocationId(l1.getLocationId());
//Clear patient's location
patient.setLocationId(null);
//Set prior patient ID for the location
l1.setPriorPatientId(patient.getPatientId());
//Clear patient ID for location
l1.setPatientId(null);
</event>
<!-- A06 - Change an Outpatient to an Inpatient -->
<event key="A06">
//Log the A06 event.
log.info("OUTPATIENT TO INPATIENT: Patient '"+patient.getPatientId()+"'
to '"+l1.getLocationId()+"'.");
//If patient is already assigned to that location, log a warning.
if (l1.getPatientId() != null &&
!l1.getPatientId().equals(patient.getPatientId()))
{
log.warn("OUTPATIENT TO INPATIENT: Patient '" +
patient.getPatientId() + "' to '" + l1.getLocationId() + "'
: patient '" + l1.getPatientId() + "' already assigned this location!");
}
//Set patient's location
patient.setLocationId(l1.getLocationId());
//Set patient ID for location
l1.setPatientId(patient.getPatientId());
</event>
<!-- A07 - Change an Inpatient to an Outpatient -->
<event key="A07">
//Log the A07 event.
log.info("INPATIENT TO OUTPATIENT Patient '"+patient.getPatientId()+"'
from '"+l2.getLocationId()+"'.");
//If patient already discharged, do nothing.
if (patient.getLocationId() == null &&
patient.getPriorLocationId()!= null &&
patient.getPriorLocationId().equals(l2.getLocationId()))
{
log.debug("INPATIENT TO OUTPATIENT: Patient
'"+patient.getPatientId()+"' from '"+l2.getLocationId()+"'
... already discharged (duplicate discharge or outpatient
disposition).");
return;
}
//If patient never assigned to location, do nothing.
if (patient.getLocationId() == null)
{
log.debug("INPATIENT TO OUTPATIENT: Patient
'"+patient.getPatientId()+"' from '"+l2.getLocationId()+"'
... was never assigned to the room.");
return;
}
//If patient in location not equal to discharge patient,
//log a warning.
if (l2.getPatientId()!= null &&
!l2.getPatientId().equals(patient.getPatientId()))
{
log.warn("INPATIENT TO OUTPATIENT: Patient
'"+patient.getPatientId()+"' from '"+l2.getLocationId()+"'
: patient '"+l2.getPatientId()+"' in room not equal to
discharge!");
}
//Set patient's prior location
patient.setPriorLocationId(l2.getLocationId());
//Clear patient's location
patient.setLocationId(null);
//Set prior patient ID for location
l2.setPriorPatientId(patient.getPatientId());
//Clear patient ID for location
l2.setPatientId(null);
</event>
<!-- A08 - Update -->
<event key="A08">
//Log the A08 event.
log.info(
"UPDATE: Patient '"+patient.getPatientId()+"'
current/prior location '"+patient.getLocationId()+
"'/'"+patient.getPriorLocationId()+
"' current/prior message id '"+patient.getMessageId()+
"'/'"+patient.getPriorMessageId()+"'.");
//Set patient's location
patient.setLocationId(l1.getLocationId());
//Set patient ID for location
l1.setPatientId(patient.getPatientId());
</event>
<!-- A13 - Cancel Discharge -->
<event key="A13">
//Log the A13 event.
log.info("CANCEL DISCHARGE: Patient '"+patient.getPatientId()+
"' from '"+l1.getLocationId()+"'.");
//If patient is already assigned to that location, log a warning.
if (l1.getPatientId() != null &&
!l1.getPatientId().equals(patient.getPatientId()))
{
log.warn("CANCEL DISCHARGE: Patient '" + patient.getPatientId() +
"' from '" + l1.getLocationId() + "' : patient '" +
l1.getPatientId() + "' already assigned this location!");
}
//Set patient's location
patient.setLocationId(l1.getLocationId());
//Set patient ID for location
l1.setPatientId(patient.getPatientId());
</event>