PAS to Other System Integration using FHIR


May be I should give full picture here of what am trying to do, We have PAS, we need to build a bidirectional communication link with one of our third party downstream system using FHIR (for demonstration purpose - Assumption is the Third party downstream systems has FHIR server or FHIR capable).
use case 1: Patient created in PAS should be communicated to Third party system using FHIR
use case 2: Patient seen in Third party system - update the date of birth in Third party system - this should be communicated to PAS using FHIR
use case 3: Updated date of birth seen in PAS.
to achieve these FHIR communication what are the requirements from PAS side. [this is already working with HL7v2.4].
please share your thoughts on this.

(Kev Mayfield) #2

You are looking at creating equivalents of In HL7v2 (ITK) A28 (create Patient) and A31 (update Patient). In FHIR the closest equivalent would be FHIR Messaging using Bundles -

A basic bundle would include:

MessageHeader (MSH/EVN)
Patient (PID)
Practitioner + Organization (would be referred to by Patient PD1)
Person (NK1)
EpisodeOfCare (+ Encounter) PV1

The format of these FHIR resources should match the profiles here: (where applicable - EpisodeOfCare and Person haven’t been profiled yet)

Once you’ve created the Bundle, if using REST, you would (http) POST these to the Bundle FHIR Endpoint e.g. POST

Bundle only supports POST which is CREATE in REST, so you would also need to set the request properties of the Bundle accordingly (so the Patient entry.request for A28 would be POST and PUT for A31).

Your usecase 3 could be treated differently as you are only updating one resource (Patient). So you could just update that resource (PUT /Patient). The same could be said for the other use cases, do you need to send the other resources and could you just use PUT/POST Patient??
This way of working is referred to as http on the fhir site
An documentation on NHS http api can be found here:
The link shows equivalent of HL7v2 PDQ and v3 PDQv3

This api is demonstrated here: with source code available here: (it’s also available on docker, see here for instructions: )

(Kev Mayfield) #3

A few notes on the reference implementation:

It has many components, follows DevOp principles and so services can be used by themselves.

In the diagram below the part referred to as Apache Tomcat is a HAPI RESTful server which uses Apache Hibernate to communicate to a SQL server (Hibernate supports SQL Server, MySQL, Cache and others). You can use this as a starter for building your own FHIR server but you would need to do your own mappings in Hibernate to your database structure.

The two FHIR Gateways are also HAPI RESTful servers which use Apache Camel to communicate to the main FHIR server. Apache Camel is integration/middleware tool used in a similar manner to trust integration engines (TIE) e.g. mirth. Both of these hide features of the main server (the main server supports POST/PUT operations but the public server just supports GET) and for the secure endpoint it also provides SMART on FHIR.

The Apache Camel layer (FHIR gateway) could be used to support HL7v2 messages (via the v2 HAPI) and also FHIR messaging. What I mean is we could take the PID from the A28/A31 or Patient from the FHIR Bundle and turn it into a POST/PUT Patient. A mobile/web app developer would probably just want to use POST/PUT Patient (and not use messaging).

Lastly the OAuth2 server is from here with smart on fhir extensions from HSPC


Thank you Kevin for these details, these would help me to start with FHIR.

(Kev Mayfield) #5

As discussed