Thursday, 31 January 2013

ADT A07 Change Inpatient to Outpatient


In hospitals,there might be a need to change an Inpatient to Outpatient. This happens when patient admitted as inpatient is no longer admitted but still receiving care/services.

This is also required when an outpatient is admitted as inpatient by mistake and records need to be corrected.
HL7 has provided this trigger event (ADT A07 Inpatient to Outpatient) to perform this task.
This trigger event (A07 Inpatient to Outpatient) signals receiving system to change patient's status from Inpatient/admitted to Outpatient/Pre admitted/Not admitted.
I will provide basic details of implementing A07 into your system, but please contact source system administrator before implementing your interface.
There could be many fields in HL7 message or in your system which can distinguish an inpatient  & an outpatient (This depends on your EMR configuration or system which mangaes your Admission/Discharge/Transfer).
Common fields are PatientClass, PatientType, AccountStatus, AssignedPatientLocation etc. and all of these values would be very meaningful for Healthcare Systems.
Let me start with a scenario where we need to change an Inpatient to Outpatient
Suppose Patient A is registered in a system as Inpatient.
We will assume that while admitting (A01) we have received following values in PV1 segment of HL7 message
PatientClass (PV1.2) - I (Important & Requred field)
PatientType (PV1.18) - IPE
AccountStatus (PV1.41) - ADM
Note: There will also be other fields for inpatient like Admitting Physician, Hospital Service etc, but I don't want to include those in this discussion

So, when our system receives this registration message it will admit a new patient and data in database will look like this
(I have only mentioned fields which are required to describe A07)
PV1.2 AssignedPatientLocation PV1.3 PV1.18 PV1.41 AccomodationCode PV2.2 PV2.3
PatientClass PointOfCare Room Bed PatientType AccountStatus Id Text AdmitReason
I IR 101 1 IPE ADM S-P Semi-Private Appendicitis

Now, let's assume that we have received an A07 HL7 message for same patient with following values in PV1 segment
PatientClass (PV1.2) - P (Important & Requred field)
PatientType (PV1.18) - XX
AccountStatus (PV1.41) - PRE
So when we process this message, system will change the values in database as following
PV1.2 AssignedPatientLocation PV1.3 PV1.18 PV1.41 AccomodationCode PV2.2 PV2.3
PatientClass PointOfCare Room Bed PatientType AccountStatus Id Text AdmitReason
P UR XX PRE

You can see, now, the system will identify same patient as an Pre-Admit patient. And very importantly we haven't changed episode of care. So, patient can continue receiving care services in this same episode.

Important

Please get clarification from your source system administrator on following:
What should be done if AssignedPatientLocation is not availalbe in A07 HL7 message? Usually while admitting a patient as inpatient, patient should be allocated a physical location.

Note:

ADT messages always contain current information except MRG segments
Process all the fieds in PID & PV1 & other segments in message as normal A08 upate message unless specified by source system.
It is recommended not to send any updated fields except required ones in A07. A08 should be used to update any other fields.
Patient's Current Physical Location will be in PV1.3 & prior location will be in PV1.6

ADT A06 Change Outpatient to Inpatient


In hospitals,there might be a need to admit an outpatient as inpatient. This happens when patient comes as outpatient and after diagnosis, doctor decides to admit patient.

This is also required when an inpatient is admitted as outpatient by mistake and records need to be corrected.

HL7 has provided this trigger event (ADT A06 Outpatient to Inpatient) to perform this task.
This trigger event (A06 outpatient to inpatient) signals receiving system to change patient's status from outpatient to inpatient.

I will provide basic details of implementing A06 into your system, but please contact source system administrator before implementing your interface.

There could be many fields in HL7 message or in your system which can distinguish an inpatient  & an outpatient (This depends on your EMR configuration or system which mangaes your Admission/Discharge/Transfer).

Common fields are PatientClass, PatientType, AccountStatus, AssignedPatientLocation etc. and all of these values would be very meaningful for Healthcare Systems.

Let me start with a scenario where we need to change an outpatient to inpatient

Suppose Patient A is registered in a system as outpatient.
We will assume that while registration (A04) we have received following values in PV1 segment of HL7 message
PatientClass (PV1.2) - O (Important & Requred field)
PatientType (PV1.18) - OPE
AccountStatus (PV1.41) - REG
So, when our system receives this registration message it will register a new patient and data in database will look like this
(I have only mentioned fields which are required to describe A06)

PV1.2 AssignedPatientLocation PV1.3 PV1.18 PV1.41 AccomodationCode PV2.2 PV2.3
PatientClass PointOfCare Room Bed PatientType AccountStatus Id Text AdmitReason
O UR OPE REG

Now, let's assume that we have received an A06 HL7 message for same patient with following values in PV1 segment

PatientClass (PV1.2) - I (Important & Requred field)
PatientType (PV1.18) - INE
AccountStatus (PV1.41) - ADM

Note: There will also be other fields for inpatient like Admitting Physician, Hospital Service etc, but I don't want to include these in this article

So when we process this message, system will change the values in database as following

PV1.2 AssignedPatientLocation PV1.3 PV1.18 PV1.41 AccomodationCode PV2.2 PV2.3
PatientClass PointOfCare Room Bed PatientType AccountStatus Id Text AdmitReason
I IR 101 1 IPE ADM S-P Semi-Private Appendicitis

You can see, now, the system will identify same patient as an Inpatient. And very importantly we haven't changed episode of care. So, patient can continue receiving care services in this same episode as inpatient.

Important

Please get clarification from your source system administrator on following:
What should be done if AssignedPatientLocation is not availalbe in A06 message? Usually while admitting a patient as inpatient, patient should be allocated a physical location.

Note:

ADT messages always contain current information except MRG segments
Process all the fieds in PID & PV1 & other segments in message as normal A08 upate message unless specified by source system.
It is recommended not to send any updated fields except required ones in A06. A08 should be used to update any other fields.
Patient's Current Physical Location will be in PV1.3 & prior location will be in PV1.6

Wednesday, 30 January 2013

ADT A17 - Bed Swap


In hospitals, there might be a need to swap beds between two patiens. HL7 has provided this trigger event (A17 Bed Swap) to perform this task.
This is a special kind of message which contains two different Patient ID & Visit segments for both patients.


In this article I will discuss how to implement this message & will request readers to add to this or correct me.

HL7 has provided this message type to swap beds and there is a common way to treat this message. But before implementing any interface for this please contact your client or administrator of source system which is sending this message.

Before I start how I have handled A17 (Bed Swap) messages in my implementations, let me describe some sematics of A17 (Bed Swap) messages:
Suppose, two patients A & B had a bed exchange and we have received A17 trigger to reflect this in our system.

These messages contain two PID segments containing patient identifiers & demographics
 first one will be of Patient A and second one will be of Patient B.  These segments are important to indentify two patients who swap or exchange beds.

Same way we will have two PV1 segments containing visit information.
First PV1 will contain Patiet A's visit details and second PV1 will contain Patient B's visit details. These segments are important to identify both patient's current & prior locations.

We can also have optional PV2s for both patients. I don't want to include PV2 in scope of this article, but it can surely provide some valuable comments/reasons for bed transfers.
Now, lets discuss implementation:
Suppose we have two patients A & B registered in our system as inpatient.
Note: If you find A17 where any of the PV1s says outpatient or preadmit, please clarify it with the administrator of source system which is sending the feed.

Here is a sample PV1 data of both of this patients in our database

AssignedPatientLocation PriorPatientLocation
Patient PatientClass PointOfCare Room Bed PointOfCare Room Bed
Patient A I PTC 353 1
Patient B I PTC 354 2

Now, we have received A17 message to swap beds of A & B
After processing this A17, database values will changes as following:

AssignedPatientLocation PriorPatientLocation
Patient PatientClass PointOfCare Room Bed PointOfCare Room Bed
Patient A I PTC 354 2 PTC 353 1
Patient B I PTC 353 1 PTC 354 2

Can you see the magic of A17? Please see the AssignedPatientLocation & PriorPatientLocation columns and match them with previous data.
Before A17, Patient A's location was Room 353 Bed 1 and Patient B's location was Room 354 Bed 2
Now After A17, Patient A's location is Room 354 Bed 2 (Patient B's prior location) and Patient B's location is Room 353 Bed 1 (Patient A's prior Location)

Important
Please get clarification from your source system administrator on following:

A17 message with PID Segment count != 2 (these should be skipped with an error)
A17 message with PV1 Segment count != 2 (these should be skipped with an error)
A17 message with both PID's having same patient ID (these should be skipped with an error)
What to do if we receive an A17 message for a patient which is not registered in our system? (skip the message or register the patient and continue)

Note:
ADT messages always contain current information
Process all the fieds in PID & PV1 & other segments in message as normal A08 upate message unless specified by source system.
Patient's Current Physical Location will be in PV1.3 & prior location will be in PV1.6

Let me quickly discuss why do we need A17 when we have A02 (transfer) message.

With A02, bed swap will become a three step process.
This is very similar to swap algorithm that we learn while learning basics of computer programming:

To swap values between variables A & B
have temporary variable T

T = A
A = B
B = T

Now, I will let readers to think how can we swap beds with A02 message and why we have A17?

Sample Immunization Records Blockchain using Hyperledger Composer

This is basic and sample Blockchain implementation of Immunization Records using Hyperledger Composer.  Source Code available at:  https...