Adding 'As Needed' field to Bahmni-Mart

Hello community,

We have a facility that would like to analyze data stored in the As needed field from the medication tab using Bahmni-Mart/Metabase. However, it seems like this data is not included in the analytics database that Bahmni-Mart creates.

Is there a way to add this field to the analytics database? And could it be done through the bahmni-mart.json file?

Thanks in advance for your support!

Kris

2 Likes

I am not fully conversant with bahmni-mart code. I think, this is what is happening:

  1. I used the openmrs data model browser - and it seems you want the as_needed field from drug_order table, to be stored in the mart table. Is this understanding correct?

  2. From bahmni-mart.json it seems this line mentions: "type": "medicationAndOrders",

  3. From medicationAndOrders.json it seems this line mentions sql file for reading as: readerSql/drugOrder.sql

  4. This SQL file reads from drug_order table, but doesn’t seem to read in the as_needed column. This SQL will need a change. Github: drugOrder.sql.

I don’t think a bahmni-mart.json file modification will solve this, unless you maybe disable this job completely and add a custom job. See this: https://bahmni.atlassian.net/wiki/spaces/BAH/pages/2318893430/Add+Custom+View+Sql+to+bahmni-mart.json.

cc: @binduak – thoughts?

1 Like

Thanks @gsluthra - I was looking at making the modification to the drugOrder.sql file to add as_needed.

However, we were trying to find a way to manage this without having to re-bundle mart…

Hello @krisr, as @gsluthra suggested changing drugOrder.sql is one option which would require re-building the mart rpm or making it as custom job which wouldn’t require re-bundling the mart.

Thanks @binduak and @gsluthra - we created a custom job and were able to pull the data we needed :smiley:

2 Likes