Obs Group Export Module


The Data Export tool and the Form Data Export module are not particularly helpful for exporting Obs groups. This module allows you to export obs groups as rows.
Download it

Obs groups are logically grouped observations. At a database level, all obs are at the same level and all in the obs table. The obs_group_id column is used to do the hierarchy. If the obs is not in a group, obs_group_id is null. If an obs is the "grouping obs" (topmost level), obs_group_id is also null. (I think so anyway, maybe obs_group_id is its own obs_id). All obs that are "members" of that group have the same obs_group_id. That number is the obs_id of the "grouping obs".

At the API level, there are methods on Obs and Encounter to help you get these:

  • Encounter.getObs() and Encounter.getAllObs() will return all obs
  • Encounter.getObsAtTopLevel() will return only ungrouped obs and the grouping obs
  • Obs.getMembers() will get Obs that its grouped with.


You pick a Concept out of the dictionary, which should be a Concept Set. You may specify a date range, and whether or not you want to have obsDatetime value exported as well as the values.


Imagine you are exporting a Concept Set called "Adverse Effect Construct" which contains Concepts for "Adverse Effect" and "Adverse Effect Date", and you have chosen not to include obsDatetimes. Output would be a tab-separated-value file that might look like this in a spreadsheet:

patientId	encounterId	ADVERSE EFFECT_value_id	ADVERSE EFFECT_value_name	ADVERSE EFFECT DATE_value
12030	62816	80	JOINT PAIN	02/27/06
12032	60370	29	HEPATITIS	02/14/06
12032	67738	512	RASH	01/17/06
12032	67738	29	HEPATITIS	02/14/06
12052	65032	821	PERIPHERAL NEUROPATHY	01/27/06


  • Interface is ugly and unpolished
  • No error checking whatsoever
    • You're allowed to pick a Concept that isn't a set.
    • Putting a bad date in isn't checked
  • Some obs datatypes are not implemented
  • Choosing a cohort is not implemented
  • You need to be able to specify what type of concept name is used as column headers
    • Module doesn't handle new-style concept names
  • Dates are exported as YYYY-MM-DD for Excel compatibility, but this should really be a full datetime format
  • You should be able to choose your report renderer.
  • This functionality may be folded into the core at some point

Release Notes

Version 1.2

  • This version adds an auto-update URL. Apologies for not having that before.

Version 1.1

Version 1.0

  • Initial release