Expanded cohort and delta synchronization proposal

I’m a graduate student from San Francisco State University. Thanks for @ayeung, I’ll be contributing and helping develop OpenMRS beginning with this: https://wiki.openmrs.org/display/projects/Expanded+Cohort+Features

As per our discussion with @ayeung and several others, I would like to begin a conversation for the proposal that will go towards the Expanded Cohort module starting with the data model that will incorporate Cohort membership information as per the link above. In addition, in the UI part we plan to add options for the user to define a time interval to run the scheduled tasks in the Expanded Cohort.

I have outlined the changes that are needed to the data model in the ER diagram below:

Membership information is added to the cohort_member table and scheduled_interval for the scheduled tasks is added to the expanded_cohort_definition table because it seemed appropriate to accompany it with the sql query.

This is definitely up for discussion, because I would love some input on how to store the time intervals for the scheduled tasks. As per the diagram, I suppose one way to store them is 6h, 7d, 3w, 4m and use MySQL events to run the queries?!

1 Like

Copying to @darius and @burke

@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

Thanks Darius for your reply.

expanded_cohort_definition table exists in the Expanded Cohort module. Considering the cohort definitions exists in the reporting compatibility module, shouldn’t it be better to extend the reporting compatibility module? That way we can consolidate the expanded cohort features into the reporting compatibility module. I am open for more ideas, since I only have limited exposure to openmrs.

@vshankar, I believe the idea with this project is that you’re supposed to be bringing some of the functionality that was previously only available in add-on modules (expandedcohort, reporting, reportingcompatibility) into openmrs-core.

But you should talk with @burke (who I think will be available again on Monday) and @ayeung about that.

This is a GSoC 2016 project to be mentored by @burke (not @ayeung).

If you’re just now working on your proposal, it’s too late because the deadline has already passed. If this is a not a GSoC proposal, please know that someone has likely already applied to work on this project and will likely be selected.

Sorry if I misunderstood your original message.

1 Like

Thanks, @darius and @michael.

I just chatted with @burke and explained to him what @vshankar is working on is a different project from https://wiki.openmrs.org/display/projects/Expanded+Cohort+Features.

For @vshankar’s project, he will create the columns based on the suggested naming convention from https://notes.openmrs.org/2016-02-17-Design-Forum and it will be created under a separate module (not as core as it’s stated in GSOC project).

I hope that has clarified the confusion.

1 Like