How to build a healthcare platform in 10 days using Azure Cloud Service

MONIRUL ISLAM
7 min readJun 12, 2020

--

When I started learning about cloud-native, the phrase Cloud-Native speedups the application building process didn’t make any sense. It took a pandemic like COVID-19 to teach me the concept. Azure Cloud Services along with cloud-native concepts, enable us to build a complex healthcare platform in flat 10 days.

The platform I am talking about is Apthamitra, by Karnataka Government.

The primary objective of this platform was to optimize the resources in Karnataka to fight against Covid-19 and to stop the spread of this disease. The stakeholders are around 5000 volunteers (MBBS students), 1025 retired doctors, 444 fever clinics, Ambulance operators and government food, medicine, municipality, etc. departments. We flow in citizens’ data from a survey, ASHA workers data, Aarogya setu data, government COVID data, etc. to our platform. After that, the volunteers call them to get regular health checks and depending on the condition either refer to telemedicine doctors or to an ambulance. Citizens can also call our platform to clear their doubts regarding COVID-19. If anyone is in a contaminated zone, we also made sure that everyone got food, medicines, or their garbage collected, etc.

Building User interface

Apthamitra has four user interfaces for

1. Volunteers
2. Doctors
3. Administrators and management
4. Citizens’

Volunteers' web application is used to record historical health data for a citizen. They can either call someone or receive a call on IVR. Volunteers also can refer any citizen to telemedicine doctors, to hospital, etc. The whole application was build using Angular 9. The code is compiled and stored in Azure Blob Storage and served through Azure CDN.

Administrators app is for uploading doctor roaster, update the volunteer’s details, analyze the data from the dashboard, run special kinds of information gathering (Campaign), etc. It was also build using Angular 9.

Whenever a patient got assigned to a telemedicine doctor, the doctor gets an SMS regarding the patient. The doctor logins through the application, see the details and either calls them for further information or prescribe them some medicine or next steps. This application is also build using Angular 9.

Citizens’ app is a mobile application to show the basic information regarding the platform and also anyone can provide health information as a survey format.

Microservices

There are 6 microservices used for this platform

1. Survey — To flow the citizen survey data
2. Ticketing — The main CRM
3. Notification — To send SMS and emails
4. Batch Processing — To process the bulk upload of data like roasters, Aarogya setu Data
5. Reporting — To generate reports for the requests regarding food, medicines or garbage collection, etc.
6. Keycloak — Open Source authentication and authorization platform.

All these microservices are spring boot-microservices written in Java. All the services use Azure Database for PostgreSQL as the persistence data source and Kafka as a messaging service with Avro serialization (Confluent schema registry).

Other Services

Apthamitra uses Apache NiFi (from azure cloud computing solutions) as a data ingestion platform to ingest citizen’s health data from other sources like SMS, WhatsApp, etc.

The CRM microservice also uses Elasticsearch as an indexing database. For dashboards, it uses Druid (Azure Cloud Computing Solutions) and Apache superset.

Block Diagram

Tech-stacks

These are all the technology that is used

Tech Stack

Deployment

I had an excellent team of 15 people who worked tirelessly for a week to write down the code. But deploying the whole thing with all network security and availability is a tough task.

UI deployment

The whole angular codes were compiled to static files. Then we created an Azure Storage Account on https://portal.azure.com/.

Push the compiled code to this storage account. On the left-hand side of that storage, account go to settings à Static website and enable static website.

Now we can create a CDN and add this storage account to serve the app from CDN.

Now this part was easy and fast anyone with slight knowledge about angular and azure cloud services could have done it. The main challenge was to deploy, secure, and scale backend services.

Backend Deployment

Database

All the micro-services are dependent on PostgreSQL as a database. The main requirements for a database in this kind of application are scalable and availability. For this, we started exploring the Yugabyte database, servers. Even though Yugabyte provides auto-scalability and availability, it needed to be set up from bare metal VM which is time-consuming and the configurations for making the server multi-master were tough. One instance of Azure Database for PostgreSQL server of configuration “General Purpose, 8 vCore(s), 100 GB” did the trick for us.

Kafka

Apthamitra uses Kafka as a messaging service. All the messages are encrypted and serialized using the Avro serializer. For the schema registry, we use Confluent Schema Registry. We set up 3 nodes Kafka brokers, 3 nodes Zookeeper, 1 node schema-registry on three Ubuntu Server 18.04 LTS VMs on the azure cloud. All these services are started using ansible-playbook (https://github.com/confluentinc/cp-ansible).

Elasticsearch, Druid, NiFi

We set up Elasticsearch (Self-Managed) for a quick set up of the Elasticsearch cluster for the main CRM application.

Druid was set up using ansible script on three nodes of three Ubuntu Server 18.04 LTS VMs on the azure cloud.
NiFi is used from azure computing engine.

Microservices

For reliable and scalable performance, we containerized all the microservices. As an orchestration platform, we used Azure Kubernetes Services (AKS) to see its fast deployment process than a self-managed Kubernetes cluster. We set up a 5 node AKS cluster, which can auto-scale up to 10. Nginx-ingress controller is used as the load-balancer for this cluster. Nginx-ingress is deployed using a helm chart in no time. Apthamitra backend services are mainly divided into 4 major parts or namespaces. Those namespaces are Keycloak, Survey, Ticketing, Notification

Keycloak

This namespace has one service namely Keycloak-service which runs Keycloak, an open-source authentication, and authorization application by JBoss. Kubernetes used the auto-scaling feature to scale up or down. The minimum replicas are set to 5 and maximum to 10.

The main challenge in deploying this service was to make it run on HA mode. Even though we set it up in HA mode it was not able to persist the session information between each other. We have put JGroup discovery properties. We tried with Kube ping but Kube ping gave us problems and we didn’t have time to explore that area. We started working on JDBC ping, which uses PostgreSQL to maintain the session between the pods. This increased our Database load, but Azure Database for PostgreSQL was capable of handling the loads.

Survey

This namespace contains services related to the Survey. Those services were responsible for flowing the data to the CRM and giving the best user experience to the citizens using the app. All the services have mainly 3 to 5 replications.

Notification

This namespace has services for sending communications to the corresponding people starting from citizens, admins, managements to doctors. All the services have mainly 3 to 5 replications.

Ticketing CRM

This namespace contains services related to CRM. The services include Ticketing Service, Doctors Module, Batch Processing Service, Reporting Service, etc. Ticketing service is the main microservice that is used by volunteers, administrators, management. Ticketing service is replicated 8 to 12 pods.

For Doctor Service, the replication varies from 3 to 5. And for other services, the number of pods are limited to 1 only.

Azure Services Used

As it is clear from the above diagrams this platform uses a lot of the Azure services. It uses Azure Blob Storage, Azure CDN, Azure Load Balancer, AKS, Azure Database for PostgreSQL, Azure Computing engine, etc.

Conclusion

All the decision choices including the azure cloud services helped us starting this platform from scratch. Right now, there are 50K unique families are already calling the Apthamitra platform. Daily we provide all the reports related to the citizens, fever clinics, ambulance, foods, medicines, etc. to the government officials.

--

--