GSoC Week 13: Enhancing FHIR Integration and Performance Optimization

Manojlakshan
3 min readAug 3, 2024

--

Hi folks!

Welcome back to my Week 13 blog about my journey with Google Summer of Code 2024. This week, I focused on addressing the changes requested during the FHIR PR review process, fixing the flag evaluation exception, and re-implementing the flag generation for patients using parallelStreams.

FHIR Pull Request Feedback

My FHIR pull request got reviewed in this week, and I received feedback highlighting a few minor issues. The primary changes requested included adjusting how I set the FHIR code for the OpenMRS flags message. Initially, I had directly assigned the FHIR code to the OpenMRS flags message,

Code: {
coding: [
{
system: "Alletgy",
code: "message",
},
];
}

but it was recommended to set this value to the code.text property instead. I promptly addressed these issues and pushed the changes for further review.

Code: {
coding: [
{
system: "Alletgy",
},
];
text : "message"
}

Performance Improvements

One of my primary objectives this week was to improve the performance of generating flags for patients. Previously, I implemented a parallel processing approach, but I re-implement this using Java’s parallelStream to optimize it further.

public List<Flag> generateFlagsForPatient(final Patient patient, Filter filter, Map<Object, Object> context) {
List<Flag> results = Collections.synchronizedList(new ArrayList<>());

// we can get rid of this once onStartup is implemented
if (!isInitialized)
refreshCache();

// test each Flag in the cache against the specific Patient
filter.filter(flagCache).parallelStream().forEach(flag -> {
try {
Context.openSession();
if (flag.eval(patient, context)) {
results.add(flag);
}
} catch (Exception e) {
log.error("Unable to test flag " + flag.getName() + " on patient #" + patient.getId(), e);
} finally {
Context.closeSession();
}
});

return results;
}

Performance Test Results

Here are the test results comparing the different methods:

  • ParallelStreams: 7 ~ 8 ms
  • Parallel Process: 15 ~ 16 ms
  • Sequential Process: 16 ~ 17 ms

parallelStreams show better result, reducing the executing time by almost half compared to the previous parallel process implementation.

All flag evaluation exception

When evaluating all flags with all patients, an exception is thrown. Upon investigating the root cause, we noticed that this exception occurs only in OpenMRS versions lower than 2.6.0. I tried to upgrade the OpenMRS version in the module to 2.6, but I was unable to do so. I plan to figure this out and find a solution next week.

GSoC experience and Final Evaluation

There are only two weeks left to wrap everything up, as the final evaluation will start on August 19th. I need to complete all my work by that time and be ready for the final evaluation. During this 13-week GSoC period, I have experienced a lot of things. It has been joyful, challenging, and full of learning opportunities. Throughout these weeks, I have learned

  • How to ask questions effectively
  • How to communicate productively and share my updates
  • Time management skills
  • How to present my work

Plan for next week

  • fix the all flag exception
  • start working on documentation things

Stay tuned for more updates, and thank you for following along with my GSoC journey!

Thank you for the reading, Join me on this tech adventure! Follow my profile to stay updated on the cool world of technology and innovation. Your support means a lot, and I can’t wait to share more exciting stuff with you. Let’s stay connected for more insights and fun discoveries ahead!

Github: https://github.com/ManojLL

LinkedIn : https://www.linkedin.com/in/manoj-lakshan/

--

--