Cohort builder error on openmrs 2.1.2.

I am running openmrs Version: 2.1.2 and i am attempting to create a new cohort of patients with a certain encounter type - which is successful but returns 0 results yet the database has the information

Was there a recent change – that is breaking this



This looks like a bug and am trying to investigate.

In the meantime, ever had a chance to look at this?

Daniel I don’t use the reference application Dk unless I can use the web app with the legacy UI it’s not going to work for my use Case

@judy / @dkayiwa, quickly testing on, this seems to work fine there, which is running 2.0.6, so perhaps there is an issue introduced between 2.0.6 and 2.1.2.

Judy, can you check your server log and browser console for any errors, and let us know if you find any?

Thanks, Mike

Off the head this could have been a side effect of

I’ve also tested this on Bahmni 0.90 (…which is running OpenMRS 2.1.1) and found the same issue. All Cohort builder queries are returning 0.

Composition queries from the reporting module are also returning wrong results. Maybe this is related to this commit. All composition queries return the value from the first cohort query in the composition as describe on this post.

The log file doesn’t show any errors, it just logs a warning message:

[WARN ] HibernateConceptDAO - No concept found for 'REASON ORDER STOPPED'

…which i see is from this line.

@mksd @mksrom

Good find people!

(Yes, I’m not surprised that Cohort Builder is broken due to the Platform 2.1.x changes. It would be good if some dev can research exactly what’s broken and how to fix it. (“This commit” that Bailly links to is relevant, but it doesn’t seem to be the latest code.)

FWIW, the problem started happening with this commit:

Can someone please create a ticket for this?


Just created a ticket and committed a proposed fix

@wyclif if you review and approve, i will back port to the 2.1.x branch

1 Like

Hey I’m having a similar issue only that, instead of 0 , I get a “?” for all cohort. I’m also on 2.1.2 Any ideas?

Sorry, I took this conversation to the #dev channel, in this other thread: More changes to the new Cohort Membership model

To summarize the current state:

  • changes introduced in Platform 2.1.x have broken the cohort builder module
  • I’m proposing a change to the platform (see that other thread) that will address this in the “right way”
    • someone is working on this ticket now
    • this will require releasing a new Platform 2.1.3

Now that I write this I realize we should consider doing a quick-hack fix purely in the cohort builder code. @dkayiwa, thinking back to the original fix you proposed, would it be possible to do something like this purely within the module? (This would let us get the module fixed immediately for people running the latest platform release.)

I have created this ticket and attached a compiled module with the hack:

If the hack is approved, and @judy you test to confirm that all is well, i can release the module.

@aramirez, you also could test this.

@darius, I already did, take a look a couple of posts up.

@aramirez I mean, Daniel just did a quick-fix for this issue, and before he officially releases it he’d like a real user to test it.

See the attached file here:

@darius @dkayiwa test this fix with version 2.1.2,

I still get the ? in the values, but now also get this warning message:

No class by name: DWRCohortBuilderService

@aramirez are you running a new query? Or just looking at existing ones? Which new query did you run? And how did you update the module? Can you also confirm by going to the Administration Manage modules page to confirm that the version is 2.0.5-snapshot?

On my side, I tested it with OpenMRS Version: 2.1.1 and I’m now getting results when I run searches.

The results are sometimes wrong though! Especially when I use patient attributes and composition searches.

I agree with @rubailly, still get incorrect results after doing search of the patient attributes like males or females