Get encounter

Fetches one or several encounters as a single ORUR01 message.

Transaction Specification

URL: GET /ws/rest/v1/patient/$<pat-ID>/encounter/$<enc-ID>

Description: Gets the encounter located at the specific URL.

Request

The GET request contains 2 required parameters in the URL.

Parameters

$<pat-ID>
This parameter represents a patient's ID for the patient that the encounter belongs to. It must be specified in the following format:
<ID-type>-<ID-number>
Where <ID-type> is one of the following:

  • NID - for a national identification number
  • MUT - Mutuelle number
  • RAM - Rama number
  • OMRS<fosaid of facility> - OpenMRS identifier eg, OMRS357-123456789

Eg. GET /ws/rest/v1/patient/NID-1234567890123/encounter/$<enc-ID>
$<enc-ID>

This is a uuid for the requested encounter. This is usually fetched as part of a URL from a query for encounters request.

Response

HTTP 200 - OK

HTTP response body will contain the encounter encoded in the HL7 v2.5 message defined below.

Data

From Maternal data mapping.xls and RapidSMS_SHRIntegrationDraft.docx (PRE, RISK and BIR messages)

Messaging specifications

The response body must contain a HL7 v2.5 ORU_R01 message that contain the encounter specified by the request parameter. The format is as follows:
See Query-or-SavePatientEncounter
For more detail for RapidSMS:
See RapidSMSMessaging Specs

Error

HTTP 500 - Server Error - If the server encountered an error.

HTTP 400 - Bad Request - If the HL7 v2.5 message is malformed.

Orchestration

This section describes how this transaction is orchestrated through the HIM (interoperability layer) in order to complete this transaction.

  1. Call Get Encounter

Sample Messaging Implementation

Scenario 1

Fetches one or several encounters as a single ORUR01 message. 

User Interface

TODO

Sample Request Message

GET https://hie.jembi.org:5000/ws/rest/v1/patient/NID-1234567890/encounter/321 HTTP/1.1

Sample Response Message 

A Sample message which contains one ORC, OBR and OBX is as follows - 

<?xml version="1.0"?>
<ORU_R01 xmlns="urn:hl7-org:v2xml"><?xml version="1.0"?>
<ORU_R01 xmlns="urn:hl7-org:v2xml">
    <MSH>
        <MSH.1>|</MSH.1>
        <MSH.2>^~\&amp;</MSH.2>	<!-- Fails without &amp; as an encoding character -->
        <MSH.4>
            <HD.1>LOCAL</HD.1>	<!-- This is a very importaint segment for OpenMRS. Based on OpenMRS logic, this field must be a concept source. it is later stored in the hl7inarchive and hl7inqueue tables --> -->
        </MSH.4>
        <MSH.6>
            <HD.1>Point of Care</HD.1>
        </MSH.6>
        <MSH.7>
            <TS.1>20120622071619</TS.1>
        </MSH.7>
        <MSH.9>
            <MSG.1>ORU</MSG.1>
            <MSG.2>R01</MSG.2>
            <MSG.3>ORU_R01</MSG.3>
        </MSH.9>
        <MSH.10>76c2b950-985a-477c-9594-bde5b855e47b</MSH.10> <!-- this is currently a randomly generated uuid - The query-or-savepatientencounter document says that this must be determined by implementers. Is a uuid suitable ? -->
        <MSH.11>
            <PT.1>D</PT.1>
            <PT.2>C</PT.2>
        </MSH.11>
        <MSH.12>
            <VID.1>2.5</VID.1>
            <VID.2>
                <CE.1>RWA</CE.1>
            </VID.2>
        </MSH.12>
    </MSH>
    <ORU_R01.PATIENT_RESULT>
        <ORU_R01.PATIENT>
            <PID>
                <PID.3>
                    <CX.1>1234</CX.1>
                    <CX.5>ECID</CX.5>
                </PID.3>
                <PID.5>
                    <XPN.1>
                        <FN.1>Patient</FN.1>
                    </XPN.1>
                </PID.5>
            </PID>
            <ORU_R01.VISIT>
                <PV1>
                    <PV1.2>0</PV1.2>
                    <PV1.3>
                        <PL.1>1</PL.1>
                        <PL.4>
                            <HD.1>Unknown Location</HD.1> <!-- I need this PV1 segment to try to provide a Location per each encounter. We cannot create OpenMRS encounters without specifying a Location -->
                        </PL.4>
                    </PV1.3>
                    <PV1.4>Admission type</PV1.4> <!-- Need this to specify an encounter type. I know this needs to go into the OBR, but its rather ambiguous. Can you please verify the query-or-save document for me, Please ? -->                    <PV1.7>
                        <XCN.1>2</XCN.1> <!-- i'm using this field to specify provider, as opposed to OBR 16. This is because OpenMRS 1.8.3 supports only one provider per Encounter, so I cant handle multiple providers via several OBR segments -->
                        <XCN.2>
                            <FN.1>Hornblower</FN.1>
                        </XCN.2>
                        <XCN.3>Horatio</XCN.3>
                    </PV1.7>
                    <PV1.19>
                        <CX.1>44</CX.1>
                    </PV1.19>
                    <PV1.44>
                        <TS.1>201206210242</TS.1>
                    </PV1.44>
                </PV1>
            </ORU_R01.VISIT>
        </ORU_R01.PATIENT>
        <ORU_R01.ORDER_OBSERVATION>
            <ORC> <!-- Please let me know what the ORC.1 (order control) value is for GET encounters -->
                <ORC.9>
                    <TS.1>201206220716</TS.1>
                </ORC.9>
                <ORC.12>
                    <XCN.1>2</XCN.1>
                    <XCN.2>
                        <FN.1>Hornblower</FN.1>
                    </XCN.2>
                    <XCN.3>Horatio</XCN.3>
                </ORC.12>
                <ORC.16>
                    <CE.1>XXX</CE.1> <!--This is a placeholder for order Control Code reason. The document says that this field "ties into provider registry. Future use, for Updates" -->
                </ORC.16>
            </ORC>
            <OBR>
                <OBR.1>2</OBR.1>
                <OBR.3>
                    <EI.1>44-univServiceId-20140601</EI.1>
                </OBR.3>
                <OBR.4>
                    <CE.1>univServiceId</CE.1> <!-- Im having some trouble understanding the spreadsheet specifications here. Could you please clarify this some more ? -->
                    <CE.2>univServIdName</CE.2>
                    <CE.3>codeSys</CE.3>
                </OBR.4>
                <OBR.7>
                    <TS.1>201406010000</TS.1>
                </OBR.7>
            </OBR>
            <ORU_R01.OBSERVATION>
                <OBX>
                    <OBX.1>0</OBX.1>
                    <OBX.2>NM</OBX.2>
                    <OBX.3>
                        <CE.1>1235</CE.1>
                        <CE.2>NUMBER OF WIVES</CE.2>
                        <CE.3>LOCAL</CE.3>
                    </OBX.3>
                    <OBX.5>2.0</OBX.5>
                    <OBX.6>
                        <CE.1># wives</CE.1>
                        <CE.3>ucum</CE.3>
                    </OBX.6>
                    <OBX.14>
                        <TS.1>20120621144326</TS.1>
                    </OBX.14>
                </OBX>
            </ORU_R01.OBSERVATION>
            <ORU_R01.OBSERVATION>
                <OBX>
                    <OBX.1>1</OBX.1>
                    <OBX.2>CE</OBX.2>
                    <OBX.3>
                        <CE.1>32</CE.1>
                        <CE.2>MALARIAL SMEAR</CE.2>
                        <CE.3>RW_CS</CE.3>
                    </OBX.3>
                    <OBX.5>
                        <CE.1>664</CE.1>
                        <CE.2>NEGATIVE</CE.2>
                        <CE.3>RW_CS</CE.3>
                    </OBX.5>
                    <OBX.14>
                        <TS.1>20120621144311</TS.1>
                    </OBX.14>
                </OBX>
            </ORU_R01.OBSERVATION>
        </ORU_R01.ORDER_OBSERVATION>
        <ORU_R01.ORDER_OBSERVATION>
            <OBR>
                <OBR.1>2</OBR.1>
                <OBR.3>
                    <EI.1>30-univServiceId-20140604</EI.1>
                </OBR.3>
                <OBR.4>
                    <CE.1>univServiceId</CE.1>
                    <CE.2>univServIdName</CE.2>
                    <CE.3>codeSys</CE.3>
                </OBR.4>
                <OBR.7>
                    <TS.1>201406040000</TS.1>
                </OBR.7>
            </OBR>
            <ORU_R01.OBSERVATION>
                <OBX>
                    <OBX.1>0</OBX.1>
                    <OBX.2>CE</OBX.2>
                    <OBX.3>
                        <CE.1>32</CE.1>
                        <CE.2>MALARIAL SMEAR</CE.2>
                        <CE.3>RW_CS</CE.3>
                    </OBX.3> <!-- Skipping OBX since its "not used initially" -->
                    <OBX.5>
                        <CE.1>664</CE.1>
                        <CE.2>NEGATIVE</CE.2>
                        <CE.3>RW_CS</CE.3>
                    </OBX.5> <!-- OBX 6 is mentioned only if there are units to specify -->
                    <OBX.14>
                        <TS.1>20120620214128</TS.1>
                    </OBX.14>
                </OBX>
            </ORU_R01.OBSERVATION>
        </ORU_R01.ORDER_OBSERVATION>
    </ORU_R01.PATIENT_RESULT>
</ORU_R01>