Programme Enrollment search (cohort builder)

Hi everyone, the cohort builder is being given a new look and an improved user experience. You can check it out here. We’ve been able to fix the programme enrollment search tab that allows a user to be able to search for patients enrolled in programs. The image below is how the form looks like now

Programme enrollment search

At the moment, you can search for patients enrolled in a particular programme by selecting the program but the form also allows user to be able to select program workflow & state. However after taking a look at the patient_program table. I don’t know how that can be achieved. The image below shows the schema of the patient_program table. It has a foreign key for program_id but nothing for program_workflow or state patient_program schema

Thanks

I thought you are making REST calls to the reporting module api which should take care of that, without requiring you to know the database tables. Not so?

Yes, that’s correct, I’m making an AJAX post request to ws/rest/v1/reportingrest/adhocquery?v=preview and this is a sample of the post body

{
  "type": "org.openmrs.module.reporting.dataset.definition.PatientDataSetDefinition",
  "customRowFilterCombination": "1",
  "rowFilters": [
    {
    	"type": "org.openmrs.module.reporting.cohort.definition.PatientDataDefinition",
    	"key": "reporting.library.cohortDefinition.builtIn.patientsWithEnrollmentkhkjhjkh",
    	"parameterValues": {
    		"programs": ["09c52c0c-aafe-11df-a781-001e378eb67e"]
    	}
    }
  ]
}

But the ProgrammeEnrollmentCohortDefinition does not have configuration property to handle workflow and state. However, those fields are in the old cohort definition that was why I had to take a look at the database table. Also, I made use of the old cohort builder and I’m not so sure if the workflow was actually made use of because I got the same result set when I specified one and when I did not

@femi, see PatientStateCohortDefinition and InStateCohortDefinition.

Thanks, @mseaton, I’ve taken a look at the PatientStateCohortDefinition and InStateCohortDefinition and it has what I need. But I don’t know if any exist for program workflow

@femi the idea is that (1) may be enrolled in a program, (2) you may have a current state within a workflow.

But it would not make any sense in real life to be “in a workflow”, so the user cannot actually search for that.

-Darius (by phone)

1 Like