What this module does
Exposes the reporting module's functionality via REST web services
Documentation / How-To
Modules Required
- Reporting
- REST web services
...
About
The Reporting REST module lets you do reporting queries against your OpenMRS database, via REST web services. For example you can search for patients matching some criteria, or get a table of data for a given set of patients.
This module exposes the functionality in the Reporting Module, so you should look to that module's documentation for details of the available queries and dataset definitions.
Source code: https://github.com/openmrs/openmrs-module-reportingrest
General Usage
This module requires both the Reporting and REST Web Services modules to be installed.
General conventions, including authentication are documented at REST Web Services API For Clients.
REST Resources
cohortDefinition
Represents saved user-defined cohort definitions.
GET .../ws/rest/v1/reportingrest/cohortDefinition | Fetches all saved CohortDefinitions |
GET .../ws/rest/v1/reportingrest/cohortDefinition/{UUID} | Fetches one saved CohortDefinition |
POST .../ws/rest/v1/reportingrest/cohortDefinition/{UUID} | Updates one saved CohortDefinition. Supports modifying name and description, but not the underlying query definition. |
DELETE .../ws/rest/v1/reportingrest/cohortDefinition/{UUID} | Deletes one specific saved CohortDefinition Specify |
Example full representation:
Code Block |
---|
{
"class": "org.openmrs.module.reporting.cohort.definition.AgeCohortDefinition",
"uuid": "637ba7e2-8501-43cf-a2ba-d59c68f326b3",
"name": "Adults",
"description": "Patients at least 18 years old",
"parameters": [],
"links": [
{
"rel": "self",
"uri": "http://127.0.0.1:8080/openmrs/ws/reporting/v1/reportingrest/cohortDefinition/637ba7e2-8501-43cf-a2ba-d59c68f326b3"
}
],
"resourceVersion": "1.8"
} |
cohort
Lets you evaluate cohort definitions, either built-in, saved, or specified on the fly.
GET .../ws/rest/v1/reportingrest/cohort/{UUID} | Evaluates a cohort definition. You may specify either the UUID of a saved user-defined cohort definition or the key of a cohort definition in a definition library. You may pass parameters to the evaluation context either as query parameters, or as fields in a JSON body. Response will include a "members" array that gives you the UUIDs of patients matching the query. Examples: Sample response:
|
definitionLibrary
Lets you see the built-in queries available in Definition Libraries.
GET .../ws/rest/v1/reportingrest/definitionlibrary?q=cohort | Lists Cohort Definitions from all definition libraries. Sample response:
|
Warning |
---|
Text below here is older, and may not be accurate. |
The Reporting REST module lets you do this:
- GET http://localhost:8018/openmrs18/ws/rest/v1/reportingrest/cohortdefinition -> lists all available cohort definitions
- GET http://localhost:8018/openmrs18/ws/rest/v1/reportingrest/datasetdefinition -> lists all available data set definitions
- GET http://localhost:8018/openmrs18/ws/rest/v1/reportingrest/uuid-of-cohort -> lists all patients of that cohort
- GET http://localhost:8018/openmrs18/ws/rest/v1/reportingrest/dataset/c6f3a3cf-df0e-4733-9d9e-ff0c6cf9629f?cohort=f6f5a60e-72a9-4e7f-8f92-f95d4000ca2a -> evaluates a DSD against a cohort
...