Wednesday, June 12, 2024

Week Two: Progress and Insights


In the second week of my GSoC project, I've delved deeper into integrating OpenELIS with a FHIR-based open client registry. My primary focus has been on enhancing the user interface and improving the dictionary menu functionalities, as well as understanding the FHIR layer within OpenELIS. Here's a detailed look at my progress and learnings this week.

UI Enhancements and REST Controllers for the Dictionary Menu

This week, I tackled several issues to fully translate the dictionary menu into the new UI and RESTful services. The dictionary menu in OpenELIS is crucial for managing various entities and configurations. Here’s a breakdown of the tasks I completed:

Modification of Dictionary Menu

I successfully implemented the feature for modifying the dictionary menu items. This involved creating a dynamic interface where users can add, edit, and delete dictionary entries seamlessly. The new interface is more intuitive and responsive, making it easier for users to navigate and update the dictionary data.

Search Functionality Implementation

I also worked on the search functionality within the dictionary menu. This feature enables users to quickly find specific dictionary entries using keywords or phrases. By leveraging REST controllers, the search process is now efficient and returns results in real-time, significantly improving user experience.

Understanding the FHIR Layer of OpenELIS

As part of my project, I dedicated time to understanding the FHIR (Fast Healthcare Interoperability Resources) layer within OpenELIS. FHIR is essential for standardizing the exchange of healthcare information, and integrating it with OpenELIS is a key goal of this project. Here are some key insights:

Patient-to-FHIR Object Translation

I explored how patients in OpenELIS are translated into FHIR objects. This translation process is critical because it ensures that patient data is formatted and standardized according to FHIR specifications, making it interoperable with other healthcare systems.

Utilizing Existing Functionality for Patient Data Transmission

I studied how to utilize the existing functionality in OpenELIS to send the created patient data to OpenHIM (Open Health Information Mediator) once an event is triggered. This involves understanding the event-driven architecture in OpenELIS and how patient data is packaged and transmitted as a FHIR object to external systems through OpenHIM. This knowledge is pivotal for achieving seamless integration and data exchange between OpenELIS and the FHIR-based client registry.

This week has been immensely productive and insightful, laying a solid foundation for the subsequent phases of my project. I am looking forward to further refining these functionalities and ensuring robust integration between OpenELIS and the FHIR-based client registry.

List of Pull requests i worked on:

Stay tuned for more updates as the project progresses! Thank you for following along on my GSoC journey! Your support and feedback are greatly appreciated.

Sunday, June 2, 2024

Week One: Kicking Off the GSoC Project with OpenCR | GSoC'24

 


Embarking on my Google Summer of Code (GSoC) journey, I've laid the groundwork for a project aimed at integrating OpenELIS with a FHIR-based Open Client Registry. Here's a recap of the first week and the initial steps I've taken.

Setting Up the Trello Board

To ensure organized progress tracking and issue management throughout this project, I created a Trello board. This board will serve as a hub for all tasks, issues, and milestones, facilitating efficient workflow and collaboration. You can follow along with the board here.

Transforming Match Results into FHIR Bundle Objects

The primary task I tackled this week involved transforming match results returned by Open Client Registry (OpenCR) into a FHIR Bundle object. This task is crucial as it sets the foundation for seamless data exchange and interoperability between OpenELIS and the client registry.

Pull Request Overview

I made significant progress by submitting a pull request, which is currently under review. This PR encapsulates the initial implementation of the transformation process.

Technical Approach

To achieve this transformation, I followed a structured approach involving two main functions: getPatientById and transformToFhirObject. 

The getPatientById function is responsible for fetching patient data from the FHIR server based on an array of match results. Here’s a detailed breakdown of how it works:  For each match result, the function creates a promise to fetch the corresponding patient data using the fhirWrapper.getResource method.  If the patient data contains any links, the function adjusts the URLs to ensure they conform to the required format. It appends a `search` object to the patient data, which includes the match-grade and score.The function resolves the promise with the patient data or rejects it if an error occurs during fetching.

The transformToFhirObject function handles the creation of a FHIR Bundle object by combining the fetched patient data.It first calls `getPatientById` for both "auto" and "potential" match results, fetching patient data with appropriate scores and match grades.  The fetched patient data is then combined into a single array.  A FHIR Bundle object is constructed with the combined entries, setting the `resourceType` to "Bundle", generating a unique ID, setting metadata with the current timestamp, specifying the bundle type as "searchset", and setting the total number of entries. The function logs the results and returns the combined FHIR Bundle.

Moving Forward

With the first week successfully behind me, I am eagerly looking forward to the upcoming challenges and learning opportunities. The next steps will involve refining the current implementation based on review feedback, addressing any issues that arise, and diving deeper into the integration process.

Stay tuned for more updates as I continue this exciting journey of integrating OpenELIS with a FHIR-based Open Client Registry.

Sunday, May 26, 2024

GSoC 2024: Integrating OpenELIS with a FHIR-Based Open Client Registry

Community Bonding Period Summary

Greetings everyone!

I am excited to share that I have been selected as a Google Summer of Code (GSoC) student under OpenELIS for the project titled Integrating OpenELIS with a FHIR-Based Open Client Registry. This blog post marks the beginning of my journey and will serve as a log for all updates and discussions related to the project.

Project Overview

Project Mentor : @reagan

Project Summary:

The goal of this project is to integrate OpenELIS, a laboratory information system, with a FHIR-Based Open Client Registry. This integration will enable users to:

  1. Search for patients within their local OpenELIS system.
  2. If a patient isn’t found locally, search the client registry.
  3. Import patient information from the client registry into OpenELIS.

In simpler terms, this project will allow users to seamlessly find patients within their local system and, if not found, search for them in a central database. Once located, the patient's information can be imported back into the local system, enhancing the efficiency and accuracy of patient data management.

Community Bonding Period Highlights

The community bonding period has been an enriching experience filled with learning, networking, and planning. Here are some key highlights:

Understanding the Project Scope and Objectives:

  1. Detailed discussions with my mentor, @reagan, provided me with a clear understanding of the project's goals and deliverables. 
  2. We also had an on boarding session into the codebases i will be interacting with and how each will contribute to the project completion.

Technical Preparation:

  1. I familiarized myself with the OpenELIS codebase and the FHIR (Fast Healthcare Interoperability Resources) standard. 
  2. Set up my development environment and began exploring the existing APIs and documentation.
  3. Identified potential challenges and discussed solutions with my mentor and the community.

Learning and Skill Development:

  1. Participated in various tutorials and webinars related to FHIR and healthcare interoperability.
  2. Enhanced my understanding of data exchange standards in healthcare and their practical applications.

Planning and Documentation:

   - Drafted a detailed project plan outlining the tasks, timelines, and dependencies.

   - Created initial documentation to ensure a clear communication path and streamline the development process.


I will be providing regular updates on the project's progress and any challenges encountered. Stay tuned for more updates, and feel free to reach out if you have any questions or suggestions.

Thank you to the OpenELIS community and my mentor, @reagan, for their continuous support and guidance. I am looking forward to making significant contributions to this project.


Cheers,

Herman Muhereza

Friday, December 29, 2023

Using tools like Apache spark, Talend, Java in ETL to create a central data repository..

 In this blog post, I will show you how to use tools like Apache Spark, Talend, and Java in ETL and Java to create a central data repository. A central data repository is a place where you can store and access all your data from different sources in a consistent and reliable way. It can help you improve data quality, reduce data duplication, and enable data analysis and reporting.

To create a central data repository, you need to perform the following steps:

  1. Extract data from various sources, such as databases, files, web services, etc.
  2. Transform data to make it compatible and standardized, such as cleaning, filtering, joining, aggregating, etc.
  3. Load data into the central data repository, such as a data warehouse, a data lake, or a cloud storage.

To perform these steps, you can use tools like Apache Spark, Talend, and Java. Apache Spark is a distributed computing framework that can process large-scale data in parallel and in memory. Talend is a data integration platform that can connect to various data sources and provide graphical tools to design and execute ETL workflows. Java is a general-purpose programming language that can be used to write custom logic and scripts for data processing.

Here is an overview of how these tools work together:

  • You can use Talend to design and run ETL jobs that extract data from various sources and load it into Apache Spark.
  • You can use Apache Spark to transform the data using its built-in libraries or custom Java code.
  • You can use Talend or Java to load the transformed data into the central data repository.

To install Apache Spark, you need to follow these steps:

  1. Download the latest version of Apache Spark from its official website: https://spark.apache.org/downloads.html
  2. Extract the downloaded file to a location of your choice, such as C:\spark
  3. Set the environment variables SPARK_HOME and JAVA_HOME to point to the Spark and Java installation directories, respectively.
  4. Add the bin subdirectory of SPARK_HOME to your PATH variable.
  5. Verify that Spark is installed correctly by running the command spark-shell in a terminal or command prompt. You should see a welcome message and a Scala prompt.

You have now successfully installed Apache Spark on your machine. In the next section, I will show you how to use Talend to design and run ETL jobs that extract data from various sources and load it into Apache Spark.

Talend

Talend is a powerful and versatile tool for designing and running ETL (Extract, Transform, Load) jobs that can handle data from various sources and load it into Apache Spark, a distributed computing framework for large-scale data processing. In this blog post, we will show you how to use Talend to create a simple ETL job that extracts data from a CSV file, transforms it using a tMap component, and loads it into a Spark Data Frame.

The steps to Install Talend are as follows:

  1. Create a new project in Talend Studio and name it SparkETL.
  2. In the Repository panel, right-click on Job Designs and select Create job. Name the job SparkETLJob and click Finish.
  3. In the Palette panel, search for tFileInputDelimited and drag it to the design workspace. This component will read the CSV file that contains the input data.
  4. Double-click on the tFileInputDelimited component and configure its properties. In the Basic settings tab, click on the [...] button next to File name/Stream and browse to the location of the CSV file. In this example, we use a file called customers.csv that has four columns: id, name, age, and country. In the Schema tab, click on Sync columns to automatically infer the schema from the file.
  5. In the Palette panel, search for tMap and drag it to the design workspace. This component will transform the input data according to some logic. Connect the tFileInputDelimited component to the tMap component using a Row > Main connection.
  6. Double-click on the tMap component and open the Map Editor. You will see two tables: one for the input data and one for the output data. In this example, we want to transform the input data by adding a new column called status that indicates whether the customer is young (age < 30), old (age > 60), or middle-aged (30 <= age <= 60). To do this, we need to add an expression in the Expression Builder of the status column. Click on the [...] button next to status and enter the following expression:
  7. `row1.age < 30 ? "young" : row1.age > 60 ? "old" : "middle-aged"`
  8. Click OK to save the expression.
  9. In the Palette panel, search for tSparkConfiguration and drag it to the design workspace. This component will configure the connection to Spark and set some parameters for the job execution. Connect the tSparkConfiguration component to the tMap component using a Trigger > On Subjob Ok connection.
  10. Double-click on the tSparkConfiguration component and configure its properties. In the Basic settings tab, select Local mode as the Run mode and enter 2 as the Number of executors. You can also adjust other parameters such as Driver memory or Executor memory according to your needs.
  11. In the Palette panel, search for tCollectAndCheckSparkconfig and drag it to the design workspace. This component will collect and check all the Spark configurations in the job and display them in the console. Connect the tCollectAndCheckSparkconfig component to the tSparkConfiguration component using a Trigger > On Subjob Ok connection.
  12. In the Palette panel, search for tDatasetOutputSparkconfig and drag it to the design workspace. This component will load the output data from tMap into a Spark DataFrame. Connect the tDatasetOutputSparkconfig component to the tMap component using a Row > Main connection.
  13. 11. Double-click on the tDatasetOutputSparkconfig component and configure its properties. In the Basic settings tab, enter customers as the Dataset name. This name will be used to identify the DataFrame in Spark.
  14. Save your job and run it by clicking on Run in the toolbar or pressing F6. You will see some logs in the console that show how your job is executed by Spark. You can also check your Spark UI by opening http://localhost:4040 in your browser.

Congratulations! You have successfully created an ETL job that extracts data from a CSV file, transforms it using Talend, and loads it into Apache Spark.

ETL and FHIR in creating a central data repository

 In this blog post, we will explore how ETL (Extract, Transform, Load) and FHIR (Fast Healthcare Interoperability Resources) can be used to create a central data repository for healthcare data. A central data repository is a single source of truth that integrates data from multiple sources and provides a consistent and reliable view of the data. ETL and FHIR are two key technologies that enable the creation of a central data repository.

ETL is a process that extracts data from various sources, transforms it into a common format, and loads it into a target database or data warehouse. ETL can handle different types of data, such as structured, semi-structured, or unstructured data, and apply various transformations, such as cleansing, filtering, aggregating, or enriching the data. ETL can also perform quality checks and validations to ensure the accuracy and completeness of the data.

FHIR is a standard for exchanging healthcare information electronically. FHIR defines a set of resources that represent common healthcare concepts, such as patients, medications, observations, or procedures. FHIR also defines a common way of representing and accessing these resources using RESTful APIs. FHIR enables interoperability between different systems and applications that use healthcare data.

By using ETL and FHIR together, we can create a central data repository that has the following benefits:

  • It reduces data silos and fragmentation by integrating data from multiple sources and systems.
  • It improves data quality and consistency by applying standard transformations and validations to the data.
  • It enhances data usability and accessibility by providing a common way of querying and retrieving the data using FHIR APIs.
  • It supports data analysis and decision making by enabling the use of advanced tools and techniques, such as business intelligence, machine learning, or artificial intelligence.

Illustration

To illustrate how ETL and FHIR can be used to create a central data repository, let's consider an example scenario. Suppose we have three different sources of healthcare data: an electronic health record (EHR) system, a laboratory information system (LIS), and a pharmacy information system (PIS). Each system has its own data format and structure, and they do not communicate with each other. We want to create a central data repository that integrates the data from these three sources and provides a unified view of the patient's health information.

The steps to create the central data repository are as follows:

  1. Extract the data from each source system using the appropriate methods and tools. For example, we can use SQL queries to extract data from relational databases, or we can use APIs to extract data from web services.
  2. Transform the extracted data into FHIR resources using mapping rules and logic. For example, we can map the patient demographics from the EHR system to the Patient resource, the laboratory results from the LIS system to the Observation resource, and the medication prescriptions from the PIS system to the MedicationRequest resource.
  3. Load the transformed FHIR resources into the target database or data warehouse using FHIR APIs or other methods. For example, we can use HTTP POST requests to create new resources or HTTP PUT requests to update existing resources.
  4. Query and retrieve the FHIR resources from the central data repository using FHIR APIs or other methods. For example, we can use HTTP GET requests to read individual resources or search parameters to filter and sort resources.

By following these steps, we have created a central data repository that integrates the healthcare data from three different sources using ETL and FHIR. We can now access and use this data for various purposes, such as clinical care, research, or quality improvement.

In conclusion, ETL and FHIR are two powerful technologies that can help us create a central data repository for healthcare data. By using ETL and FHIR together, we can overcome the challenges of data integration, quality, usability, and accessibility, and leverage the full potential of our healthcare data.

Monday, August 21, 2023

GSoC Project Final Report : Adding Support for FHIR Patch Operations in OpenMRS

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.

Objectives:

  • 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 ✅

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: 

Found Issues:

    1. Medication Dispense was not added to the landing page of the FhirIG
    2. Medication was not added to the landing page of the FhirIG

Fixed Issues:

    1.  https://github.com/openmrs/openmrs-contrib-fhir2-ig/pull/59
    2. https://github.com/openmrs/openmrs-contrib-fhir2-ig/pull/60

 Any other work

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

    1. FM2-606: Mapping ContactPoints to OpenMRS
    2. FM2-605: Add Support for ETags in the FHIR API
    3. FM2-481: Clean up parameter passing for all Service class methods

Talk Thread links:

  1. https://talk.openmrs.org/t/gsoc-2023-fhir-add-support-for-fhir-patch-operations-project-updates/39555  

Weekly Blog Posts:

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

  1. GSOC WEEK 12 - WRAPPING UP A FRUITFUL GSOC JOURNEY: ADDING CONTACT POINTS TO THE OPENMRS-MODULE-INITIALIZER
  2. GSOC WEEK 11: A JOURNEY OF REFINEMENT AND INNOVATION IN FHIR2 MODULE
  3. GSOC WEEK 10 - EMBRACING THE FINALE: REFLECTING ON MY GSOC JOURNEY
  4. GSOC 2023 AT OPENMRS | CODING PERIOD WEEK 09
  5. GSOC 2023 AT OPENMRS | CODING PERIOD WEEK 08
  6. GSOC 2023 AT OPENMRS | CODING PERIOD WEEK 07
  7. GSOC 2023 AT OPENMRS | CODING PERIOD WEEK 06
  8. GSOC 2023 AT OPENMRS | CODING PERIOD WEEK 05
  9. GSOC 2023 AT OPENMRS | CODING PERIOD WEEK 04
  10. GSOC 2023 AT OPENMRS | CODING PERIOD WEEK 03
  11. GSOC 2023 AT OPENMRS | CODING PERIOD WEEK 02
  12. GSOC 2023 AT OPENMRS | CODING PERIOD WEEK 01
  13. GSOC 2023 AT OPENMRS | COMMUNITY BONDING PERIOD

Video(Demo)


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;-

  • 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).

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! 🌟🌐

Sunday, August 20, 2023

GSoC Week 12 - Wrapping Up a Fruitful GSoC Journey: Adding Contact Points to the openmrs-module-initializer

Introduction:

Greetings, dear readers and fellow enthusiasts of healthcare technology! It is with a mix of emotions that I write this final blog post, marking the culmination of my exhilarating Google Summer of Code (GSoC) journey. As I step into the 12th and final week, I find myself reflecting on the remarkable progress, invaluable learnings, and the gratifying experience of contributing to the OpenMRS community. Join me in celebrating the journey, as I highlight the achievements of this concluding week!

Week 12: A Grand Finale of Innovation and Integration

The 12th week of GSoC was not just a closure but a grand finale, as I embraced the opportunity to contribute a significant feature to the OpenMRS ecosystem. Building upon the groundwork laid in the previous weeks, I embarked on a unique endeavor: integrating Contact Points into the OpenMRS-Module-Initializer. This initiative aimed to enhance the functionality of OpenMRS by ensuring seamless configuration and representation of Contact Points, enriching the interoperability of healthcare data.

A Fusion of Coding and Collaboration:

Week 12 was a harmonious fusion of coding, collaboration, and the pursuit of excellence. Here's a glimpse into the key milestones of the week: With a clear vision of the project's goals, I set out to integrate Contact Points into the OpenMRS-Module-Initializer. This involved configuring Contact Points as attribute types and enabling dynamic updates through the initializer, adding csv files, etc. 

The GSOC Reflection: A Journey of Growth and Impact

As I reflect on this GSoC journey, I'm struck by the depth of growth and impact it has brought. From diving into FHIR PATCH operations to integrating Contact Points, every challenge and accomplishment has contributed to my journey as a developer and an open-source advocate.

A Note of Gratitude: Mentors and Community

My journey wouldn't have been possible without the exceptional guidance and support of my primary mentor, @ibacher, and backup mentor, @abertnamanya. Their expertise, mentorship, and encouragement have been invaluable assets that enriched my GSoC experience.

Looking Beyond: A Future of Possibilities

As GSoC draws to a close, a new chapter begins. Armed with the skills honed, lessons learned, and connections made, I'm excited to continue contributing to OpenMRS and the broader healthcare technology landscape.

Conclusion:

As I bid farewell to this transformative GSoC journey, I am filled with gratitude, accomplishment, and the promise of new beginnings. The path ahead holds countless opportunities to shape healthcare technology, collaborate with passionate minds, and drive innovation.

Thank you for joining me on this incredible voyage. Let's continue to code, collaborate, and create a future where technology and healthcare seamlessly converge. Until we meet again, let's continue making a difference, one commit at a time!

Write code, save lives!