Implementation Specific Custom REST Paths for OpenMRS Resources

I am wondering if it is possible for modules to expose custom REST paths on top of those provided by the web services module and other modules. Some examples below:

  1. /patient/{parent-uuid}/viralload/{parameters} - exposes values for viral load for example
  • current-value not detected or detected with a numeric value
  • next-test-date - the date of the next test that is due
  1. /patient/{parent-uuid}/dsdm/ - status of the patient in the differentiated models of care program

  2. /patient/{parent-uuid/hiv/

  3. /patient/{parent-uuid}/mch/

Etc, this will enable the simplification of querying various status values across different program areas of care for the patient. Is there any other approach that abstracts the queries for the status in a consistent way?

UPDATE: Additionally is there a way to build the custom concepts leveraging existing calls from the webservices module - for example #1 is the value from 3 different concepts (in the same encounter)?

From this i see yourmoduleid as part of the url.

I do not see much value in making REST calls from your module’s Java code. Just directly invoke the Java that the REST calls delegate to.

To answer this specific question, I think this is technically possible, via a Spring controller. But it feels like bad style to add these under the main namespace, and it’s better to do something like this: