Expanded cohort and delta synchronization proposal

@vshankar, glad to hear you’re interested in this project! Sorry for the slow reply, you caught us while I was in an all-week workshop and Burke is on service in the hospital.

The initial question I have is whether you’re aiming to make these changes directly in openmrs-core for future release (that’s what the project page says), or via a module that could run against existing OpenMRS installations. Assuming it goes in openmrs-core, I would not expect an expanded_cohort_definition table, but rather I’d expect you to add columns to the existing cohort table.

Also, you’ve described a specific implementation of how dynamic cohorts could work (e.g. there’s a sql_definition column), however openmrs-core actually need to support a more extensible mechanism than this. E.g. openmrs-core might support the functionality:

cohort_calculation_handler = "org.openmrs.cohort.SqlCohortHandler"
cohort_calculation_config = "select person_id as patient_id from person where gender = 'M' "

but it should also allow the reporting module to provide alternative functionality like

cohort_calculation_handler = "org.openmrs.module.reporting.cohort.ReportingCohortHandler"
cohort_calculation_config = "uuid-of-some-reporting-module-definition"

Basically, openmrs-core needs to provide an API by which dynamic cohorts can be evaluated on some schedule, and have their results automatically populate the cohort_member tables, but the specific method by which the evaluation happens should be extensible.

One option for the schedule format would be a cron format. As far as what format, one option is a cron format