MySQL views documentation

Going a bit deeper into reporting, I’ve started to explore the database schema. I’ve noticed a couple of views, which I assume were introduced by Bahmni (like concept_view, encounter_view, patient_view, visit_view, …).

I’ve seen some of the ‘canned reports’ make use of them, but I couldn’t find further documentation. I can look up the view definition, but I wonder how stable (in terms of changing) these views are and if they are meant to be used by (external) reports?

And regardless of the usage of these views one observation: Most (all?) of the view definitions I’ve seen so far do not include any voided/retired flag. Now as Bahmni doesn’t offer the void feature for patient data, it might be ok. But for changing the metadata over time this can be a problem. I guess either these views should expose the voided/retired flags or include them in their view query definition.

@cine, we had defined some of these views to make it easier to write reports. But we have tried to move away from views which are for “transactional” data (and not “metadata”), like obs_view, encounter_view etc for performance reasons.

Views for which data doesn’t change frequently is still fine to use. e.g. concept_view

Maybe reports which are using these views are including voided/retired flag. If not, we should fix that.


Got it.

Besides the view definition, all the DB schema changes would be interesting to know. I assume they are defined as liquibase changesets. But it seems as if you have restructured your project layout as I think they disappeared from the place I initial looked at. And they also included OpenMRS metadata changes, so just reading the schema changes out of them might be a bit more difficult.

Do you have a high-level documentation of additional tables and their usage within Bahmni?