...
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}
GET .../ws/rest/v1/reportingrest/cohort/{definitionLibraryKey}
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:
GET .../ws/rest/v1/reportingrest/cohort/22c14ac5-9254-46b9-bff8-860a4eac2a38
GET .../ws/rest/v1/reportingrest/cohort/reporting.library.cohortDefinition.builtIn.atLeastAgeOnDate?minAge=15&effectiveDate=2017-01-01
Sample response:
Code Block |
---|
{
"uuid": "reporting.library.cohortDefinition.builtIn.atLeastAgeOnDate",
"definition": { /* ... */ },
"members": [
{
"uuid": "5e1eac23-fd0a-4568-ac30-861692b14b56",
"display": "",
"links": [
{
"rel": "self",
"uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/patient/5e1eac23-fd0a-4568-ac30-861692b14b56"
}
]
}
]
} |
definitionLibrary
Lets you see the built-in queries available in Definition Libraries.
...
Lists Cohort Definitions from all definition libraries.
Sample response:
...
API Documentation
Warning |
---|
Text below here is older, and may not be accurate. |
...