WebServices Rest - Ability to Return a count how many Observations for a Specified Concept match a value

Tags: #<Tag:0x00007f73f05f8be0>
(Stephen Senkomago Musoke) #1

Is it possible to query the webservices end points for counts say

  • How many observations have a concept that matches a specified value
  • How many patients have an observation that matches such a value

Or are these done via the Reporting Rest API?

(Daniel Kayiwa) #2

You could define the queries as a definition library within the reporting module: https://github.com/openmrs/openmrs-module-reporting/blob/master/api/src/main/java/org/openmrs/module/reporting/cohort/definition/library/BuiltInCohortDefinitionLibrary.java

Then use an endpoint in the reportingrest module to evaluate any query from the definition library.

Here is the definition library resource: https://github.com/openmrs/openmrs-module-reportingrest/blob/a4080f5d2af14b0cabb6667c7ae352345c13a08d/omod/src/main/java/org/openmrs/module/reportingrest/web/resource/DefinitionLibraryResource.java

(derrick baluku) #3

@dkayiwa the definition library does not appear among the /webservices/rest/apiDocs.htm page under the reporting rest endpoints.What could be the issue causing this. The reporting rest module version being used 1.10.0.

Demo: https://demo.openmrs.org/openmrs/module/webservices/rest/apiDocs.htm

(Daniel Kayiwa) #4

The docs may have an issue. But the important thing is that the resource exists: https://github.com/openmrs/openmrs-module-reportingrest/blob/a4080f5d2af14b0cabb6667c7ae352345c13a08d/omod/src/main/java/org/openmrs/module/reportingrest/web/resource/DefinitionLibraryResource.java