Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Current »

Transaction Specification

Description: Queries a patient's previous encounters restricted to a specific time frame or encounter id. This transaction return a list of encounters that fall within the query parameters or an error message in return if the transaction fails.

Message Type : Clinical Summary response

Input: Parameters as defined in external API for the function matching this one.
Output: An HL7 ORU_R01 containing the patient's encounters.

Sample Messaging Implemenation

Scenario 1

User requests patient encounters restricted by patient id, date range or encounter id.

Sample Request Message

GET /ws/rest/RHEA/patient/encounters?patientId=1234&idType=ECID

The GET request will contain the mandatory request parameters patient ID (the enterprise id per each patient) and the idType (ECID)

Currently, the SHR Adapter module supports only enterprise Id's (ECID).

However, the GET Encounter request may contain three optional request parameters. These are,

  • dateStart (format is dd-MM-yyyy)
  • dateEnd (format is dd-MM-yyyy)
  • encounterUniqueId (the UUID for a specific encounter object)

Currently, a GET request may be made for one or many encounters. If the request was made for several encounters, they are merged into a single ORU_R01 message through the use of multiple ORC, OBR and OBX segments.
For the above GET request to work, the SHR database MUST have a patient with ECID id number 1234

Sample Response Message 

The following message contains an encounter with four grouped observations and two ungrouped observations.

The grouped observations are included into one OBR, while the two remaining un grouped observations were included in a second OBR.

<?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>
        <MSH.4>
            <HD.1>Shared Health Record</HD.1>
        </MSH.4>
        <MSH.6>
            <HD.1>Point of Care</HD.1>
        </MSH.6>
        <MSH.7>
            <TS.1>20120630103233</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>f72dac3d-6e71-42a1-821a-0cbd4a4c5a87</MSH.10>
        <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.21>
            <EI.1>CLSM_V0.83</EI.1>
        </MSH.21>
    </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>
                    <XPN.2>John</XPN.2>
                </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>
                        </PL.4>
                    </PV1.3>
                    <PV1.4>ADULTINITIAL</PV1.4>
                    <PV1.7>
                        <XCN.1>2</XCN.1>
                        <XCN.2>
                            <FN.1>Hornblower</FN.1>
                        </XCN.2>
                        <XCN.3>Horatio</XCN.3>
                    </PV1.7>
                    <PV1.44>
                        <TS.1>201206260829</TS.1>
                    </PV1.44>
                </PV1>
            </ORU_R01.VISIT>
        </ORU_R01.PATIENT>
        <ORU_R01.ORDER_OBSERVATION>
            <ORC>
                <ORC.1>RE</ORC.1>
                <ORC.9>
                    <TS.1>201206301032</TS.1>
                </ORC.9>
                <ORC.12>
                    <XCN.1>2</XCN.1>
                </ORC.12>
                <ORC.16>
                    <CE.1>XXX</CE.1>
                    <CE.2>YYY</CE.2>
                    <CE.3>ZZZ</CE.3>
                </ORC.16>
            </ORC>
            <OBR>
                <OBR.1>0</OBR.1>
                <OBR.3>
                    <EI.1>104</EI.1>
                </OBR.3>
                <OBR.4>
                    <CE.2>ADULTINITIAL</CE.2>
                </OBR.4>
                <OBR.7>
                    <TS.1>202506230000</TS.1>
                </OBR.7>
                <OBR.16>
                    <XCN.1>2</XCN.1>
                    <XCN.2>
                        <FN.1>Hornblower</FN.1>
                    </XCN.2>
                    <XCN.3>Horatio</XCN.3>
                </OBR.16>
                <OBR.20>1</OBR.20>
                <OBR.21>Unknown Location</OBR.21>
            </OBR>
        </ORU_R01.ORDER_OBSERVATION>
        <ORU_R01.ORDER_OBSERVATION>
            <OBR>
                <OBR.1>1</OBR.1>
                <OBR.3>
                    <EI.1>104</EI.1>
                </OBR.3>
                <OBR.4>
                    <CE.1>1234</CE.1>
                    <CE.2>NEUTROPHILS</CE.2>
                    <CE.3>LOCAL</CE.3>
                </OBR.4>
                <OBR.18>0</OBR.18>
                <OBR.29>
                    <EIP.2>
                        <EI.3>104</EI.3>
                    </EIP.2>
                </OBR.29>
            </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>
                    <OBX.5>
                        <CE.1>664</CE.1>
                        <CE.2>NEGATIVE</CE.2>
                        <CE.3>RW_CS</CE.3>
                    </OBX.5>
                    <OBX.14>
                        <TS.1>20120626202953</TS.1>
                    </OBX.14>
                </OBX>
            </ORU_R01.OBSERVATION>
            <ORU_R01.OBSERVATION>
                <OBX>
                    <OBX.1>1</OBX.1>
                    <OBX.2>NM</OBX.2>
                    <OBX.3>
                        <CE.1>1234</CE.1>
                        <CE.2>NEUTROPHILS</CE.2>
                        <CE.3>LOCAL</CE.3>
                    </OBX.3>
                    <OBX.5>45.0</OBX.5>
                    <OBX.6>
                        <CE.1>%</CE.1>
                        <CE.3>ucum</CE.3>
                    </OBX.6>
                    <OBX.14>
                        <TS.1>20120626202953</TS.1>
                    </OBX.14>
                </OBX>
            </ORU_R01.OBSERVATION>
            <ORU_R01.OBSERVATION>
                <OBX>
                    <OBX.1>2</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>20120626202953</TS.1>
                    </OBX.14>
                </OBX>
            </ORU_R01.OBSERVATION>
            <ORU_R01.OBSERVATION>
                <OBX>
                    <OBX.1>3</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>1.0</OBX.5>
                    <OBX.6>
                        <CE.1># wives</CE.1>
                        <CE.3>ucum</CE.3>
                    </OBX.6>
                    <OBX.14>
                        <TS.1>20120626202953</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>104</EI.1>
                </OBR.3>
                <OBR.18>1</OBR.18>
                <OBR.29>
                    <EIP.2>
                        <EI.3>104</EI.3>
                    </EIP.2>
                </OBR.29>
            </OBR>
            <ORU_R01.OBSERVATION>
                <OBX>
                    <OBX.1>4</OBX.1>
                    <OBX.2>NM</OBX.2>
                    <OBX.3>
                        <CE.1>11638-4</CE.1>
                        <CE.2>TOTAL NUMBER OF CHILDREN SIRED</CE.2>
                        <CE.3>LOCAL</CE.3>
                    </OBX.3>
                    <OBX.5>5.0</OBX.5>
                    <OBX.6>
                        <CE.1># children</CE.1>
                        <CE.3>ucum</CE.3>
                    </OBX.6>
                    <OBX.14>
                        <TS.1>20120628220517</TS.1>
                    </OBX.14>
                </OBX>
            </ORU_R01.OBSERVATION>
            <ORU_R01.OBSERVATION>
                <OBX>
                    <OBX.1>5</OBX.1>
                    <OBX.2>NM</OBX.2>
                    <OBX.3>
                        <CE.1>987</CE.1>
                        <CE.2>BODY MASS INDEX</CE.2>
                        <CE.3>LOCAL</CE.3>
                    </OBX.3>
                    <OBX.5>100.0</OBX.5>
                    <OBX.6>
                        <CE.1>kg/m2</CE.1>
                        <CE.3>ucum</CE.3>
                    </OBX.6>
                    <OBX.14>
                        <TS.1>20120628220637</TS.1>
                    </OBX.14>
                </OBX>
            </ORU_R01.OBSERVATION>
        </ORU_R01.ORDER_OBSERVATION>
    </ORU_R01.PATIENT_RESULT>
</ORU_R01>

Sample error response messages

The following error respone messages will be returned for invalid inputs

1. User inputs an patient identifier type other than ECID

HTTP/1.1 400 Bad Request
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie: JSESSIONID=pvuaqamw4jxe;Path=/openmrs
Content-Type: text/xml; charset=utf-8
Content-Length: 153
Server: Jetty(6.1.10)
<?xml version="1.0"?><error><error_code>400</error_code><error_msg>ID type not recognized. Currently, RHEA Supports only ID type ECID</error_msg></err
or>

2. Patient does not exsist in the system

HTTP/1.1 400 Bad Request
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie: JSESSIONID=1tzifjq4qoi0k;Path=/openmrs
Content-Type: text/xml; charset=utf-8
Content-Length: 120
Server: Jetty(6.1.10)
<?xml version="1.0"?><error><error_code>400</error_code><error_msg>Error : failed to resolve patient</error_msg></error>

3. Date specified in the requests is incorrect (cannot be parsed)

HTTP/1.1 400 Bad Request
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie: JSESSIONID=9ihmy7i776rl;Path=/openmrs
Content-Type: text/xml; charset=utf-8
Content-Length: 136
Server: Jetty(6.1.10)
<?xml version="1.0"?><error><error_code>400</error_code><error_msg>java.text.ParseException: Unparseable date: "2-2"</error_msg></error>
  • No labels