GSOC-FinalReport

Add Support for FHIR PATCH operations Deploy static content to Pages pages-build-deployment

Overview

OpenMRS is using the FHIR API more and more in place of the REST API. However, the FHIR API is, by default, quite verbose. Supporting PATCH operations would allow us to support partial updates to FHIR resources without needing to send the whole resource from the client to the server.

The journey of enhancing OpenMRS through the addition of support for FHIR Patch Operations has been a remarkable experience. In light of the growing importance of the FHIR API as a replacement for the REST API, this project sought to introduce PATCH operations to enable more efficient partial updates to FHIR resources. This feature empowers users to modify specific elements within resources without the need to transmit entire resources between the client and the server.

In the context of the HAPI FHIR library, “patching” refers to the process of making partial updates to a FHIR (Fast Healthcare Interoperability Resources) resource. FHIR resources are representations of healthcare-related data, such as patient, observations, medications, etc., designed to be easily shared and exchanged between different healthcare systems.

Patching allows you to modify specific parts of a FHIR resource without having to replace the entire resource. This can be particularly useful when you want to make minor updates or corrections to a resource without sending the entire payload over the network. The PATCH operation follows the HTTP PATCH method semantics and is designed to be more efficient than the PUT or POST methods for updating resources, especially when dealing with large resources or slow network connections.

Format for supporting a single patch

  1. Detect the incoming format(either json-merge patch, json-patch or xml-patch)
  2. Load the existing resource in the appropriate format
  3. Apply the patch

Objectives:

Contributions:

During the project, I worked on various code repositories and pull requests to bring the functionality of PATCH operations to the FHIR API:

Repositories:

Pull Requests: filtered here!

  1. Add Support for Patching on Immunization Resource - Merged ✅
  2. Add Support for UPDATE on the Observation Resource - Merged ✅
  3. Add support for XML PATCH operation - Location Resource - Merged ✅
  4. Add support for XML PATCHing operations - Encounter Resource - Merged ✅
  5. Add support for XML PATCHing operations-MedicationDispense Resource - Merged ✅
  6. Add support for XML PATCHing operations-Task Resource - Merged ✅
  7. Add support for XML PATCHing operations - Medication Resource - Merged ✅
  8. Add support for XML PATCHing operations - DiagnosticReport Resource - Merged ✅
  9. Add support for XML PATCHing operations - MedicationRequest Resource - Merged ✅
  10. Add support for XML patching operations - Condition Resource - Merged ✅
  11. Add support for XML patching operations - Person Resource - Merged ✅
  12. Add support for XML patching operations - AllergyIntolerance Resource - Merged ✅
  13. Add support for XML patching operations - Practitioner Resource - Merged ✅
  14. Add support for XML Patch operations - Patient Resource - Merged ✅
  15. Add Support for JSON patching operations — MedicationDispense Resource - Merged ✅
  16. Add support for Json Merge Patch operations - Practitioner Resource - Merged ✅
  17. Add support for Json Patching operations - DiagnosticReport Resource - Merged ✅
  18. Add support for Json patching operations - Encounter Resource - Merged ✅
  19. Add support for Json Merge Patch operations - Medication Resource - Merged ✅
  20. Ensure that we can support json patches too since json merge patches have a limitation when it comes to patching attributes inside Arrays, Lists - Merged ✅
  21. toOpenmrsType translators should set uuid to id part of id, not full id - Merged ✅
  22. Add support for Json patching operations - Task Resource - Merged ✅
  23. Add support for Json patching operations - Patient Resource - Merged ✅
  24. Add support for Json patching operations - Allergy Intolerence Resource - Merged ✅
  25. Add support for Json patching operations - Person Resource - Merged ✅
  26. Add support for Json patching operations - Condition Resource - Merged ✅
  27. Add support for Json patching operations - Location Resource - Merged ✅

Found Issues:

Fixed Issues:

During this GSoC jouney, i was able to do other work on the FHIR module as assigned by my mentor and below are the pull requests;-

Jira Epic

Weekly Blog Posts:

Throughout the development cycle, I chronicled my progress and insights through weekly blog posts:

Video(Demo)

https://github.com/mherman22/GSOC-FinalReport/assets/47120265/09a4d47d-e67f-4dc1-ab04-0f9a33a4971b

Resources:

Future Works:

While significant strides have been made, certain aspects require further attention. Completing the integration of PATCH operations with complex FHIR resources is a priority. Additionally, refining error handling and optimizing performance will ensure a robust implementation.

Part of the work to be worked on includes but not limited to the following;-

Thoughts on GSoC:

Participating in GSoC 2023 on the OpenMRS platform has been an enlightening journey. Working with esteemed mentors like Ian Bacher and Abert Namanya has been instrumental in my growth. I have gained insights into the world of healthcare informatics, API optimization, and collaborative open-source development. Looking forward, GSoC has paved the way for a continued commitment to enhancing healthcare technology. My knowledge in FHIR standards and OpenMRS data model and how the two integrate to complement each other has greatly grown.

A special thanks to GSoC, OpenMRS, mentors, and the vibrant community for making this journey a resounding success! 🌟🌐