http://localhost:29221/alexanderwilms_7788/

Introduction

RED medical offers a FHIR interface for third-party data providers/consumers. This interface is based on the German regulatory standards §291 (Verordnungssoftware - Schnittstelle / VOS) and §371 (Archiv- und Wechselschnittstelle / AWS) SGB V. These interfaces are based on the international FHIR-Standard with local extensions e.g. for statutory billing purposes.

RED Interchange API provides a third-party system with functions


The RED Interchange API uses the XML-based FHIR format for data exchange. Data to be sent to RED must be separated and packaged into FHIR bundles, and data queried from RED will be returned in FHIR bundles. RED uses the FHIR bundles defined by Kassenärztliche Bundesvereinigung in their AWS project.

In order to ensure the secrecy of person-related data (as required by German criminal law) RED uses end-to-end encryption of all person-related data stored in its data-centers. In order to access data in RED Users must authenticate during login and obtain the cryptographic keys necessary to decrypt and encrypt data. Therefore the RED Interchange API cannot be a server interface, as encryption keys are in the possession of the users only, and data cannot be encrypted or decrypted server-side. By requirement the RED Interchange API expects to communicate with an application installed on the local machine or a locally installed server reachable via localhost.

After a user has logged in successfully and obtained his cryptographic keys a local FHIR server is started by RED on the users machine. If the FHIR server is running RED will act as recipient and listen to POST and GET requests from the sending third-party application.

Setup in RED

To use the RED Interchange API it must be set up for each RED terminal (Arbeitsplatz)For development and testing the tool Postman (https://www.postman.com/downloads/) can be used as sending application. Please contact us to receive a Postman collection with sample requests. 

Receiving data from RED - Search and Read

RED Interchange API - Search/Read Practitioners

RED Interchange API - Search/Read PractitionerRoles

RED Interchange API - Search/Read Organizations

RED Interchange API - Search/Read Claims

RED Interchange API - Search/Read Encounters

RED Interchange API - Search/Read Observations

RED Interchange API - Search/Read Coverages

RED Interchange API - Search/Read DocumentReferences

RED Interchange API - Search/Read Medication


Create data items

POST requests can be used to send data to and create new data items in RED. Data to be created and stored must be packaged in FHIR bundles. A FHIR bundle contains all data necessary to create the new data item. 

Example: the bundle of a new patient may contain (see Postman example Create Patient)


> POST http://localhost:29221/{tenant}/Bundle

Request Header should set the content-type to

> 'Content-Type': 'application/fhir+xml; charset=UTF-8'

Request body (see Postman examples)

<Bundle xmlns="http://hl7.org/fhir">
  <id value="10000"/>
  <meta>
    <versionId value="1"/>
    <lastUpdated value="2020-09-24T12:52:00+00:00"/>
    <profile value="https://fhir.kbv.de/StructureDefinition/KBV_PR_AW_Bundle_Patientenakte|1.2.0"/>
  </meta>
  <type value="history"/>
  <entry>
  ...
  </entry>
  <entry>
  ...
  </entry>
</Bundle>

 

Delete Items from RED

> DELETE http://localhost:29221/{tenant}/Bundle/10000

Deletes a stored bundle in RED medical application.


Request an electronic prescription 

The RED interchange API may also be used to communicate with gematik Fachdienst to retrieve stored electronic prescriptions and to send dispense requests.

Request prescription

A prescription is identified by its PrescriptionID and the AccessCode. PrescriptionID and AccessCode are represented by the barcode on the prescription form. The barcode contains a string containing an array of urls. Each url is represented by a string with this format:

Task/<Prescription ID>/$accept?ac=<AccessCode>

{"urls":["Task/160.000.111.065.827.98/$accept?ac=b8d9e513cd11cfe0a1d829b96a503e9df5b17803bbdbc4036f32858494539f28"]}

In this example the prescriptionID is 160.000.111.065.827.98 and AccessCode is b8d9e513cd11cfe0a1d829b96a503e9df5b17803bbdbc4036f32858494539f28.

To get the prescription data for this prescription a GET request is sent:

> GET http://localhost:29221/{tenant}/Task?action=$accept&prescriptionid={PrescriptionID}&accesscode={AccessCode}

Example

http://localhost:29221/{tenant}/Task?action=$accept&prescriptionid=160.000.111.065.827.98&accesscode=b8d9e513cd11cfe0a1d829b96a503e9df5b17803bbdbc4036f32858494539f28

This request returns a FHIR bundle with several items.


This GET request can be used for the initial fetch of prescription data as well as further requests to fetch the same data later. When the FHIR bundle is returned from Fachdienst a second access code (“secret”) is added. All further requests to Fachdienst (in order to retrieve prescription data again, cancel or dispense the prescription) must include this secret to prove the requesters authorization to access the data. RED stores the secret in its database and adds it automatically for every further processing action of this request.

Return a prescription

After a pharmacy has requested an electronic prescription from Fachdienst and received the FHIR bundle the Fachdienst locks the prescription. If the pharmacy is not able to deliver the prescribed products the prescription can be returned. If a prescription is returned it is released on Fachdienst and may be requested by someone else.

To return a prescription a GET request is sent. In addition to PrescriptionID and AccessCode RED automatically includes the secret.

> GET http://localhost:29221/{tenant}/Task?action=$reject&prescriptionid={PrescriptionID}&accesscode={AccessCode}

Example

http://localhost:29221/{tenant}/Task?action=$reject&prescriptionid=160.000.111.065.827.98&accesscode=b8d9e513cd11cfe0a1d829b96a503e9df5b17803bbdbc4036f32858494539f28

Dispense a prescription

After a pharmacy has delivered the prescription a dispense request is created. The dispense request contains a FHIR bundle of type MedicationDispense. 

The bundle is sent to RED using POST

> POST http://localhost:29221/{tenant}/Bundle