Inpatient report with diagnosis

I am trying to create a report of all inpatients who were admitted to my hospital. Data elements required are ID Name Gender Age Person attributes Address (address1, city_village) Date of admission Date of discharge Observations (Height, Weight) Diagnosis

This will be filtered based on date of admission.

Is there an out of the box report in Bahmni that allows me to do this? Bahmni version: 0.88

@vinay i was trying to look at that. i don’t think there is exactly a report that could give you out of the box what you need. There is a visits report, observations report and aggregate report as described in wiki here, using a combination of which you might be able to come up with what you need (not sure though as i haven’t tried aggregate report myself ever but at least that was the promise).

The bug that Charles reported is reproducible on demo environment. I was trying to figure out what exactly is causing the bug in this query but it might take some more time then i can spend right now. However this report is part of the older canned reports which Bahmni wiki mentions as old feature and as i remember the plan was to deprecate this and recommend using the ‘new generic reports’. If we stick to that plan then it doesn’t make sense to investigate and fix this bug.

For now, a quicker solution for you would be to write a custom sql which should be much simpler compared to the generic query pointed above but it can act as reference.

Ideally i would have liked we continued reports like ipd report out of the box from the product as they seem to be a generic scenario but i suppose there were reasons to move away from them. something we could discuss in the architecture call? cc : @angshuonline @darius

Agree. We are going this route for now.

Adding some more context on pain points in reports I am seeing as of now (for the limited number of reports I have seen recently).

Based on the wiki, there is no way to retrieve diagnosis (retrieving observations is a very poor way of doing this because diagnosis recording is a bit complex with the current data structure). We definitely need a way to append diagnosis to an existing report (such as a visit report). It will be useful if the diagnosis report stays un-deprecated until there is a way to retrieve them directly through a non-deprecated report.

We also need ways to filter patients based on whether they were an inpatient (another Bahmni specific internal concept). This is present in the visit report, but not in others such as the observation report etc. It will be useful if there is a global filter for all reports to get just inpatient information.

+1 to this. Diagnosis is an important domain concept and we need to give it first-class treatment. When I was working on the Mirebalais project for PIH we built a diagnosis report as SQL, and it looks like they later built a newer version based on the Reporting module. (In the Bahmni case we’d want to base this off of emrapi concept mappings.)

I can imagine what a “Diagnoses” report would look like (basically a row-per-diagnosis), but it’s less clear to me how this would look when appended to a Visit report. I assume one would want the intake diagnosis and the discharge diagnosis. This could be imperfectly simplified by giving the first and last primary diagnoses captured in the visit. (But what if there are >1 primary diagnoses?) @vinay can you do a bit more research on what your implementations would want want here?

The old diagnosis report in Bahmni had the following columns ID Name, Gender, Age, Person attributes, Address (address1, city_village), Date of admission, Date of discharge, Observations (Height, Weight), Diagnosis.

If there were multiple obs/diagnosis they would be comma separated in the same column. So if we have something similar would that suffice? @vinay @arjun @darius

The older report:

The discharge diagnosis is considered the diagnosis for the visit (true in both inpatient and outpatient settings).

For inpatient visits, there is usually an admission diagnosis – if there isn’t a separate field for it, one may be able to distinguish it by the fact that it is entered on the admission date.

For outpatient (ambulatory) visits, what you are referring to as intake diagnosis may be expressed as “chief complaint” or “reason for visit” in different settings. If it is also in fact listed as a diagnosis in some settings, that would make things harder, so it will be a useful bit of research to find out.

For multiple diagnoses, I imagine that they can be displayed comma-separated. If the site specifies one primary diagnosis and one or more secondary diagnoses, it would be useful to highlight the primary.

I think concept names often have commas in them (e.g. in your example “Headache, tension”), so this might be a problem.

Per Jonathan’s comment I guess we’d want to have a column that specifically gives the primary discharge diagnosis. @arjun, do you know how this is typically captured?

(Sorry for the delayed reply. was awaiting some inputs from client) @darius, you are right that the diagnosis names have commas. So they will have to be separated by a different delimiter say semicolon (i doubt if anyone would have semicolons in diagnosis but not sure. If it is then may be the delimiter should be configurable).

Also the qualifiers - primary/secondary and presumed/confirmed would be required.

So an example might look like Malaria (Primary, Confirmed); Diabetes, Mellitus (Secondary, Confirmed)

There is no definite logic to identify the admission and discharge diagnosis. What i understand is doctors will have to explicitly specify them for it to work in all scenarios. We don’t have UI for capturing separate diagnosis like that. They could be fields in forms if and when required and could be shown in report as any other obs (inpatient report should continue to have the obs support) For now, having one dedicated column for Primary Diagnosis (as that is required in most scenarios like reports to funders , etc) and other column for all diagnosis could work.

@arjun @darius @angshuonline Found the issue in existing IPD report query to show diagnosis as well with a delimiter of ‘|’ locally. This is regression caused due to change in the way we store diagnosis status. (commit). When diagnosis status was active, previously we used to store a obs(for diagnosis status) with null value but now with the change we started voiding the inactive one. Since its a inner join the report fails to retrieve diagnosis. Either we could add a left join or create a obs with null value as value_coded as was done previously(Is there any specific reason we were doing it this way?) Other requirements: The report already has a way to specify Concept names of Observations needed (like Height and Weight) and person attributes. However we don’t have a separate column for Primary diagnosis.

@shruthipitta I’m not quite sure I understand your finding. Can you illustrate with a small text table or other example the old behavior and new?