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 c1321ad commit a7be05d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions postgres-scripts/example-usage/02_join_pc_and_lga_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,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) as qa_count
sum(pc.cases) as qa_count,
count(*) as postcode_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 @@ -40,16 +41,18 @@ SELECT pc_data.lga_id,
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 / pc_data.qa_count::float * 100.0)::smallint as concordance_percent
(pc_data.cases::float / pc_data.qa_count::float * 100.0)::smallint as concordance_percent,
pc_data.postcode_count
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
-- example of poor concordance due to number of partial postcodes that intersect with 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 a7be05d

Please sign in to comment.