Tabular Views of OpenMRS Data

The only lists of data available are metadata lists, for configuration, however I would like to suggest that we add views of the following:

  1. Encounters - with filters for patients, encounter types, encounter start and end dates and the ability to export the data into Excel and CSV (Data tables already has this capability and is used in Data Integrity module)

  2. Observations - with filter for patients, encounter types, encounter start and end dates, observation types (these are the concepts for only the data that has been collected)

  3. Encounter Observations - a de-normalized list of the observations in an encounter (which is an extension of 1 and 2 above). I am fine with having this as a separate page which is only accessed for a single encounter or a single patient for performance reasons

I have received requests for exporting all the encounters for a patient and rather than write a report I believe this will provide the necessary solution.

Is there any design reason why data is not displayed in this form within OpenMRS?

Do you mean built in reports that would give you such data?

@dkayiwa All i need is a way to export the data based on the needs above. I think there should be native support which allows filtering and sorting too

For the reason as to why this is not in place, it is a result of not being able to know needs for each and every implementation. That is why a generic reporting module was created such that you can use it to come up with a solution to the above. But when various implementations start asking for similar kinds of reports out of the box, then there comes what is being worked on as built in reports.

@dkayiwa This is generic and can be used by any implementation - custom needs can go to reporting

So would you vote for it to go in built in reports?

I do not mind as long as I can filter/sort, search and export data.

@mseaton Can the reporting module provide a backend for this kind of data display with filtering and sorting

@ssmusoke, yes, the reporting module aims to provide this type of back-end functionality.


I am reviving this thread to see if there is new thinking about how to approach this.

Due to increased data use needs within UgandaEMR this has become a regularly requested feature with most comments being, for most systems this is default functionality.

I think the default would be provide a de-normalized view of the data by encounter type (which seems to have the same concepts) to be meaningful.

@ssmusoke I would say that if you can provide a very concrete description of the first most valuable thing, then others can comment on whether they agree with this, and we can evolve to a consensus on what/how to build.

@darius The most concrete thing that I have is this flow:

  1. Enter encounter for patients

  2. Export the encounter data into Excel/Stata for further analysis - which may not be possible with in-built tools (or takes long to develop) or may be unknown

@ssmusoke: you created this thread talking about tabular views of OpenMRS data, and clearly you have some specific ideas in mind around it. But I’m not sure that others are getting those same ideas. So, put together a quick mockup (even in text), or just describe how the screen might look.

Here is a spreadsheet

So, you want to let people choose:

  • encounter date (range)
  • encounter type (multiselect)
  • location (multiselect)
  • provider (multiselect)
  • creator (multiselect)

And then this will export a row-per-encounter spreadsheet, with a few patient details, and also with all the obs values flattened out.

Just to point out that including the obs values is technically difficult because of repeating obs and obs groups. How would you want those to work?

(Though actually I see that there’s an EncounterAndObsDataSetEvaluator already in the reporting module, so maybe the best thing to do is to just build a thin UI wrapper around calling this, and see if that’s sufficient.)

I don’t know if last year’s GSoC built-in reports module complete enough to be a good starting point for this. If not, just writing an OWA with a few UI widgets, that then calls Reporting REST should be pretty easy for someone to build.

Hi @ssmusoke

We happen to be facing the same issue for implementation, how did you resolve this(Exporting patient encounter data out of Openmrs)?

Is this of any help?

@dkayiwa this is exactly were I’m in need of your guidance,

I was reading through this thread and I learned that to export all encounter data, we need to a row-per-encounter dataset,


On attempting to create one, I get this server on clicking the save button:

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class

See full error log. (This error happens on both the QA-RefApp and demo environments).

@ssmusoke did you solve problem by leveraging around the ‘EncounterAndObsDataSetDefinition’ or a different Dataset class/type?

@muswangali We did not get any input, so we went the hard way and built Excel exports for the data as we needed to have it