Closed sraby closed 3 years ago
So, I tried scaling down the code in total-active-cases.sql to show us a cumulative count. Trimming off the last subquery, I was able to get counts of cumulative active cases that match up exactly with the count of cases in the table.
with covid_filings as (
select
court,
fileddate,
propertytype,
disposeddate,
date_trunc('week', fileddate)::date as week_filed,
date_trunc('week', disposeddate)::date as week_disposed
from oca_index
where
classification = any('{Holdover,Non-Payment}')
and fileddate < '2021-03-21'
--and propertytype = 'Residential' # commented out to show Statewide evictions, which includes commercial
order by fileddate asc
)
select
count(*) as cases_filed,
count(*) filter (where week_disposed is not null) as cases_disposed,
count(*) - count(*) filter (where week_disposed is not null) as cases_active
from covid_filings;
SOLVED! Turns out the date in the SQL code for the table was listing the pandemic start date in 2021 instead of 2020.
The cumulative graph of active cases states that there were 172,076 cases at the start of the pandemic, but our table of values introduced in #42 states that there were actually 218,916 cases at the start of the pandemic. We should look in to the methodology for how we calculate each count here to make sure we are counting the same way and arrive at the same number.