Setting up Antenatal Care Program and Visits

Currently i have implement patient registration with my custom patient attribute and identifier. Then i’ve setup a new ‘ANC’ Program with its attribute and everything is working well.

I want to implement an ‘ANC Visits’ observation or visits specific only to that program. Where some of the fields are auto filled. One of the ‘ANC’ program attribute is the date of the last time the patient observed which is called ‘LMP’. When every ANC observations is collect i want to auto set one of the observation fields to be auto set to the number of days between the programs ‘LMP’ and the time of the observations.

How do i go about that?

1 Like

Bahmni allows creation of a Form, which will need to be filled during a Visit/Consultation. In that form, you can add auto-calculated fields – either through Form2 script (form level), or using Groovy Script (global level). I think one of these ways could possibly help you.

Some related resources:

  1. Form2/Implementer Interface:
  1. Groovy Script:

I hope this helps you write your logic for days elapsed, and set it into an Obs value.

That helps. Got few more questions Now can i enable or disable the form from observations tab based on the patients program enrolled status? Can i show a form as soon as the patient enrolls to a program? And can i use the program’s form values to auto set values on my observation form?

In most cases Bahmni doesn’t “force” processes. It assumes a paper like environment, where all forms are available, and people decide if they need to fill a particular form or not. In most NGOs we found there to be too many real world exceptions, to realistically mandate one way of working, and were requested to let the users decide what forms/data they wish to fill. Maybe as facilities get larger, this requirement will become more important to reconsider.

For privacy/security reasons, Bahmni does provide ability to restrict view/edit of forms if a person is unauthorised. See this:

So, I don’t think your requirement is directly fulfilled. But, if only certain people have authorisation in a facility to enrol/view program data, then the form can be made accessible to only those. We have seen such requirements earlier (for instance mental health forms of a patient), and hence this feature was added in v0.93.

In short: No, you won’t be able to show/hide forms just based on Program enrollment.

can i use the program’s form values to auto set values on my observation form?

Can you please elaborate this use case further, with some example? I didn’t understand. What did you mean by Program’s Form?

cc: @akhilmalhotra @angshuonline @binduak – might be able to shed more light on this area.

Thanks you that was helpful

can i use the program’s form values to auto set values on my observation form?

I thought i could implement form specific to the program. Hence why i called it Program’s Form.

Another question i have is i’ve created 2 program attribute types which are dates. I want to disallow future dates for the first date attribute and i want the second date to be at least 280 after the first dates. How can i implement that? I was able to implement same kind of validation in another form use formConditions.

@yohannes.suraphel Interesting discussion.

If you want to capture program specific observation template, you can already do that, see here. However, thats only possible with Forms1 (conceptSet convention based) and that does not have much scripting support. check here. Not sure if you have tried this approach.

Note, we discourage usage of Forms1 tech, and only support for legacy reasons, and fixing in critical bug. Most implementations have moved to Forms 2, I would assume.

We wish to replace and enhance the association of observation templates to programs and also define per stage.

On the feature side, I think many of your thoughts are inline with this feature request card on JIRA.


I haven’t tried to use formConditions.js for program attributes. How will i be able to validate program attributes using that. More preferably i would want when the first date is set to restrict the other date picker 280 days prior to the first one

For example: 1 Date input one (when set) 2. Date input two (Can only pick days which are after 280 days from the first date input) Both are program attributes

And i want to setup a one time form for a patient. I would want that form to bet set right after a patient is enrolled to a program but i don’t think thats possible. If i set it up as an observation template. It can be set every visit. Maybe use Forms save event validation?

Thanks for ur help