Data Aggregation API
The Data Aggregation Module
Currently, the Data Aggregation Module supports three queries that access specific data from the database: Disease Counts, Tests Ordered, and Get Weights.
Disease Counts:
Disease Counts is a query that can be used to compile data on the disease burden of patients in the OpenMRS instance. The query can be customized based on specific diseases, cities, time period of diagnosis, minimum/maximum number of cases, and output format. The results of the query are returned as JSON, XML, or CSV format of diseases and counts separated by a colon, with line breaks after each count (e.g. MALARIA:4).
Optional Parameters | Default Value | Description | Format |
String diseaseList | All Diseases | Filters the results to a specific list of diseases. | Disease1:Disease2:Disease3:Disease4 |
String cityList | All Cities | Filters the results to a specific list of cities. | City1:City2:City3: City4:City5:City6 |
String startDate | 0000-01-01 00:00:00 | Filters the results to any cases after specified date. | yyyy-MM-dd HH:mm:ss |
String endDate | Current Date and Time | Filters the results to any cases before specified date. | yyyy-MM-dd HH:mm:ss |
Integer minNumber | No Minimum | Filters the results to show diseases with at least n cases. | 5 (Any integer) |
Integer maxNumber | No Maximum | Filters the results to show diseases with at most n cases. | 1000 (Any integer) |
String format | JSON | Allows the query to return in JSON, XML, or CSV format | JSON (JSON, XML, or CSV) |
Note:
The specified URL path to access the Disease Counts query form of the module is: http://host.example.com/openmrs/module/dataaggregation/diseasecounts.form
A question mark(?) is used after the url path to the page, denoting that parameters will follow.
An ampersand(&) is used between parameters and the order of parameters does not matter.
There should be no spaces in the url except between the date (yyyy-MM-dd) and the time (HH:mm:ss). However, the space should be input as it’s url encoding, %20. But, a date can be applied while omitting the time.
*** If any information is entered into the database incorrectly, with a date in the future, the default endDate parameter will NOT account for that data. The default endDate is the current date and time.
Tests Ordered:
The Tests Ordered query gathers data from an OpenMRS instance that represents a total count of all tests ordered. Like the Disease Counts query, this can also be customized based on specific tests, a set of certain locations, occurrence of tests during a time period, minimum/maximum number of cases, and output format. The results of the query are returned as JSON, XML, or CSV format of tests and counts separated by a colon, with line breaks after each count (e.g. CD4 PANEL:10).
Parameters | Default Value | Description | Example Format |
String testsOrderedList | All Tests | Filters the results to a specific list of tests. | Test1:Test2:Test3:Test4 |
String cityList | All Cities | Filters the results to a specific list of cities. | City1:City2:City3: City4:City5:City6 |
String startDate | 0000-00-00 00:00:00 | Filters the results to any cases after specified date. | yyyy-MM-dd HH:mm:ss |
String endDate | Current Date and Time | Filters the results to any cases before specified date. | yyyy-MM-dd HH:mm:ss |
Integer minNumber | No Minimum | Filters the results to show tests with at least n cases. | 7 (Any integer) |
Integer maxNumber | No Maximum | Filters the results to show tests with at most n cases. | 5000 (Any integer) |
String format | JSON | Allows the query to return in JSON, XML, or CSV format | XML (JSON, XML, or CSV) |
Note:
The specified URL path to access the Tests Ordered query form of the module is: http://host.example.com/openmrs/module/dataaggregation/testsordered.form
A question mark(?) is used after the url path to the page, denoting that parameters will follow.
An ampersand(&) is used between parameters and the order of parameters does not matter.
There should be no spaces in the url except between the date (yyyy-MM-dd) and the time (HH:mm:ss). However, the space should be input as it’s url encoding, %20. But, a date can be applied while omitting the time.
*** If any information is entered into the database incorrectly, with a date in the future, the default endDate parameter will NOT account for that data. The default endDate is the current date and time.
Get Weight:
Get Weight displays all the different weights of individuals within a specific age range. This information can be customized by adding the gender, minimum age and maximum age, and output format parameters. The results of the query are returned as JSON, XML, or CSV format of Person IDs and their weight separated by a colon, with line breaks after each count (e.g. 1152: 86.0(KG)).
Parameters | Default Value | Description | Example Format |
Character gender | ‘M’ (Male) | Filters the results to show only patients with specified gender. | ‘F’ (Female) ‘M’ (Male) |
Integer minAge | No Minimum | Filters the results to show only patients at least n years old. | 20 (Any integer) |
Integer maxAge | No Maximum | Filters the results to show only patients at most n years old. | 50 (Any integer) |
String format | JSON | Allows the query to return in JSON, XML, or CSV format | CSV (JSON, XML, or CSV) |
Note:
The specified URL path to access the Get Weights query form of the module is: http://host.example.com/openmrs/module/dataaggregation/weights.form
A question mark(?) is used after the url path to the page, denoting that parameters will follow.
An ampersand(&) is used between parameters and the order of parameters does not matter.