Tuesday, April 8, 2014

HL7 FHIR Partial Update

Below I summarized what I have tried so far for handling partial update in HL7 FHIR.

1) Syntax

URL: http://[server]/[resource]/[logical id]/_delta
method: POST

I did not use PATCH method since some of older browser does not support this method, also not sure whether PATCH method has been supported in all javascript library

2) Extension element to specify update mode

For each element to be added/replaced/deleted, added the following extension

       <extension url="http://hl7.org/fhir/Profile/iso-21090#updateMode" >
            <valueCode value="A or R or D" />
        </extension>

As an example, below is the XML snippet for updating birthDate

 <birthDate value="1970-03-13">
      <extension url="http://hl7.org/fhir/Profile/iso-21090#updateMode" >
            <valueCode value="R" />
        </extension
>

  </birthDate>


3) Handling collection

For collection data elements such as name, address and contact in Patient resource, server needs to know which element within the collection is to be replaced/deleted. So I decided to pull collection element's internal id as part of the query response, and then use the same id when submitting the payload to server

- Added collection element internal id in query response as part of element extension

    <telecom>
        <extension url="http://hl7.org/fhir/metadata#id">
            <valueString value="1308"/>
        </extension>

        <system value="phone"/>
        <value value="68181256"/>
        <use value="home"/>
    </telecom>

- Payload for partial update
      <telecom>
            <extension url="http://hl7.org/fhir/metadata#id">
                <valueString value="1308"/>
            </extension>

            <extension url="http://hl7.org/fhir/Profile/iso-21090#updateMode" >
                <valueCode value="R" />
             </extension>

           <system value="phone"/>
           <value value="68181256"/>
           <use value="office"/>
    </telecom>


4) Suggestion

The above approach works okay so far, however I'd like to make one suggestion here. As we can see from the above XML snippet, the content is very verbose after adding extension elements.Can we add the two attributes (id and updateMode) in FHIR resource as part of Element built-in attributes? In this way, the content will be very compact as the following snippet shows,

     <telecom  id="1308" updateMode="R">             
           <system value="phone"/>
           <value value="68181256"/>
           <use value="office"/>
    </telecom>


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!

Thursday, March 7, 2013

The Purpose of Architecture

Very thought-provoking interview from MIT's Ross

MIT’s Ross on How Enterprise Architecture and IT More Than Ever Lead to Business Transformation


Particurily the following two points,

If you have all the money in the world, you’re not forced to make tough decisions. Architecture is all about making tough decisions, understanding your tradeoffs, and recognizing that you’re going to get some things that you want and you are going to sacrifice others

We really just need architecture to pull out unnecessary cost and to enable desirable reusability. And the architect is typically going to be the person representing that enterprise view and helping everyone understand the benefits of understanding that enterprise view, so that everybody who can easily or more easily see the local view is constantly working with architects to balance those two requirements.