# EHRS-Peru

## Creators
Jorge Fatama Vera and Katherine Ruiz
 from Pontificia Universidad Católica del Perú (PUCP) contributed this project.

## About the project

This is a theoretical Electronic Health Record system (EHR-S) in Peru, which uses a MongoDB cluster to store clinical information.

Note: This is my (Jorge) dual-thesis project for the degree in Computer Engineering (with the role of Backend Development). The MongoDB + Spring service is hosted in the "ehrs-format" folder of the Gitlab repository, in the "develop" branch. 

## Inspiration

When I started this project, I didn’t know about MongoDB. I think in Peru, it’s a myth that MongoDB is only used in Data Analytics or Big Data. Few people talk about using MongoDB as their primary database.  Most of the time, we use MySQL. SQL Server or Oracle.  In university, we only learn about relational databases. When I looked into my project thesis and other Electronic Health Record Systems, I discovered many applications use MongoDB. So I started to investigate more, and I learned that MongoDB has many advantages as my primary database.

## Why MongoDB?
    
We chose MongoDB for its horizontal scaling, powerful query capacity, and document flexibility. We specifically used these features to support various clinical information formats regulated by local legal regulations.

When we chose MongoDB as our system's clinical information database, I hadn't much previous experience in that. During system development, I was able to identify the benefits that MongoDB offers. This motivated me to learn more about system development with MongoDB, both in programming forums and MongoDB University courses. Then, I wondered how the technological landscape would be favored with integrating NoSQL databases in information systems with potential in data mining and/or high storage capability.

In the medium term, we'll see more systems developed using MongoDB as the primary database in Peru universities' projects for information systems, taking advantage of the growing spread of Big Data and Data Analytics in the Latin American region.

## How it works

For this project, I’m using information systems from relational databases and non-relational databases. Because I discovered that they are not necessarily separated, they can both be convenient to use. 

This is a system with a microservice-oriented architecture. There is a summary of each project in the GitLab repository (each folder represents a microservice):

* **ehrs-eureka**: Attention Service, which works as a server for the other microservices.
* **ehrs-gateway**: Distribution Service, which works as a load balancer, which allows the use of a single port for the requests received by the system.
* **ehrs-auth**: Authentication Service, which manages access to the system.
* **ehrs-auditoria**: Audit Service, which performs the audit trails of the system.
* **ehrs-formatos**: Formats Service, which records clinical information in the database of formats.
* **ehrs-fhir under maintenance]**: FHIR Query Service, which consults the information under the HL7 FHIR standard.

## Challenges and learnings

When I presented this idea to my advisor M.Sc. Angel Lena, he didn’t know about MongoDB as a support in this area. We had to make a plan to justify the use of MongoDB as the primary database. 

The challenge, later on, was how we could store all the different formats in one collection. 

At the moment, we’ve been working with the free cluster.  As the program will scale and go into the deployment phase, I probably need to increase my cluster. That will be a challenge for me because the investment can be a problem. Besides that, there are not many other projects built with MongoDB in my university, and it is sometimes difficult for me to get support. 

To solve this problem, I’ve been working on increasing my knowledge of MongoDB. I’ve been taking classes at [MongoDB University. I’ve completed the basics course and the cluster administration course. There are not many certified MongoDB professionals in my country; only two, I believe,  and I would like to become the third one.  

When I started working on my thesis, I didn’t imagine that I had the opportunity to share my project in this way, and I’m very excited that I can.  I hope that MongoDB will work on a Student ambassador program for universities in the future. Universities still need to learn a lot about MongoDB, and it’s exciting that an ambassador program is in the works.