avniproject / calcutta-kids

0 stars 0 forks source link

Report issue #95

Closed vedfordev closed 3 months ago

vedfordev commented 6 months ago

Ticket : https://avni.freshdesk.com/a/tickets/3300

Task:

Analyse report and fix the issue

vedfordev commented 6 months ago

Report : CK Growth Faltering

I checked with below query and find out that november has no data.

select count(distinct enc.individual_id)
from program_encounter enc
join program_enrolment enr on enc.program_enrolment_id = enr.id
where enc.encounter_type_id = 20
  and enc.encounter_date_time notnull
  and extract(MONTH from encounter_date_time) = 11
  and extract(YEAR from encounter_date_time) = 2023
  and enc.is_voided = false and enr.is_voided = false
  and enc.observations @> '{"a5067bcc-d333-4c80-a0f2-d61df9d210d3": ["04bb1773-c353-44a1-a68c-9b448e07ff70"]}'
  and enr.program_exit_date_time isnull
;

Also I find out that date filter is applied on encounters cte. I think it should apply on last_encounters cte.

vedfordev commented 6 months ago

@sachsk putting on hold. will fix after resolving ticket https://avni.freshdesk.com/a/tickets/3323