Skip to content

Send a document to the DPI

The DPI is a software gathering the medical data of all patients of a healthcare facility. DPI providers usually support HPRIM, HL7, but they each have some specificities which can make it difficult to integrate documents. After years of exchange with many DPI providers, Lifen provides a reliable matching parser giving you the opportunity to easily integrate medical documents in the DPI.

Access Control

You have to use the Access Token of an authenticated user with the BINARY_CREATE, DOCUMENTREFERENCE_CREATE, COMMUNICATIONREQUEST_CREATE, ENCOUNTER_CREATE, PATIENT_CREATE, and PATIENT_SEARCH permissions in the scope to access the FHIR API. For user authentication, take a look at the Connect Users Guide.

How does DPI integration work ?

First, make sure you have previously created a FHIR Patient and a FHIR Encounter on the API. (see paragraph below for more information)

Next, you have to upload the document on the FHIR Document API, add metadata to it, then create a request of communication.

Posting your CommunicationRequest will trigger several operations :

  • Gather all data about the patient (through the FHIR Patient and the FHIR Encounter resources)
  • Transform all FHIR information in HL7-ORU or HPRIM format
  • Post the document on a dedicated server
  • Create a Communication. The communication can have 2 status:
    • success: the document has been added to the DPI
    • entered-in-error: an error occurred during the integration.

Requested property on the Patient resource

Patients can be created by sending a POST to api.lifen.fr/fhir/v2/Patient with a JSON body following this example :

{
  "resourceType": "Patient",
  "meta": {
    "tag": [
      {
        "system": "https://www.lifen.fr/default",
        "code": "DEFAULT",
        "display": "Default tag"
      }
    ]
  },
  "identifier": [
    {
      "use": "official",
      "type": {
        "coding": [
          {
            "system": "http://interopsante.org/fhir/valueset/fr-patient-identifier-type",
            "version": "1.0",
            "code": "PI",
            "display": "PI"
          }
        ]
      },
      "system": "urn:oid:1.2.250.1.71.4.2.2.${custodian-idnat}",
      "value": "xxxxxxx"
    }
  ],
  "name": [
    {
      "family": "xxxxxxx",
      "given": [
        "xxxxxxxx"
      ]
    }
  ],
  "birthDate": "YYYY-MM-DD",
  "managingOrganization": {
    "reference": "Organization/xxxxxxx"
  }
}

Take care of the following attributes :

  • custodian-idnat is the national identifier of the healthcare facility where the DPI is.
  • value is the patient's IPP. This value is assigned to a patient when he comes for the first time in a hospital. This number is unique and will never change inside the same organization.
  • family name, given name, birthDate and managingOrganization are mandatory fields
  • managingOrganizationis the value of http://lifen.fr/userInfo.currentWorkspaceId from the user's ID token

Important: A patient cannot be created twice with the same IPP and ManagingOrganization. If it's the case, the FHIR API Patient will return an Error 412, and the Patient will have to be found first using the patient search documentation.

Requested property on the Encounter resource

An integration in the DPI requires a Patient resource, and an Encounter resource attached to it.

An Encounter can be created by sending a POST to api.lifen.fr/fhir/v2/Encounter with a JSON body following this example :

{
  "resourceType": "Encounter",
  "status": "xxxxxxxxxx",
  "subject": {
    "reference": "Patient/xxxxxxxxxx"
  },
  "identifier": [
    {
      "use": "official",
      "type": {
        "coding": [
          {
            "system": "http://www.interopsante.org/fhir/valueset/fr-encounter-identifier-type",
            "version": "3.0.1",
            "code": "VN",
            "display": "Visit Number"
          }
        ]
      },
      "system": "urn:oid:1.2.250.1.71.4.2.2.${custodian-idnat}",
      "value": "${visit-number-value}",
      "assigner": {
        "reference": "Organization/xxxxxxxx"
      }
    }
  ],
  "period": {
    "start": "YYYY-MM-DDThh:mm:ss+00:00",
    "end": "YYYY-MM-DDThh:mm:ss+00:00"
  },
  "serviceProvider": {
    "reference": "Organization/xxxxxxxxxx"
  }
 }

Take care of the following attributes :

  • custodian-idnat is the national identifier of the healthcare facility where the DPI is.
  • visit-number-value is the value of the visit
  • status: planned | arrived | triaged | in-progress | onleave | finished | cancelled
  • subject: the patient present at the encounter (previously created or searched)
  • period: start and end of the encounter (year - month - day and hour in UTC). At leat one property is mandatory.
  • serviceProvider and assigner: the custodian organization of this Encounter record. It is the managingOrganization present on the Patient

Create a Binary resource to upload a PDF report

How to create a Binary

Create a DocumentReference resource containing the document's metadata

How to create a DocumentReference

Create a CommunicationRequest resource

Send a POST api.lifen.fr/fhir/v2/CommunicationRequest with a JSON body referencing the previously created DocumentReference, the sender, the requester, the recipient and the subject of the document.

Example :

{
  "resourceType": "CommunicationRequest",
  "meta": {
    "tag": [
      {
        "system": "http://lifen.fr/fhir/tag/processing/mode",
        "code": "IMMEDIATE_MODE",
        "display": "request should be treated in immediate mode"
      }
    ]
  },
  "status": "active",
  "priority": "routine",
    "extension": [
        {
          "url": "http://lifen.fr/fhir/StructureDefinition/communicationrequest-active-devices",
          "valueReference": {
            "reference": "Device/xxxxxxx"
          }
        }
      ],
  "category": [
    {
      "coding": [
        {
          "system": "http://lifen.fr/fhir/ValueSet/communication-category",
          "code": "MEDICAL_REPORT"
        }
      ]
    }
  ],
  "payload": [
    {
      "contentReference": {
        "reference": "DocumentReference/xxxxxxx"
      }
    }
  ],
    "subject": {
    "reference": "Patient/xxxxxxx"
  },
    "topic": [
    {
      "reference": "Patient/xxxxxxx"
    }
  ],
  "context": {
    "reference": "Encounter/xxxxxxx"
  },
  "sender": {
    "reference": "Practitioner/xxxxxxx"
  },
  "requester": {
    "agent": {
      "reference": "Organization/xxxxxxx"
    }
  },
"recipient": [
    {
      "reference": "Device/xxxxxxx"
    }
  ]
}

Take care of the following attributes :

  • device : is a value provided by Lifen
  • sender is one of the identities to choose in the http://lifen.fr/userInfo.identities array from the user's ID token
  • requester is the value of http://lifen.fr/userInfo.currentWorkspaceId from the user's ID token
  • subjectand topic are the value of the Patient ID previously created
  • context is the value of the Encounter ID previously created

After that, the CommunicationRequest will be integrated into Lifen's sending flow to add some other information and send the document to the DPI.