Transaction examples

De EPD Playground
Aller à la navigation Aller à la recherche

This page lists examples of transactions using the Mobile Access Gateway to access the EPD Playground.

Create / Register Patient

Profile Patient Master Identity Registry (PMIR)
Transaction Mobile Patient Identity Feed [ITI-93]
SOAP Transaction Patient Identity Feed HL7 V3 [ITI-44]

The following example creates a patient ALAN ALPHA (which, by the way, also exists in the gazelle reference environment):

 POST https://test.ahdis.ch/mag-bfh/fhir/$process-message

 {
   "resourceType": "Bundle",
   "type": "message",
   "entry": [
     {
       "fullUrl": "http://example.com/fhir/MessageHeader/1",
       "resource": {
         "resourceType": "MessageHeader",
         "id": "1",
         "eventUri": "urn:ihe:iti:pmir:2019:patient-feed",
         "source": {
           "endpoint": "http://example.com/patientSource"
         },
         "focus": [
           {
             "reference": "Patient/123"
           }
         ],
         "destination": [
           {
             "endpoint": "http://example.com/patientEndpoint"
           }
         ]
       }
     },
     {
       "fullUrl": "http://example.com/fhir/Patient/123",
       "resource": {
         "resourceType": "Patient",
         "id": "123",
         "contained": [
           {
             "resourceType": "Organization",
             "id": "1",
             "identifier": [
               {
                 "system": "urn:oid:2.16.756.5.30.1.178.1.1",
                 "value": "Klinik H\u00f6heweg"
               }
             ],
             "name": "Klinik H\u00f6heweg",
             "contact": [
               {
                 "name": {
                   "family": "Test",
                   "given": [
                     "Hugo"
                   ]
                 }
               }
             ]
           }
         ],
         "identifier": [
           {
             "system": "urn:oid:2.16.756.5.30.1.178.1.1",
             "value": "PATIENT1",
             "assigner": {
               "display": "Klinik H\u00f6heweg"
             }
           },
           {
             "system": "urn:oid:2.16.756.5.30.1.127.3.10.3",
             "value": "DEMO"
           }
         ],
         "name": [
           {
             "family": "ALPHA",
             "given": [
               "ALAN"
             ]
           }
         ],
         "gender": "male",
         "birthDate": "1938-02-24",
         "address": [
           {
             "line": "1_PINETREE",
             "city": "WEBSTER",
             "state": "MD",
             "postalCode": "63119"
           }
         ],
         "managingOrganization": {
           "reference": "#1"
         }
       },
       "request": {
         "method": "POST"
       }
     }
   ]
 }
  • The id in the Patient resource (e.g. "123") does not matter, but has to match the id linked in the Messageheader (focus.reference: "Patient/123").
  • The creating organization must be present as a contained resource Organization and linked from the Patient resource under managingOrganization ("#1").
  • In the point identifier the local patient-id in the creating organization (e.g. the "Klinik Höheweg" with OID 2.16.756.5.30.1.178.1.1) as well as the EPR-SPID (with the official OID 2.16.756.5.30.1.127.3.10.3) are listed.

Search patient

Notice: the newest PIXm specifications don't allow anymore to query all patient id's at once. A "target system" has to be given in the query.

Search MPI Identifier using the EPR-SPID (PIXm)

  • OID of the EPD Playground's MPI: 1.1.1.99.1
  • OID of the EPR-SPID: 2.16.756.5.30.1.127.3.10.3


GET https://test.ahdis.ch/mag-bfh/fhir/Patient/$ihe-pix?sourceIdentifier=urn:oid:2.16.756.5.30.1.127.3.10.3|DEMO&targetSystem=urn:oid:1.1.1.99.1

Which should get you the following response body:

 {
   "resourceType": "Parameters",
   "parameter": [
     {
       "name": "targetIdentifier",
       "valueIdentifier": {
         "system": "urn:oid:1.1.1.99.1",
         "value": "0f5a8034-3c8a-4796-bd39-d3ea877a4155"
       }
     }
   ]
 }

Search local id using the EPR-SPID (PIXm)

  • OID of the Klinik Höheweg: 2.16.756.5.30.1.178.1.1
  • OID of the EPR-SPID: 2.16.756.5.30.1.127.3.10.3


GET https://test.ahdis.ch/mag-bfh/fhir/Patient/$ihe-pix?sourceIdentifier=urn:oid:2.16.756.5.30.1.127.3.10.3|DEMO&targetSystem=urn:oid:2.16.756.5.30.1.178.1.1

Which should get you the following response body:

 {
   "resourceType": "Parameters",
   "parameter": [
     {
       "name": "targetIdentifier",
       "valueIdentifier": {
         "system": "urn:oid:2.16.756.5.30.1.178.1.1",
         "value": "PATIENT1"
       }
     }
   ]
 }

Search patient by any identifier (PDQm)

When known, a patient can be searched by any identifier, like the EPR-SPID, the communitys MPI or a local id (e.g. from a primary system):

This returns a FHIR Bundle:

   {
     "resourceType": "Bundle",
     "id": "47b0e100-5475-45e3-9dd2-0ae422bdbed9",
     "meta": {
       "lastUpdated": "2021-03-25T10:28:44.250+00:00"
     },
     "type": "searchset",
     "total": 1,
     "link": [
       {
         "relation": "self",
         "url": "https://test.ahdis.ch/mag-bfh/fhir/Patient?identifier=2.16.756.5.30.1.127.3.10.3%7CDEMO"
       }
     ],
     "entry": [
       {
         "fullUrl": "https://test.ahdis.ch/mag-bfh/fhir/Patient/1.1.1.99.1-0f5a8034-3c8a-4796-bd39-d3ea877a4155",
         "resource": {
           "resourceType": "Patient",
           "id": "1.1.1.99.1-0f5a8034-3c8a-4796-bd39-d3ea877a4155",
           "identifier": [
             {
               "system": "urn:oid:1.1.1.99.1",
               "value": "0f5a8034-3c8a-4796-bd39-d3ea877a4155"
             }
           ],
           "active": true,
           "name": [
             {
               "family": "ALPHA",
               "given": [
                 "ALAN"
               ]
             }
           ],
           "gender": "male",
           "birthDate": "1938-02-24",
           "address": [
             {
               "city": "WEBSTER",
               "state": "MD",
               "postalCode": "63119"
             }
           ]
         }
       }
     ]
   }

Upload a document

Profile Mobile Access to Health Documents (MHD)
Transaction Provide Document Bundle [ITI-65]
SOAP Transaction Provide and Register Document Set [ITI-41]

The following example creates a document for the patient ALAN ALPHA:

POST https://test.ahdis.ch/mag-bfh/fhir

   {
     "id": "2-7-BundleProvideDocument",
     "resourceType": "Bundle",
     "meta": {
       "profile": [
         "http://ihe.net/fhir/StructureDefinition/IHE_MHD_Provide_Minimal_DocumentBundle"
       ]
     },
     "type": "transaction",
     "entry": [
       {
         "fullUrl": "urn:uuid:d8d1fe44-07e9-4a84-985f-fde97d77d54b",
         "resource": {
           "resourceType": "Binary",
           "contentType": "text/xml",
           "data": "<Base64 encoded file content>"
         },
         "request": {
           "method": "POST",
           "url": "urn:uuid:d8d1fe44-07e9-4a84-985f-fde97d77d54b"
         }
       },
       {
         "fullUrl": "urn:uuid:68a928c0-df48-4743-a291-bfb0609bbddc",
         "resource": {
           "resourceType": "DocumentManifest",
           "masterIdentifier": {
             "value": "urn:oid:1.3.6.1.4.1.12559.11.13.2.6.2955"
           },
           "identifier": [
             {
               "system": "urn:ietf:rfc:3986",
               "value": "urn:uuid:8c3e40b2-3cf9-4980-b4fb-cc84ba8a181a"
             }
           ],
           "status": "current",
           "type": {
             "coding": [
               {
                 "system": "http://snomed.info/sct",
                 "code": "71388002",
                 "display": "Procedure (procedure)"
               }
             ]
           },
           "subject": {
             "reference": "https://test.ahdis.ch/mag-bfh/fhir/Patient/1.1.1.99.1-0f5a8034-3c8a-4796-bd39-d3ea877a4155"
           },
           "content": [
             {
               "reference": "urn:uuid:50383ae5-49e5-4dea-b0e6-660cb9e7b91f"
             }
           ],
           "created": "2020-06-29T12:01:30+00:00",
           "source": "urn:oid:1.3.6.1.4.1.12559.11.13.2.5",
           "description": "Hello World example neu"
         },
         "request": {
           "method": "POST",
           "url": "urn:uuid:68a928c0-df48-4743-a291-bfb0609bbddc"
         }
       },
       {
         "fullUrl": "urn:uuid:50383ae5-49e5-4dea-b0e6-660cb9e7b91f",
         "resource": {
           "resourceType": "DocumentReference",
           "contained": [
             {
               "resourceType": "Patient",
               "id": "1",
               "identifier": [
                 {
                   "use": "official",
                   "system": "1.1.1.99.1",
                   "value": "0f5a8034-3c8a-4796-bd39-d3ea877a4155"
                 }
               ]
             }
           ],
           "masterIdentifier": {
             "value": "urn:oid:1.3.6.1.4.1.12559.11.13.2.1.2956"
           },
           "identifier": [
             {
               "use": "official",
               "system": "urn:ietf:rfc:3986",
               "value": "urn:uuid:50383ae5-49e5-4dea-b0e6-660cb9e7b91f"
             }
           ],
           "status": "current",
           "type": {
             "coding": [
               {
                 "system": "http://snomed.info/sct",
                 "code": "721912009",
                 "display": "Medication summary document (record artifact)"
               }
             ]
           },
           "category": [
             {
               "coding": [
                 {
                   "system": "http://snomed.info/sct",
                   "code": "422735006",
                   "display": "Summary clinical document (record artifact)"
                 }
               ]
             }
           ],
           "subject": {
             "reference": "https://test.ahdis.ch/mag-bfh/fhir/Patient/1.1.1.99.1-0f5a8034-3c8a-4796-bd39-d3ea877a4155"
           },
           "source": "urn:oid:1.3.6.1.4.1.12559.11.13.2.5",
           "date": "2020-06-29T11:58:00.000+00:00",
           "description": "2-7-MedicationCard",
           "securityLabel": [
             {
               "coding": [
                 {
                   "system": "http://snomed.info/sct",
                   "code": "17621005",
                   "display": "Normal (qualifier value)"
                 }
               ]
             }
           ],
           "content": [
             {
               "attachment": {
                 "contentType": "text/xml",
                 "language": "de-CH",
                 "url": "urn:uuid:d8d1fe44-07e9-4a84-985f-fde97d77d54b",
                 "size": 309219
               },
               "format": {
                 "system": "urn:oid:1.3.6.1.4.1.19376.1.2.3",
                 "code": "urn:ihe:pharm:pml:2013",
                 "display": "Community Medication List"
               }
             }
           ],
           "context": {
             "facilityType": {
               "coding": [
                 {
                   "system": "http://snomed.info/sct",
                   "code": "264358009",
                   "display": "General practice premises (environment)"
                 }
               ]
             },
             "practiceSetting": {
               "coding": [
                 {
                   "system": "http://snomed.info/sct",
                   "code": "394802001",
                   "display": "General medicine (qualifier value)"
                 }
               ]
             },
             "sourcePatientInfo": {
               "reference": "#1"
             }
           }
         },
         "request": {
           "method": "POST",
           "url": "urn:uuid:5604f114-bf96-4c12-8dac-25715a05cf3f"
         }
       }
     ]
   }

Update a document

You can not directly update a document. You will to replace it, by uploading a new document with a reference to the other document it replaces. The reference points to the Resource ID of the document to replace (keep in mind here, this is not the temporary ID you assigned to it in the ITI-65 Provide Document Bundle, but the ID assigned by the server. So the Document Bundle is the same as in Upload a Document, with the difference of the additional relatesTo reference in the DocumentReference resource. The EPD Playground then sets the status of the replaced DocumentResource to superseded, so it won't show up in searches for current documents anymore.

POST https://test.ahdis.ch/mag-bfh/fhir

   {
     "id": "2-7-BundleProvideDocument",
     "resourceType": "Bundle",
     "meta": {
       "profile": [
         "http://ihe.net/fhir/StructureDefinition/IHE_MHD_Provide_Minimal_DocumentBundle"
       ]
     },
     "type": "transaction",
     "entry": [
       {
         "fullUrl": "urn:uuid:d8d1fe44-07e9-4a84-985f-fde97d77d54b",
         "resource": {
           "resourceType": "Binary",
           ...
         },
         "request": {
           "method": "POST",
           "url": "urn:uuid:d8d1fe44-07e9-4a84-985f-fde97d77d54b"
         }
       },
       {
         "fullUrl": "urn:uuid:68a928c0-df48-4743-a291-bfb0609bbddc",
         "resource": {
           "resourceType": "List",
           ...
         },
         "request": {
           "method": "POST",
           "url": "urn:uuid:68a928c0-df48-4743-a291-bfb0609bbddc"
         }
       },
       {
         "fullUrl": "urn:uuid:50383ae5-49e5-4dea-b0e6-660cb9e7b91f",
         "resource": {
           "resourceType": "DocumentReference",
           ...
           "relatesTo": [
             {
               "code": "replaces",
               "target": {
                 "reference": "5d7b180a-1407-48e6-99c2-141a9fa303b7" // this is the resource ID of the document reference to replace
               }
             }
           ]
         },
         "request": {
           "method": "POST",
           "url": "urn:uuid:5604f114-bf96-4c12-8dac-25715a05cf3f"
         }
       }
     ]
   }

Search and retrieve a document

Search for DocumentReferences

A FHIR search for DocumentReferences returns a Bundle of DocumentReference resources. Each DocumentReference represents one available document and contains the link for retrieving the document (see below).

GET https://test.ahdis.ch/mag-bfh/fhir/DocumentReference?status=current&patient.identifier=urn:oid:1.1.1.99.1%7C0f5a8034-3c8a-4796-bd39-d3ea877a4155

Search for SubmissionSets

A FHIR search for List returns a Bundle of List resources. Each List resource represents a submission set, which are documents for a patient that were uploaded together. The List resources refer to the DocumentReference resources, that then contain the link to the actual document.

GET https://test.ahdis.ch/mag-bfh/fhir/List?status=current&patient.identifier=urn:oid:1.1.1.99.1%7C0f5a8034-3c8a-4796-bd39-d3ea877a4155

Retrieve a document

In the DocumentReference resource, under content[0].attachment.url, you find the link to the actual document.

   {
       "resourceType": "DocumentReference",
       ...
       "content": [
           {
               "attachment": {
                   "contentType": "text/xml",
                   "language": "de-CH",
                   "url": "http://test.ahdis.ch/mag-bfh/camel/xdsretrieve?uniqueId=92100cf9-e6e8-4bf8-a61c-2ee66e69eb2c&repositoryUniqueId=1.1.1.2.31",
                   "size": 80461,
                   "hash": "ZGU4YzRmNDM4ZjAzNmRmNDM0MDUyZWRjYjIzMTNjNDUzOTMyNzg1MQ==",
                   "creation": "2020-06-29T11:58:00+00:00"
               },
               "format": {
                   "system": "urn:oid:1.3.6.1.4.1.19376.1.2.3",
                   "code": "urn:ihe:pharm:pml:2013",
                   "display": "Community Medication List"
               }
           }
       ],
       ...
   }

Using this link, you can fetch the document with a GET request:

GET http://test.ahdis.ch/mag-bfh/camel/xdsretrieve?uniqueId=92100cf9-e6e8-4bf8-a61c-2ee66e69eb2c&repositoryUniqueId=1.1.1.2.31