Obs Group
This page is outdated and no longer receives updates!
Obs Groups are logically grouped observations. Each obs is a distinct question/answer. 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. All obs that are "members" of that group have the same obs_group_id. That number is the obs_id of the "grouping obs". (If the grouping obs is itself in an obs group, its obs_group_id will be the obs id of its parent grouping obs).
So you need to create concepts for the grouping obs as well as for all of it's members. In the concept dictionary then for the group obs, you can select if it's a group and place it's members there
Table Storage Example
Grouping obs (concept): COMPLETE_BLOOD_COUNT (CBC is concept id 1019 on the demo server)
Members (concept): HEMATOCRIT, PLATELETS, etc
When data is entered for the CBC tests, the obs table will look like this:
obs_id | question concept | obs_group_id | answer value |
---|---|---|---|
1 | CBC | null | null |
2 | HEMATOCRIT | 1 | 203 |
3 | PLATELETS | 1 | 100 |
4 | HEMOGLOBIN | 1 | 343 |
5 | WEIGHT | null | 65kg |
Other Examples
Other example usage might be collecting related answers:
Grouping obs: TRAVEL TO CLINIC
Members, MODE_OF_TRANSPORTATION, DISTANCE_TRAVELED, TIME_SPENT_TRAVELING
(please modify this or add other examples here)
API Methods
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.
Other Helpful Information
For information about when to use obs groups and when to use value groups, please see this wiki page.