Building a FHIR (Care Connect) Server

This is a write up from the NHS Digital Connectathon last month.

https://nhsconnect.github.io/CareConnectAPI/build_patient_server.html

It’s aimed at people providing FHIR Servers to existing systems.

Those looking for an example FHIR enabled Care Connect server (such as those developing a mobile or web application) take a look at the Care Connect demo site (http://yellow.testlab.nhs.uk/careconnect-ri/).

This server is has both un-secure (http) and secure (https) endpoints. https is using OAuth2 (plus SMART on FHIR) - see site for more details. The authorisation server is open source Open Mitre Authorisation server plus extensions from the US ‘open source’ health service provider consortium HSPC.

2 Likes

Just brilliant Kev, bravo such a great help. Many thanks

Hi Kevin,

What would be the approach to build a FHIR server (expose Patient Resource as REST FHIR API) with CareConnect Profile to the existing PAS, the PAS has its own database and java APIs to Read / Write patient demographics.

As a first step, implemented the FHIR REST API using HAPI libraries with the mapping between HAPI-Patient Resource and PAS-Patient.

The next step to convert this to CareConnect API, am not sure where to start with ? please share your thoughts ?

thank you.

I’ve tried several approaches so far, using a TIE and also Apache Camel but settled on using the restful server from hapi fhir.
It’s used in the link above the fhir starter link above with the core code here https://github.com/nhsconnect/careconnect-examples/tree/master/ccri-nosql-fhirStarter

As you already have java API’s you should be able to replace the (mongo) data access layer with your own.
We’ve been doing this with most of our later projects, we start with the fhir starter and then implement a data layer, either:

hibernate (for sql access)
Apache camel (for calling other API’s and then transform using hapi classes)
Hapi client for calling other fhir servers

If I still had access to a TIE, I’d still using that for processing or orchestration, calling these hapi server endpoints.
Would also facade the TIE with a HAPI server as that makes it easier to configure and add in security (tokens, oauth2, etc). Doing the configuration in java (and learning java) is easier in the long term than trying to do the same in JavaScript or Caché.
The other bonus of taking the data access and transform out of the TIE is you can reuse the FHIR servers for other projects - the main one I’ve seen in practice is the rest endpoints for clinical portals.

This is from the next care connect reference implementation, it’s still based on a implemention in a West Yorkshire NHS trust (well just)
It’s using five fhir servers now, the two fhir servers connected to databases do transform and data access only. The two public servers (on the left hand side) do orchestration and security. The other one creates FHIR documents.

I’ve gone off on a bit of a tangent but wanted to show using fhir micro services (embers??). In TIEs I’d worked with, productions we’re getting quite large and maintence had a lot of risk. Splitting out components has really reduced that risk but the down side is having more components To monitor.

1 Like

Thank you Kevin, appreciate your quick response. get back to you once I go through the information you provided.

HI Kevin,

We have Open RiO hosted by Servelec and no access to the live database. Will they be providing the necessary API’s?

Thanks

Phil

From the replies here it appears to be a yes

Hi Kevin,

Thank you, just have another question after gone through your example, how can I make sure that the FHIR server (restful) I implemented from HAPI Fhir uses the care connect profile or compliance with care connect profile.

thanks

I believe the NHS Digital Reference server (https://fhir.nhs.uk/) will have testing capabilities shortly.

2 Likes

hi Kevin,

The Apache Camel between FHIR server and the APIs are there any specific reason ?

thank you.

we’re using it as a switchboard, so requests to the front fhir server get redirected to either the ‘epr’, ‘Edms’ fhir server or business logic fhir servers.

We also use this camel/fhir server to reduce our capability statement (the internal servers support get, post and put plus extra resources). Also we include api security on one of the external servers.

It is not necessary.

Hi Kevin,

how the FHIR server handles sudden peak of requests ? should this be always synchronous ? or can the Apache Camel act as queue and provide asynchronous behaviour to the FHIR server ?
Thank you,

Good question. We run all queries synchronously but internally the post runs using a queue (it takes time to post a lot of resources).
Idealy we should make the post async but it increases complexity

Hi Kevin,

How is the outbound flow working here, ie when a resource needs to be sent outside to another REST Server(s). how can this be handled ?

thank you

By outbound do you mean a system where a Patient is created and that triggers an outbound Patient event (similar to ADT^A28 or ADT^A31)?

Hi Kevin,

not exactly, in the above reference implementation, a 3rd party system (FHIR Client) calls FHIR Server to post/put with a resource. In the same way how this reference implementation can act as a client to call the post/put on the 3rd party FHIR Server(s) with a resource?

thank you

Outbound messaging would be handled by a FHIR Subscription capability. I haven’t seen this mentioned as a core part of the NHS architecture but I think it may be being piloted within the child health domain. We’re using Subscription as part of the Somerset CCG SIDeR programme and have shared a reference implementation for a REST-hook endpoint that you could experiment with.

1 Like

Is that purely restful/resource based?

CCRI doesn’t include a trigger/event service but it wouldn’t be difficult to include one, that could be a feed to a subscription service.

1 Like

Yes - on C_UD the resource can be sent to the subscriber if it matches the subscription criteria

1 Like