Making Bahmni Outreach Integration work with other implementations

This page lists down the refactoring / code changes that would be required on the Avni Bahmni Integration service, metadata, avni client to make it generic and configurable for Bahmni product. If you have questions or interested to take up refactoring or need more information, please reach out to us Bahmni Slack

Avni Integration Service:

Code Changes made on top of Avni Integration service can be seen from this link: Comparing avniproject:main...Bahmni-HWC:main · avniproject/integration-service

Feature / Domain

Current Behaviour in Bahmni HWC

Code Change / Config Change

How should this be on product

Comments

Feature / Domain

Current Behaviour in Bahmni HWC

Code Change / Config Change

How should this be on product

Comments

Address Hierarchy

State --> District --> SubDistrict --> City/Village hierarchy is used in Avni and catchements are defined with villages.

StateProvince --> CountryDistrict --> Address4 --> CityVillage hierachy is setup

List of states, districts, subdistricts, villages to be synced from avni to bahmni should be defined in environment variables

Needs code change to make it generic

Use Bahmni as base

Maintain a metadata mapping for individual address fields

Multiple address (current/permanent) is possible for a patient/subject both on Bahmni and Avni side

Code reference on where the address hierarchy is harcoded:

https://github.com/Bahmni-HWC/integration-service/blob/main/bahmni/src/main/java/org/avni_integration_service/bahmni/service/PatientService.java#L110

https://github.com/Bahmni-HWC/integration-service/blob/main/bahmni/src/main/java/org/avni_integration_service/bahmni/service/SubjectService.java#L120

 

 

 

 

 

Location and Catchments

Locations and catchments are created in Bahmni and Avni with config

Mapping to be added with Catchemnt name and location uuid

Note: Catchemnts should be defined in a way that the subjects will be assigned to a single catchement

Config change

Documentation on creating catchments and mapping to locations

Q to Avni:
Is there a possibility for multiple catchements for a user ?

How to allow address outside of catchment for registration ?

 

 

 

 

 

Identifiers

Preferred Identifier between Bahmni and Avni

Bahmni identifier is advanced to start from 500000
In avni, identifiers are pre-allocated to individual users

Bahmni identifier UUID to be added in mapping and as well as constants table for key IntegrationBahmniIdentifierType

Can we use a different identifier prefix for identifiers in Avni ?

Documentation on assigning identifiers to avni users

Needs some more investigation

 

 

 

 

Additional Identifiers (RCH ID, NIKSHAY ID, ABHA Number, ABHA Address)

In Avni added as Concepts and added to Registration Second page
In Bahmni added from config

UUID and concept names are hardcoded in code

Needs code change

Allow implementers to define mappings for additional identifiers to be synced

Note: Update of identifiers from both ways should be developed

https://github.com/Bahmni-HWC/integration-service/blob/main/bahmni/src/main/java/org/avni_integration_service/bahmni/service/SubjectService.java#L120

https://github.com/Bahmni-HWC/integration-service/blob/main/bahmni/src/main/java/org/avni_integration_service/bahmni/service/PatientService.java#L155

 

 

 

 

 

Person Attributes

father/mother name, phoneNumber

In Bahmni added via config, in avni added as concept and in second registration page details

UUID comes from mapping, whereas Avni concept name is hardcoded in code

Needs code change

Person attributes should be dynamically synced based on the list of mapping defined in mappings

Note: Update of identifiers from both ways should be developed

https://github.com/Bahmni-HWC/integration-service/blob/main/bahmni/src/main/java/org/avni_integration_service/bahmni/service/PatientService.java#L155

https://github.com/Bahmni-HWC/integration-service/blob/main/bahmni/src/main/java/org/avni_integration_service/bahmni/service/SubjectService.java#L176

 

 

 

 

Gender mapping
Bahmni allows config, in avni only Male, Female, Others is possible
So, male -> male , female -> female and rest other gender types in Bahmni maps to Other in Avni

-

Should be okay.

https://github.com/Bahmni-HWC/integration-service/blob/main/bahmni/src/main/java/org/avni_integration_service/bahmni/service/SubjectService.java#L30

 

 

 

 

 

 

Avni User --> Bahmni Provider

Currently different user base for Avni and Bahmni

For any user created in avni, provider to be added in Bahmni and mapping for avni username and Bahmni provider uuid to be defined in mappings

Config change

Default provider with name offline sync will be used if mapping for a user is not defined

Documentation on creating users in Avni , providers in Bahmni and defining mappings

 

 

 

 

 

 

Visits

Visit type: Community Visit created via config in Bahmni with a fixed UUID and needs to added to Constants table

Config change, update value in Constant table of IntegrationBahmniVisitType

Should be okay to have a single visit type

 

 

 

 

Visits creation: Integration check for visit in a given day, if yes adds encounter to the same or creates a new visit, adds encounter and closes visit

 

 

 

 

 

 

 

 

 

 

 

Sync of Consultation information from Avni to Bahmni

Whenever a form is filled in Avni, it syncs as new encounter to Bahmni.
Mapping for the individual form element to be addded.
A concept set to be created for each form which contain all the individual concepts of the form.
An encounter type is needed which is created from Bahmni config and added the UUID in mapping

Currently Vitals , History and Examination, Referral are synced

Config Change

Currently works for text, numeric, coded based concepts and concept group members with a single hierarchy

Documentation on how to configure new forms in Avni and define mappings in integration service

Need to implement forms-2 based approach.

 

 

 

 

 

Sync of Prescriptions from Bahmni to Avni

Drug orders from Bahmni are added as bulleted list to Avni.

A form to be added with a text concept

Configuration

Documentation

https://github.com/Bahmni-HWC/integration-service/blob/main/bahmni/src/main/java/org/avni_integration_service/bahmni/worker/bahmni/atomfeedworker/PatientEncounterEventWorker.java#L131

 

 

 

 

 

Sync of Diagnosis from Bahmni to Avni

Encounters with dignoses answers filled from Bahmni are added as bulleted list to Avni.

A form to be added with a text concept

Configuration

Documentation

https://github.com/Bahmni-HWC/integration-service/blob/main/bahmni/src/main/java/org/avni_integration_service/bahmni/worker/bahmni/atomfeedworker/PatientEncounterEventWorker.java#L116

 

 

 

 

 

Sync of Bahmni Forms to Avni

A mapping to be defined for the form name in Bahmni to the form in Avni . The concepts to be mapped in mapping service. The form in Avni to be made readonly by access privileges

Configuration.

Supports only simple concepts sync. Would need code change for complex concepts

 

 

 

 

 

 

 

ABHA Offline

ABHA Module captures Aadhaar and demographics information, and when aadhar number is found in patient registration details call hip demographic api and creates abha and patches subject's identifier

 

Not needed for product, needed for Bahmni indiadistro and applicable only to government integrators

Enable this with a configuration (based on environment variable)

 

https://github.com/Bahmni-HWC/integration-service/blob/main/bahmni/src/main/java/org/avni_integration_service/bahmni/worker/avni/SubjectWorker.java#L92

 

 

 

 

 

 

Sync of Medication Dispense from Avni

Medication items are created as concepts in Avni with the same UUID. When Dispense Medication form is filled, the concept UUID is used as item UUID and Stock Distribution Inventory operation API is called from integration service

Code Change

May not be required for product. Uses openhmis inventory module APIs.

https://github.com/Bahmni-HWC/integration-service/blob/main/bahmni/src/main/java/org/avni_integration_service/bahmni/worker/avni/GeneralEncounterWorker.java#L128

 

Avni Client Code Changes:

Code Difference made on top of Avni Client Code can be seen from this link Comparing avniproject:master...Bahmni-HWC:master · avniproject/avni-client

Feature / Domain

Current Behaviour in Bahmni HWC

Code Change / Config Change

How should this be on product

Comments

Feature / Domain

Current Behaviour in Bahmni HWC

Code Change / Config Change

How should this be on product

Comments

Rebranding

Avni app named as Bahmni Outreach, with logo files of different sizes added as new files

Few entries to be added in build config files with flavor name as Bahmni

Code change for changing the name/ logo

 

Avni Documentation: Rollout your own Avni App from Play store

 

 

 

 

 

 

 

 

 

 

e-Sanjeevani Integration

Login screen and rest of the flows are independent component

Adding e-sanjeevani button is little intrusive

Code Change

Not needed for product, better to drive it with configuration

Add a build time configuration (feature toggle) to enable / disable the feature

 

 

 

 

 

ABHA Offline Integration

Separate module based on Kotlin is written for interacting with various APIs from the HIP Service

Launching of ABHA module is a simple change. But populating of information back from ABHA response is intrusive and needs concepts to be created for ABHA number, abha address

Code Change

Not needed for global product, needed for BahmniInidiaDistro.

 

Add a build time configuration (feature toggle) to enable / disable the feature

 

 

 

 

 

Dropdown for forms with answers more than 10

We have reused the AutoCompleteSearch component for answers with options >10.

Code change

Better to push it to avniproject codebase. But Avni has a different thought process. Introduction of widgets to Avni · Issue #1400 · avniproject/avni-product

 

Aadhar QR Scan based patient registration

Added as an enhancement in abha-android module which allows to pre-fill demographic data from the QR code of Indian citizens unique identification document Aadhar.

Code change

Not needed for global product, needed for BahmniInidiaDistro.

Add a build time configuration (feature toggle) to enable / disable the feature

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