{"id":21,"date":"2023-02-24T03:51:05","date_gmt":"2023-02-24T03:51:05","guid":{"rendered":"https:\/\/blogs.oregonstate.edu\/asaleholland\/?p=21"},"modified":"2023-02-24T03:51:05","modified_gmt":"2023-02-24T03:51:05","slug":"a-software-engineers-exploration-of-openmrs","status":"publish","type":"post","link":"https:\/\/blogs.oregonstate.edu\/asaleholland\/2023\/02\/24\/a-software-engineers-exploration-of-openmrs\/","title":{"rendered":"A Software Engineer\u2019s Exploration of\u00a0OpenMRS"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/0*VLV6zmfK-hazAE4V.png\" alt=\"\" \/><figcaption class=\"wp-element-caption\">OpenMRS Logo (source: <a href=\"https:\/\/en.wikipedia.org\/wiki\/File:OpenMRS_logo_699.png\" rel=\"noreferrer noopener\" target=\"_blank\">Wikipedia<\/a>)<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">I. Introduction<\/h3>\n\n\n\n<p>OpenMRS is a free and open-source medical record system designed to support healthcare delivery in low-resource environments. It was first launched in 2004 as a collaboration between multiple organizations, including the <a href=\"https:\/\/www.regenstrief.org\/\" rel=\"noreferrer noopener\" target=\"_blank\">Regenstrief Institute<\/a> and <a href=\"https:\/\/www.pih.org\/\" rel=\"noreferrer noopener\" target=\"_blank\">Partners In Health<\/a> (<a href=\"https:\/\/en.wikipedia.org\/wiki\/OpenMRS\" rel=\"noreferrer noopener\" target=\"_blank\">Wikipedia<\/a>). It started out being used <a href=\"https:\/\/wiki.openmrs.org\/display\/docs\/Introduction+to+OpenMRS#:~:text=in%20Kenya%20and%20Rwanda%29\" rel=\"noreferrer noopener\" target=\"_blank\">in Kenya and Rwanda<\/a> to support HIV care. Today, OpenMRS is used in a variety of settings, including hospitals, clinics, and research organizations, and is supported by a global community of contributors.&nbsp;<\/p>\n\n\n\n<p>There are other open source medical record system applications (<a href=\"https:\/\/github.com\/dhis2\" rel=\"noreferrer noopener\" target=\"_blank\">DHIS2<\/a> and <a href=\"https:\/\/github.com\/openemr\/openemr\" rel=\"noreferrer noopener\" target=\"_blank\">OpenEMR<\/a> are a few big ones), and OpenMRS has been integrated into other larger systems (like <a href=\"https:\/\/www.bahmni.org\/\" rel=\"noreferrer noopener\" target=\"_blank\">Bhamni<\/a>), but I chose to dive into OpenMRS specifically because it has a widely accessible open-source developer community. The purpose of this blog post is to document my own exploration of OpenMRS from a software engineering perspective, providing insights into the code base, architecture, and testing process. My hope is that this post will serve as a valuable resource not just for me as I poke around in a system I\u2019ve wanted to learn about for some time, but also for others interested in exploring OpenMRS or working on similar projects.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">II. Exploring the OpenMRS Code&nbsp;Base<\/h3>\n\n\n\n<p>Starting with the<a href=\"https:\/\/wiki.openmrs.org\/display\/docs\/Introduction+to+OpenMRS#:~:text=using%20the%20system.-,What%20is%20OpenMRS%3F,-OpenMRS%20is%20a\" rel=\"noreferrer noopener\" target=\"_blank\"> OpenMRS Wiki<\/a>, I learned how OpenMRS is built using a three-tier system: a core data model, a<a href=\"https:\/\/wiki.openmrs.org\/display\/docs\/API\" rel=\"noreferrer noopener\" target=\"_blank\"> java Spring API with full documentation<\/a>, and a web-based application that uses that API. The project also comes with <a href=\"https:\/\/wiki.openmrs.org\/display\/docs\/Implementer+Documentation\" rel=\"noreferrer noopener\" target=\"_blank\">Implementer Documentation <\/a>for those who are seeking to set up OpenMRS for actual use.&nbsp;<\/p>\n\n\n\n<p>I wanted to get a 10,000-mile overhead view of the tools of the project, and the OpenMRS documentation offers a clear path for new open-source contributors. In particular, the <a href=\"http:\/\/archive.flossmanuals.net\/openmrs-developers-guide\/development-process.html\" rel=\"noreferrer noopener\" target=\"_blank\">Development Process page<\/a> of the OpenMRS Developers Guide provides a clear step-by-step set of instructions for how to contribute to the open-source project.<\/p>\n\n\n\n<p>OpenMRS\u2019 core data model is built using a concept dictionary meant to define all the unique concepts used in the system. I\u2019m a budding enthusiast of domain-driven design, and this immediately struck me as to how ubiquitous language from a DDD perspective should be defined.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">III. Understanding the OpenMRS Architecture<\/h3>\n\n\n\n<p>The core domains of the core OpenMRS data model are as follows:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Concepts<\/strong>: These are utilized to facilitate strongly coded data across the system.<\/li>\n\n\n\n<li><strong>Encounter<\/strong>: This contains the metadata related to the healthcare providers\u2019 interactions with the patient.<\/li>\n\n\n\n<li><strong>Form<\/strong>: Essentially, it describes the user interface for various components.<\/li>\n\n\n\n<li><strong>Observation<\/strong>: This is the place where the actual health information is stored. Within an Encounter, there may be several observations.<\/li>\n\n\n\n<li><strong>Order<\/strong>: Refers to things or actions that have been requested.<\/li>\n\n\n\n<li><strong>Patient<\/strong>: Contains fundamental information about the patients within the system.<\/li>\n\n\n\n<li><strong>User<\/strong>: Contains basic information about the people who use the system.<\/li>\n\n\n\n<li><strong>Person<\/strong>: Contains basic information about individuals in the system.<\/li>\n\n\n\n<li><strong>Business<\/strong>: Pertains to non-medical data that is used for administering OpenMRS.<\/li>\n\n\n\n<li><strong>Groups\/Workflow<\/strong>: Refers to Cohort data and workflows.<\/li>\n<\/ul>\n\n\n\n<p>An in-depth image of the tables used to construct the datamodel can be found <a href=\"https:\/\/wiki.openmrs.org\/display\/docs\/Data+Model?preview=\/589829\/34374262\/openmrs_data_model_1.9.0.svg\" rel=\"noreferrer noopener\" target=\"_blank\">here<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/0*X7FLPLT4KvLhopWP.png\" alt=\"\" \/><figcaption class=\"wp-element-caption\">An OpenMRS Overview diagram (<a href=\"http:\/\/archive.flossmanuals.net\/openmrs-developers-guide\/architecture.html\" rel=\"noreferrer noopener\" target=\"_blank\">source: FlossManuals<\/a>)<\/figcaption><\/figure>\n\n\n\n<p>A laundry list of OpenMRS tech stack entries:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.java.com\/en\/download\/help\/whatis_java.html\" rel=\"noreferrer noopener\" target=\"_blank\">Java<\/a>: primary programming language used in OpenMRS backend<\/li>\n\n\n\n<li><a href=\"https:\/\/spring.io\/why-spring\" rel=\"noreferrer noopener\" target=\"_blank\">Spring<\/a>: a Java platform application framework that helps structure the project to use the Model-View-Controller pattern<\/li>\n\n\n\n<li><a href=\"https:\/\/maven.apache.org\/\" rel=\"noreferrer noopener\" target=\"_blank\">Maven<\/a>: handles building, reporting and documenting the Java project<\/li>\n\n\n\n<li><a href=\"https:\/\/hibernate.org\/\" rel=\"noreferrer noopener\" target=\"_blank\">Hibernate<\/a>: an Object Relational Mapper for Java that abstracts the relational database table design away from the core backend logic<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysql.com\/\" rel=\"noreferrer noopener\" target=\"_blank\">MySQL<\/a>: a relational database management system used for data storage<\/li>\n\n\n\n<li><a href=\"https:\/\/www.tutorialspoint.com\/jsp\/index.htm\" rel=\"noreferrer noopener\" target=\"_blank\">Jakarta Server Pages (JSP)<\/a>: renders views for the web browser using Java. This is generally considered to be outdated tech since it does not allow designers direct access to the plain HTML of templates, with an alternative like Spring Boot, JavaServer Faces (component-based), and React being preferable<\/li>\n\n\n\n<li><a href=\"https:\/\/jquery.com\/\" rel=\"noreferrer noopener\" target=\"_blank\">jQuery<\/a>: JavaScript library used for HTML DOM tree and Ajax handling<\/li>\n\n\n\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Direct_Web_Remoting\" rel=\"noreferrer noopener\" target=\"_blank\">Direct Web Remoting (DWR)<\/a>: translates java objects and methods into javascript objects and methods during Ajax.<\/li>\n\n\n\n<li><a href=\"https:\/\/groovy-lang.org\/\" rel=\"noreferrer noopener\" target=\"_blank\">Groovy<\/a>: programming language used in reference application user interfaces that tap into the OpenMRS backend.<\/li>\n\n\n\n<li><a href=\"https:\/\/issues.openmrs.org\/secure\/Dashboard.jspa\" rel=\"noreferrer noopener\" target=\"_blank\">Jira<\/a>: issue management system used to track planned project changes<\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/OpenMRS\" rel=\"noreferrer noopener\" target=\"_blank\">GitHub<\/a>: version control system for OpenMRS core applications<\/li>\n\n\n\n<li><a href=\"https:\/\/www.atlassian.com\/software\/bamboo\" rel=\"noreferrer noopener\" target=\"_blank\">Bamboo<\/a>: continuous integration system that performs regression testing<\/li>\n<\/ul>\n\n\n\n<p>Wow! That\u2019s a whole lot of jargon. To be totally up front, I\u2019m not much of a Java developer (more of a Typescript and Python guy, so far), a lot of these tools were new to me.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">IV. Digging into&nbsp;OpenMRS<\/h3>\n\n\n\n<p>Ready to dive in? Okay, let\u2019s go.<\/p>\n\n\n\n<p>To start off, I wanted to see what the frontend application looks like to end users. OpenMRS offers a demo of the tool <a href=\"https:\/\/openmrs.org\/demo\/#:~:text=Explore%20OpenMRS%202-,OpenMRS%203,-Demo\" rel=\"noreferrer noopener\" target=\"_blank\">on their website.<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/1*o8Vm8e0CE3CAl8lNokVs0w.png\" alt=\"\" \/><figcaption class=\"wp-element-caption\">Open MRS Demo&nbsp;Entrance<\/figcaption><\/figure>\n\n\n\n<p>I\u2019d like to highlight three points from the user perspective:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>The system is quite modular, and allows an admin user to manage the Modules currently installed. For example, in the following screenshot, you can see modules like FHIR2 and Bahmni Appointment Scheduling, which correspond to actual code repositories on GitHub (<a href=\"https:\/\/github.com\/openmrs\/openmrs-module-fhir2\" rel=\"noreferrer noopener\" target=\"_blank\">openmrs-module-fhir2<\/a> and <a href=\"https:\/\/github.com\/Bahmni\/openmrs-module-appointments\" rel=\"noreferrer noopener\" target=\"_blank\">openmrs-module-appointments<\/a> respectively):<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/1*BCausw1mVV9wAbW_MDexqw.png\" alt=\"\" \/><figcaption class=\"wp-element-caption\">OpenMRS Demo Modular Build Management<\/figcaption><\/figure>\n\n\n\n<p>2. The frontend of the system utilizes the same ubiquitous language that was used in the core data model. For example, in the following screenshot of the Admin view, you can see some of the core domains that were identified in the core data model:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/1*3b_Z-eDWrbbsRASgLm57DA.png\" alt=\"\" \/><figcaption class=\"wp-element-caption\">OpenMRS Demo Administration View showing Core Data Model&nbsp;Domains<\/figcaption><\/figure>\n\n\n\n<p>3. Remember how I mentioned the Concept Dictionary? It turns out, the tool allows each instance of the application to define its own terms, called Concepts, in the form of a living dictionary within the application:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/1*r3ndjBCPcKsIqTHlyBFiYg.png\" alt=\"\" \/><figcaption class=\"wp-element-caption\">OpenMRS Demo Concept Dictionary showing Implementation-Specific Terminology and Definitions&nbsp;<\/figcaption><\/figure>\n\n\n\n<p>The demo is not without its limitations, and I did come across a few bugs with the demo, like when I tried to open the \u201cForm Builder\u201d:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/1*_4zZZMi7lX-RnT23GGaWIw.png\" alt=\"\" \/><figcaption class=\"wp-element-caption\">Error received on OpenMRS Demo when clicking into \u201cForm Builder\u201d from the App&nbsp;Menu.<\/figcaption><\/figure>\n\n\n\n<p>\u2026 and when I tried to load the \u201cCohort Dashboard\u201d from the Admin Dashboard:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/1*GCm_RWqgiqVd3tAph_cNjA.png\" alt=\"\" \/><figcaption class=\"wp-element-caption\">Error received on OpenMRS Demo when clicking on the link for \u201cCohort Dashboard\u201d from the Admin&nbsp;page.<\/figcaption><\/figure>\n\n\n\n<p>Overall though, after playing around with the frontend application demo I can see how this is a flexible tool that could be modified and tweaked based on each implementation. From what I could see, it has a highly modular architecture and a great deal of care has been taken when it comes to designing the tool to be adaptable to different purposes. Cool stuff!<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Conclusion<\/strong><\/p>\n\n\n\n<p>Overall this was a good entrypoint into this application. Next steps for me would definitely be try to get it running locally and maybe even make a few Open Source commits. But even this exercise provided some insights into the application and more broadly into the types of applications that hold up to international development projects within the healthcare space. This was a fun exercise to go through, and I&#8217;m excited to see what the next steps will be.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I. Introduction OpenMRS is a free and open-source medical record system designed to support healthcare delivery in low-resource environments. It was first launched in 2004 as a collaboration between multiple organizations, including the Regenstrief Institute and Partners In Health (Wikipedia). It started out being used in Kenya and Rwanda to support HIV care. Today, OpenMRS [&hellip;]<\/p>\n","protected":false},"author":13106,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-21","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.oregonstate.edu\/asaleholland\/wp-json\/wp\/v2\/posts\/21","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.oregonstate.edu\/asaleholland\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.oregonstate.edu\/asaleholland\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/asaleholland\/wp-json\/wp\/v2\/users\/13106"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/asaleholland\/wp-json\/wp\/v2\/comments?post=21"}],"version-history":[{"count":1,"href":"https:\/\/blogs.oregonstate.edu\/asaleholland\/wp-json\/wp\/v2\/posts\/21\/revisions"}],"predecessor-version":[{"id":22,"href":"https:\/\/blogs.oregonstate.edu\/asaleholland\/wp-json\/wp\/v2\/posts\/21\/revisions\/22"}],"wp:attachment":[{"href":"https:\/\/blogs.oregonstate.edu\/asaleholland\/wp-json\/wp\/v2\/media?parent=21"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/asaleholland\/wp-json\/wp\/v2\/categories?post=21"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/asaleholland\/wp-json\/wp\/v2\/tags?post=21"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}