Developer documentation‎ > ‎HL7 API‎ > ‎Roadmap‎ > ‎

QRY A19 - Registration Status

QRY^A19: Query for patient registration status

Status

In development. API spec subject to change.

Overview


This query can be used to retrieve a list of patients including registration status who are associated with your Organisation. A patient will be returned if there is a consent record (whether active or inactive) for any Team in your organisation.

Note: Self-registered patients that have not been activated will not be returned from an A19 query.

Definition

Segment Field Component Description Example Data Model
MSH Message header. This conforms to PKB's standard definition.  
QRD

Query definition
 

[ QRD-1 ]
Timestamp. We do not process this field. However, we will echo the value back to you in our response.
 
  [ QRD-4 ]   Query ID. We do not process this field. However, we will echo the value back to you in our response.    
  [QRD-7]    Quantity Limited Request    
    QRD-7.1 The result size to return before a DSC segment is introduced.  10000  
    QRD-7.2 Must be 'RD'  RD  

[ QRD-9 ]
"STA" to request results for all patients including registration status custom segment.
 


QRD-9.1 What subject filter STA  
   [QRD-11]    Registration status filter.    
     QRD-11.1   

An optional registration status to filter results by when QRD.9.1 = STA.


Options:

REGISTERED


If start timestamp (QRF.2.1) is specified then the query behaviour is to find patients where current registration status = specified value and where that status was set on or after the timestamp specified in QRF.2.1.


If there is no date restriction specified within the QRF segment then this is an open status query and results will be returned where current registration status = the value specified.

 REGISTERED  
[ QRF ]

Query filter
 

[ QRF-2 ]
Start timestamp. This will restrict the returned results to those patients with a registration status set on or after this date
 


QRF-2.1 Start timestamp (inclusive).  201807012352  
   [QRF-5]   Last seen patient identifier.  If provided in conjunction with QRF.2.1 then the first result in the response will be the patient record matching QRF.5.1 (if applicable to overall search criteria).  This is intended to be used after a previous query response that was truncated with a DSC segment.    
     QRF-5.1  Public ID (UUID) for the corresponding patient 1fd2a0f6-890b-4f68-9fa1-65342f649771  

Examples

PKB supports a few variations on the registration status (STA) query:

1. 
An open registration status query (return all patients including registration status) for your organisation
MSH|App|SendingInst|HL7API|PKB|20190110140316||QRY^A19|ABC0000000001|P|2.4
QRD||||_queryId|||||STA

1. An open registration status query (return all patients including registration status) for your organisation. Limit results to 1000 records per query.
MSH|App|SendingInst|HL7API|PKB|20190110140316||QRY^A19|ABC0000000001|P|2.4
QRD||||_queryId|||1000^RD||STA

3. 
A specific registration status query (return all patients with a registration state set to QRD.11) for your organisation
MSH|App|SendingInst|HL7API|PKB|20190110140316||QRY^A19|ABC0000000001|P|2.4
QRD||||_queryId|||||STA|REGISTERED

4. 
A timestamp start and registration status specific query (return all patient records with a registration state set to and remaining at value specified in QRD.11 since defined timestamp -- use the QRF filter to specify timestamp range).
MSH|^~\&|App|SendingInst|HL7API|PKB|20190110140316||QRY^A19|ABC0000000001|P|2.4
QRD||||_queryId|||||STA||REGISTERED
QRF||201811090000

Response

PKB will respond with an ADR^A19 message including a custom ZID segment and potentially a DSC continuation pointer segment.  The returned patients will be sorted first by timestamp of change, and second by patient ID

ADR^A19: Query response to a Registration Status 'STA' query

Overview

This message returns the patient information requested by a QRY^A19 message when QRD-9.1 is 'STA'.

Definition

Segment Field Component Description Example Data Model
MSH

Message header. This conforms to PKB's standard definition.
 
MSA

Message acknowledgement
 

MSA-1
Acknowledgement code
 


MSA-1.1 Acknowledgement code. AA = accepted, AR = rejected, AE = error AA  

MSA-2
Message control ID. This is the MSH-10 value that was sent to PKB.
 


MSA-2.1 Message control ID ABC0000000001  
QRD

Query definition. A copy of the submitted QRD segment is returned.
 
[ QRF ]

Query filter. If a QRF segment was supplied, it will be returned.
 
{ [ PID ] }

Patient identification. One PID segment is returned for each matching patient.
 

{ [ PID-3 ] }
The patient identifiers.  A repeating list of national id and any additional local id's connected to the calling organisation
 


PID-3.1 Patient ID 5637453543 If National ID:
[[Patient.National ID.Value]]

If Organisation Level ID:
[[Patient.Organisation Level ID.Value]]

If Team Level ID:
[[Patient.Team Level ID.Value]]


PID-3.4 Patient ID assigning authority (e.g 'NHS') NHS If National ID:
[[Patient.National ID.National ID Type.HL7 Assigning Authority]]

If Organisation Level ID:
[[Patient.Organisation Level ID.Organisation Level ID Type.HL7 Assigning Authority]]

If Team Level ID:
[[Patient.Team Level ID.Team Level ID Type.HL7 Assigning Authority]]


PID-3.5 Patient ID type code. (e.g 'NH' for national id.) NH If National ID:
[[Patient.National ID.National ID Type.HL7 Type Code]]

If Organisation Level ID:
[[Patient.Organisation Level ID.Organisation Level ID Type.HL7 Type Code]]

If Team Level ID:
[[Patient.Team Level ID.Team Level ID Type.HL7 Type Code]]

PID-5
Name
 


[ PID-5.1 ] Family name Smith [[Patient.Family Name]]


[ PID-5.2 ] Given name John [[Patient.Given Name]]

[ PID-7 ]
Date of birth
 


PID-7.1 Date of birth 19800101 [[Patient.Date of Birth]]

PID-11
Address
 


[ PID-11.5 ] Postal code SW1A 1AA
[[Patient.Postal Code]]
 { [ ZID ] }     Custom segment to return registration specific information. One ZID segment per corresponding PID segment.    
   ZID-1        
     ZID-1.1  Public ID (UUID) for the corresponding PID segment. 1fd2a0f6-890b-4f68-9fa1-65342f649771 [[User->Public ID]]
   ZID-2

 
     ZID-2.1  Registration status   REGISTERED  [[Patient->Registered]]
     ZID-2.2     Registration status last updated. Timestamp reflecting when ZID-2.1 was set. 201807012352  Derived from multiple sources.
   ZID-3        
     ZID.3.1 Deregistration indicator.  'true' if the patient is now NOT_REGISTERED after previously being REGISTERED  true  
 [DSC]     Continuation pointer segment.  This will be returned if the number of results has exceeded the value specified by the caller in QRD.7.1 or has exceeded the server side max results setting. 

The calling organisation will need to recognise this segment and programatically re-query with an amended start timestamp (QRF.2.1) based on the last seen timestamp (ZID.2.2) and the inclusion of a last seen patient (QRF.5.1) based on the last seen patient UUID (ZID.1.1).
   
     DSC.1.1  A UUID. Not to be used on subsequent calls.    



Examples

PKB responds to the QRY_A19 with a list of matching patients and their registration status. Minimal info for each patient is listed -- enough to match records (NHS num, name, DoB).

1. Response to query for all patient registration statuses - including deregistration indicator

MSH|^~\&|HL7API|PKB|App|ReceivingInst|201901101100||ADR^A19|E|P|2.4
MSA|AA|ABC0000000001
QRD||||query1|||||STA
PID|||9444444444^^^NHS^NH||SMITH^MARJORIE||19700101||||^^^^CB1 1BC|
ZID|1fd2a0f6-890b-4f68-9fa1-65342f649771|REGISTERED^201806012352
PID|||9555555555^^^NHS^NH||DOE^JAMES||195001202||||^^^^CB1 8BL|
ZID|6e4ba6f5-8c6e-43b9-8de0-601ec833ee83|NOT_REGISTERED^201806012352
PID|||9666666666^^^NHS^NH||BLOGGS^DAVID||195001202||||^^^^CB1 8BL|
ZID|9d90e773-dfe4-4c95-9690-d9b07c62f004|REGISTERED^201807012352
PID|||977777777^^^NHS^NH||JONES^BOB||195001202||||^^^^CB1 8BL|
ZID|962cb105-8e95-41f1-9ebe-7761b8c5fd93|NOT_REGISTERED^201810012352|true

2. Response to query for all patient registration statuses - result limit exceeded.

MSH|^~\&|HL7API|PKB|App|ReceivingInst|201901101100||ADR^A19|E|P|2.4
MSA|AA|ABC0000000001
QRD||||query1|||1000^RD||STA
PID|||1000112C^^^MRN^HOSP~9444444444^^^NHS^NH||SMITH^MARJORIE||19700101||||^^^^CB1 1BC|
ZID|1fd2a0f6-890b-4f68-9fa1-65342f649771|REGISTERED^201806012352
PID|||9555555555^^^NHS^NH||DOE^JAMES||195001202||||^^^^CB1 8BL|
ZID|6e4ba6f5-8c6e-43b9-8de0-601ec833ee83|NOT_REGISTERED^201806012352
PID|||9666666666^^^NHS^NH||BLOGGS^DAVID||195001202||||^^^^CB1 8BL|
ZID|9d90e773-dfe4-4c95-9690-d9b07c62f004|REGISTERED^201807012352
PID|||977777777^^^NHS^NH||JONES^BOB||195001202||||^^^^CB1 8BL|
ZID|962cb105-8e95-41f1-9ebe-7761b8c5fd93|NOT_REGISTERED^201810012352|true
DSC|c4e61363-45c4-4a3d-a96e-777fe0f1e3e7

3. Response to query for all patients with a current registration status of REGISTERED

MSH|^~\&|HL7API|PKB|App|ReceivingInst|201901101100||ADR^A19|E|P|2.4
MSA|AA|ABC0000000001
QRD||||query1|||||STA||REGISTERED
PID|||1000112C^^^MRN^HOSP~9444444444^^^NHS^NH||SMITH^MARJORIE||19700101||||^^^^CB1 1BC|
ZID|1fd2a0f6-890b-4f68-9fa1-65342f649771|REGISTERED^201806012352
PID|||9666666666^^^NHS^NH||BLOGGS^DAVID||195001202||||^^^^CB1 8BL|
ZID|9d90e773-dfe4-4c95-9690-d9b07c62f004|REGISTERED^201807012352

4. Response to query for patients with a current registration status set to REGISTERED and that status was set after a defined start date

MSH|^~\&|HL7API|PKB|App|ReceivingInst|201901101100||ADR^A19|E|P|2.4
MSA|AA|ABC0000000001
QRD|||||||||STA||REGISTERED
QRF||201806290000
PID|||9666666666^^^NHS^NH||BLOGGS^DAVID||195001202||||^^^^CB1 8BL|
ZID|9d90e773-dfe4-4c95-9690-d9b07c62f004|REGISTERED^201807012352
Comments