Running Bahmni with ABDM Integration on Docker

Bahmni successfully completed the ABDM integration process and was certified as an ABDM compliant product on 15th Feb 2022.

This document explains the steps for setting up Bahmni with ABDM services using docker-compose.

 

 

 

Pre-Requisites

Training

See this: https://bahmni.atlassian.net/wiki/spaces/BAH/pages/3227648001

Setting up the callback URL

ABDM Integration requires a publicly available URL for the Gateway to callback the services and to allow other HIPs to push data to HIU. The URL should have a valid SSL certificate.

Using Ngrok

If you don’t have a domain registered, but want to try out ABDM features, you can use Ngrok which tunnels requests to your local machine. The SSL termination happens at Ngrok level.

  • Install Ngrok https://ngrok.com/download

  • Setup Ngrok Auth

  • Start ngrok to expose port 443 by running ngrok http 443 . Keep the terminal window running. Note this exposes your application running on port 443 to the public internet. Be careful of any sensitive data.

  • You will get a URL on the screen. Copy that.

  • You will get a URL in the format <*>.in.ngrok.io. Add /hiprovider to the URL. The final URL should look like https://<hash>.in.ngrok.io/hiprovider.This is your callback URL

  • Follow the steps in this page under Updating your Health Repository URL section to define your callback URL.

Using your own domain

If you have a domain already registered and you have a public IP to your instance, you can use the same URL as the callback URL. The important point to note here is you need to have a valid SSL certificate for the domain.

  • Refer this video on setting up SSL certificate with Bahmni on Docker.

  • Add /hiprovider to your URL. The final URL should look like https://<your-domain>/hiprovider.This is your callback URL.

  • Follow the steps in this page under Updating your Health Repository URL section to define your callback URL.

 

Starting Bahmni Services

1. Clone the repository

The docker-compose for running Bahmni with ABDM services is available in BahmniIndiaDistro/bahmni-india-package

Clone the repo by running the following command

git clone https://github.com/BahmniIndiaDistro/bahmni-india-package.git cd bahmni-india-package

2. Update the .env file with your ABDM Sandbox details

  1. Update secrets

    1. Open the .env file in a file editor

    2. Find for the key ABDM_GATEWAY_CLIENT_ID and set the value with your client ID

    3. Find for the key ABDM_GATEWAY_CLIENT_SECRET and set the value with your client secret

  2. Update HIP ID and HIU ID

    1. Open the .env file in a file editor

    2. Find for the key HIP_ID and set the value with the Facility HIP ID you defined in the pre-requisites step

    3. Find for the key HIU_ID and set the value with the Facility HUI ID you defined in the pre-requisites step

    4. Find for the key HIU_NAME and set the value with the Facility Name you defined in the pre-requisites step

  3. Update Data Push URL (Need only if you are implementing HIU flows)

    1. Open the .env file in a file editor

    2. Find for the key HIU_DATA_PUSH_URL and set the value as https://<your-domain>/hiu-api/data/notification (or) https://<hash>.in.ngrok.io/hiu-api/data/notification depending on your configuration.

Note: Make sure to update localhost with your-domain HIU_BACKEND_BASE_URL=https://<your-domain>/hiu-api

3. Start Bahmni EMR Services

First it is recommended to start the Bahmni EMR components and then start the ADBM services. You can start the emr services alone by running the following command. This should be run from the bahmni-india-package directory.

docker compose up -d

After 5-10 minutes you should see be able to access Bahmni EMR on https://localhost

4. Start ABDM Services

Now once you have the EMR up and running, you can start the ABDM services.

a. Open the .env file in file editor.

b. Update the COMPOSE_PROFILES key with abdm. It should look like COMPOSE_PROFILES=emr,abdm

c. Save the file

Now from the bahmni-india-package directory run the following command.

docker compose up -d

You can check the status of the services by running docker compose ps.

ABDM Role: Ensure to assign ABDM role to the user to view the ABDM features

First Time Error: Note for the first time some services would exit with an error. If you see some containers in exit state you can start them again by running docker compose up -d.

One time run: Note that the hiu-db-setup service’s job is to setup the database and then exit. It does not continue to run once the database has been updated. This is expected behavior.

The Bahmni documentation is licensed under Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)