Rhapsody Rhapsody FHIR Brendon McAlevey – Nov 2018
24th July 2017 this email arrived in my Inbox, announcing NHS Digital’s plan to move from using CDAs to FHIR when sending discharge summaries and outpatient clinic correspondence to GPs. Much easier to move structured information using FHIR than CDA so there was a really good really reason for making the shift – worldwide experience has shown it’s easier to get structured information out of the FHIR – Move beyond sending a document someone can read -> shredding the document
Hospital Discharge Summary - Today GP Practice Post Discharge? Discharge Summary written Rhapsody Integration Engine Send to GP Practice Manually file into GP record Transcribe clinical codes e.g. diagnosis, allergies, medication Patient attends ED Yes No System Format Transport PAS RTF/PDF with flat file metadata Medical Interoperability Gateway Patient admitted to ward EDIS Digital Dictation ITK wrapped CDA document EDT DocMan Document Management Decision to discharge* Electronic Patient Record XML NHS.net email HL7 MDM DTS/MESH Clinical Portal with e-Forms Fax Kettering XML Shared Care Record *alternatively patient dies HTML
NHS Standard Contract – Changes and Technical Guidance Must use FHIR Must use PRSB headings Semantically interoperable SNOMED coded Allergies dm+d coded Medications Delivered nationally i.e. able to send to GPs outside usual catchment area Stop using NHS.net email Straight-forward to import the data under the guidance of a clinician in the practice
Transfer of Care – Future Hospital GP Practice Discharge? Discharge Summary written Rhapsody Integration Engine Send to MESH GP system retrieves from MESH Automatically file in GP record Patient attends ED Yes No Import clinical codes e.g. diagnosis allergies, medication Patient admitted to ward Certain data sets can be automatically parsed into GP Record Output as XML Mapped to FHIR Document Sent over MESH Decision to discharge*
NHS Standard Contract – Achieving Compliance
Open APIs - Contract NHS Standard Contract 2017/19 - Service Conditions (Full-length) - SC23 Service User Health Records The Provider must use all reasonable endeavours to ensure that its clinical information technology systems provide open interfaces in accordance with Open API Policy and must ensure that, by no later than 31 December 2018, all of its major clinical information technology systems enable the Key Clinical Data Fields to be accessible as structured information through open interfaces, subject to the provisions of GC21 (Patient Confidentiality, Data Protection, Freedom of Information and Transparency) to other providers of services to Service Users. NHS Standard Contract 2017/19 - General Conditions (Full-length) - Definitions Open API Policy - Guidance available at: https://www.england.nhs.uk/digitaltechnology/info-revolution/interoperability/open-api/ Interopen - adapt resources for use within the UK
Rhapsody Support for FHIR Javascript and HTTP REST client comm points Template based mapping filter (Freemarker mapper) XML/JSON conversion Server comm points for hosting FHIR endpoints. Can use email client to listen for Atom feeds or TCP, HTTP com points PH
Case Study Discharge Summaries Rhapsody
FHIR Documents Rhapsody Analogous to CDA Clinical summary at a point in time Can be signed, authenticated, etc Collection of resources in a Bundle Rhapsody can be used to convert between CDA & FHIR Documents Bundle Composition Resource 1 Resource 2
Mapping from HL7 v2 Rhapsody HL7v2 messages can be mapped to either FHIR messages or FHIR documents. The FHIR website even provides mapping specifications e.g http://hl7.org/fhir/encounter- mappings.html. However the mappings highlight how there are difficult mapping options or no clear equivalent mappings. This means any HL7v2 to FHIR mapping needs to allow for customisation as an out of the box mapping filter will ever be able to map from HL7 to FHIR.
Free Marker Mapper Rhapsody The FreeMarker Mapper filter transforms the input message from one format to another using the FreeMarker template engine. Its probably the best solution to map from any fomat into FHIR. It has the following advantages over other mapping methods in Rhapsody You don’t need to import an XSD schema, you only specify the output message and map fields into it. It allows importing files so the mapping logic can be reused and kept separate. What you see if want you get. The output isn’t restricted or post processed by an XML parser. It can output JSON. PH
Getting Started Rhapsody Basics The Input message can be XML or EDI (such as HL7v2, CSV, X12 etc) The Output message can be any format, but typically XML or JSON. Input as EDI When using EDI messages as input use the “inputEDI” template parameter to access the input message body context , for example And “getElementAt” is used to access fields. Input as XML For XML use “inputXML” and then the XML elements, for example PH
Inbuilt Functions Rhapsody Rhapsody includes some useful inbuilt functions. For FHIR generating UUID’s is common as well as converting date/time fields to other formats. Other functions also allow users to access the messages properties and Rhapsody lookup tables and the entire input message itself as text.
Mapping basics - Variables Rhapsody Mapping basics - Variables Free Marker Mapper has a concept of variables. This is useful for creating UUID’s that need to be used in multiple places. To use them use the “#Assign” element, the following example creates a variable “identifier_UUID” with the value from the result of calling the Rhapsody UUID.Generate function: The next example creates an “lastUpdated” variable to store an HL7 datetime value and then uses an datetime formatting function to convert it to an specific format. PH
Mapping basics – if then else statements Rhapsody Mapping basics – if then else statements Every mapping language needs an if-then-else statement. In Free Marker Mapper this is an example of how its used: PH
Mapping basics – List (For Loops) Rhapsody Mapping basics – List (For Loops) The Free Marker Mapper allows users to use “lists” to loop though repeating elements. The example below uses an “list” to loop through HL7 repeating OBX segments. PH
Mapping basics – Importing templates Rhapsody Mapping basics – Importing templates The template file is included as an auxiliary file in Rhapsody. Other FreeMarker templates can be added to the auxiliary files on the filter and referenced from within the main template using the “#import” element. This allows mapping to be modelled around the structure of an FHIR document or Message. The main template can be used to store the “Bundle” object and import the necessary resources contain in individual template files. PH
Case Study – Mapping an HL7v2 MDM to FHIR Rhapsody Case Study – Mapping an HL7v2 MDM to FHIR ed PH
Case Study – Mapping an HL7v2 MDM to FHIR - Approach Rhapsody Case Study – Mapping an HL7v2 MDM to FHIR - Approach The approach used here was to use the Free Marker Mapper filter An sample output message (FHIR bundle with Composition resource and related resources was used as a base). The main template models the FHIR Bundle which imports other templates containing either Resources or Lists. By storing the Resources in separate template files allows for the mapping to be easier debugged and designed. It is also hoped the templates for each Resource can be reused by other projects. The input message was an deidentified actual HL7 v2 MDM message from Cerner that has a lot of the required Composition section information, although not all. PH
This is an example of an main template containing an FHIR bundle and importing Composition, Patient and Encounter resources. Bundle Composition Patient Encounter XX Resource
Mapping Composition Sections Rhapsody Mapping Composition Sections
Mapping Composition Sections Rhapsody Mapping Composition Sections A number of section text is stored in OBX segments in the HL7v2 message. The Free Marker Mapper loops though these segments and extracts the data for the appropriate FHIR composition section.
Rhapsody Input and Output ed PH
Message Distribution Bundle Rhapsody Message Distribution Bundle
Message Exchange for Social Care and Health (MESH) Rhapsody Message Exchange for Social Care and Health (MESH) The Message Exchange for Social Care and Health (MESH) is the main messaging service used across health and social care. It works on the Spine infrastructure. It's used to transfer electronic messages directly from one application to another, so different organisations can communicate securely. As an example, pathology labs use MESH to communicate test results to GP practices. MESH replaced the Data Transfer Service (DTS). https://digital.nhs.uk/services/message-exchange-for-social-care-and-health-mesh
Message Exchange for Social Care and Health (MESH) Rhapsody Message Exchange for Social Care and Health (MESH) https://digital.nhs.uk/services/message-exchange-for-social-care-and-health-mesh
Message Exchange for Social Care and Health (MESH) Rhapsody Message Exchange for Social Care and Health (MESH)
Case Study Implementing a simple FHIR Server Rhapsody
Simple FHIR Server Rhapsody This demo shows how to implement a simple FHIR server in Rhapsody using an HTTP Server to return a patient resource The demo has two parts: An non FHIR REST API to retrieve an HTML page with an list of patients read from an database An FHIR API to retrieve a Patient Resource for a patient in the list above in either XML or JSON format. PH
Rhapsody Patient List The URL http://127.0.0.1:7188/PatientList invokes an HTTP server communication point that retrieves a list of Patients from a SQL Server database, then uses an Free Marker Mapper filter to create an HTML page which is returned to the HTTP Server communication point . PH Users can click on the “FHIR XML” to retrieve the patients FHIR Patient Resource in XML format or “FHIR JSON” to receive the resource in JSON.
Get Patient Resource Rhapsody The second route uses an HTTP Server to process an REST request like http://localhost:7188/Patient/11112?_format=JSON by selecting an patient to obtain the patient (eg 11112) record from the database and the uses an Free Marker Mapper to map it to XML. Depending on the format requested it could be transformed into JSON format.
Free Marker Mapper Filter Rhapsody Free Marker Mapper Filter The Free Marker Mapper filter is used to transform the database output into an FHIR Patient Resource by mapping the input fields into the appropriate places.
Rhapsody Patient List The returned result is either XML or JSON
Rhapsody INTEROPen Hackathon
Rhapsody INTEROPen Hackathon
Rhapsody INTEROPen Hackathon extenstions