dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24077
[Branch ~dhis2-documenters/dhis2/dhis2-docbook-docs] Rev 787: Analytics events, sorting, paging
------------------------------------------------------------
revno: 787
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2-docbook-docs
timestamp: Thu 2013-08-22 18:12:42 +0200
message:
Analytics events, sorting, paging
modified:
src/docbkx/en/dhis2_user_man_web_api.xml
--
lp:~dhis2-documenters/dhis2/dhis2-docbook-docs
https://code.launchpad.net/~dhis2-documenters/dhis2/dhis2-docbook-docs
Your team DHIS 2 developers is subscribed to branch lp:~dhis2-documenters/dhis2/dhis2-docbook-docs.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-documenters/dhis2/dhis2-docbook-docs/+edit-subscription
=== modified file 'src/docbkx/en/dhis2_user_man_web_api.xml'
--- src/docbkx/en/dhis2_user_man_web_api.xml 2013-08-22 14:24:45 +0000
+++ src/docbkx/en/dhis2_user_man_web_api.xml 2013-08-22 16:12:42 +0000
@@ -1904,6 +1904,32 @@
case-insensitive.</entry>
<entry>Operators can be EQ | GT | GE | LT | LE | NE | LIKE | IN</entry>
</row>
+ <row>
+ <entry>asc</entry>
+ <entry>No</entry>
+ <entry>Items to be sorted ascending, can reference executiondate or any items.</entry>
+ <entry>executiondate | item identifier</entry>
+ </row>
+ <row>
+ <entry>desc</entry>
+ <entry>No</entry>
+ <entry>Items to be sorted descending, can reference executiondate or any
+ items.</entry>
+ <entry>executiondate | item identifier</entry>
+ </row>
+ <row>
+ <entry>page</entry>
+ <entry>No</entry>
+ <entry>The page number. Page size of 50 will be used if no page size parameter is
+ specified.</entry>
+ <entry>Numeric positive value</entry>
+ </row>
+ <row>
+ <entry>pageSize</entry>
+ <entry>No</entry>
+ <entry>The page size. Unlimited if not specified.</entry>
+ <entry>Numeric zero or positive value</entry>
+ </row>
</tbody>
</tgroup>
</table>
@@ -1912,13 +1938,23 @@
operator and a filter.</para>
<screen>api/analytics/events/query/<program-id>?startDate=yyyy-MM-dd&endDate=yyyy-MM-dd&item=<item-id>&item=<item-id>;<operator>;<filter></screen>
<para>For example, to retrieve events from the "Inpatient morbidity and mortality" program
- between January and October 2012, where the "Gender" and "Age" data elements are included and
- the "Gender" item is filtered on "female", you can use the following query:</para>
- <screen>api/analytics/events/query/eBAyeGv0exc?startDate=2012-01-01&endDate=2012-10-31&item=oZg33kd9taw;EQ;female&item=qrur9Dvnyt5;eq;18</screen>
+ between January and October 2012, where the "Gender" and "Age" data elements are included
+ and the "Age" item is filtered on "18", you can use the following query:</para>
+ <screen>api/analytics/events/query/eBAyeGv0exc?startDate=2012-01-01&endDate=2012-10-31&item=oZg33kd9taw&item=qrur9Dvnyt5;EQ;18</screen>
<para>To retrieve events for the "Birh" program stage of the "Child programme" program between
March and December 2012, where the "Weight" data element, filtered for values larger than
2000, and the "Address" person attribute are included:</para>
<screen>api/analytics/events/query/IpHINAT79UW?stage=A03MvHHogjR&startDate=2012-03-01&endDate=2012-12-31&item=UXz7xuGCEhU;GT;2000&item=AMpUYgxuCaE</screen>
+ <para>Sorting can be applied to the query for the "executiondate" of the event and any items.
+ To sort descending on the executiondate and ascending on the "Age" data element item you can
+ use:</para>
+ <screen>api/analytics/events/query/eBAyeGv0exc?startDate=2012-01-01&endDate=2012-10-31&item=qrur9Dvnyt5&desc=executiondate&asc=qrur9Dvnyt5</screen>
+ <para>Paging can be applied to the query by specifying the page number and the page size
+ parameters. If page number is specified but page size is not, a page size of 50 will be
+ used. If page size is specified but page number is not, a page number of 1 will be used. To
+ get the third page of the response with a page size of 20 you can use a query like
+ this:</para>
+ <screen>api/analytics/events/query/eBAyeGv0exc?startDate=2012-01-01&endDate=2012-10-31&item=qrur9Dvnyt5&page=3&pageSize=20</screen>
</section>
<section>
<title>Response formats</title>
@@ -1929,8 +1965,17 @@
<listitem>
<para>json (application/json)</para>
</listitem>
+ <listitem>
+ <para>jsonp (application/javascript)</para>
+ </listitem>
+ <listitem>
+ <para>xls (application/vnd.ms-excel)</para>
+ </listitem>
</itemizedlist>
- <para>The response format will look similar to this:</para>
+ <para>As an example, to get a response in Excel format you can use a file extension in the
+ request URL like this:</para>
+ <screen>api/analytics/events/query/eBAyeGv0exc.xls?startDate=2012-01-01&endDate=2012-10-31&item=oZg33kd9taw&item=qrur9Dvnyt5</screen>
+ <para>The default response JSON format will look similar to this:</para>
<screen>{
headers: [
{
@@ -1955,7 +2000,8 @@
name: "Organisation unit",
column: "ou",
type: "java.lang.String",
- meta: false},
+ meta: false
+ },
{
name: "Weight",
column: "UXz7xuGCEhU",
@@ -1989,12 +2035,12 @@
"Mombasa road 93"
],
[
- ",
- "lHcVxFKBk4O",
+ "j23JsB1h128",
+ "A03MvHHogjR",
"2012-11-19",
"DiszpKrYNg8",
"2965",
- "Main road 12"
+ "Selassie road 5"
]
]
}</screen>