Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Add QAQC tables for Condo Checks #428

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Add QAQC tables for Condo Checks #428

wants to merge 11 commits into from

Conversation

mbh329
Copy link
Contributor

@mbh329 mbh329 commented Feb 9, 2023

Addresses issue #414.

Changes

  • Add dcp_housing as in input data source to compare the Certificate of Occupancy # of units residential (most accurate units residential number) in the Housing DB to PLUTO data
  • Creates new QAQC logic in two separate scripts to generate two separate QAQC tables to be displayed in the app to catch condos with extremely high unit counts
  • output. NOTE: the qaqc_housing_units table failed to generate because of a datatype error but latest commit implements a fix, a new output will take a few hours to produce. I suggest looking at the qaqc_pts_condo output first until both tables are generated. This action was built off of a minor release of PLUTO.
  • Add new dataset to source_data_version.csv
  • AD developed the logic for both QAQC scripts. Implementation is based off other QAQC processes that have already been established in PLUTO

@mbh329 mbh329 added the enhancement New feature or request label Feb 9, 2023
@mbh329 mbh329 changed the title WIP: Add QAQC tables for Condo Checks Add QAQC tables for Condo Checks Feb 10, 2023
@damonmcc damonmcc linked an issue Feb 10, 2023 that may be closed by this pull request
@damonmcc
Copy link
Member

thoughts so far from looking at qaqc_pts_condo.csv:

  • since there are only 24 rows with an old_value, does that mean only 24 were de
  • 12,312 total rows, so appears to have a row for all condos?
  • a description of what each final column represents would be helpful. maybe at the top of the sql file? or maybe more descriptive column names?

Copy link
Member

@AmandaDoyle AmandaDoyle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments for detailed feedback.

@@ -0,0 +1,45 @@
-- Create qaqc table All PLUTO records where there is a match in Housing Database
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing "of"
I think this need to be " Create qaqc table of all PLUTO records where there is a match in Housing Database"

-- Create qaqc table All PLUTO records where there is a match in Housing Database
-- and the PLUTO residential units value does not match the housing database certificates
-- of occupancy value. Have flag indicating if bbl has residential unit correction in manual corrections table.
-- select PLUTO records that have a match in the HousingDB subset where unitsres does not equal units co
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this last sentence repetitive of the first 3 lines?

-- Data Dictionary
-- bbl - billing BBL
-- job_number - The DOB job application number assigned when the applicant begins the application. This is the unique identifier for the application submitted to the Department of Buildings (DOB).
-- units_res - The number of residential units as reported by dcp_housing database
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unitsres is coming from PLUTO

-- units_res - The number of residential units as reported by dcp_housing database
-- units_co - The number of units listed on the DOB issued Certificate of Occupancy
-- new_value
-- old_value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would adding definitions of what these fields are be useful?

old_value text
);

INSERT INTO qaqc_housing_units
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are duplicate records in the output table in DO. This may have to do with the CREATE TABLE IF NOT EXISTS and INSERT INTO statements. I confirmed that the duplicates do not appear when querying the database directly.

-- primebbl - Billing BBL
-- bbl - Unit level BBl
-- units - The number of units listed by Department of Finance for the property (compare to units_co in dcp_housing)
-- coop_apts - The number of coop apartments listed for the property
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the number of residential units

-- old_value - The previous number of units as reported by the pluto_correction file


CREATE TABLE IF NOT EXISTS qaqc_pts_condo(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are duplicate records in the output table in DO. This may have to do with the CREATE TABLE IF NOT EXISTS and INSERT INTO statements. I confirmed that the duplicates do not appear when querying the database directly.

-- select only corrections to unitsres field
corrections_subset as (
SELECT *
FROM pluto_corrections
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're no longer pulling in pluto_corrections per PR #425 so this needs to be changed.

-- select only corrections to unitsres field
corrections_subset as (
SELECT *
FROM pluto_corrections
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're no longer pulling in pluto_corrections per PR #425 so this needs to be changed.

@fvankrieken
Copy link
Contributor

@AmandaDoyle @damonmcc let's check in on this pr this afternoon?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Catch incorrect unit totals for condos
4 participants