South African flag
Skip to main content

PDQ-HPRS ITI integration documentation

Supporting Information

  • ITI-21 Examples
  • Supported Identifiers
  • PID segment Definition
  • Table0203
  • Table0363
  • Table 0445
  • Article Sources and Contributors
  • Table0002
  • MPI name search implementation
  • Important Links: HL7

ITI-21 Examples​

ITI-21 request with what domains returned

Request

MSH|^~\&|TEST_HARNESS|TEST|CR1|MOH_CAAT|20090226131520-0600||QBP^Q22^QBP_Q21|TEST-CR-14-30|P|2.5
QPD|Q22^Find Candidates^HL7|8494764101303661668890645833527|@PID.3.1^20287~@PID.3.4.1^DOH_fileNumber.172842~@PID.3.4.2^2.25.17843963144693579256192190624330832718.172842~@PID.3.4.3^ISO|||||^^^DHA~^^^HPRS_PATIENT_UUID
RCP|I

Response

MSH|^~\&|HPRSPIXMANAGER^2.25.17843963144693579256192190624330832714^ISO|HPRSPIXMANAGER^2.25.17843963144693579256192190624330832714^ISO|TEST_HARNESS^UNKNOWN^ISO|TEST^UNKNOWN^ISO|201602021437||RSP^K22^RSP_K21|1454416631774019|P|2.5
MSA|AA|TEST-CR-14-30
QAK|8494764101303661668890645833527|OK
QPD|Q22^Find Candidates^HL7|8494764101303661668890645833527|@PID.3.1^20287~@PID.3.4.1^DOH_fileNumber.172842~@PID.3.4.2^2.25.17843963144693579256192190624330832718.172842~@PID.3.4.3^ISO|||||^^^DHA~^^^HPRS_PATIENT_UUID
PID|||f453542f-6768-4d9a-9fd3-1310f11007d1^^^HPRS_PATIENT_UUID~9412210000081^^^DHA^NNZAF||Joy^Gladness^^^^^U||20110214|F|||7474 EXT 3B^^^^^ZA

ITI-21 request with HPRN identifier AND DOH namespace id AND NH identifier type, response includes NK1

Request

MSH|^~\&|TEST_HARNESS|TEST|CR1|MOH_CAAT|20090226131520-0600||QBP^Q22^QBP_Q21|TEST-CR-14-30|P|2.5
QPD|Q22^Find Candidates^HL7|8494764101303661668890645833527|@PID.3.1^165-676-3727~@PID.3.4.1^DOH~@PID.3.5.3^NH

Response

MSH|^~\&|HPRS|HPRS|TEST_HARNESS|TEST|201808081405||RSP^K22^RSP_K21|1533729834610149|P|2.5
MSA|AA|TEST-CR-14-30
QAK|8494764101303661668890645833527|OK
QPD|Q22^Find Candidates^HL7|8494764101303661668890645833527|@PID.3.1^165-676-3727~@PID.3.4.1^DOH~@PID.3.5.3^NH
PID|||04af6ab6-9270-11e5-9641-efed249e8181^^^HPRS_PATIENT_UUID&test-hie.health.gov.za&DNS~4004000001234^^^DHA&www.home-affairs.gov.za&DNS^NNZAF ZA ID number dispensed by dept home affairs DHA~116-222-8124^^^DOH&www.health.gov.za&DNS^NH^^20160620 ACTIVE HPRN dispensed by dept health with effective date (a patient may have multiple inactive prns and one active prn- querying by either inactive or active will be successful)~165-676-3727^^^DOH&www.health.gov.za&DNS^NH^^^20171213 INACTIVE HPRN dispensed by dept health with expiry date~0888^^^DOH&www.health.gov.za&DNS^MR^472824||filenumber for facility id 472824 as per health data dictionary
Du Toit^Stephanuse^Petrus^^^^U||19400405|F|||123 Test Loc^^Test City^^9800^ZA
NK1|1|testsurname^testfirstname^^^^^U|SIS^Sister|135 testRd^^^^^ZA|^^^^^^^^^^^0112345678

ITI-21 request with identifier - SA id number with unsupported namespace id

Request

MSH|^~\&|TEST_HARNESS|TEST|CR1|MOH_CAAT|20090226131520-0600||QBP^Q22^QBP_Q21|TEST-CR-14-30|P|2.5
QPD|Q22^Find Candidates^HL7|8494764101303661668890645833527|@PID.3.1^7804250694088~@PID.3.4.1^2DHA~@PID.3.4.3^ISO~@PID.3.5^PI
RCP|I

Response

MSH|^~\&|HPRSPIXMANAGER^2.25.17843963144693579256192190624330832714^ISO|HPRSPIXMANAGER^2.25.17843963144693579256192190624330832714^ISO|TEST_HARNESS^UNKNOWN^ISO|TEST^UNKNOWN^ISO|201602021440||RSP^K22^RSP_K21|1454416828775534|P|2.5
MSA|AE|TEST-CR-14-30
ERR||QPD^1^3^2|204|E||||unknown domain namespace id
QAK|8494764101303661668890645833527|AE
QPD|Q22^Find Candidates^HL7|8494764101303661668890645833527|@PID.3.1^7804250694088~@PID.3.4.1^2DHA~@PID.3.5^PI

ITI-21 request with identifier - SA id number with identifier type code

NOTE: If the identifierType code is not specified the response will contain all patients with any DHA identifier that matches the one in the request.

Request

MSH|^~\&|TEST_HARNESS|TEST|CR1|MOH_CAAT|20090226131520-0600||QBP^Q22^QBP_Q21|TEST-CR-14-30|P|2.5
QPD|Q22^Find Candidates^HL7|8494764101303661668890645833527|@PID.3.1^7804250694088~@PID.3.4.1^DHA~@PID.3.4.3^ISO~@PID.3.5^NNZAF
RCP|I

Response

MSH|^~\&|HPRSPIXMANAGER^2.25.17843963144693579256192190624330832714^ISO|HPRSPIXMANAGER^2.25.17843963144693579256192190624330832714^ISO|TEST_HARNESS^UNKNOWN^ISO|TEST^UNKNOWN^ISO|201602021443||RSP^K22^RSP_K21|1454416984649544|P|2.5
MSA|AA|TEST-CR-14-30
QAK|8494764101303661668890645833527|OK
QPD|Q22^Find Candidates^HL7|8494764101303661668890645833527|@PID.3.1^7804250694088~@PID.3.4.1^DHA~@PID.3.5^PI
PID|||IF82^^^DOH^MR^342415~00000179-500d-41ee-9970-131a39cf9a2e^^^HPRS_PATIENT_UUID~7804250694088^^^DHA^NNZAF||TESTSURNAME^TESTFIRSTNAME^^^^^U||19780425|F|||GOVANMBEKI LOCAL MUNICIPALITY^^^^^ZA||^^^^^^^^^^^0820314017

ITI-21 request with wildcard demographics — NOT SUPPORTED BY HPRS

Request

MSH|^~\&|TEST_HARNESS|TEST|CR1|MOH_CAAT|20090226131520-0600||QBP^Q22^QBP_Q21|TEST-CR-14-30|P|2.5
QPD|Q22^Find Candidates^HL7|8494764101303661668890645833527|@PID.5.1.1^MOFO*~@PID.5.2^Maria~@PID.8^F
RCP|I|10^RD

Response returns more than fifty candidates with continuation pointer.

ITI-21 request with continuation — SHOULD NOT BE NECESSARY

Request 1

MSH|^~\&|TEST_HARNESS|TEST|CR1|MOH_CAAT|20090226131520-0600||QBP^Q22^QBP_Q21|TEST-CR-14-30|P|2.5
QPD|Q22^Find Candidates^HL7|8494764101303661668890645833527|@PID.5.1.1^MOFO*~@PID.5.2^Maria~@PID.8^F
RCP|I|10^RD

Response 1

MSH|^~\&|HPRSPIXMANAGER^2.25.17843963144693579256192190624330832714^ISO|HPRSPIXMANAGER^2.25.17843963144693579256192190624330832714^ISO|TEST_HARNESS^UNKNOWN^ISO|TEST^UNKNOWN^ISO|201601221454||RSP^K22^RSP_K21|1453467286296055|P|2.5
MSA|AA|TEST-CR-14-30
QAK|8494764101303661668890645833527|OK
QPD|Q22^Find Candidates^HL7|8494764101303661668890645833527|@PID.5.1.1^MOFO*~@PID.5.2^Maria~@PID.8^F
PID|||2842^^^DOH fileNumber~013a10be-9fdd-11e5-9ad1-1ffb131933a4^^^HPRS PATIENT UUID||MOFOKENG^MARIA^^^^^U||19750107|F|||370 SLOVOPARK^^^^9870^ZA^^^WITSIESHOEK
PID (9 more)
DSC|10|I

(continuation pointer of 10) – to obtain the following ten records the next request should look as follows:

Request 2

MSH|^~\&|TEST_HARNESS|TEST|CR1|MOH_CAAT|20090226131520-0600||QBP^Q22^QBP_Q21|TEST-CR-14-30|P|2.5
QPD|Q22^Find Candidates^HL7|8494764101303661668890645833527|@PID.5.1.1^MOFO*~@PID.5.2^Maria~@PID.8^F
RCP|I|10^RD
DSC|10|I

(start with an offset of 10 and return the following 10 records)

ITI-21 request with fuzzy search — NOT SUPPORTED BY HPRS

Request

MSH|^&~\|CLINREG|WESTCLIN|HOSPMPI|HOSP|199912121135-0600||QBP^Q22^QBP_Q21|1|D|2.5
QPD|Q22^Find Candidates^HL7nnn|111069|@PID.5.1^SMITH~@PID.5.2^JOHN~@PID.8^M|80|MATCHWARE|1.2||^^^METRO HOSPITAL~^^^SOUTH LAB|
RCP||I|20^RD

Response

MSH|^&~\|HOSPMPI|HOSP|CLINREG|WESTCLIN|199912121135-0600||RSP^K22^RSP_K21|1|D|2.5
MSA|AA|8699|
QAK|111069|OK|Q22^Find Candidates^HL7nnnn|3|
QPD|Q22^Find Candidates^HL7nnn|111069|@PID.5.1^SMITH~@PID.5.2^JOHN~@PID.8^M|80|MATCHWARE|1.2||^^^METRO HOSPITAL~^^^SOUTH LAB|
PID|||66785^^^METRO HOSPITAL~66532^^^SOUTH LAB||Smith^John||19630423|M||C|N2378 South Street^^Madison^WI^53711|
QRI|95||MATCHWARE 1.2|
PID|||87443^^^METRO HOSPITAL~651189^^^SOUTH LAB||Smith^Jon||19470606|M||C|124 Second Street^^Madison^WI^53711|
QRI|90||MATCHWARE 1.2|
PID|||43266^^^METRO HOSPITAL~81209^^^SOUTH LAB||Smithy^John||19901210|M||C|W11234 Bay Drive^^Lodi^WI^53555|
QRI|85||MATCHWARE 1.2|

ITI-21 request with DOH namespace

This queries for a patient associated with facilityid (137321) and filenumber (MR=medical record) (20287).

Request

MSH|^~\&|TEST_HARNESS|TEST|CR1|MOH_CAAT|20090226131520-0600||QBP^Q22^QBP_Q21|TEST-CR-14-30|P|2.5
QPD|Q22^Find Candidates^HL7|8494764101303661668890645833527|@PID.3.1^20287~@PID.3.4.1^DOH~@PID.3.5.5^MR~@PID.3.6.1^137321
RCP|I

Response

MSH|^~\&|HPRSPIXMANAGER^2.25.17843963144693579256192190624330832714^ISO|HPRSPIXMANAGER^2.25.17843963144693579256192190624330832714^ISO|TEST_HARNESS^UNKNOWN^ISO|TEST^UNKNOWN^ISO|201602021429||RSP^K22^RSP_K21|1454416180860118|P|2.5
MSA|AA|TEST-CR-14-30
QAK|8494764101303661668890645833527|OK
QPD|Q22^Find|@PID.3.1^20287~@PID.3.4.1^DOH~@PID.3.5.5^MR~@PID.3.6.1^137321
PID|||20287^^^DOH&www.health.gov.za&DNS^MR^20287~f453542f-6768-4d9a-9fd3-1310f11007d1^^^HPRS_PATIENT_UUID~1102140000081^^^DHA^NNZAF||testsurname^testfirstname^^^^^U||20110214|F|||7474 EXT 3B^^^^^ZA

Supported Identifiers​

Field 3 of the PID segment is the Patient Identifier List. It is used within most messages either to query a patient with a certain identifier, or when returning information regarding a patient including identifiers for that patient. Within HPRS the following types of identifiers are supported for use within the Patient Identifier List:

NOTE: in order to distinguish between unverified NNZAF and verified NNZAF (via DHA), PID.32 (Table 0445) will be used. In the case of an UNVERIFIED NNZAF the value will be UNNZAF (unknown South African DHA ID number).

Identifier TypeAssigning Authority (Table0363)Identifier Type Code (Table0203)Assigning JurisdictionAssigning FacilityITI-21 ExampleITI-8 ExampleNotes
South African Id NumberDHANNZAF@PID.3.1^7804250694088~@PID.3.4.1^DHA~@PID.3.5.3^NNZAF7804250694088^^^DHA^NNZAFAssigning Authority namespaceid and identifier type code associated with the identifier must be specified
Asylumseeker - Section 22 permitDHAVP@PID.3.1^37691aafr44~@PID.3.4.1^DHA~@PID.3.5.3^VP37691aafr44^^^DHA^VPAssigning Authority namespaceid and identifier type code associated with the identifier must be specified
South African passport numberDHAPPN@PID.3.1^pp11111154632~@PID.3.4.1^DHA~@PID.3.5.3^PPNpp11111154632^^^DHA^PPNAssigning Authority namespaceid and identifier type code associated with the identifier must be specified
Legal refugee - Section 24 permitDHATPR@PID.3.1^rn11111154632~@PID.3.4.1^DHA~@PID.3.5.3^TPRrn11111154632^^^DHA^TPRAssigning Authority namespaceid and identifier type code associated with the identifier must be specified
Foreign passport numberFOREIGN_GOVTPPNZWE@PID.3.1^pp11111154632~@PID.3.4.1^FOREIGN_GOVT~@PID.3.5.3^PPN~@PID.3.9.1^ZWEpp11111154632^^FOREIGN_GOVT^^^ZWE^PPNAssigning Authority namespaceid and identifier type code associated with the identifier must be specified
Facility File NumberDOHMR<6digitfacilityid>@PID.3.1^2876~@PID.3.4.1^DOH~@PID.3.5.3^MR~@PID.3.6.1^1373212876^^^DOH^MR^137321Assigning Authority namespaceid and identifier type code associated with the identifier must be specified
HPRN numberDOHNH@PID.3.1^11111154632~@PID.3.4.1^DOH~@PID.3.5.3^NH11111154632^^^DOH^NHAssigning Authority namespaceid and identifier type code associated with the identifier must be specified

PID segment Definition​

HL7 v2.3.1 — PID fields​

SEQLENDTOPTRP/#TBL#Element NameComment
14SIOSet ID - PIDNumber to identify the transaction - first one is 1, then 2, etc.
220CXBPatient IDUsed for backward compatibility only; should rather use PID-3.
320CXRYPatient Identifier ListList of identifiers used to uniquely identify patient
420CXBYAlternate Patient ID - PIDUsed for backward compatibility only; should rather use PID-3.
548XPNRYPatient NameLegal or primary name of the patient. All other names should be in PID-9. Name type should be 'L - Legal'. Repetition allowed for representing same name in different character sets.
648XPNOYMother's Maiden NameFamily name under which the mother was born; distinguishes patients with the same last name.
726TSODate/Time of BirthThe patient's date and time of birth
81ISO0001SexThe patient's sex
948XPNOYPatient AliasPatient's alias/other names
1080CEOY0005RaceThe patient's race
11106XADOYPatient AddressMailing address of the patient
124ISB0289County CodeFor backward compatibility, rather use PID-11
1340TNOYPhone number - HomePatient's personal phone numbers
1440TNOYPhone number - BusinessPatient's business telephone numbers
1560CEO0296Primary LanguageThe patient's primary language
1680CEO0002Marital StatusThe patient's marital (civil) status
1780CEO0006ReligionThe patient's religion
1820CXOPatient Account NumberAccount number to which all charges, payments, etc. are recorded
1916STBSSN Number - PatientFor backward compatibility; use PID-3
2025DLNODriver's Licence Number - PatientDefault second component is state in which license is registered
2120CXOYMother's IdentifierUsed as a link field for newborns
2280CEOY0189Ethnic GroupDefines the patient's ancestry
2360STOBirth PlaceThe location of the patient's birth
241IDO0136Multiple Birth IndicatorIndicates whether the patient was part of a multiple birth
252NMOBirth OrderIf part of multiple birth, indicates birth order
2680CEOY0171CitizenshipPatient's country citizenship
2760CEO0172Veterans Military StatusMilitary status assigned to a veteran
2880CEO0212NationalityNation or national grouping to which the person belongs
2926TSOPatient Death Date and TimeThe date and time at which death occurred
301IDO0136Patient Death IndicatorIndicates whether the patient is deceased

HL7 v2.5 — PID fields (additional/changed vs v2.3.1)​

Fields 1–30 are broadly similar to v2.3.1 (with field lengths extended to 250 for many fields, and PID-9 becoming backward-compatible-only). Additional fields in v2.5:

SEQLENDTOPTRP/#TBL#Element NameComment
311IDO0136Patient Unknown IndicatorIndicates whether or not the patient's/person's identity is known
3220ISOY0445Identity Reliability CodeCoded value used to communicate the reliability of patient/person identifying data
3326TSOLast Update Date/TimeLast update date/time for the patient's identifying and demographic data
34241HDOLast Update FacilityIdentifies the facility of the last update (DHIS DD codes recommended)
35250CEC0446Species CodeSpecies of living organism; if not specified, 'human' is assumed
36250CEC0447Breed CodeBreed of animal (animals only)
3780STOStrainSpecific strain of animal
38250CEO0429Production Class CodePrimary use for which the living subject was bred or grown
39250CWEOY0171Tribal CitizenshipInformation about the tribal membership of the patient

Table0203​

See PDQm-Table0203 for the full HL7 Table 0203 (Identifier type) values for both v2.3.1 and v2.5 — the tables are identical.

Table0363​

HL7 Table 0363 (Assigning authority)

Basic information: Table 0363, Type: User, Name: Assigning authority

Detail: This table is used to encode the namespace of an assigning authority used within a Patient Identifier List. As a user-defined table, values are identical across all HL7 versions (values shown below use HL7 v2.5).

ValueDescription
DHADepartment of Home Affairs - this namespaceid covers all identifiers issued by the DHA, identifiers should be distinguished by identifiertypecode.
HPRS_PATIENT_UUIDInternal patient Identifier for HPRS system
DOHDepartment of Health - this namespaceid covers all identifiers issued by the DOH, identifiers should be distinguished by identifiertypecode. (MR for filenumber (must also submit a facilityid), NH for PRN)
FOREIGN_GOVTAny foreign government; identifiers should be distinguished by identifiertypecode and country should be distinguished by assigning jurisdiction

Table 0445​

HL7 Table 0445 (Identity Reliability Code)

Basic information: Table 0445, Type: User, Name: Identity Reliability Code

Detail: This table is used to encode the form of identity supplied that is unreliable.

ValueDescription
UNNZAFDepartment of Home Affairs – South African Identification Number is UNVERIFIED

Article Sources and Contributors​

  • ITI-21 — Contributors: Kdutoit
  • ITI-21 Request Message Header — Contributors: Kdutoit, RAlberts
  • ITI-21 Request Query Parameter Definition — Contributors: Kdutoit, RAlberts
  • ITI-21 Request Response Control Parameter — Contributors: Kdutoit, RAlberts
  • ITI-21 Request Continuation Pointer — Contributors: Kdutoit, RAlberts
  • ITI-21 Response Message Header — Contributors: Kdutoit, RAlberts
  • ITI-21 Response Message Acknowledgement — Contributors: Kdutoit
  • ITI-21 Response Error — Contributors: Kdutoit
  • ITI-21 Response Query Acknowledgement — Contributors: Kdutoit
  • ITI-21 Response Query Parameter Definition — Contributors: Kdutoit, RAlberts
  • ITI-21 Response Patient Identification — Contributors: Kdutoit, RAlberts
  • HL7 NK1 — Contributors: Kdutoit
  • ITI-21 Response Continuation Pointer — Contributors: Kdutoit
  • V2.5 HL7 Communication standard — Contributors: Kdutoit, Kvdwalt, RAlberts
  • ITI-21 Examples — Contributors: Kdutoit, RAlberts
  • Supported Identifiers — Contributors: Kdutoit
  • PID segment — Contributors: Tfogwill
  • Table0203 — Contributors: Tfogwill
  • Table0363 — Contributors: Kdutoit

(Source references originally point to http://health-docs.dhcp.meraka.csir.co.za/mediawiki/index.php?oldid=... internal wiki article revisions.)

Table0002​

See PDQm-Table0002 for the full HL7 Table 0002 (Marital Status) values.

MPI name search implementation​

NOT SUPPORTED BY HPRS

  1. An input search string without accents will match names with and without accents.
  2. An input search string with an accent will match names with and without accents.
  3. An input search string with an apostrophe will match names with and without an apostrophe.
  4. An input search string with a hyphen will only match a name with a hyphen.
  5. An input search string without a hyphen will not match a name with a hyphen.
  6. An input firstname (givenname) @PID.5.2 with a space in it will be split into 2 strings, and both the first string and the full string will be used to match to firstname.
  7. When searching on an idnumber AND a name, the patient with names within an edit distance of one will be returned.

HPRS-ITI-21

Contents​

  • ITI-21
  • ITI-21 Summary
    • ITI-21 Patient Demographics Query
    • RESPONSE FORMAT
    1. ITI-21 Request
    • 2a. ITI-21 Request Message Header
    • 2b. ITI-21 Request Query Parameter Definition
    • 2c. ITI-21 Request Response Control Parameter
    • 2d. ITI-21 Request Continuation Pointer
    1. ITI-21 Response RSP_K22
    • 3a. ITI-21 Response Message Header
    • 3b. ITI-21 Response Message Acknowledgement
    • 3c. ITI-21 Response Error
    • 3d. ITI-21 Response Query Acknowledgement
    • 3e. ITI-21 Response Query Parameter Definition
    • 3f. ITI-21 Response Patient Identification
    • 3g. ITI-21 Response Next of Kin
    • 3h. ITI-21 Response Continuation Pointer
  • PDQexamples

HPRS Implementation of ITI-21 — PDQ (Patient Demographics Query)

Author: Kirsten du Toit — Version: 1.0 — HPRS Version: 1.10.0 — Date: 19/03/2019

ITI-21 Summary​

ITI-21 Patient Demographics Query​

REQUEST FORMAT

The format of the query message is the HL7 QBP^Q22 message — IHE IT Infrastructure Technical Framework, Volume 2a (p. 149). If the incoming message is a QBP message of type Q22, the solution retrieves a list of demographic information from the EMPI for patients that match the search data specified in the incoming message. The query results are returned in an RSP (response) message.

Trigger Events: For selecting a patient based on demographic information about patients whose information matches a minimal set of known data: Q22 – Find Candidates.

[]=optional, {}=multiple allowed, otherwise required.

  • MSH (2a. ITI-21 Request Message Header)
  • QPD (2b. ITI-21 Request Query Parameter Definition)
  • RCP (2c. ITI-21 Request Response Control Parameter)
  • [ DSC[ ] ] (2d. ITI-21 Request Continuation Pointer)

RESPONSE FORMAT​

For unsuccessful queries, an AE RSP, AE ACK, or AR ACK message is returned, depending on the reason for the failure. Additional information about the failure is contained in the ERR segment of the response.

Required Format:

  • MSH (3a. ITI-21 Response Message Header)
  • MSA (3b. ITI-21 Response Message Acknowledgement)
  • [[ {ERR} ]] (3c. ITI-21 Response Error)
  • QAK (3d. ITI-21 Response Query Acknowledgement)
  • QPD (3e. ITI-21 Response Query Parameter Definition)
  • [ { PID[ (3f. ITI-21 Response Patient Identification) [ PD1 ] [{NK1 (Next of Kin)}] [ QRI Query Response Instance] } ]
  • [ DSC[ ] ] (3h. ITI-21 Response Continuation Pointer)

2. ITI-21 Request​

2a. ITI-21 Request Message Header​

ITI-21 REQUEST MSH SEGMENT

Example:

MSH|^~\&|RXSOLUTIONS|171234|HPRSPIXPDQ|CENTRAL|20090224104204-0600|2a777bf6-1ba1-11ec-a451-6f38e66abc76$9402041167082|QBP^Q22^QBP_Q21|9241351356666182528|P|2.5
SEQLENDTOPTRP/#TBL#Element NameValue per ExampleNotes
11STRField Separator|Character used as separator for the rest of the message
24STREncoding Characters^~\&Message delimiters: component separator, repetition separator, escape character, subcomponent separator
3180HDOSending ApplicationRXSOLUTIONSUniquely identifies the sending application - site defined
4180HDOSending Facility171234Address of one of several occurrences of the same application within the sending system; in the example this is the 6 digit facility ID as per the DOH - user defined
5180HDOReceiving ApplicationHPRSPIXPDQSite defined
6180HDOReceiving FacilityCENTRALSite defined
726TSODate/Time Of Message20090224104204-0600Date/time sending system created the message, i.e. now()
840STOSecurity2a777bf6-1ba1-11ec-a451-6f38e66abc76$9402041167082$Joe$Test$joetest@csir.co.za$0110001111$146.64.1.1$maternity — format: accountid$Idnumber$firstname$surname$email$phonenumber$ipaddress$wardnameContains account information for the original requester. User details separated by $. If information is unavailable it is acceptable to leave fields blank. The system unique accountid of the original requester is required and MUST be sent.
97CMR0076,0003Message TypeQBP^Q22^QBP_Q21Predefined for ITI-21
1020STRMessage Control ID9241351356666182528Unique identifier for this message
113PTR0103Processing IDPD=Debugging, P=Production, T=Training
128IDR0104Version ID2.5HL7 version of this message

2b. ITI-21 Request Query Parameter Definition​

ITI-21 REQUEST QPD SEGMENT

Example:

QPD|IHE PDQ Query|8494764101303661668890645833527|@PID.3.1^165-652-1397~@PID.3.4.1^DOH~@PID.3.5^NH
SEQLENDTOPTRP/#TBL#Element NameValue per ExampleNotes
1250CER0471Message Query NameIHE PDQ QueryPredefined for ITI-21
232STRQuery Tag8494764101303661668890645833527Uniquely identifies query
3250QIPRDemographics FieldsQuery by idnumber: @PID.3.1^7804250694088~@PID.3.4.1^DHA~@PID.3.5.3^NNZAF; Query by demographics: @PID.5.1.1^MOFO*~@PID.5.2^Maria~@PID.8^F~@PID.13.1^0736705638; Query by PRN: @PID.3.1^165-652-1397~@PID.3.4.1^DOH~@PID.3.5^NHThe first component of each parameter contains the name of an HL7 element in the form @<seg>.<field position>.<component position>.<subcomponent position>
4250CXO0363What Domains Returned^^^DHA~^^^HPRS_PATIENT_UUIDRestricts the set of domains for which identifiers are returned in PID-3: only component 4 (Assigning Authority) shall be valued. If empty, all identifiers for all domains supported are returned.

Querying with Demographics — NOT SUPPORTED BY HPRS

Example query by demographics:

QPD|IHE PDQ Query|8494764101303661668890645833527|@PID.5.1.1^MOFO*~@PID.5.2^Maria~@PID.8^F~@PID.13.1^0736705638
Query ElementPID MappingValue per ExampleNotes
@PID.5.1.1patientName.familyName.surnameMOFO*Wildcards are supported
@PID.5.2PatientName.givenNameMariaWildcards are supported
@PID.7.1Date/time of Birth19780425yyyymmdd (degree of precision not yet supported); putting date of birth as 197804 would allow search of all birth dates within April 1978
@PID.8Administrative sexFF:female, M:male, U:unknown, A:ambiguous
@PID.11Patient AddressSubcomponents specified in PID segment
@PID.13.1Phone Number0736705638South African phone number
@PID.13.12Unformatted Phone Number+27(73 670 5638)Unformatted South African phone number

Querying with Identifiers

Please refer to Supported Identifiers for information on how to construct the query fields for identifiers such as South African Passport Number, South African Id Number, Department of Health facility folder number etc.

Example query by South African IDNumber:

QPD|IHE PDQ Query|8494764101303661668890645833527|@PID.3.1^7804250694088~@PID.3.4.1^DHA~@PID.3.5^NNZAF

Example query by Patient Record Number:

QPD|IHE PDQ Query|8494764101303661668890645833527|@PID.3.1^165-652-1397~@PID.3.4.1^DOH~@PID.3.5^NH
Query ElementPID MappingValue per ExampleNotes
@PID.3.1PatientIdentifierList.idNumber7804250694088 / 165-652-1397South African ID number / HPRN number
@PID.3.4.1PatientIdentifierList.assigningAuthority.namespaceidDHA / DOHThe namespaceid for the domain that assigned the identifier, DHA=Dept of Home Affairs, DOH=Dept of Health
@PID.3.5PatientIdentifierList.identifierTypecodeNNZAF / NHSpecifies the type of identifier being used in the query – restricts identifiers found within the assigning authority domain requested to the type requested (Table0203). NNZAF = South African National Identifier, NH = National Health identifier

2c. ITI-21 Request Response Control Parameter​

ITI-21 REQUEST RCP SEGMENT

Example:

RCP|I|10^RD
SEQLENDTOPTRP/#TBL#Element NameValue per ExampleNotes
11IDO0091Query PriorityISignifies an immediate response requested - predefined for ITI-21
210CQO0126Quantity Limited Request10^RDIf the query could result in hundreds/thousands of matches, response may be limited using the HL7 continuation protocol

2d. ITI-21 Request Continuation Pointer​

ITI-21 REQUEST DSC SEGMENT

The DSC segment should be omitted on the initial query request. Its purpose is to request additional increments of data from the Patient Demographic Supplier Actor.

Example:

DSC|10|I
SEQLENDTOPTRP/#Element NameValue per ExampleNotes
1180STOContinuation Pointer10To request additional increments, DSC-1 shall echo the value from RSP^K22 DSC-1
21IDOContinuation StyleISignifies this is part of an interactive continuation message - predefined for ITI-21

3. ITI-21 Response RSP_K22​

3a. ITI-21 Response Message Header​

ITI-21 RESPONSE MSH SEGMENT

Example:

MSH|^~\&|HPRSPIXPDQ|171234|RXSOLUTIONS|CENTRAL|20090224104204-0600||RSP^K22^RSP_K21|9241351356666182529|P|2.5
SEQLENDTOPTRP/#TBL#Element NameValue per ExampleNotes
11STRField Separator|Character used as separator for the rest of the message
24STREncoding Characters^~\&Message delimiters
3180HDOSending ApplicationHPRSPIXPDQUniquely identifies sending application - site defined
4180HDOSending FacilityCENTRALAddress of an occurrence of the same application within the sending system
5180HDOReceiving ApplicationRXSOLUTIONSSite defined
6180HDOReceiving Facility171234Site defined; in the example this is the 6 digit DOH facility ID as per the request
726TSODate/Time Of Message20090224104204-0600Date/time sending system created the message
840STOSecurity
97CMR0076,0003Message TypeRSP^K22^RSP_K21Predefined for ITI-21 Response
1020STRMessage Control ID9241351356666182529Unique identifier for this message
113PTR0103Processing IDPD=Debugging, P=Production, T=Training
128IDR0104Version ID2.5HL7 version of this message

3b. ITI-21 Response Message Acknowledgement​

ITI-21 RESPONSE MSA SEGMENT

Example:

MSA|AA|TEST-CR-14-30

MSA-1: Acknowledgement code (ID); MSA-2: Message Control ID (ST); MSA-3: Text Message (ST) optional; MSA-4: Expected Sequence Number (NM) optional; MSA-5: Delayed Acknowledgement Type (ID) optional; MSA-6: Error Condition (CE) optional.

SEQLENDTOPTRP/#TBL#Element NameValue per ExampleNotes
11IDRAcknowledgement codeAAIndicates whether or not the message was successfully received and processed ('AA' for a positive ACK; 'AE' or 'AR' for a negative ACK — application accept/error/reject)
24STRMessage Control IDTEST-CR-14-30The control Id of the request

3c. ITI-21 Response Error​

Error Segment (ERR) Specifications

The ERR segment is used to add error comments to acknowledgment messages. It is only populated for AR or AE type acknowledgments. HPRS currently only returns an AE acknowledgement.

ERR||QPD^1^3^2|204|E|||| query is too vague, query requires either phonenumber, dateofbirth, both firstname and surname, both id and assigningauthorityid parameters
ERR||QPD^1^3^2|204|E|||| wildcard query is too vague, firstname or surname first character may not be a wildcard
ERR||QPD^1^3^2|204|E|||| wildcard query is too vague, surname length should be at least 4 chars plus wildcard
ERR||QPD^1^3^2|204|E|||| wildcard query is too vague, firstname length should be at least 4 chars plus wildcard
ERR||QPD^1^3^2|204|E|||| dateofbirth - invalid date or format - must be yyyymmdd or yyyymm or yyyy
ERR||QPD^1^3^2|204|E|||| invalid query
ERR||QPD^1^3^1|101|E|||| pdq query requires an id number
ERR||QPD^1^3^1|101|E|||| pdq query requires a domain
ERR||QPD^1^3^1^4|204|E|||| unknown domain
ERR||QPD^1^3^1^4|204|E|||| unknown domain namespace id
ERR||QPD^1^3^1^4|204|E|||| unknown domain universal id
ERR||QPD^1^3^2|204|E|||| invalid continuation pointer or quantity limit
ERR||QPD^1^4^1|204|E|||| unknown domain in whatdomainsreturned
ERR||QPD^1^3^2|204|E||||this id is not known
ERR||QPD^1^3^2|204|E||||unknown domain namespace id
SEQLENDTOPTRP/#TBL#Element NameValue per ExampleNotes
1493ELDBError Code and LocationSupported for backward compatibility only
218ERLRError LocationQPD^1^3^2Identifies the location in a message related to the identified error, warning or message. Components: <Segment ID>^<Segment Sequence>^<Field Position>^<Field Repetition>^<Component Number>
3705CWERError Code204204=unknown key identifier, 101=required field missing
42IDRSeverityEI=information, E=error, W=warning
8250TXOUser Messageunknown domain namespace id

3d. ITI-21 Response Query Acknowledgement​

Query Acknowledgement Segment (QAK) Specifications

QAK|111069|OK|Q22^Find Candidates^HL7nnnn|3|
SEQLENDTOPTRP/#TBL#Element NameValue per ExampleNotes
132STRQuery Tag111069Contains value sent in QPD-2 (query tag) by initiating system; used to match response messages to originating query. Responding system echoes it back as the first field of QAK.
2IDR0208Query Response StatusOKAllows responding system to return a precise response status; useful when no data found but no error either
3CERMessage Query NameQ22^Find Candidates^HL7nnnnMirrors QPD-1 (Message Query Name) from the query message being responded to
4NMOHit count3 (not supported)Total number of matches
5NMOThis PayloadNot supportedNumber sent in this response
6NMOHits RemainingNot supportedNumber left after this response

3e. ITI-21 Response Query Parameter Definition​

Response Query Parameter Definition Segment (QPD)

QPD|Q22^Find Candidates^HL7|8494764101303661668890645833527|@PID.3.1^7804250000088@PID.3.4.1^2DHA@PID.3.5.3^PI
SEQLENDTOPTRP/#TBL#Element NameValue per ExampleNotes
132CERMessage Query NameQ22^Find Candidates^HL7Name of the query, assigned by function-specific chapters of this specification; one to one with the conformance statement for this query name
2STRQuery Tag8494764101303661668890645833527Must be valued by initiating system to identify the query; used to match response messages. Differs from MSA-2 in that its value remains constant for each message associated with the query.
3VariesRUser Parameters (successive fields)@PID.3.1^7804250000088~@PID.3.4.1^2DHA~@PID.3.5.3^PISuccessive parameter fields hold the values the client passes to the server, as a sequence of HL7 fields. Understood positionally per the Conformance Statement. See 2b. ITI-21 Request Query Parameter Definition

3f. ITI-21 Response Patient Identification​

Response Patient Identification Segment Definition

The Patient Demographics Supplier Actor shall return one PID segment group (PID segment plus any associated segments) for each matching patient record found. The Supplier shall return the attributes within the PID segment as specified below, plus all other attributes for which it can supply values. Inability to supply an identifier in a particular domain (specified in QPD-8) is not an error, provided the domain is recognized.

Example:

PID|||IF82^^^DOH^MR^342415~00000179-500d-41ee-9970-131a39cf9a2e^^^HPRS_PATIENT_UUID~7804250000088^^^DHA^NNZAF~140-741-1626^^^DOH&www.health.gov.za&DNS^NH^^^20180704 (INACTIVE PRN with expiry date)~143-153-8008^^^DOH&www.health.gov.za&DNS^NH^^20180704 (ACTIVE PRN with effective date)|TESTSURNAME^TESTFIRSTNAME^^^^^U||19780425|F|||GOVAN MBEKI LOCAL MUNICIPALITY^^^^^ZA|^^^^^^^^^^^0820314017
SEQLENDTOPTRP/#Element NameValue per ExampleNotes
3250CXRPatient Identifier ListIF82^^DOH^MR~7804250000088^^^DHA^NNZAF~140-741-1626^^^DOH&www.health.gov.za&DNS^NH^^^20180704~143-153-8008^^^DOH&www.health.gov.za&DNS^NH^^20180704A patient may have multiple NH identifiers. PRN numbers can be active, inactive or neither; all are valid for querying. An ACTIVE PRN has an effective date, an INACTIVE PRN has an expiration date.
5250XPNRPatient NameTESTSURNAME^TESTFIRSTNAME^^^^^U
726TSR2Date/Time of Birth19780425yyyymmdd
81ISR2Administrative SexF
11250XADR2Patient AddressGOVAN MBEKI LOCAL MUNICIPALITY^^^^^ZA
1560CEOPrimary LanguageSee ISO 639-3 codes (AFR, ENG, NDE, SASL, SEP, SES, SWA, TSO, TSW, VEN, XHO, ZUL, etc.)https://iso639-3.sil.org/code_tables/639/data
161ISOMarital StatusD=Divorced, L=Separated, M=Married, S=Single, T=Registered Domestic Partnership, W=Widowed
3220ISRIdentity Reliability CodeUNNZAFIf idnumbers returned have not been verified by the DHA, PID.32 will be populated with UNNZAF – unverified nnzaf identifier

CX subcomponent structure (Patient Identifier List component parts):

SEQLENGTHDTOPTTBL#
CX.115STR
CX.21STO
CX.33/227ID/HDO0061 / 0363
CX.4
CX.55IDO0203
CX.6227HDO
CX.78DTO
CX.88DTO
CX.9705CWEO
CX.10705CWEO

3g. ITI-21 Response Next of Kin​

Response Next Of Kin Segment Definition

The NK1 segment contains information about the patient's other related parties. Utilizing NK1-1 (Set ID), multiple NK1 segments can be sent per patient.

Example:

NK1|1|testsurname^testfirstname^^^^^U|SIS^Sister|135 testRd^^^^^ZA|^^^^^^^^^^^0112345678
SEQLENDTOPTRP/#TBL#Element Name
NK1.14SIRSet ID - NK1
NK1.2250XPNO*NK Name
NK1.3250CEO10063Relationship
NK1.4250XADO*Address
NK1.5250XTNO*Phone Number
NK1.6250XTNO*Business Phone Number
NK1.7250CEO10131Contact Role
NK1.88DTO1Start Date
NK1.98DTO1End Date
NK1.1060STO1Next of Kin / Associated Parties Job Title
NK1.1120JCCO1Next of Kin / Associated Parties Job Code/Class
NK1.12250CXO1Next of Kin / Associated Parties Employee Number
NK1.13250XONO*Organization Name - NK1
NK1.14250CEO10002Marital Status
NK1.151ISO10001Administrative Sex
NK1.1626TSO1Date/Time of Birth
NK1.172ISO*0223Living Dependency
NK1.182ISO*0009Ambulatory Status
NK1.19250CEO*0171Citizenship
NK1.20250CEO10296Primary Language
NK1.212ISO10220Living Arrangement
NK1.22250CEO10215Publicity Code
NK1.231IDO10136Protection Indicator
NK1.242ISO10231Student Indicator
NK1.25250CEO10006Religion
NK1.26250XPNO*Mother's Maiden Name
NK1.27250CEO10212Nationality
NK1.28250CEO*0189Ethnic Group
NK1.29250CEO*0222Contact Reason
NK1.30250XPNO*Contact Person's Name
NK1.31250XTNO*Contact Person's Telephone Number
NK1.32250XADO*Contact Person's Address
NK1.33250CXO*Next of Kin/Associated Party's Identifiers
NK1.342ISO10311Job Status
NK1.35250CEO*0005Race
NK1.362ISO10295Handicap
NK1.3716STO1Contact Person Social Security Number
NK1.38250STO1Next of Kin Birth Place
NK1.392ISO10099VIP Indicator

3h. ITI-21 Response Continuation Pointer​

ITI-21 RESPONSE DSC SEGMENT

If the number of records is specified in RCP-2 (Quantity Limited Request), the Patient Demographics Supplier Actor shall return an incremental response of that number of records when the number of matching records found exceeds RCP-2. As long as the Supplier has records left to return, it shall return a DSC Segment containing a unique alphanumeric value (Continuation Pointer) that the Consumer may return in the DSC of the following QBP^Q22 message to request the next increment. The Supplier shall return increments as many times as requested (while increments remain), stopping when there are no more to return.

Example:

DSC|10|I
SEQLENDTOPTRP/#Element NameValue per ExampleNotes
1180STOContinuation Pointer10To request additional increments, DSC-1 of the following request shall echo the value from RSP^K22 DSC-1
21IDOContinuation StyleISignifies part of an interactive continuation message - predefined for ITI-21

PDQexamples​

ITI-21 PDQ MESSAGE EXAMPLES

Author: Kirsten du Toit — Version: 1.0 — Date: 19/03/2019

REQUEST WITH PRN WITHOUT HYPHENS

MSH|^~\&|TEST_HARNESS|TEST|CR1|MOH_CAAT|20090226131520-0600||QBP^Q22^QBP_Q21|TEST-CR-14-30|P|2.5
QPD|Q22^Find Candidates^HL7|8494764101303661668890645833527|@PID.3.1^1571472263~@PID.3.4.1^DOH
RCP|I

MSH|^~\&|HPRS|HPRS|TEST_HARNESS|TEST|201809261238||RSP^K22^RSP_K21|1539592665343843|P|2.5
MSA|AA|TEST-CR-14-30
QAK|8494764101303661668890645833527|OK
QPD|Q22^Find Candidates^HL7|8494764101303661668890645833527|@PID.3.1^1571472263~@PID.3.4.1^DOH
PID|||e5ced406-e512-11e5-abc1-63660d354159^^^HPRS_PATIENT_UUID&test-hie.health.gov.za&DNS~6610280162082^^^DHA&www.home-affairs.gov.za&DNS^NNZAF~157-147-2263^^^DOH&www.health.gov.za&DNS^NH20160308~157-147-2263^^^DOH&www.health.gov.za&DNS^MR^371924~157-147-2263^^^DOH&www.health.gov.za&DNS^MR^942124~157-147-2263^^^DOH&www.health.gov.za&DNS^MR^735042~157-147-2263^^^DOH&www.health.gov.za&DNS^MR^833442~157-147-2263^^^DOH&www.health.gov.za&DNS^MR^625251~157-147-2263^^^DOH&www.health.gov.za&DNS^MR^687651~157-147-2263^^^DOH&www.health.gov.za&DNS^MR^475542||Marais^Elliot^^^^^U||19661028|F|||135 North Street Roodepoort^Johannesburg^Johannesburg2169^ZA||TheUserdutoit@gmail.com^^^^^^^^^^^0847587514

REQUEST WITH PRN WITH HYPHENS

MSH|^~\&|TEST_HARNESS|TEST|CR1|MOH_CAAT|20090226131520-0600||QBP^Q22^QBP_Q21|TEST-CR-14-30|P|2.5
QPD|Q22^Find Candidates^HL7|8494764101303661668890645833527|@PID.3.1^165-676-3727~@PID.3.4.1^DOH~@PID.3.5^MR~@PID.3.6.1^242815
RCP|I

MSH|^~\&|HPRS|HPRS|TEST_HARNESS|TEST|201809261234||RSP^K22^RSP_K21|1539592558257293|P|2.5
MSA|AA|TEST-CR-14-30
QAK|8494764101303661668890645833527|OK
QPD|Q22^Find Candidates^HL7|8494764101303661668890645833527|@PID.3.1^165-676-3727~@PID.3.4.1^DOH~@PID.3.5^MR~@PID.3.6.1^242815
PID|||c0e82356-e510-11e5-a5a3-53cc0a9ce617^^^HPRS_PATIENT_UUID&test-hie.health.gov.za&DNS~9109199019099^^^DHA&www.home-affairs.gov.za&DNS^NNZAF~165-676-3727^^^DOH&www.health.gov.za&DNS^NH20160308~C-267^^^DOH&www.health.gov.za&DNS^MR^242815~165-676-3727^^^DOH&www.health.gov.za&DNS^MR^282515~165-676-3727^^^DOH&www.health.gov.za&DNS^MR^475542||Brooks^Corey^^^^^U||19910919|F|||MandyimbaPRETORIA^0001^ZA
NK1|1|brownkin^gloriakin^^^^^U|SIS^Sister|135 Boland Rd Roodepoort^^^^^ZA||^^^^^^^^^^^0847587514

REQUEST WITH PRN — NO PATIENTS FOUND (NF RESPONSE)

MSH|^~\&|TEST_HARNESS|TEST|CR1|MOH_CAAT|20090226131520-0600||QBP^Q22^QBP_Q21|TEST-CR-14-30|P|2.5
QPD|Q22^Find Candidates^HL7|8494764101303661668890645833527|@PID.3.1^0571472263~@PID.3.4.1^DOH
RCP|I

MSH|^~\&|HPRS|HPRS|TEST_HARNESS|TEST|201809261240||RSP^K22^RSP_K21|1539592708134533|P|2.5
MSA|AA|TEST-CR-14-30
QAK|8494764101303661668890645833527|NF
QPD|Q22^Find Candidates^HL7|8494764101303661668890645833527|@PID.3.1^0571472263~@PID.3.4.1^DOH

REQUEST WITH IDNUMBER (Multiple responses)

MSH|^~\&|TEST_HARNESS|TEST|CR1|MOH_CAAT|20090226131520-0600||QBP^Q22^QBP_Q21|TEST-CR-14-30|P|2.5
QPD|Q22^Find Candidates^HL7|8494764101303661668890645833527|@PID.3.1^6610280162082~@PID.3.4.1^DHA~@PID.3.5.3^NNZAF
RCP|I

MSH|^~\&|HPRS|HPRS|TEST_HARNESS|TEST|201809261242||RSP^K22^RSP_K21|1539592764850339|P|2.5
MSA|AA|TEST-CR-14-30
QAK|8494764101303661668890645833527|OK
QPD|Q22^Find Candidates^HL7|8494764101303661668890645833527|@PID.3.1^6610280162082~@PID.3.4.1^DHA~@PID.3.5.3^NNZAF
PID|||1b081000-f878-11e6-974b-cb1eb5d2a38a^^^HPRS_PATIENT_UUID&test-hie.health.gov.za&DNS~6610280162082^^^DHA&www.home-affairs.gov.za&DNS^NNZAF~105-466-1937^^^DOH&www.health.gov.za&DNS^NH20170221~105-466-1937^^^DOH&www.health.gov.za&DNS^MR^735042||dasda^Ethan^^^^^U||20100202|F|||120 North Street^^^^^ZA
PID|||b0c3920a-8ae5-11e6-9c22-0b1c04bd7897^^^HPRS_PATIENT_UUID&test-hie.health.gov.za&DNS~6610280162082^^^DHA&www.home-affairs.gov.za&DNS^NNZAF~154-199-1020^^^DOH&www.health.gov.za&DNS^NH20161005~154-199-1020^^^DOH&www.health.gov.za&DNS^MR^371924~154-199-1020^^^DOH&www.health.gov.za&DNS^MR^833442~154-199-1020^^^DOH&www.health.gov.za&DNS^MR^475542~154-199-1020^^^DOH&www.health.gov.za&DNS^MR^577133~154-199-1020^^^DOH&www.health.gov.za&DNS^MR^625251~154-199-1020^^^DOH&www.health.gov.za&DNS^MR^687651||Khumalo^Demo Name^^^^^U||20140610|F|||1 Roodepoort^Johannesburg^Johannesburg2169^ZA||TheUserdutoit@gmail.com^^^^^^^^^^^0847587514
PID|||e5ced406-e512-11e5-abc1-63660d354159^^^HPRS_PATIENT_UUID&test-hie.health.gov.za&DNS~6610280162082^^^DHA&www.home-affairs.gov.za&DNS^NNZAF~157-147-2263^^^DOH&www.health.gov.za&DNS^NH20160308~157-147-2263^^^DOH&www.health.gov.za&DNS^MR^371924~157-147-2263^^^DOH&www.health.gov.za&DNS^MR^942124~157-147-2263^^^DOH&www.health.gov.za&DNS^MR^735042~157-147-2263^^^DOH&www.health.gov.za&DNS^MR^833442~157-147-2263^^^DOH&www.health.gov.za&DNS^MR^625251~157-147-2263^^^DOH&www.health.gov.za&DNS^MR^687651~157-147-2263^^^DOH&www.health.gov.za&DNS^MR^475542||Marais^Elliot^^^^^U||19661028|F|||135 North Street Roodepoort^Johannesburg^Johannesburg2169^ZA||TheUserdutoit@gmail.com^^^^^^^^^^^0847587514
PID|||f48f0fc8-565a-11e7-9df3-831b79e6c3fb^^^HPRS_PATIENT_UUID&test-hie.health.gov.za&DNS~6610280162082^^^DHA&www.home-affairs.gov.za&DNS^NNZAF~174-161-2251^^^DOH&www.health.gov.za&DNS^NH20170621~8^^^DOH&www.health.gov.za&DNS^MR^242815||Booi^Name1^^^^^U||20100202|F|||134124 Roodepoort^Johannesburg^Johannesburg2169^ZA||TheUserdutoit@gmail.com^^^^^^^^^^^0847587514
PID|||35be7600-894c-11e6-a585-ff142c548652^^^HPRS_PATIENT_UUID&test-hie.health.gov.za&DNS~6610280162082^^^DHA&www.home-affairs.gov.za&DNS^NNZAF~110-965-2352^^^DOH&www.health.gov.za&DNS^NH20161003~110-965-2352^^^DOH&www.health.gov.za&DNS^MR^833442~110-965-2352^^^DOH&www.health.gov.za&DNS^MR^577133~110-965-2352^^^DOH&www.health.gov.za&DNS^MR^625251~110-965-2352^^^DOH&www.health.gov.za&DNS^MR^282515~110-965-2352^^^DOH&www.health.gov.za&DNS^MR^397460~110-965-2352^^^DOH&www.health.gov.za&DNS^MR^475542~110-965-2352^^^DOH&www.health.gov.za&DNS^MR^687651~110-965-2352^^^DOH&www.health.gov.za&DNS^MR^371924~110-965-2352^^^DOH&www.health.gov.za&DNS^MR^942124~110-965-2352^^^DOH&www.health.gov.za&DNS^MR^735042||joseph^Nosisi^^^^^U||20110303|F|||Ngqongweni Roodepoort^Johannesburg^Johannesburg2169^ZA||TheUserdutoit@gmail.com^^^^^^^^^^^0847587514
NK1|1|noksurname^nokfirstname^^^^^U|SIS^Sister|135 Boland Rd Boland Rd^Roodepoort^Johannesburg2169^ZA||^^^^^^^^^^^0847587514

REQUEST TOO VAGUE (AE RESPONSE)

MSH|^~\&|TEST_HARNESS|TEST|CR1|MOH_CAAT|20090226131520-0600||QBP^Q22^QBP_Q21|TEST-CR-14-30|P|2.5
QPD|Q22^Find Candidates^HL7|8494764101303661668890645833527|@PID.5.1.1^bo*@PID.5.2^na*@PID.8^F
RCP|I

MSH|^~\&|HPRS|HPRS|TEST_HARNESS|TEST|201809261248||RSP^K22^RSP_K21|1539592979931125|P|2.5
MSA|AE|TEST-CR-14-30
ERR|||207|E||||wildcard query is too vague, surname length should be at least 4 chars plus wildcard
QAK|8494764101303661668890645833527|AE
QPD|Q22^Find Candidates^HL7|8494764101303661668890645833527|@PID.5.1.1^bo*@PID.5.2^na*@PID.8^F

POINTS TO NOTE:

  1. A request by parameter PRN will only ever return one patient.
  2. If the PRN was allocated remotely and has not yet been synched from local to central, a search to central will not return a patient for that PRN. However a search to local will return that patient.
  3. A patient may have multiple PRNs.
  4. A search by NNZAF number (SA idnumber) may return multiple patients.

Sandbox

hprsintegrationv1.10​

HPRS integration sandbox details

Author: Kirsten du Toit — Version: 1.0 — Date: 19/03/2019

HPRS INTEGRATION SANDBOX ACCESS

CREATE A PATIENT TO SEARCH FOR ON THE HPRS WEBEND:

URL: https://test-hie.health.gov.za/

Username: Mede_Mass Password: 6jrzF2f7

  1. Login
  2. Select "facility settings" from drop down menu for "Administration"
  3. Register your PC to a certain facility by either searching for it and then selecting it, or browsing through the facility tree (for example 'bhele')
  4. Please note you will need to use the DOH 6 digit facilityid associated with this facility when querying via pdq.
  5. Bhele: 735042
  6. Register a visit
  7. Take note of the new patient's Patient Record Number, their ID number.

Hook Notification:

HPRS provides a hook on the successful registration of a visit that posts the following information to the below url:

Request URL: https://127.0.0.1:4720/

Form Data:

firstname: Name
surname: Surname
HPRN: 1346541529
prnfile:
idNumber: 2110280162082
hprs_uuid: 617a6c92-bb8b-11e6-acc0-838a7c0786d3

The integrating application will be able to listen for this https post and then make a pdq request based on the information passed in the post. The post url is https because browsers do not allow http requests within https environments.

PDQ ACCESS:

All PDQ requests whether to HPRS central or to HPRS local use Mutual TLS Https (see separate document 'ER7 over HTTPS' for details). Health-interop is setup to work with both mutual TLS (certificate that we sign for you) and without mutual TLS (still using https, but not sending a certificate). Note that this is only for testing. A certificate is REQUIRED for connection to production central.

Secured HTTPS traffic (Mutual TLS): URL: https://test-hie.health.gov.za/pdq

Use the Patient Idnumber, HPRS uuid, FileNumber, PRN or demographics to query via pdq.

WORKING PDQ EXAMPLES: See separate document

TEST TOOL: POSTMAN in order to create an http post for testing the PDQ query and response.

Integration Methods

The following integration methods are available for testing on health-interop:

Service nameProtocolPort Number
hprs-local-pix-pdq-service (no longer supported)MLLP2575
hprs-local-pix-pdq-service-tls (no longer supported)MLLP TLS2576
hprs-local-pix-pdq-service-httpsHTTPS443

There are 3 methods of sending pdq requests:

  1. Unsecured MLP traffic: URL: test-hie.health.gov.za:2575
  2. Secured MLP traffic: URL: test-hie.health.gov.za:2576
  3. Secured HTTPS traffic (Mutual TLS): URL: https://test-hie.health.gov.za/pdq

For the purposes of testing, mutual TLS is optional in order to test against https://test-hie.health.gov.za/pdq. However a certificate is required for connection to production HPRS central or facility versions.

Transports and Protocols

V2.5 HL7 Communication standard​

Overview: http://art-decor.org/decor/services/ProjectIndex?prefix=ad4bbr-&format=html&language=en-US (Project Index HL7 V2.5 International)

See also: https://en.wikipedia.org/wiki/Health_Level_7

The HL7 version 2 standard (also known as Pipehat) has the aim to support hospital workflows. It was originally created in 1989. HL7 version 2 defines a series of electronic messages to support administrative, logistical, financial as well as clinical processes. Since 1987 the standard has been updated regularly, resulting in versions 2.1, 2.2, 2.3, 2.3.1, 2.4, 2.5, 2.5.1 and 2.6. The v2.x standards are backward compatible (e.g., a message based on version 2.3 will be understood by an application that supports version 2.6).

HL7 v2.x messages use a non-XML encoding syntax based on segments (lines) and one-character delimiters. Segments have composites (fields) separated by the composite delimiter. A composite can have sub-composites (components) separated by the sub-composite delimiter, and sub-composites can have sub-sub-composites (subcomponents) separated by the sub-sub-composite delimiter.

The default delimiters are vertical bar or pipe (|) for the field separator, caret (^) for the component separator, and ampersand (&) for the subcomponent separator. The tilde (~) is the default repetition separator.

Each segment starts with a 3-character string which identifies the segment type. Each segment of the message contains one specific category of information. Every message has MSH as its first segment, which includes a field that identifies the message type.

The message type determines the expected segment types in the message. The segment types used in a particular message type are specified by the segment grammar notation used in the HL7 standards.

Example (admission message):

MSH|^~\&|MegaReg|XYZHospC|SuperOE|XYZImgCtr|20060529090131-0500||ADT^A01^ADT_A01|01052901|P|2.5
EVN||200605290901||||200605290900
PID|||56782445^^^XYZ UAReg^PI||KLEINSAMPLE^BARRY^Q^JR||19620910|M||2028-9HL70005^RA99113^^^99DEF^AN|260 GOODWIN CREST DRIVE^BIRMINGHAM^AL^35209^^M~NICKELL'S PICKLES^10000 W 100TH AVE^BIRMINGHAM^AL^35200^^O
PV1||I|W^389^1^UABH^^^^3^^^V VISIT|E||||13579^POTTER^SHERMAN^T^^^MD^0010^UAMC^L|||||||||||||||||||||||||||200605290900
OBX|1|NM|^Body Height||1.80|m^Meter^ISO+|||||F
OBX|2|NM|^Body Weight||79|kg^Kilogram^ISO+|||||F
AL1|1||^ASPIRIN
DG1|1||786.50^CHEST PAIN, UNSPECIFIED^I9|||A

(Note: the PV1/attending-physician portion of this sample message is reconstructed from a somewhat garbled source and may not be exactly byte-for-byte identical to the original.)

Article Sources and Contributors

V2.5 HL7 Communication standard — Contributors: Kdutoit, Kvdwalt, RAlberts

ER7 over HTTPS​

ER7 OVER HTTPS

Author: Kirsten du Toit — Version: 1.0 — Date: 19/03/2019

Communications Protocol

The only currently supported transport protocol is ER7 over HTTPS secured with mutual TLS, i.e. a pipe-hat message set as the body of an HTTPS request that is secured with a certificate and key as allocated by HPRS.

ER7 over HTTPS

ER7 over HTTP Draft Specification: https://hapifhir.github.io/hapi-hl7v2/hapi-hl7overhttp/specification.html

ER7 communications can also be sent via https, also secured using Mutual TLS Authentication. Before testing can take place, the testing client will need to be allocated an SSL certificate that the testing client machine will use to establish the https socket connection.

If the body of the HTTPS message contains a valid PDQ request and is accepted by the server, then a 200 OK response containing the HL7 response will be returned.

HL7 PROCESSING ERROR

If there is an error within the HL7 processing, the HL7 error acknowledgement code will be supplied within the HL7 message within the body of a 200 OK HTTPS response.

HL7 acknowledgement codes

The HL7 protocol defines four non-successful acknowledgement codes:

  • AR (Application Reject)
  • AE (Application Error)
  • CR (Commit Reject)
  • CE (Commit Error)

When a receiving application produces an HL7 response payload containing one of these status codes, this is considered a successful interaction at the transport layer, and a response code of "HTTP/1.1 2xx" MUST be used.

HTTP TRANSPORT ERRORS

If there is an error at the HTTP transport layer (routing/authentication problem), a NON-HL7 response will be generated with an error HTTP response code.

If the response status is not HTTP 2xx, the content type MUST NOT be an HL7 payload type. Instead, a textual representation of the transport level error must be provided using an appropriate content type.

Non-2xx status codes are reserved for use in cases where the message was not understood, could not be delivered to the receiving application layer, or the receiving application layer failed to process the message due to an unexpected error condition.

Status CodeDescription
400 Bad RequestThe server cannot or will not process the request due to an apparent client error (e.g., malformed request syntax, size too large, invalid request message framing, or deceptive request routing).
401 Unauthorized (RFC 7235)Similar to 403 Forbidden, but specifically for use when authentication is required and has failed or has not yet been provided. The response must include a WWW-Authenticate header field containing a challenge applicable to the requested resource. See Basic access authentication and Digest access authentication. 401 semantically means "unauthenticated," i.e. the user does not have the necessary credentials. Note: some sites incorrectly issue HTTP 401 when an IP address is banned from a website and that specific address is refused permission to access it.
403 ForbiddenThe request was valid, but the server is refusing action. The user might not have the necessary permissions for a resource, or may need an account of some sort.
404 Not FoundThe requested resource could not be found but may be available in the future. Subsequent requests by the client are permissible.
405 Method Not AllowedA request method is not supported for the requested resource; for example, a GET request on a form that requires data to be presented via POST, or a PUT request on a read-only resource.
408 Request TimeoutThe server timed out waiting for the request. According to HTTP specifications: "The client did not produce a request within the time that the server was prepared to wait. The client MAY repeat the request without modifications at any later time."
413 Payload Too Large (RFC 7231)The request is larger than the server is willing or able to process. Previously called "Request Entity Too Large".
415 Unsupported Media TypeThe request entity has a media type which the server or resource does not support. For example, the client uploads an image as image/svg+xml, but the server requires that images use a different format.
500 Internal Server ErrorA generic error message, given when an unexpected condition was encountered and no more specific message is suitable.
502 Bad GatewayThe server was acting as a gateway or proxy and received an invalid response from the upstream server.
504 Gateway TimeoutThe server was acting as a gateway or proxy and did not receive a timely response from the upstream server.

MLP (no longer supported)​

Communications Protocol

MLLP (Minimal Lower Layer Protocol), also known as Lower Layer Protocol (LLP), is no longer supported for transmitting the HL7 message string (as of HPRS v1.13.0).

A large portion of HL7 messaging is transported by Minimal Lower Layer Protocol (MLLP), also known as Lower Layer Protocol (LLP). For transmitting via TCP/IP, header and trailer characters are added to the message to identify the beginning and ending of the message because TCP/IP is a continuous stream of bytes.

MLLP takes place on a socket connection established between host and client. To conform to the MLLP standard, the ER7 HL7 message (pipehat string) must have header and trailer characters as laid out in the JavaScript example code below.

ENCODER

var options = { encoding: 'utf8' };
var start = new Buffer([0x0B]);
var end = new Buffer([0x1C, 0x0D]);
Encoder.prototype._transform = function(chunk, encoding, callback) {
this.push(Buffer.concat([start, chunk, end]));
callback();
};

Security

The socket connection is secured using Mutual TLS Authentication. Before testing can take place, the testing client will need to send the SSL certificate that the testing client machine will be using to establish the socket connection. See example JavaScript code below:

ENCODER WITH TLS

var start = new Buffer([0x0B]);
var end = new Buffer([0x1C, 0x0D]);
var options = {
key: fs.readFileSync("HPRSPIXPDQ.key.pem"),
cert: fs.readFileSync("HPRSPIXPDQ.cert.crt"),
requestCert: true
};

console.log("trying to connect tls on port 8081, 146.64.19.175");
var socket = tls.connect(8081, '146.64.19.175', options, function () {
console.log('client connected', socket.authorized ? 'authorized' : 'unauthorized');
var msg = fs.readFileSync('test/files/IHE-transactions/ITI-21-query-demographics-by-id.er7');
msg = msg.toString().replace('\n', '\r');
socket.write(start + msg + end);
});
socket.setEncoding('utf8');

Normal Points of message definition conformance failure:

  1. Missing Requesting application in message header.
  2. Missing Integrator name in message header.
  3. Missing Requesting facility in message header.
  4. Missing Security field in message header.
  5. Missing ATNA logging.
  6. Inability to handle Error cases.