FHIR for Developers: Part 7

Jaideep Pahwa
Nerd For Tech
Published in
6 min readJun 25, 2022

FHIR Clients and Top Features of FHIR Clients

Till now we have looked into many features of FHIR from FHIR Resouces to FHIR Profiles, from FHIR Data Types to FHIR servers, if you still not have checked out seriously!! What are you waiting for? I have curated a list of all the articles which can be checked here. Now coming back to the topic, in the last part of the series we have checked out the FHIR server and set up your own HAPI FHIR server. If you were successfully able to set up the HAPI FHIR server(even if you are not able to set it up you can use the public HAPI FHIR ser until then), the next part will be interacting with FHIR servers and using the FHIR server to build your apps.

FHIR Client plays an important role when it comes to interaction with the FHIR server. In other words, if an FHIR server is the enabler for working with the FHIR specifications then an FHIR client is an enabler for working with FHIR servers. Further in this article, we will take a deeper dive into FHIR clients.

FHIR Clients

As we have discussed FHIR client is the enabler while working with FHIR servers. Although FHIR specification is complete in itself as it defines the Resources, Data Types, Profiles, HTTP requests, etc. Thus, we can work and interact with the FHIR servers directly without bringing FHIR clients into the picture. But realistically, it would be very difficult and may not be the best option. We need to take care of interaction with the FHIR object, validation of FHIR objects, authorization of HTTP requests, and many more. All these cross-cutting operations are necessary but cause difficulty in the actual development of FHIR specifications. That's where FHIR clients come to our rescue.

FHIR Client

FHIR client sits between FHIR servers and the app as an enabler for the developers to easily interact with the FHIR servers and focus on actual development. FHIR Clients are not only limited to interaction with the FHIR Server but over that, it provides features like validation, authorization, versioning, etc. This not only makes the developer's life easy while working with FHIR but also helps them work efficiently and create more reliable and stable FHIR apps. Further, we will look into different features of FHIR Clients.

Features of FHIR Client

FHIR Clients provide us with many features that will help us in developing an FHIR app. All these features may not be available to all the FHIR Clients, but we are collating all these for your knowledge that these do exist and can be implemented if required.

The following are important features:

  • CONNECTION: This is first step in developing any FHIR app is to connect it to the FHIR server. There are four parts to this feature Endpoint, Authentication, Headers, and Version. This connection may or maynot be an FHIR version(STU2, STU3, R4) specific. The FHIR client will take a base endpoint(check Part 3 of this series) to the FHIR server that will help to easily interact with the FHIR servers. Different methods(basic, bearer token, etc. ) of authentication are prebuilt is also built-in and users provide inputs based on the requirements. FHIR clients also enable the user to choose the FHIR version to use.
FHIR Client: Connection
  • RESTful METHODS: After the connection is created and now there is time to use the connection and perform the operation on the FHIR server. FHIR client provides inbuilt methods for performing different CRUD operations on the FHIR server. Users would just need to call the inbuilt methods for performing operations like create, read, update and delete. The client will internally create the APIs and call when we call the execute method.
  • ADVANCED RESTful METHODS: FHIR Client enables to perform the Advanced Restful operation. These include operations like Conformance, Validation, Terminology Operations, Conditional Operations, etc. Conformances Operations allows FHIR Client to make a first call to the FHIR server that will tell what all operations that are supported on your FHIR server and also tell if any particular profile is active. Extended Operations are the instance-specific operations, these include operation _history to get the history of a resource, $everything is to get the is all related resources for a particular patient. Terminology operations include terminology (Vocabulary) services specific operations apart from the general get and search operations, these include operations like $validate-code(validating the given code), $expand(getting a filtered list of concepts), $lookup(getting details of a specific code). Validation includes validating an FHIR resource against an FHIR Profile. Many FHIR servers include validation operation when an FHIR objects against a profile, FHIR client enables to validate resources before those are even posted which turns around time and server load.
FHIR Client: Advanced Restful Methods
  • RESOURCE MODELS: This is one of the most important features of the FHIR client because for other features of the FHIR Client we still have a way around to implement even without using FHIR Client(though not recommended), but there is none. To interact with FHIR Resources it is important to have respective models against those resources and FHIR Client provides these resource models through which we can easily interact with the FHIR Resouces in a native environment in any language. FHIR Resouces model is implemented in such a way that we can easily implement features like resource references without the hassle of workarounds. Resources also take care of conformance of elements and validity of values through defined enums.
FHIR Client: Resource Model
  • PARSING and SERIALIZATION: Parsing is a process of conversion of a valid string to an FHIR Object and Serialization is a process of converting an FHIR Object to string form. These operations become very handy and useful when we want to do some cross-platfom implementation with the FHIR and where FHIR may not be natively supported. The default may give errors or may not work with the FHIR Resources in an FHIR client library and may give the error, that is why each FHIR client comes along with the inbuilt serializer and parser to overcome this issue.
FHIR Client: Parsing
FHIR ClientL Serialization
  • SEARCH: This is the most important and frequent operation that you may perform on an FHIR Server. Not every organization have its own FHIR Server nor do they need to have one so they do not need to perform other operations as frequently as search operation. eg: Suppose a hospital fully complies with the FHIR specification in their work and way of storing the data and has a system in place to use this system. When a patient comes to the hospital for a checkup then the first thing that a hospital will do is to connect common medical records and search for the records of the patient. FHIR natively supports very powerful search operations. FHIR Client only makes these search operations simpler, faster, and more efficient. Compartment search (baseurl: / [CompartmentClass] /[id]/[ResourceClass]) will be used for searching special set of resources. Include Resource will enable get multiple related resources in a single search call. eg: The medication request and the referenced patient ( [base]/MedicationRequest?_include=MedicationRequest:patient ).

Summary

In this article, we looked into what is FHIR Client. Then we took a deeper look into important features of FHIR Clients. To summarize FHIR client is the enabler while working with FHIR servers and helps the FHIR developers to easily integrate with the FHIR server. This will not only make the life of an FHIR developer easy and also helps them to efficiently develop FHIR apps.

On a lighter note:

If you loved my work please like and share this article(and it’s free :)). Also, do follow me for more articles like these.

Also, check out my complete FHIR for Developers series:

FHIR for Developers

9 stories

--

--

Jaideep Pahwa
Nerd For Tech

Software Engineer at Walmart | Tech Enthusiast | Avid Learner