Fetching global properties using Rest API for concept.causeOfDeath

Problem

A person can add any set of causes behind death and if he names the question concept something other than “cause of death”, then how we know from the concept list that this particular question has answers which correspond to cause of death??? Is there any rest API through which we can access global properties so we know that this particular conceptID is linked to the concept.causeOfDeath ???

In the reference app, we set the id in Global properties, so web knows which concept to choose, how to do that in mobile application


Why I need this

I want to add the option to mark the patient dead in android client but this is a sort of blocker, I have some perfectly working workarounds below.


My Proposed Solution(for coded response)

  1. We create a dialogue box asking the conceptID before proceeding to mark patient dead
  2. Since while playing around at https://qa-refapp.openmrs.org/openmrs/module/webservices/rest/test.htm, I observed that we can mark the patient dead from any concept available, so I fetch all of them and give an autocomplete field to select any one (irrespective if it belongs to cause of death)
  3. We create a rest API to fetch global ID’s and put this feature for the android client on hold until it is implemented.

What are your suggestions for the proposed solutions? @f4ww4z @gcliff @dkayiwa @burke @ssmusoke @ibacher

https://qa-refapp.openmrs.org/openmrs/ws/rest/v1/systemsetting?q=concept.causeOfDeath

2 Likes

@rishabh997 does this work for you ?

yes it returns the conceptID successfully, now I am searching for how to retrieve complete concept from ID as query, havent found anything as such yet in the https://rest.openmrs.org/#available-operations-for-concepts to successfully fetch concept using only ID

Internal IDs of resources are not exposed via rest api but instead we use UUIDs , you can do a get request to the server via POST MAN with some thing like this ‘http://localhost:8081/openmrs-standalone/ws/rest/v1//concept/{uuid}

is it how you want to fetch the concept with ?

@rishabh997 what happens when you set the setting value to a uuid instead of integer?

the /systemsetting?q=concept.causeOfDeath returns the following results where I get the ID (not UUID) of the assigned concept

I want something like /concept?q=conceptID (something like that).

Here the following two things are observed:

  1. On clicking the mark patient deceased, following error throws up - https://pastebin.com/PhE4ZJVn
  2. The /systemsetting?q=concept.causeOfDeath returns the UUID of the concept assigned.

Can you fix the MarkPatientDeadPageController to expect a uuid or integer?

1 Like

The error seems to occur at

Looking at this, I think modifications might be needed in conceptService as well. I am not familiar with the code of core-apps, but can give a try. Will need to setup IDE first for this.

There is no need of making any change to the ConceptService.

@rishabh997 Did you try to fix this?

There is a UI for this in the demo reference app’s ‘Configure Metadata’ page, but it doesn’t seem to recognize the concept ID.

If we see the demo server’s global properties for causeOfDeath, we get

Now if we go to Home -> Configure Metadata -> Manage Concepts Dictionary -> Manage Concepts and enter 5002 there, the ID is not found:

@dkayiwa is this the right place to search for concepts using its ID?

That concept does not exist in your dictionary.

Yes. It looks like 5002 used to be in the CIEL dictionary, and hence probably in the default RefApp metadata, but has been removed. @akanter Was there a replacement for this or should we have be rethinking how we’re representing cause of death? I see that there’s 1599, but that doesn’t seem to have any default answers.

2 Likes

1599 is the correct concept for probable cause of death, but is not the same as the official cause of death from a death certificate (1814). The concept is coded, without predefined pick lists as the number of diagnoses/causes is huge.

2 Likes

I got a bit involved in two of the issues today, will try this today after finishing them.

That makes sense to me, though it makes things a bit more difficult to test on the demo instance.

In the RefApp, we provide a form for marking a patient as deceased that looks like this:

Would either 1599 or 1814 be a good fit for this or should we capture an additional field to make the decision as to which of those we use (something like a checkbox saying “Cause of death from death certificate” or w/e)?

I think 1599 would be appropriate. As for the pick list, either we do a database query or we need a shortlist of likely options, but in reality the actual list is pretty long.

1 Like