Difference between revisions of "MHD Implementation Guide"

From IHE Wiki
Jump to navigation Jump to search
Line 477: Line 477:
 
Host: example.org
 
Host: example.org
 
Accept: application/json
 
Accept: application/json
Content-Type: application/json
+
Content-Type: application/json+fhir
 
Origin: trustme.org
 
Origin: trustme.org
  

Revision as of 08:14, 23 October 2014

MHD Submissions

This is an example of an MHD submission. It is minimal in that it is a submission of a single document, its associated metadata, and the DocumentManifest/SubmissionSet which documents the submission. Also, each metadata object includes only the required attributes. Some are required by the IHE XDS profile and others required by the FHIR specification. Either way, this is the minimal set.

Sorry for the horrible use of codes but remember that famous quote from Star Trek (with apologies): Darn-it Jim, I'm an engineer, not a doctor.

FHIR Document

This example of a Provide Document Resources transaction only shows the minimum required fields and attributes. The HL7 FHIR documentation contains the full specification at http://www.hl7.org/implement/standards/fhir/xml.html#atom. The specification for what goes into the Atom feed (which makes it a FHIR Document) can be found at http://www.hl7.org/implement/standards/fhir/documents.html.

A FHIR Document is a submission of a bundle of resources organized by the Atom Feed wrapper. The term FHIR Document is unrelated to the IHE Document Sharing concept of Document which is a piece of stored content.

This example shows the most basic MHD submission: DocumentManifest, single DocumentReference, and the Binary resource holding the content of the Document Sharing document. In this example the Binary resource is packaged in the Atom Feed as a separate entry. It could have been packaged inside the DocumentReference in a <contained/> section. FHIR allows either encoding.

<?xml version="1.0" encoding="UTF-8"?>

<feed xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.w3.org/2005/Atom ../../../HL7/FHIR/Schema/atom.xsd"
 xmlns="http://www.w3.org/2005/Atom">
    <title>FHIR Document</title>
    <id>urn:uuid:29b42a31-4dc0-4021-ad67-fede99c5d3c1</id>
    <updated>2005-12-24T09:35:00</updated>
    <category scheme="http://hl7.org/fhir/tag" term="http://hl7.org/fhir/tag/document"/>
    <entry>
        <title>Entry title</title>
        <id>urn:uuid:5749d5ca-df77-4dd2-b9f4-dcdcdeb5c746</id>
        <updated>2005-12-24T09:35:00</updated>
        <content type="text/xml">
            <!-- The Composition resource anchors the submission by duplicating content in 
                the SubmissionSet and Association content in composing these separate 
                elements into a single submission. In XDS these elements are naturally 
                grouped.  In FHIR they would more naturally be submitted separately.  
                The Composition resource bridges the gap.
               -->
            <Composition xsi:schemaLocation="http://hl7.org/fhir file:/Users/bmajur/Documents/HL7/FHIR/Schema/fhir-all-xsd/fhir-all.xsd"
                xmlns="http://hl7.org/fhir">
                <text>
                    <status value="generated"/>
                    <div xmlns="http://www.w3.org/1999/xhtml"/>
                </text>
                <date value="2005-12-24T09:35:00"/>
                <type>
                    <text value="MHD Submission"/>
                </type>
                <status value="final"/>
                <confidentiality>
                    <system value="http://ihe.net/xds/connectathon/confidentialityCodes"/>
                    <code value="1.3.6.1.4.1.21367.2006.7.101"/>
                    <display value="Clinical-Staff"/>
                </confidentiality>                
                <subject>
                    <display value="King George"/>
                </subject>
                <author>
                    <display value="King George's Royal Doctor"/>
                </author>
                <!-- The sections tie together all the composed entries -->
                <section>
                    <!-- DocumentManifest -->
                    <content>
                        <!-- references the entry below -->
                        <reference value="urn:uuid:9d8257d3-ae40-4b02-b2b9-c0e8849bac8b"/>
                    </content>
                </section>
                <section>
                    <!-- DocumentReference -->
                    <content>
                        <!-- references the entry below -->
                        <reference value="urn:uuid:e15620b3-0dd3-44fd-b75b-f57598f7c752"/>
                    </content>
                </section>
                <section>
                    <!-- Binary (document content) -->
                    <content>
                        <!-- references the entry below -->
                        <reference value="urn:uuid:72fe0400-db3f-43a5-99ed-cad93a1595ad"/>
                    </content>
                </section>
            </Composition>
        </content>
    </entry>
    <entry>
        <title>Entry title</title>
        <id>urn:uuid:9d8257d3-ae40-4b02-b2b9-c0e8849bac8b</id>
        <updated>2005-12-24T09:35:00</updated>
        <content type="text/xml">
            <DocumentManifest xmlns="http://hl7.org/fhir">
                <!-- content removed -->
            </DocumentManifest>
        </content>
    </entry>
    <entry>
        <title>Entry title</title>
        <id>urn:uuid:e15620b3-0dd3-44fd-b75b-f57598f7c752</id>
        <updated>2005-12-24T09:35:00</updated>
        <content type="text/xml">
            <DocumentReference xmlns="http://hl7.org/fhir">
                <!-- content removed -->
            </DocumentReference>
        </content>
    </entry>
    <entry>
        <title>Entry title</title>
        <id>urn:uuid:72fe0400-db3f-43a5-99ed-cad93a1595ad</id>
        <updated>2005-12-24T09:35:00</updated>
        <content type="text/xml">
            <Binary xmlns="http://hl7.org/fhir" contentType="text/plain">
                QmFzZS02NCBjb250ZW50IGdvZXMgaGVyZQ==
            </Binary>
        </content>
    </entry>
</feed>

Minimal DocumentReference

This is the most basic MHD DocumentReference object. It contains the attributes required by XDS and by FHIR and includes nothing extra. The target of the reference #binary is not included. This has been validated with the FHIR schema but not yet tested against any of the FHIR test servers. It is parsed correctly by the Java Reference Implementation.

<?xml version="1.0" encoding="UTF-8"?>

<!-- DocumentReference
    This is the absolute minimalistic coding of an MHD DocumentReference with
    requirements coming from both FHIR and XDS.
-->
<DocumentReference xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://hl7.org/fhir file:/Users/bmajur/Documents/HL7/FHIR/Schema/fhir-all-xsd/fhir-all.xsd"
    xmlns="http://hl7.org/fhir">
    <!-- DocumentEntry.sourcePatientId and DocumentEntry.sourcePatientInfo
         coded as extension with a reference from the Patient resource representing
         the sourcePatient (information stored outside XDS environment on the patient -->
    <extension url="http://ihe.net/fhir/Profile/XDS/extensions#sourcePatient">
        <valueResource>
            <reference value="#sourcepatient"/>
        </valueResource>
    </extension>
    <text>
        <status value="generated"/>
        <div xmlns="http://www.w3.org/1999/xhtml"/>
    </text>
    <contained>
        <!-- only detail is Patient ID 
             referenced by <subject/> DocumentEntry.patientId 
             this is the Affinity Domain patientID -->
        <Patient id="patient">
            <identifier>
                <system value="urn:oid:1.3.6.1.4.1.21367.2005.3.7"/>
                <value value="1234"/>
            </identifier>
        </Patient>
    </contained>
    <contained>
        <!-- this could contain the full sourcePatientInfo detail 
             referenced by <subject/> DocumentEntry.patientId 
             this is the Source patientID -->
        <Patient id="sourcepatient">
            <identifier>
                <value value="DTG1234"/>
                <system value="urn:oid:7.7.7"/>
            </identifier>
        </Patient>
    </contained>
    <contained>
        <!-- DocumentEntry.author.authorPerson -->
        <Practitioner id="docdave">
            <name>
                <family value="Careful"/>
                <given value="Dave"/>
                <prefix value="Dr"/>
            </name>
        </Practitioner>
    </contained>
    <!-- DocumentEntry.uniqueId -->
    <masterIdentifier>
        <system value="urn:ietf:rfc:3986"/>
        <value value="urn:oid:1.3.6.1.4.1.21367.2005.3.7"/>
    </masterIdentifier>
    <!-- DocumentEntry.patientId -->
    <subject>
        <reference value="#patient"/>
    </subject>
    <!-- DocumentEntry.typeCode -->
    <type>
        <coding>
            <system value="urn:oid:2.16.840.1.113883.6.1"/>
            <code value="28651-8"/>
            <display value="Nurse Transfer note"/>
        </coding>
    </type>
    <!-- DocumentEntry.classCode -->
    <class>
        <coding>
            <system value="urn:oid:1.3.6.1.4.1.21367.100.1"/>
            <code value="DEMO-Pt Mgmt"/>
            <display value="Patient Management"/>
        </coding>
    </class>
    <!-- DocumentEntry.author 
         this is required by FHIR and optional in XDS -->
    <author>
        <reference value="#docdave"/>
    </author>
    <!-- DocumentEntry.creationTime -->
    <created value="2005-12-24T09:35:00"/>
    <!-- required by FHIR - when was DocumentReference created -->
    <indexed value="2005-12-24T09:35:00"/>
    <!-- DocumentEntry.availabilityStatus (Approved) 
         FHIR requires this on submission -->
    <status value="current"/>
    <!-- DocumentEntry.confidentialityCode -->
    <confidentiality>
        <coding>
            <system value="urn:oid:2.16.840.1.113883.5.25"/>
            <code value="N"/>
            <display value="Normal"/>
        </coding>
    </confidentiality>
    <!-- DocumentEntry.languageCode -->
    <primaryLanguage value="en-US"/>
    <!-- DocumentEntry.mimeType -->
    <mimeType value="text/plain"/>
    <format value="urn:wustl:mir:ppoc:1999"/>
    <location value="#binary1"/>
    <!-- DocumentEntry.formatCode - 
         not a coded value like in XDS -->
    <context>
        <!-- DocumentEntry.healthcareFacilityTypeCode -->
        <facilityType>
            <coding>
                <system value="urn:oid:2.16.840.1.113883.5.11"/>
                <code value="PEDHO"/>
                <display value="Pediatric oncology clinic"/>
            </coding>
        </facilityType>
    </context>
</DocumentReference>

Minimal DocumentManifest

This is the most basic MHD DocumentManifest object. It contains the attributes required by XDS and by FHIR and includes nothing extra. This has been validated with the FHIR schema but not yet tested against any of the FHIR test servers.

<?xml version="1.0" encoding="UTF-8"?>

<!-- DocumentManifest
    This is the absolute minimalistic coding of an MHD DocumentManifest with
    requirements coming from both FHIR and XDS.
-->

<DocumentManifest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://hl7.org/fhir file:/Users/bmajur/Documents/HL7/FHIR/Schema/fhir-all-xsd/fhir-all.xsd"
    xmlns="http://hl7.org/fhir">
    <!-- SubmissionSet.contentTypeCode. See Open Issue MHD022 for discussion on why this may be wrong! -->
    <extension url="http://ihe.net/fhir/Profile/XDS/extensions#contentTypeCode">
        <valueCodeableConcept>
            <coding>
                <system value="2.16.840.1.113883.6.1"/>
                <code value="28570-0"/>
                <display value="Procedure Note"/>
            </coding>
        </valueCodeableConcept>
    </extension>
    <text>
        <status value="generated"/>
        <div xmlns="http://www.w3.org/1999/xhtml"/>
    </text>
    <contained>
        <!-- only detail is Patient ID 
             referenced by <subject/> SubmissionSet.patientId 
             this is the Affinity Domain patientID -->
        <Patient id="patient">
            <identifier>
                <system value="urn:oid:1.3.6.1.4.1.21367.2005.3.7"/>
                <value value="1234"/>
            </identifier>
        </Patient>
    </contained>
    <!-- SubmissionSet.uniqueId -->
    <masterIdentifier>
        <system value="urn:ietf:rfc:3986"/>
        <value value="urn:oid:1.3.6.1.4.1.21367.2005.3.8"/>
    </masterIdentifier>
    <!-- DocumentEntry.patientId -->
    <subject>
        <reference value="#patient"/>
    </subject>
    <!-- SubmissionSet.availabilityStatus 
         FHIR requires this on submission -->
    <status value="current"/>
    <!-- This takes the place of the HasMember association placing
         a DocumentEntry/DocumentReference in the SubmissionSet. The
         referenced value is not present in the example since this is an example
         of just the DocumentManifest object. -->
    <content>
        <reference value="#DocumentEntry1"/>
    </content>
</DocumentManifest>

Full DocumentReference

This example contains all the attributes defined by XDS. The target of the reference #binary is not included. This is a work in progress.

<?xml version="1.0" encoding="UTF-8"?>

<!-- DocumentReference
    This example contains all the attributes defined by XDS.
-->
<DocumentReference xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://hl7.org/fhir file:/Users/bmajur/Documents/HL7/FHIR/Schema/fhir-all-xsd/fhir-all.xsd"
    xmlns="http://hl7.org/fhir">
    <!-- DocumentEntry.sourcePatientId and DocumentEntry.sourcePatientInfo
         coded as extension with a reference from the Patient resource representing
         the sourcePatient (information stored outside XDS environment on the patient -->
    <extension url="http://ihe.net/fhir/Profile/XDS/extensions#sourcePatient">
        <valueResource>
            <reference value="#sourcepatient"/>
        </valueResource>
    </extension>
    <text>
        <status value="generated"/>
        <div xmlns="http://www.w3.org/1999/xhtml"/>
    </text>
    <contained>
        <!-- only detail is Patient ID 
             referenced by <subject/> DocumentEntry.patientId 
             this is the Affinity Domain patientID -->
        <Patient id="patient">
            <identifier>
                <system value="urn:oid:1.3.6.1.4.1.21367.2005.3.7"/>
                <value value="1234"/>
            </identifier>
        </Patient>
    </contained>
    <contained>
        <!-- this could contain the full sourcePatientInfo detail 
             referenced by <subject/> DocumentEntry.patientId 
             this is the Source patientID -->
        <Patient id="sourcepatient">
            <identifier>
                <value value="DTG1234"/>
                <system value="urn:oid:7.7.7"/>
            </identifier>
        </Patient>
    </contained>
    <contained>
        <!-- DocumentEntry.author.authorPerson -->
        <Practitioner id="docdave">
            <name>
                <family value="Careful"/>
                <given value="Dave"/>
                <prefix value="Dr"/>
            </name>
        </Practitioner>
    </contained>
    <!-- DocumentEntry.uniqueId -->
    <masterIdentifier>
        <system value="urn:ietf:rfc:3986"/>
        <value value="urn:oid:1.3.6.1.4.1.21367.2005.3.7"/>
    </masterIdentifier>
    <!-- DocumentEntry.patientId -->
    <subject>
        <reference value="#patient"/>
    </subject>
    <!-- DocumentEntry.typeCode -->
    <type>
        <coding>
            <system value="urn:oid:2.16.840.1.113883.6.1"/>
            <code value="28651-8"/>
            <display value="Nurse Transfer note"/>
        </coding>
    </type>
    <!-- DocumentEntry.classCode -->
    <class>
        <coding>
            <system value="urn:oid:1.3.6.1.4.1.21367.100.1"/>
            <code value="DEMO-Pt Mgmt"/>
            <display value="Patient Management"/>
        </coding>
    </class>
    <!-- DocumentEntry.author 
         this is required by FHIR and optional in XDS -->
    <author>
        <reference value="#docdave"/>
    </author>
    <!-- DocumentEntry.creationTime -->
    <created value="2005-12-24T09:35:00"/>
    <!-- required by FHIR - when was DocumentReference created -->
    <indexed value="2005-12-24T09:35:00"/>
    <!-- DocumentEntry.availabilityStatus (Approved) 
         FHIR requires this on submission -->
    <status value="current"/>
    <!-- DocumentEntry.confidentialityCode -->
    <confidentiality>
        <coding>
            <system value="urn:oid:2.16.840.1.113883.5.25"/>
            <code value="N"/>
            <display value="Normal"/>
        </coding>
    </confidentiality>
    <!-- DocumentEntry.languageCode -->
    <primaryLanguage value="en-US"/>
    <!-- DocumentEntry.mimeType -->
    <mimeType value="text/plain"/>
    <format value="urn:wustl:mir:ppoc:1999"/>
    <location value="#binary1"/>
    <!-- DocumentEntry.formatCode - 
         not a coded value like in XDS -->
    <context>
        <event>
          <coding>
            <system value="http://ihe.net/xds/connectathon/eventCodes"/>
            <code value="T-D8200"/>
            <display value="Arm"/>
          </coding>
        </event>
        <!-- DocumentEntry.healthcareFacilityTypeCode -->
        <facilityType>
            <coding>
                <system value="urn:oid:2.16.840.1.113883.5.11"/>
                <code value="PEDHO"/>
                <display value="Pediatric oncology clinic"/>
            </coding>
        </facilityType>
    </context>
</DocumentReference>

Transactions

Provide Document Resources (ITI-??)

This transaction obsoletes "Put Document Dossier" (ITI-65) as described in section 3.65 of MHD Rev. 1.2 – 2013-09-20.

Most notable changes:

  • The new transaction leverages HL7 FHIR resources for request and response
  • The limitation to submit one document has been dropped

Closed issues:

  • Use Mailbox and FHIR messaging? No: has seen very limited use and would lead to unnecessary complication of the transaction.

Open issues:

  • Re-cycle transaction ITI-65 or introduce a new one?
  • Introduce an XDS option to further profile the expected actions - the availability of the created resources through XDS transactions? Or mark this out of scope?

Out of scope:

  • FHIR Conformance (declared or automated)
  • How to efficiently encode large binary contained in the submission? For now: use FHIR binary and include the location as DocumentReference in the submission (example provide above).

Message Semantics

A HTTP post containing the DocumentManifest and one or more DocumentReference resources as a FHIR bundle is sent to the Document Recipient. The bundle shall use the tag:

"http://ihe.net/fhir/tag/iti-65"

. The Document Recipient shall support both representations of FHIR bundles (ATOM XML and JSON). Refer to Volume 3 on the specifics for the FHIR attributes that shall be supported. With the exception of DocumentReference resources, all resources (including but not limited to the Patient resource) shall be present in the FHIR bundle as contained resources.

The Document Recipient shall support CORS (http://www.w3.org/TR/cors) and handle the appropriate HTTP headers.

Expected Actions

On receipt of the submission, the Document Recipient shall validate the resources and respond with one of the HTTP codes defined in FHIR REST API for create (http://www.hl7.org/implement/standards/fhir/http.html#create). Transaction semantics shall be compatible with the XDS Provide & Register transaction (e.g., if creation of one of the resources fails, all shall fail).

For a successful submission the server returns a 201 Created, along with a Location header which contains the new Logical Id and Version Id of the created *DocumentManifest* resource.

TBD: If the XDS option is supported, the created DocumentManifest resource shall be made available through XDS StoredQuery and the DocumentReferences through the XDS RetrieveDocumentSet transaction.

On failure, transaction specific failures shall be signaled as follows:

  • 400 Bad Request - resource could not be parsed or failed basic FHIR validation rules
  • 404 Not Found - resource type not supported, or not a FHIR end point
  • 422 Unprocessable Entity - one or more proposed resources violated applicable FHIR profiles or server business rules. This should be accompanied by an OperationOutcome resource providing additional detail.

In addition, The Document Recipient may also send 5xx status codes to indicate non-transaction related failures.

Example transactions

Request (JSON)
POST /net.ihe/ProvideDocumentResources?patientID=patientID HTTP/1.1
Host: example.org
Accept: application/json
Content-Type: application/json+fhir
Origin: trustme.org

{  "resourceType": "Bundle",
  "title": "example submission bundle",
  "id": "uri",
  "category": [
    {
      "scheme": "http://hl7.org/fhir/tag",
      "term": "http://ihe.net/fhir/tag/iti-65"
    }
  ],
  "entry": [
    {
      "title": "example SubmissionSet",
      "id": null,
      "content": {
        "resourceType": "DocumentManifest",
        "contained": [
          {
            "resourceType": "Practitioner",
            "_id": "author1"
          }
        ]
      }
    },
    {
      "title": "example DocumentEntry",
      "id": null,
      "content": {
        "resourceType": "DocumentReference",
        "contained": [
          {
            "resourceType": "Binary",
            "_id": "doc1",
            "contentType": "text/plain",
            "content": "dGhpcyBpcyBteSBkb2N1bWVudC4="
          },
          {
            "resourceType": "Patient",
            "_id": "patient"
          }
        ]
      }
    },
    {
      "title": "example DocumentEntry",
      "id": null,
      "content": {
        "resourceType": "DocumentReference",
        "contained": [
          {
            "resourceType": "Binary",
            "_id": "doc2",
            "contentType": "text/plain",
            "content": "dGhpcyBpcyBteSBkb2N1bWVudC4="
          },
          {
            "resourceType": "Patient",
            "_id": "patient"
          }
        ]
      }
    }
  ]
}

Failure Response (XML)

HTTP/1.1 400 Bad Request
Connection: close
Content-Type: application/xml
Date: Thu, 23 Oct 2014 12:02:03 GMT
Access-Control-Allow-Origin: trustme.org
Access-Control-Expose-Headers: Content-Location, Location
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
<?xml version="1.0" encoding="UTF-8"?>
<OperationOutcome xmlns="http://hl7.org/fhir">
  <text>
    <status value="generated"/>
    <div xmlns="http://www.w3.org/1999/xhtml">
      <p>Incorrect document syntax.  at line 1 char 1. source = ""</p>
    </div>
  </text>
  <issue>
    <severity value="error"/>
    <details value="Incorrect document syntax.&#x0D;
 at line 1 char 1. source = """/>
  </issue>
</OperationOutcome>