Tuesday, November 12, 2013

Open source implementation of HL7 FHIR persistence

After I presented the journey from HL7v2 to HL7 FHIR during HIMSS DHW 2013 few weeks ago, the slide is here Use of FHIR in next generation healthcare product for reference, I started to think about how easy it is to implement native FHIR based RDMBS storage, so that the FHIR resource can be natively stored in RDMBS and users are also able to directly query the data using SQL. There are some existing open source implementation, but as far as I can tell those implementations are using document based storage such as MongoDB, data reuse and extraction for reporting and other usage might be problem.

It is not as straightforward as I have initially thought, I need to explore different ways of persisting FHIR resource into RDMBS such as

1) Whether it is possible to just generate O/R mapping without changing the existing FHIR resource java classes. For this issue, the initial assessment is not 100 percent possible, I intend to compile a list and feed back to Grahame for consideration.
2) Whether to store patient name as JPA embeddable or entity
3) How to handle nested collection, such as List<CodeableConcept> since CodeableConcept object itself contains list of Coding object. or List<HumanName> where each attribute such as 'family' attribute is again a collection of String object
4) With nested collection, is it possible to query such attributes at API level. For example I already encountered some problems when I tried to query collection attributes within embedded table as even the latest JPA 2.1 spec does not support such implementation yet, as a result I have to go back to change the O/R mapping approach

Though it is still in early stage of exploring and trying out, I think it might be useful experience to share with other like-minded developers who might be keen to explore the same to create FHIR based persistence similar to HL7 RIMBAA concept, so I decided to make it as open source project, the project is hosted at sourceforge http://sourceforge.net/projects/hl7-fhir/

The scope of the project is illustrated below,  the reference implementation uses eclipselink 2.5 which is based on the latest JPA 2.1 spec,  database tier is using hsqldb as reference.

Once I have finalized the O/R mapping approach, the next step is to come up a XSLT to auto generate all the JPA O/R mapping based on FHIR XSD

So do stay tuned, and let me know if you have any feedback or have the intention to contribute to this project!