On 19 August 2011 15:07, Darius Jazayeri <[email protected]> wrote:
> You're not doing a count distinct, so if your opd_patient_queue_log can have
> the same patient_id more than once, that'd be why you get a difference.
> -Darius

Thanks Darius.  You are absolutely right.  I also just figured that
out a few minutes ago.

Though it has left me with a sinking feeling about how to use the
reporting module.  It makes sense now that the penny has slowly
dropped, that a cohort query is in fact a query to select a distinct
group, or cohort, of patients.  Which you could then drill down into
etc.

But at the level of a typical service indicator, I am really not
interested in who the individual patients are.  I need to know how
many patients had OPD encounters this month, for example.  Using a
cohort query for this seemed to make sense, but of course it doesn't
as it filters the duplicate patients.  So I should in fact be counting
the encounters rather than the patients, but then its not a cohort
query :-(

>
> On Fri, Aug 19, 2011 at 5:37 AM, Bob Jolliffe <[email protected]> wrote:
>>
>> I am trying to compose an indicator which makes use of a join with a
>> custom table.
>>
>> Does anyone have an idea why executing the query directly as:
>> mysql -u ... -e 'Select count(patient.patient_id) from patient inner
>> join opd_patient_queue_log on
>> patient.patient_id=opd_patient_queue_log.patient_id'
>>
>> results in 16593,
>>
>> but when I create a sql cohort query as above (without the count), I
>> get a result of 13592.
>>
>> How does openmrs count the size of the resultset?  It seems its not a
>> simple count ...
>>
>> Regards
>> Bob
>>
>> _________________________________________
>>
>> To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to
>> [email protected] with "SIGNOFF openmrs-devel-l" in the  body (not
>> the subject) of your e-mail.
>>
>> [mailto:[email protected]?body=SIGNOFF%20openmrs-devel-l]
>
> ________________________________
> Click here to unsubscribe from OpenMRS Developers' mailing list

_________________________________________

To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to 
[email protected] with "SIGNOFF openmrs-devel-l" in the  body (not 
the subject) of your e-mail.

[mailto:[email protected]?body=SIGNOFF%20openmrs-devel-l]

Reply via email to