Skip to content

Commit

Permalink
added QA
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugh Saalmans committed May 17, 2022
1 parent 25ecf2e commit c1321ad
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions postgres-scripts/example-usage/02_join_pc_and_lga_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
WITH pc_data AS (
SELECT con.to_id AS lga_id,
con.to_name AS lga_name,
sum(pc.cases::float * con.address_percent / 100.0)::integer AS cases
sum(pc.cases::float * con.address_percent / 100.0)::integer AS cases,
sum(pc.cases) as qa_count
FROM testing.nsw_covid_cases_20220503_postcode AS pc
INNER JOIN gnaf_202202.boundary_concordance AS con ON pc.postcode = con.from_id
WHERE con.from_source = 'geoscape 202202'
Expand All @@ -38,6 +39,17 @@ SELECT pc_data.lga_id,
pc_data.lga_name,
lga.tests,
pc_data.cases,
(pc_data.cases::float / lga.tests::float * 100.0)::numeric(4,1) AS infection_rate_percent
(pc_data.cases::float / lga.tests::float * 100.0)::numeric(4,1) AS infection_rate_percent,
(pc_data.cases::float / pc_data.qa_count::float * 100.0)::smallint as concordance_percent
FROM testing.nsw_covid_tests_20220503_lga AS lga
INNER JOIN pc_data on pc_data.lga_id = lga.lga_code19;


-- example of poor concordance due to number of postcodes in one LGA
select *
from gnaf_202202.boundary_concordance
WHERE from_source = 'geoscape 202202'
AND from_bdy = 'postcode'
AND to_source = 'abs 2016'
AND to_bdy = 'lga'
and to_name = 'Dungog (A)';

0 comments on commit c1321ad

Please sign in to comment.