RESTWS and CohortMember

0 views
Skip to first unread message

Friedman, Roger (CDC/CGH/DGHA) (CTR)

unread,
May 21, 2012, 9:45:21 AM5/21/12
to d...@openmrs.org

At this moment, CohortMember is modeled as a subresource of Cohort.  However, since the CohortMembers are patients, and we allow creation and editing of CohortMembers, we now are breaking caching for patients.  It seems to me we have a few possible ways to fix this:

(1) not support POST or DELETE for CohortMembers; [makes CohortMember sort of hokey]

(2) use GET on a Cohort with a parameter (e.g. ?evaluate) to produce a list of members; [makes Cohort GET polymorphic]

(3) use PUT on a Cohort to produce a list of members; [PUT?]

(4) have an Evaluate resource that would work with various types of definition objects (e.g. Cohort, LogicRule, Form, Report).  [probably would require parameters to identify object and POST for passing parameters to the object]

Darius Jazayeri

unread,
May 21, 2012, 10:27:25 AM5/21/12
to d...@openmrs.org
Hi Roger,

I don't think this is correct.

CohortMember has a patient, but it isn't a patient itself. Doing this

    POST .../cohort/(parentUuid)/member ...

does not create a patient, but rather it adds the patient to the specified cohort, writing a row to the cohort_member table. 

Is that not how it's working? (If not, could you provide the sequence of REST calls that would cause an error?)

I do see that CohortMemberResource includes a default rep of patient in its own default rep. Is that what you're referring to? I do think we should change things so the default rep only includes a ref of the patient...

-Darius


Click here to unsubscribe from OpenMRS Developers' mailing list

Friedman, Roger (CDC/CGH/DGHA) (CTR)

unread,
May 21, 2012, 11:26:59 AM5/21/12
to d...@openmrs.org

Darius --

     I had just looked at the catalog, not the code.  Since a cohort's membership is persistent, I agree with you about the REST call (although I can't say I like the idea of different users being able to add or delete patients from the same cohort at the same time).  I also agree about the default representation.

    But that still leaves a number of objects which contain definitions that have an evaluate-like function.  Could we agree on a common approach to that use case?

-- OpenMRS Developers: http://go.openmrs.org/dev
Post: d...@openmrs.org
Unsubscribe: dev+uns...@openmrs.org

Darius Jazayeri

unread,
May 21, 2012, 11:55:40 AM5/21/12
to dev
Are there any core objects that have a definition-evaluator pattern?

In the reportingrest module we took an approach very close to this: https://groups.google.com/a/openmrs.org/d/msg/dev/VCyB6E2OcQU/h8SZJRqszUQJ

-Darius
Reply all
Reply to author
Forward
0 new messages