MediRecords FHIR Implementation Guide
1.4.2 - release


DocumentReference

The MediRecords FHIR API supports the following DocumentReference profiles:

MRDocumentReferenceIn Correspondence - In
MRDocumentReferenceOut Correspondence - Out
MRDocumentReferencePrescription Medications - Prescription
MRDocumentReferenceConsultation Consultation - Notes
MRDocumentReferenceAdmission Admission - Notes
MRDocumentReferenceConsent Consent Document
MRDocumentReferenceAttachment Attachment Document
MRDocumentReferenceOutWrite Correspondence Out - Write

The MediRecords FHIR API supports the following DocumentReference operations.

Read

GET {API_URL}/v1/DocumentReference/{id}

This API interface enables the client to read a DocumentReference resource from MediRecords repository which is compliant with the supported MediRecords DocumentReference profiles.

In an error situation, server SHALL return OperationOutcome detailing the error with the appropriate HTTP Error code as follows.

Status Text
200 OK
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Server Error

Create

POST {API_URL}/v1/DocumentReference

This API interface enables the client to create a DocumentReference resource in MediRecords repository which is compliant with following DocumentReference profiles:

Description Request Profile Response Profile
Correspondence Out - Write MRDocumentReferenceOutWrite MRDocumentReferenceOut
Request Parameters  
_format This parameter allows a client to override the accept header value when it is unable to set it correctly due to internal limitations (e.g. XSLT usage). the values xml, text/xml, application/xml, and application/fhir+xml SHALL be interpreted to mean the XML format, the codes json, application/json and application/fhir+json SHALL be interpreted to mean the JSON format. The _format parameter does not override the Content-Type header for the type of the body of a POST request
Request Headers  
Prefer The client can indicate how the response can be returned. return=minimal indicates that the client asks to return no body. return=representation indicates that the client asks to return the full resource. return=OperationOutcome indicates that the client asks server to return an OperationOutcome resource containing hints and warnings about the operation rather than the full resource. If not provided, it defaults to return=representation.
X-Request-Id A unique id to for the request/response assigned by either client or server. The expected format is UUID. If the client doesn’t supply this id, it is expected that server SHALL assign one.

Request Body

Request body that creates a new DocumentReference resource. See the following examples for sample request bodies:

Description Example(s)
Correspondence Out - Write DocumentReference Out Write Example(s)

Response

In an error situation, server SHALL return OperationOutcome detailing the error with the appropriate HTTP Error code as follows.

Status Text  
201 Created The response to this depends on what is specified in “Prefer” header or what is server’s default behaviour. By default this returns the requested DocumentReference instance with the logical id populated in it.
400 Bad Request Resource could not be parsed or failed basic FHIR validation rules
401 Unauthorized  
403 Forbidden  
422 Unprocessable Entity The proposed resource violated applicable FHIR profiles or server business rules.
500 Internal Server Error  

Webhook

The following table provides the FHIR Webhook event types generated for the DocumentReference resource.

Hub Event Application Trigger Event
document-in-reference.created Occurs whenever a new correspondence in record is created
document-out-reference.created Occurs whenever a new correspondence out record is created
document-in-reference.updated Occurs whenever a correspondence in record is updated
document-out-reference.updated Occurs whenever a correspondence out record is updated
Bundle<br>
  DocumentReference (1)
  Encounter (0..1)
  Patient (1)
  PractitionerRole (0..2)
  Practitioner (0..3)
  Organization (0..3)
   
document-in-reference.deleted Occurs whenever a correspondence in record is deleted
document-out-reference.deleted Occurs whenever a correspondence out record is deleted
Bundle<br>
  request (1)
    url: DELETE DocumentReference/{id}

Webhook Prescription

The following table provides the FHIR Webhook event types generated for the MRDocumentReferencePrescription resource.

Hub Event Application Trigger Event  
document-reference.created Occurs whenever an documentreference prescription record is created  
Bundle
  DocumentReference (1)
  Practitioner (0..*)
  Organization (0..*)
  Patient (1) 
  Encounter (0..*)
  MedicationRequest (0..*)

Webhook Consultation

The following table provides the FHIR Webhook event types generated for the MRDocumentReferenceConsultation resource.

Hub Event Application Trigger Event  
document-reference-consultation.created Occurs whenever an documentreference consultation record is created  
document-reference-consultation.updated Occurs whenever an documentreference consultation record is created  
document-reference-attachment.created Occurs whenever an documentreference consultation attachment record is created  
Bundle
  DocumentReference (1)
  Practitioner (0..*)
  Organization (0..*)
  Patient (1) 
  Encounter (0..*)

Webhook Admission

The following table provides the FHIR Webhook event types generated for the MRDocumentReferenceAdmission resource.

Hub Event Application Trigger Event  
document-reference-admission.created Occurs whenever an documentreference admission record is created  
document-reference-admission.updated Occurs whenever an documentreference admission record is updated  
document-reference-attachment.created Occurs whenever a single file is uploaded as an admission attachment  
Bundle
  DocumentReference (1)
  Practitioner (0..*)
  Organization (0..*)
  Patient (1) 
  RelatedPerson (0..*)
  Encounter (1)
  PractitionerRole (0..*)
  Location (0..*)
document-reference-attachment.deleted Occurs whenever a single file is deleted in the admission attachment
Bundle
  request (1)
  url: DELETE DocumentReference/{id}