Developer documentation‎ > ‎HL7 API‎ > ‎Messages‎ > ‎MDM T02‎ > ‎


MDM T02: Send a document


In addition to care plans, the MDM T02 can be used to send correspondence to a patient, for example a discharge summary. The document type (TXA-2) value will be used to determine what sort of data we have received.

Relevant entities

  • Correspondence information will be used to populate [[Document]] entities
Please click through to the Data Model to explore the presentation of these entities in the web interface.

Update behaviour

Message Entity Matching Criteria Behaviour (Matched) Behaviour (Not Matched)
T02 [[Document]] [[Document.External Data Point ID]] as derived from TXA-12.1 Replacement. The existing document is replaced in its entirety with the values provided in this message. A partial update is not performed. New [[Document]] created.


Segment Field Component Description Example Data Model


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



Patient identification. This conforms to PKB's standard definition.


We identify the [[Document.Timestamp]] value by trying the following fields in order: TXA-8, TXA-7, TXA-6, TXA-4. If none are provided, MSH-7 will be used.

Document type

TXA-2.1 Document type. Allowed values for this field are defined in Code Set PKBCS05, but you must not use CP since that will cause the document to be handled as a care plan. DS [[Document.Document Type]]

[ TXA-4 ]
Activity timestamp

TXA-4.1 Activity timestamp 201508010900 [[Document.Timestamp]]

if neither TXA-8, TXA-7, nor TXA-6 were provided.

[ TXA-5 ]
Primary activity provider. If provided, at least the family name must be given.
 [[Document->Source.Source Text]]

TXA-5.2 Family name Foster
    [ TXA-5.3 ] Given name John  
    [ TXA-5.4 ] Middle names Harry  
    [ TXA-5.6 ] Title Dr  

[ TXA-6 ]
Origination timestamp

TXA-6.1 Origination timestamp 201508010910 [[Document.Timestamp]]

if neither TXA-8 nor TXA-7 were provided.

[ TXA-7 ]
Transcription timestamp

TXA-7.1 Transcription timestamp 201508010920 [[Document.Timestamp]]

if TXA-8 was not provided.

[ TXA-8 ]
Edit timestamp

TXA-8.1 Edit timestamp 201508010930 [[Document.Timestamp]]
   TXA-12   Unique document number    
     TXA-12.1 Unique document number MYDOC00001 [[Document.External Data Point ID]]
  [ TXA-16 ]   Filename. If provided, will be used instead of the default for the name of the downloadable attachment.    
     TXA-16.1 Filename mydoc.rtf [[Document->Attachment.Filename]]
  TXA-17   Document completion status.    
     TXA-17.1 Document completion status. Must be "AU" for authenticated (this is not an in-progress or tentative document). AU

Observation or result.  This contains the actual document content. See the OBX definition for an ORU R01 message, but note the extra restrictions.


    OBX-2.1  Only "ED" supported. ED  


    OBX-5.2 Only "TEXT" supported. TEXT  

OBX-5.3 RTF or PDF accepted. Note that viewing these attachments requires the end user to have the viewer installed, e.g. Microsoft Word or Adobe Reader. RTF  

OBX-5.4 Must be either "Base64" or "A", to match the data supplied in OBX-5.5. Base64  

OBX-5.5 If encoded in "A" format, this data must be escaped using the standard HL7 escape strings. e1xydGYxXGFkZWZsYW5nMTAyN... This value set in


after being processed according to OBX-5.4

[ OBX-13 ]
Custom access rules. Currently supported: "{patientDelay:NUMBERdays}" with any whole number in place of "NUMBER" (no spaces).  The patient will see that the message has arrived, but the contents will not be revealed until the set number of days past the date/time of the message have passed. If this field is not specified the patient will be able to see the message immediately.

OBX-13.1 Custom access rules {patientDelay:3days}  
[ PV1 ]


[ PV1-2 ]
Patient class

PV1-2.1 Patient class. Allowed values are defined in Code Set PKBCS04. I [[Document.Class]]
  [ PV1-10 ]   Hospital service. See here for more information on code sets.  
    PV1-10.1 Hospital service code SPEC_03 [[Document.Specialty]]
[ ZPM ]

Custom segment for a partner hybrid mail solution to provide postal metadata

[ ZPM-1 ]
Postal metadata

ZPM-1.1 Planned Postal Date.
If the supplied value includes time information then this will still be accepted but the time element will be ignored.
20150815 [[Document.Planned Postal Date]]


PID|||9999999999^^^NHS^NH||Smith^John^Joe^^Mr||19700101|M|||My flat name^1, The Road^London^London^SW1A 1AA^GBR||^NET~01234567890^PRN~07123456789^PRS|^NET~01234098765^WPN||||||||||||||||N|
OBX|1|ED|||^TEXT^RTF^Base64^BERi0xLjMKJeTjz9IKNSI (more bytes...)||||||


PKB will respond with a standard HL7 acknowledgement.