- Project Title: Add Support for FHIR PATCH operations
- Primary mentor: Ian Bacher
- Backup mentor: Abert Namanya
- Project Link: GSoC-2023: FHIR: Add Support for FHIR PATCH operations
- Project Report: Report repo
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.
- The Patch operations used within the above mentioned patch formats are
add, replace, move, copy, test, remove
.
- Detect the incoming format(either json-merge patch, json-patch or xml-patch)
- Load the existing resource in the appropriate format
- Apply the patch
- Implement JSON PATCH operations on all OpenMRS FHIR R4 resources and ensure to have the tests working perfectly. - COMPLETED ✅
- Implement JSON MERGE PATCH operations on all OpenMRS FHIR R4 resources and ensure to have the tests working perfectly. - COMPLETED ✅
- Implement XML PATCH operations on all OpenMRS FHIR R4 resources and ensure to have the tests working perfectly. - COMPLETED ✅
During the project, I worked on various code repositories and pull requests to bring the functionality of PATCH operations to the FHIR API:
Pull Requests: filtered here!
- Add Support for Patching on Immunization Resource - Merged ✅
- Add Support for UPDATE on the Observation Resource - Merged ✅
- Add support for XML PATCH operation - Location Resource - Merged ✅
- Add support for XML PATCHing operations - Encounter Resource - Merged ✅
- Add support for XML PATCHing operations-MedicationDispense Resource - Merged ✅
- Add support for XML PATCHing operations-Task Resource - Merged ✅
- Add support for XML PATCHing operations - Medication Resource - Merged ✅
- Add support for XML PATCHing operations - DiagnosticReport Resource - Merged ✅
- Add support for XML PATCHing operations - MedicationRequest Resource - Merged ✅
- Add support for XML patching operations - Condition Resource - Merged ✅
- Add support for XML patching operations - Person Resource - Merged ✅
- Add support for XML patching operations - AllergyIntolerance Resource - Merged ✅
- Add support for XML patching operations - Practitioner Resource - Merged ✅
- Add support for XML Patch operations - Patient Resource - Merged ✅
- Add Support for JSON patching operations — MedicationDispense Resource - Merged ✅
- Add support for Json Merge Patch operations - Practitioner Resource - Merged ✅
- Add support for Json Patching operations - DiagnosticReport Resource - Merged ✅
- Add support for Json patching operations - Encounter Resource - Merged ✅
- Add support for Json Merge Patch operations - Medication Resource - Merged ✅
- 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 ✅
- toOpenmrsType translators should set uuid to id part of id, not full id - Merged ✅
- Add support for Json patching operations - Task Resource - Merged ✅
- Add support for Json patching operations - Patient Resource - Merged ✅
- Add support for Json patching operations - Allergy Intolerence Resource - Merged ✅
- Add support for Json patching operations - Person Resource - Merged ✅
- Add support for Json patching operations - Condition Resource - Merged ✅
- Add support for Json patching operations - Location Resource - Merged ✅
- Medication Dispense was not added to the landing page of the FhirIG
- Medication was not added to the landing page of the FhirIG
- Add medication resource to the index page - Merged ✅
- Adding MedicationDispense to index.md - Merged ✅
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;-
- FM2-606: Mapping ContactPoints to OpenMRS - Merged ✅
- FM2-605: Add Support for ETags in the FHIR API - Merged ✅
- FM2-481: Clean up parameter passing for Condition Service Search - Merged ✅
- FM2-481: Clean up parameter passing for AllergyIntolerance Service Search - Merged ✅
- FM2-481: Clean up parameter passing for DiagnosticReport Service Search - Merged ✅
- FM2-481: Clean up parameter passing for MedicationRequest Service Search - Merged ✅
- FM2-481: Clean up parameter passing for Practitioner Service Search method - Merged ✅
- FM2-481: Clean up parameter passing for Medication Service Search method - Merged ✅
- FM2-481: Clean up parameter passing for Task Service class search method - Merged ✅
- FM2-481: Clean up parameter passing in Person Service class search method - Merged ✅
- GSoC 2023: Add Support for FHIR Patch Operations - project updates
- GSoC 2023: Add Support for FHIR Patch Operations - final presentation
- toOpenmrstype-translator-for-servicerequest-should-be-implemented
- failed-to-validate-with-reason-uuid-this-value-exceeds-the-maximum-length-of-38-permitted-for-this-field
- add-support-for-fhir-patch-operations
Throughout the development cycle, I chronicled my progress and insights through weekly blog posts:
- GSOC WEEK 12 - WRAPPING UP A FRUITFUL GSOC JOURNEY: ADDING CONTACT POINTS TO THE OPENMRS-MODULE-INITIALIZER
- GSOC WEEK 11: A JOURNEY OF REFINEMENT AND INNOVATION IN FHIR2 MODULE
- GSOC WEEK 10 - EMBRACING THE FINALE: REFLECTING ON MY GSOC JOURNEY
- CODING PERIOD WEEK 09
- CODING PERIOD WEEK 08
- CODING PERIOD WEEK 07
- CODING PERIOD WEEK 06
- CODING PERIOD WEEK 05
- CODING PERIOD WEEK 04
- CODING PERIOD WEEK 03
- CODING PERIOD WEEK 02
- CODING PERIOD WEEK 01
- COMMUNITY BONDING PERIOD
MUHEREZA.HERMAN.-.GSOC.2023.mp4
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;-
- Ensure Service Request resource is fully translated
- Ensure Service Request resource supports all the PATCHing formats implemented above.
- Write more tests in regard to the how the json documents and xml documents should be written in the attempt to give clearer error messages.(To Be Discussed)
- We could also implement the PATCH operations for the R3 resources(To Be Discussed).
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! 🌟🌐