I'd like to be involved in  this

From: [email protected] [mailto:[email protected]] On Behalf Of Darius Jazayeri
Sent: Friday, August 19, 2011 11:31 AM
To: [email protected]
Subject: Re: [OPENMRS-DEV] sql cohort query

We talked off-list, and it turns out that:

  *   Many/most of the indicators Bob wants to build are not really cohort 
indicators, but rather counts of encounters, obs, log entries, etc.
  *   They'd mostly be calculated via SQL.
  *   They need to be able to export these via the sdmx-hd module, into DHIS.
@Mike, @Ryan,
If we were to do a SqlIndicator implementation (which wouldn't be too much 
work), would that easily fit into the current SDMX-HD export module? Or is that 
hardcoded to cohort indicators? And how much work would it be to change that?

-Darius
On Fri, Aug 19, 2011 at 7:33 AM, Bob Jolliffe 
<[email protected]<mailto:[email protected]>> wrote:
On 19 August 2011 15:07, Darius Jazayeri 
<[email protected]<mailto:djazayeri%[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]<mailto:[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]<mailto:[email protected]> with 
>> "SIGNOFF openmrs-devel-l" in the  body (not
>> the subject) of your e-mail.
>>
>> [mailto:[email protected]<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]<mailto:[email protected]> with "SIGNOFF 
openmrs-devel-l" in the  body (not the subject) of your e-mail.

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

________________________________
Click here to 
unsubscribe<mailto:[email protected]?body=SIGNOFF%20openmrs-devel-l> 
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