A practical guide to turning legacy software architecture into FHIR-native
Many healthcare software solutions are still developed without integrating FHIR, creating a significant barrier to interoperability with other healthcare products. This guide will walk you through transforming your custom-built solution into one that natively supports FHIR standards, making integration seamless. At Beda Software, we’ve successfully implemented this approach across multiple projects, proving its effectiveness for medium-sized applications and startups in real-world environments.
Limitations
Unfortunately, not any kind of application could be easily transformed into a FHIR-native application. There is a set of prerequisites required for this approach to work. First of all the application should be a SPA application. It is a best practice nowadays, so most likely it is correct. In this article, I will refer to the React-based frontend. However, this technique could be used for other kinds of web frameworks and even mobile applications. The only requirement is that the application's user interface should be decoupled from the data access layer. If the state managment is implemented with Redux, it is already implemented by design. If not, some refactoring may be needed in advance to implement decoupling. So, from an architecture perspective, legacy application should look like this:
Leveraging Data Access Layer from Beda EMR
Beda EMR is built with TypeScript and React and follows all the requirements above.
The data access layer of the legacy application could be replaced by the data access layer from Beda EMR.
If the application uses alternative frontend frameworks or it is a mobile applications,
you will need to implement FHIR data access layer on your own.
The source code of Beda EMR and underlying libraries such as https://github.com/beda-software/aidbox-react is publicly available.
So, it could be used as an example.
Once FHIR data access layer is implemented, it should be connected to the existing user interface.
For this purpose, a custom developed connector
is needed.
This connector
will perform a transformation from FHIR data structures into data structures used in the user interface.
This kind of transformation is a common requirement,
so we have implemented a powerful mapping engine on top of FHIRPath.
It is called FHIRPathMappingLanguage, it is open source and available on GitHub: https://github.com/beda-software/FHIRPathMappingLanguage
Writing data back
Finally, the application needs a way to write data back from the user interface into the FHIR server. The connector performs this reverse transformation by replacing custom API calls with related FHIR calls. The code that was calling the custom API will be replaced with a mapper that converts the input parameters of an API call into an FHIR Bundle transaction. Bundle transaction is a universal way that performs an atomic update in the FHIR datastore. There is no limitation on a number of resources to be updated in a single transaction. Bundle transaction is a set of any requests to FHIR API. So, it could gradually update a specific resource field via PATCH, or implement even more complex logic with a power of FHIR conditional operations.
Benefiting from FHIR-native architecture
Once the application supports FHIR as a data source, there are many benefists you can get.
If you are into low-code solutions, please have a look on FHIR SDC IG.
FHIR-native apps can use FHIR Questionnaires instead of forms implemented in the applicaiton's source code.
This will turn your solution into a low-code platform, simplify form development, and provide you access to lots of existing forms.
Questionanire engine from Beda EMR is distributed as a stand-alone open-source project,
so you can integrate it into any React or React Native application.
If you need powerful analytics or data analysis for your medical data, please review SQL on FHIR.
It provides you a way to flatten FHIR data and connect to any analytics platform.
And finally, you are FHIR compliant now, you can integrate your solution with many other solutions that also support FHIR.