=== modified file 'src/docbkx/en/dhis2_user_man_web_api.xml' --- src/docbkx/en/dhis2_user_man_web_api.xml 2013-09-27 14:59:53 +0000 +++ src/docbkx/en/dhis2_user_man_web_api.xml 2013-09-27 18:47:14 +0000 @@ -2106,12 +2106,13 @@
- Event analytics + Event query analytics In order to query events captured in DHIS 2 you can work with the analytics/events/query resource. This resource lets you retrieve events based on a program and optionally a program stage, and lets - you retrieve and filter events on any event item. Event items include data elements and, for - programs which require person registration, person attributes and person identifiers. + you retrieve and filter events on any event item. Event items include data elements, person + attributes and person identifiers. The query analytics resource will simply return events + matching a set of criteria and does not perform any aggregation.
Request query parameters The analytics event API let you specify a range of query parameters. @@ -2316,44 +2317,44 @@ { "headers": [ { - "name": "Event", - "column": "psi", - "type": "java.lang.String", - "meta": false - }, - { - "name": "Program stage", - "column": "ps", - "type": "java.lang.String", - "meta": false - }, - { - "name": "Execution date", - "column": "executiondate", - "type": "java.lang.String", - "meta": false - }, - { - "name": "Organisation unit", - "column": "ou", - "type": "java.lang.String", - "meta": false - }, - { - "name": "Organisation unit name", - "column": "ouname", - "type": "java.lang.String", - "meta": false - }, - { - "name": "Weight", - "column": "UXz7xuGCEhU", - "type": "java.lang.String", - "meta": false - }, - { - "name": "Address", - "column": "AMpUYgxuCaE", + "name": "psi", + "column": "Event", + "type": "java.lang.String", + "meta": false + }, + { + "name": "ps", + "column": "Program stage", + "type": "java.lang.String", + "meta": false + }, + { + "name": "executiondate", + "column": "Execution date", + "type": "java.lang.String", + "meta": false + }, + { + "name": "ou", + "column": "Organisation unit", + "type": "java.lang.String", + "meta": false + }, + { + "name": "ouname", + "column": "Organisation unit name", + "type": "java.lang.String", + "meta": false + }, + { + "name": "UXz7xuGCEhU", + "column": "Weight", + "type": "java.lang.String", + "meta": false + }, + { + "name": "AMpUYgxuCaE", + "column": "Address", "type": "java.lang.String", "meta": false } @@ -2407,6 +2408,80 @@
+ Event aggregate analytics + In order to get aggregated numbers of events captured + in DHIS 2 you can work with the analytics/events/aggregate + resource. This resource lets you retrieve aggregate data based on a program and optionally a + program stage, and lets you filter on any event item. Event items include data elements, + person attributes and person identifiers. + The aggregate events resource follows much of the same semantics as the event query + resource which is described in the previous section. Please make sure you have read the + mentioned section before progressing. + Aggregate event queries should be on the format described below. + api/analytics/events/aggregate/<program-id>?startDate=yyyy-MM-dd&endDate=yyyy-MM-dd&ou=<ou-id>;<ou-id>&item=<item-id>&item=<item-id>;<operator>;<filter> + For example, to retrieve aggregate numbers for events from the "Inpatient morbidity and + mortality" program between January and October 2012, where the "Gender" and "Age" data + elements are included, the "Age" item is filtered on "18" and the "Gender" item is filtered on + "Female", you can use the following query: + api/analytics/events/aggregate/eBAyeGv0exc?startDate=2012-01-01&endDate=2012-10-31&ou=O6uvpzGd5pu;fdc6uOvgo7ji&item=oZg33kd9taw;EQ;Female&item=qrur9Dvnyt5;EQ;18 + The response will look similar to this: + { + "headers": [ + { + "name": "item", + "column": "Item", + "type": "java.lang.String", + "hidden": false, + "meta": false + }, + { + "name": "pe", + "column": "Period", + "type": "java.lang.String", + "hidden": false, + "meta": false + }, + { + "name": "ou", + "column": "Organisation unit", + "type": "java.lang.String", + "hidden": false, + "meta": false + }, + { + "name": "value", + "column": "Value", + "type": "java.lang.String", + "hidden": false, + "meta": false + } + ], + "metaData": { + "names": { + "eBAyeGv0exc": "Inpatient morbidity and mortality" + } + }, + "width": 4, + "height": 2, + "rows": [ + [ + "Gender: Female", + "", + "O6uvpzGd5pu", + "57" + ], + [ + "Age: 18", + "", + "O6uvpzGd5pu", + "57" + ] + ] +} + The response tells us that for the "Gender" item filtered on "Female" and organisation + unit with identifier "O6uvpzGd5pu" there are 57 cases. +
+
Generating resource, analytics and data mart tables DHIS 2 features a set of generated database tables which are used as basis for various system functionality. These tables can be executed immediately or scheduled to be executed at