Merging Bahmni Program Enrollment to OpenMRS

For one of our implementations we created Bahmni Program enrollment resource, in which we have added feature of supporting additional program attributes using the Open MRS attribute framework. Please look at the screenshot below to see how these additional attributes look. We think this would be useful to have in Open MRS hence would like to merge these changes back to Open MRS program enrollment resource. We would like to raise a pull request to merge this Open MRS version 1.12.1-SNAPSHOT. Please let us know your thoughts regarding the same.

@karrtikiyer -

There are a few modelling issues around the program attributes that we will need to fix first. For example, we modelled this like person attributes. Program attributes can be specific to programs, which is currently not well represented in this model.

Additionally, I don’t think backporting should be that big an issue for Bahmni. I think when we are ready, we should try having a discussion about the overall design and try adding this as part of 2.1 (instead of backporting all the way to 1.12.1).

Thanks @vinay for the inputs and the additional context about modeling issues around program attributes helps. We can discuss this further internally and come up with required next steps/action items.

Hi, Elaborating on what @vinay is suggesting,

What we have developed is based on Standard OpenMRS attribute framework. The patient_program_attribute and program_attribute_type are the tables that were added.

Some of our implementations are coming up with a requirement that they need specific attributes per program. i.e. a program should have a subset of attributes configured. The current model will not suffice this scenario. Do we see this as a generic requirement that should go into the data model or can we manage it as an external configuration (like a json mapping of program vs program_attribute_type for showing on UI)? Have somebody faced a similar situation with provider, location or visit attributes.

Thank you.

1 Like

I don’t recall having come across this before as a requirement but it definitely sounds plausible that some attributes would be specific to one program.

Personally I don’t have any objection to adding program_id to the program_attribute_type table (and then the validation should be that if that field is set, only program enrollments for that program can have that attribute).

We have two options:

  1. Either add program_id to the program_attribute_type table, as mentioned by @darius and @bharatak. This would make 1 to 1 mapping between program and its attributes.
  2. Or have a mapping table, say program_program_attribute_type (we could think of a better name for this table), using which we can have same attribute used across multiple programs. ( 1 to many relationship between attribute and its associated programs).

Based on internal discussion, we think there can be use cases where we may want to use a program attribute across multiple programs (not all programs). As for e.g: Facility_ID or Treatment_ID for specific programs. Hence I suggest that we go for option 2 listed above, please let me know your thoughts.

1 Like

I agree with option 2. It seems likely that there would be similar programs that use some of the same attributes in common, enough so that it’s worth not redefining the same attributes for each program but not general enough to merit adding the attribute to the universal set. Several cancer programs might want to specify basic therapeutic-class information, for example – that would be an attribute of the program set when the program begins, not an observation. That sort of attribute would be useful for many cancer programs but not necessary for an antenatal program.


My initial reaction is still that option 2 is excessively modeled, compared to the typical OpenMRS use case. But if you all think it’s important, I guess we can add the extra model complexity.

@jthomas, @burke, can we discuss this briefly on a Monday design call and approve one of these approaches for inclusion in openmrs-core?

@karrtikiyer, could you join a call Monday evening IST? (Perhaps even on the 29th?)

-Darius (by phone)

1 Like

Yes @darius, myself and @akhilmalhotra shall join call today at 9.30 PM IST (4 PM UTC). @jteich: If you can also make it, it would be good to have your inputs. To add

Using option 1> we can choose to keep program_id null to indicate that it is applicable to all programs. However, if we want attribute to be applicable to some and not all, in that case, if we use option 1, we may have to duplicate the rows in program_attribute_type table for a different program_id. Frequency of this use case is something that we can discuss and decide in today’s call.

We discussed this on today’s Design Forum, and decided to proceed with the more sophisticated model of having a 1-to-many mapping from program enrollment attribute types and the programs they are relevant to.

The work will be done in the master branch of OpenMRS, hopefully to be in the OpenMRS Platform 2.1 release.

Someone (Akhil? Karrtik?) will create a ticket in for this work and share a link here.

The already-existing ticket we should use for this is TRUNK-4755.

If someone is actively working on this, they should claim that OpenMRS ticket. If we don’t know who will work on it, some Bahmni tech lead or BA should claim the ticket, and update when we know.

Hello Team,

So am working on implementing EMR using bahmni and also am facing same problem where i need to have attributes to specific program. So now after seeing this thread i can see also some people on community have the same problem. I have seen you have created a ticket, but this has not been worked upon.

So my questions are if any of you have found solution to this issue? or is there any plan for this to be solved?

Thank you.

@ian Bahmni has support for attributes specific to programs. Please refer to '6. Configure Program Attributes ’ here -

I see but my problem actual is that i have two programs and i want to display different attributes for this programs…For what i understand up to now attributes are shared by all programs. If you know any way i can solve this problem please suggest @sdeepak

@sdeepak @karrtikiyer @bharatak @vinay Just checking on the status of this - is it going to be added to OpenMRS 2.1 as discussed above?

The current bahmni Patient program Attributes support code is not in a state to be merged into OpenMRS 2.1 as the design improvement is suggested which needs some amount of work to be done and is not yet started as per my knowledge. @sdeepak, let us know if any work is started on this.

Hi, I am working with Bahmni Program, where I am looking for program specific attributes when you have multiple programs in play. I think this implementation will solve my problem. From the thread I could understand that it is an important implementation which can solve a good chunk of problem for the community. Can someone tell me the status for the same? and when will it get merge back to OpenMRS 2.1?

Thank You

@kaustavc this code has (still) not been merged back to OpenMRS core. But if you’re using Bahmni then you have access to these features already.