I am working on exporting condition list data in cohort builder PR. I see that ever time I make some export from Concept/Observation it shows 0 results, though relevant data to be exported is available.
I see this part of code to be responsible for fetching data in cohort builder. On digging into the problem I found this code, which might be responsible for fetching data from data base. I discovered we have these evaluators in reporting module. When I click on search I see that the evaluators: DefinitionLibraryCohortDefinitionEvaluator , CodedObsCohortDefinitionEvaluator, BaseObsCohortDefinitionEvaluator and CompositionCohortDefinitionEvaluator are getting executed. I am not able to figure out what exactly is causing this problem and how this could be fixed.
I have tried other work-arounds as well, which failed. I feel lost when it comes to fixing this. I have tried it with rest as well. I tried to fetch all patients and filter them by checking if each patient has a particular condition. I was trying to use: /ws/rest/v1/patient rest api to fetch all patients but its giving me this error. Its happening with the existing code as well( while exporting concepts) .
Community I really need us to look at the issue raised above by @haripriya urgently to allow her to resolve this matter so that we can successfully include this MUCH AWAITED functionality in the Ref App in reasonable time. We are just too close to completing this piece of work .
@haripriya sorry I’m slow to reply. Can you please share the exact query that gets sent to the back end? E.g. what query parameters or body are you GET/POSTing to the ad hoc query resource? (e.g. you can get this from the network tab of your js console)
@haripriya , that is a red flag in openmrs. you cant fetch all patients . That why that resource /ws/rest/v1/patient ,is not supported. imagine you had a million patients, retrieving them all would make you run out of memory. If you want to take that direction , you have to add atleast one param say /ws/rest/v1/patient?q=“xx”, or you can probably write a search handler that retrieves the patients with Conditons.
@mozzy Thank you for your response on this . i want the ‘rows’ field in the above response to return data related to patients. As seen, the rows array is empty . It needs to return an array of patients with each object in the array in the following format:
I see that in cohort builder when we try to export some concept say Hypertension and select the option “Patient whose observation does not have value Hypertension” , It actually returns list of all patients present in the database. But its not able to return results of patients who are suffering Hypertension when we select “Patient whose observation has value Hypertension” though the required patients are present in the database.
@haripriya ,give me some params that i should register with a new patient ,to ensure the data exists in my database, and i try posting again.
Am going to investigate deeper into that resource and do some work there ,
Is the patient(s) you want to return supposed to have a conditon based on the this data your posting?
I surely havent yet gone deeper looking at it
@mozzy Thank you for looking into this issue These are the fields required to register a patient in the database. Yes, the patients to be displayed are filtered based on this data . The question field over here has the value of ‘condition uuid’ using which we are trying to fetch patients suffering from a particular condition during the given time range.
Ok @haripriya , i have done some testing , the adhocquery resource can return Results to Numeric ,boolean and Text Concept observation , but cant return results to Coded concept observations. Now let me try to dig deeper int that resource.
@haripriya ,in a meantime ,
what approach do you want to take get this done ,
example the way you described it here below ,
Because here we are specifically fetching patients with a given obs concept value,
Note , the above doesnt directly imply ,that the above retrieved patients have conditons.
So youll still do further filtering.
So what do you exactly want to do ??
In a meantime Am trying to look into that resource