avniproject / yenepoya

0 stars 0 forks source link

[ETL REPORT] Aggregate report #140

Closed sachsk closed 1 year ago

sachsk commented 1 year ago

Save these reports in the Yenepoya ETL directory Update the query here : https://docs.google.com/spreadsheets/d/15U3mOkcVjHhXlr318uj8DRQNzC6mBOTf-GEPf9SLfTM/edit#gid=693027088

Note : Linelists are also part of this card.

Gojo-Taqi commented 1 year ago

ETC :- 8 hrs

Gojo-Taqi commented 1 year ago

Updated ETC from now 12:12 pm:- 6 more hours to completed all the reports

Gojo-Taqi commented 1 year ago

All reports have been moved to ETL, it's only that some of the reports have not been tested, hence pushing this card back to support.

Dinesh2019 commented 1 year ago

Report Name Issue Cancer warning signs - general Data for linelist is taking time Children Report missing two rows Child Vaccination Center data is missing Details of program enrolment Report showing as 505 Environmental Factors Report is missing

Dinesh2019 commented 1 year ago

Getting 504 error for fever report after applying the filter

Private Zenhub Image

Gojo-Taqi commented 1 year ago

The report is trying to access a linelist report, and since the linelist has not yet been moved to ETL, it gives you this error. This issue should be fixed if the linelist card is moved to ETL. Hence pushing this card back to QA ready.

Dinesh2019 commented 1 year ago
vaijayanthisundaram commented 1 year ago

For "under child report we have Birth order of the child 2-3 count as 206 in aggrgrate but linelist we have 224 data"- The isnull condition for encounter date time was not Checked in the join condition. Query has been updated and report has been pushed to the server. For "Child Vaccination Center"- ETL migration has not been completed as public views were found in the queries. ETL Query appears to be unchanged from the old query.

vaijayanthisundaram commented 1 year ago

For "Details of program enrolment"- the query was rewritten and pushed to the server. For "Household social class and mother tongue" - the aggregate query was consolidating certain subcategories together irrespective of the main category. Aggregate query has been rewritten and pushed to the server.

BEULAHEVANJALIN commented 1 year ago

NCD risk factors:

NCD Age Groups:

Gojo-Taqi commented 1 year ago

Environmental Factors - this report is giving a few individuals that are null. Need to debug this further.

Gojo-Taqi commented 1 year ago

Individual sociodemograpic report generic queries.

  1. select count(*) from individual where subject_type_id = 186;

  2. select count(*) from individual where subject_type_id = 186 and gender_id = 229 ;

  3. select count(*) from individual where subject_type_id = 186 and gender_id = 230 ;

  4. with cte as ( select extract (year from age(i.date_of_birth)) as age, e.observations ->> 'ca9eab9a-da29-4775-b08b-029998c817d0' as obs, row_number() over (partition by e.individual_id order by e.encounter_date_time desc nulls last) as v_no from individual i left join encounter e on e.individual_id = i.id and e.encounter_type_id = 508 where subject_type_id = 186 and i.gender_id = 230 ) select count(*) from cte where v_no = 1 and obs = '9888cdf3-9c0d-4577-8149-aa18f631d821' and age <= 45 ;

  5. with cte as ( select extract (year from age(i.date_of_birth)) as age from individual i where subject_type_id = 186 ) select count(*) from cte where age between 0 and 5 ;

  6. with cte as ( select extract (year from age(i.date_of_birth)) as age from individual i where subject_type_id = 186 ) select count(*) from cte where age between 10 and 19 ;

  7. with cte as ( select extract (year from age(i.date_of_birth)) as age from individual i where subject_type_id = 186 ) select count(*) from cte where age >= 60 ;

  8. with cte as ( select extract (year from age(i.date_of_birth)) as age, e.observations ->> 'ca9eab9a-da29-4775-b08b-029998c817d0' as obs, row_number() over (partition by e.individual_id order by e.encounter_date_time desc nulls last) as v_no from individual i left join encounter e on e.individual_id = i.id and e.encounter_type_id = 508 where subject_type_id = 186 and i.gender_id = 230 ) select count(*) from cte where v_no = 1 and obs = '9888cdf3-9c0d-4577-8149-aa18f631d821' and age between 20 and 24 ;

  9. with cte as ( select extract (year from age(i.date_of_birth)) as age, e.observations ->> 'ca9eab9a-da29-4775-b08b-029998c817d0' as obs, row_number() over (partition by e.individual_id order by e.encounter_date_time desc nulls last) as v_no from individual i left join encounter e on e.individual_id = i.id and e.encounter_type_id = 508 where subject_type_id = 186 and i.gender_id = 229 ) select count(*) from cte where v_no = 1 and obs = '9888cdf3-9c0d-4577-8149-aa18f631d821' and age between 18 and 24 ;

  10. with cte as ( select extract (year from age(i.date_of_birth)) as age from individual i where subject_type_id = 186 and i.gender_id = 229 ) select count(*) from cte where age < 3 ;

  11. with cte as ( select extract (year from age(i.date_of_birth)) as age from individual i where subject_type_id = 186 and i.gender_id = 230 ) select count(*) from cte where age < 3 ;

  12. with cte as ( select extract (year from age(i.date_of_birth)) as age from individual i where subject_type_id = 186 and i.gender_id = 229 ) select count(*) from cte where age between 3 and 5 ;

  13. with cte as ( select extract (year from age(i.date_of_birth)) as age from individual i where subject_type_id = 186 and i.gender_id = 230 ) select count(*) from cte where age between 3 and 5 ;

  14. with cte as ( select extract (year from age(i.date_of_birth)) as age, i.gender_id g from individual i where subject_type_id = 186 ) select ( count() filter ( where g = 230 ) 1000 ) / count(*) filter ( where g = 229 ) from cte where age <= 6 ;

  15. with cte as ( select extract (year from age(i.date_of_birth)) as age, e.observations ->> 'ca9eab9a-da29-4775-b08b-029998c817d0' as obs, row_number() over (partition by e.individual_id order by e.encounter_date_time desc nulls last) as v_no from individual i left join encounter e on e.individual_id = i.id and e.encounter_type_id = 508 where subject_type_id = 186 and i.gender_id = 230 ) select count(*) from cte where v_no = 1 and obs = '9888cdf3-9c0d-4577-8149-aa18f631d821' and age between 15 and 49 ;

  16. with cte as ( select i.observations ->> '49344ffb-d10c-4e30-a284-356396970bcf' obs from individual i where subject_type_id = 184 ) select count(*) from cte where obs = 'ef40f2a9-9a47-4281-a719-aad2cb14e3ca' ;

Dinesh2019 commented 1 year ago
Gojo-Taqi commented 1 year ago