Reporting - Nested Datasets

@mseaton I am in the process of developing the attached patient report.

However I have nested datasets like ART history, vitals across encounters and laboratory tests across encounters etc.

Please can you advise on how I can put these together using code via the Patient datasets etc

cc @judeniroshan @raff (may be relevant for GSOC project)

1 Like

@ssmusoke, I’m not 100% clear on the question. You have a report definition, and it has several different datasets within it that contain essentially the tables of data included in the image above, correct? So is your question around how to render this data now that you have it?


@mseaton I am wondering how do I get the data like Vitals and laboratory results for a single patient, are these separate person data definitions? How do I even build them?

@ssmusoke, well if you want all obs of a particular concept (eg. all weights), then you can simply use ObsForPersonDataDefinition.

If you want all encounters that contain certain obs, then you would construct an EncounterDataSetDefinition, and run it for an EvaluationContext that contains only the single patient you are interested in. This will give you a row-per-encounter data set that has encounters for just that patient.

If you need to create a data set and expose this as a data definition, then there is a PatientDataSetDataDefinition.

There are lots of different options, selecting the right one will depend on the use case.