-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Chicago cbd boundary to
default.vw_pin_universe
(#372)
* Initial test * replace file year * Add cleaning function * Invoke cbd function in clean_economy function * Initial work on cta * Changes to cta * Add cbd num * Add vw_pin_universe * Switch ctas to num * Add to location view * Add to location fill * Add cbd to dbt docs * Remove Chicago * Move to econ * Add join * Change to data_year * Add to crosswalk year fill * Add join * lintr * lint * lintr --------- Co-authored-by: Sweaty Handshake <william.ridgeway@cookcountyil.gov>
- Loading branch information
1 parent
739a4ba
commit 14095e2
Showing
9 changed files
with
348 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,146 +1,148 @@ | ||
-- Source of truth view for PIN location | ||
SELECT | ||
-- Main PIN-level attribute data from iasWorld | ||
par.parid AS pin, | ||
SUBSTR(par.parid, 1, 10) AS pin10, | ||
par.taxyr AS year, | ||
REGEXP_REPLACE(par.class, '([^0-9EXR])', '') AS class, | ||
twn.triad_name, | ||
twn.triad_code, | ||
twn.township_name, | ||
leg.user1 AS township_code, | ||
REGEXP_REPLACE(par.nbhd, '([^0-9])', '') AS nbhd_code, | ||
leg.taxdist AS tax_code, | ||
NULLIF(leg.zip1, '00000') AS zip_code, | ||
|
||
-- Centroid of each PIN from county parcel files | ||
sp.lon, | ||
sp.lat, | ||
sp.x_3435, | ||
sp.y_3435, | ||
|
||
-- Corner lot indicator | ||
lot.is_corner_lot AS ccao_is_corner_lot, | ||
|
||
-- PIN locations from spatial joins | ||
vwl.census_block_group_geoid, | ||
vwl.census_block_geoid, | ||
vwl.census_congressional_district_geoid, | ||
vwl.census_county_subdivision_geoid, | ||
vwl.census_place_geoid, | ||
vwl.census_puma_geoid, | ||
vwl.census_school_district_elementary_geoid, | ||
vwl.census_school_district_secondary_geoid, | ||
vwl.census_school_district_unified_geoid, | ||
vwl.census_state_representative_geoid, | ||
vwl.census_state_senate_geoid, | ||
vwl.census_tract_geoid, | ||
vwl.census_zcta_geoid, | ||
vwl.census_data_year, | ||
vwl.census_acs5_congressional_district_geoid, | ||
vwl.census_acs5_county_subdivision_geoid, | ||
vwl.census_acs5_place_geoid, | ||
vwl.census_acs5_puma_geoid, | ||
vwl.census_acs5_school_district_elementary_geoid, | ||
vwl.census_acs5_school_district_secondary_geoid, | ||
vwl.census_acs5_school_district_unified_geoid, | ||
vwl.census_acs5_state_representative_geoid, | ||
vwl.census_acs5_state_senate_geoid, | ||
vwl.census_acs5_tract_geoid, | ||
vwl.census_acs5_data_year, | ||
vwl.cook_board_of_review_district_num, | ||
vwl.cook_board_of_review_district_data_year, | ||
vwl.cook_commissioner_district_num, | ||
vwl.cook_commissioner_district_data_year, | ||
vwl.cook_judicial_district_num, | ||
vwl.cook_judicial_district_data_year, | ||
vwl.ward_num, | ||
vwl.ward_name, | ||
vwl.ward_chicago_data_year, | ||
vwl.ward_evanston_data_year, | ||
vwl.chicago_community_area_num, | ||
vwl.chicago_community_area_name, | ||
vwl.chicago_community_area_data_year, | ||
vwl.chicago_industrial_corridor_num, | ||
vwl.chicago_industrial_corridor_name, | ||
vwl.chicago_industrial_corridor_data_year, | ||
vwl.chicago_police_district_num, | ||
vwl.chicago_police_district_data_year, | ||
vwl.econ_coordinated_care_area_num, | ||
vwl.econ_coordinated_care_area_data_year, | ||
vwl.econ_enterprise_zone_num, | ||
vwl.econ_enterprise_zone_data_year, | ||
vwl.econ_industrial_growth_zone_num, | ||
vwl.econ_industrial_growth_zone_data_year, | ||
vwl.econ_qualified_opportunity_zone_num, | ||
vwl.econ_qualified_opportunity_zone_data_year, | ||
vwl.env_flood_fema_sfha, | ||
vwl.env_flood_fema_data_year, | ||
vwl.env_flood_fs_factor, | ||
vwl.env_flood_fs_risk_direction, | ||
vwl.env_flood_fs_data_year, | ||
vwl.env_ohare_noise_contour_no_buffer_bool, | ||
vwl.env_ohare_noise_contour_half_mile_buffer_bool, | ||
vwl.env_ohare_noise_contour_data_year, | ||
vwl.env_airport_noise_dnl, | ||
vwl.env_airport_noise_data_year, | ||
vwl.school_elementary_district_geoid, | ||
vwl.school_elementary_district_name, | ||
vwl.school_secondary_district_geoid, | ||
vwl.school_secondary_district_name, | ||
vwl.school_unified_district_geoid, | ||
vwl.school_unified_district_name, | ||
vwl.school_school_year, | ||
vwl.school_data_year, | ||
vwl.tax_municipality_num, | ||
vwl.tax_municipality_name, | ||
vwl.tax_school_elementary_district_num, | ||
vwl.tax_school_elementary_district_name, | ||
vwl.tax_school_secondary_district_num, | ||
vwl.tax_school_secondary_district_name, | ||
vwl.tax_school_unified_district_num, | ||
vwl.tax_school_unified_district_name, | ||
vwl.tax_community_college_district_num, | ||
vwl.tax_community_college_district_name, | ||
vwl.tax_fire_protection_district_num, | ||
vwl.tax_fire_protection_district_name, | ||
vwl.tax_library_district_num, | ||
vwl.tax_library_district_name, | ||
vwl.tax_park_district_num, | ||
vwl.tax_park_district_name, | ||
vwl.tax_sanitation_district_num, | ||
vwl.tax_sanitation_district_name, | ||
vwl.tax_special_service_area_num, | ||
vwl.tax_special_service_area_name, | ||
vwl.tax_tif_district_num, | ||
vwl.tax_tif_district_name, | ||
vwl.tax_data_year, | ||
vwl.access_cmap_walk_id, | ||
vwl.access_cmap_walk_nta_score, | ||
vwl.access_cmap_walk_total_score, | ||
vwl.access_cmap_walk_data_year, | ||
vwl.misc_subdivision_id, | ||
vwl.misc_subdivision_data_year | ||
FROM {{ source('iasworld', 'pardat') }} AS par | ||
LEFT JOIN {{ source('iasworld', 'legdat') }} AS leg | ||
ON par.parid = leg.parid | ||
AND par.taxyr = leg.taxyr | ||
AND leg.cur = 'Y' | ||
AND leg.deactivat IS NULL | ||
LEFT JOIN {{ source('spatial', 'parcel') }} AS sp | ||
ON SUBSTR(par.parid, 1, 10) = sp.pin10 | ||
AND par.taxyr = sp.year | ||
LEFT JOIN {{ ref('location.vw_pin10_location') }} AS vwl | ||
ON SUBSTR(par.parid, 1, 10) = vwl.pin10 | ||
AND par.taxyr = vwl.year | ||
LEFT JOIN {{ source('spatial', 'township') }} AS twn | ||
ON leg.user1 = CAST(twn.township_code AS VARCHAR) | ||
LEFT JOIN {{ source('ccao', 'corner_lot') }} AS lot | ||
ON SUBSTR(par.parid, 1, 10) = lot.pin10 | ||
|
||
WHERE par.cur = 'Y' | ||
AND par.deactivat IS NULL | ||
-- Remove any parcels with non-numeric characters | ||
-- or that are not 14 characters long | ||
AND REGEXP_COUNT(par.parid, '[a-zA-Z]') = 0 | ||
AND LENGTH(par.parid) = 14 | ||
-- Source of truth view for PIN location | ||
SELECT | ||
-- Main PIN-level attribute data from iasWorld | ||
par.parid AS pin, | ||
SUBSTR(par.parid, 1, 10) AS pin10, | ||
par.taxyr AS year, | ||
REGEXP_REPLACE(par.class, '([^0-9EXR])', '') AS class, | ||
twn.triad_name, | ||
twn.triad_code, | ||
twn.township_name, | ||
leg.user1 AS township_code, | ||
REGEXP_REPLACE(par.nbhd, '([^0-9])', '') AS nbhd_code, | ||
leg.taxdist AS tax_code, | ||
NULLIF(leg.zip1, '00000') AS zip_code, | ||
|
||
-- Centroid of each PIN from county parcel files | ||
sp.lon, | ||
sp.lat, | ||
sp.x_3435, | ||
sp.y_3435, | ||
|
||
-- Corner lot indicator | ||
lot.is_corner_lot AS ccao_is_corner_lot, | ||
|
||
-- PIN locations from spatial joins | ||
vwl.census_block_group_geoid, | ||
vwl.census_block_geoid, | ||
vwl.census_congressional_district_geoid, | ||
vwl.census_county_subdivision_geoid, | ||
vwl.census_place_geoid, | ||
vwl.census_puma_geoid, | ||
vwl.census_school_district_elementary_geoid, | ||
vwl.census_school_district_secondary_geoid, | ||
vwl.census_school_district_unified_geoid, | ||
vwl.census_state_representative_geoid, | ||
vwl.census_state_senate_geoid, | ||
vwl.census_tract_geoid, | ||
vwl.census_zcta_geoid, | ||
vwl.census_data_year, | ||
vwl.census_acs5_congressional_district_geoid, | ||
vwl.census_acs5_county_subdivision_geoid, | ||
vwl.census_acs5_place_geoid, | ||
vwl.census_acs5_puma_geoid, | ||
vwl.census_acs5_school_district_elementary_geoid, | ||
vwl.census_acs5_school_district_secondary_geoid, | ||
vwl.census_acs5_school_district_unified_geoid, | ||
vwl.census_acs5_state_representative_geoid, | ||
vwl.census_acs5_state_senate_geoid, | ||
vwl.census_acs5_tract_geoid, | ||
vwl.census_acs5_data_year, | ||
vwl.cook_board_of_review_district_num, | ||
vwl.cook_board_of_review_district_data_year, | ||
vwl.cook_commissioner_district_num, | ||
vwl.cook_commissioner_district_data_year, | ||
vwl.cook_judicial_district_num, | ||
vwl.cook_judicial_district_data_year, | ||
vwl.ward_num, | ||
vwl.ward_name, | ||
vwl.ward_chicago_data_year, | ||
vwl.ward_evanston_data_year, | ||
vwl.chicago_community_area_num, | ||
vwl.chicago_community_area_name, | ||
vwl.chicago_community_area_data_year, | ||
vwl.chicago_industrial_corridor_num, | ||
vwl.chicago_industrial_corridor_name, | ||
vwl.chicago_industrial_corridor_data_year, | ||
vwl.chicago_police_district_num, | ||
vwl.chicago_police_district_data_year, | ||
vwl.econ_coordinated_care_area_num, | ||
vwl.econ_coordinated_care_area_data_year, | ||
vwl.econ_enterprise_zone_num, | ||
vwl.econ_enterprise_zone_data_year, | ||
vwl.econ_industrial_growth_zone_num, | ||
vwl.econ_industrial_growth_zone_data_year, | ||
vwl.econ_qualified_opportunity_zone_num, | ||
vwl.econ_qualified_opportunity_zone_data_year, | ||
vwl.econ_central_business_district_num, | ||
vwl.econ_central_business_district_data_year, | ||
vwl.env_flood_fema_sfha, | ||
vwl.env_flood_fema_data_year, | ||
vwl.env_flood_fs_factor, | ||
vwl.env_flood_fs_risk_direction, | ||
vwl.env_flood_fs_data_year, | ||
vwl.env_ohare_noise_contour_no_buffer_bool, | ||
vwl.env_ohare_noise_contour_half_mile_buffer_bool, | ||
vwl.env_ohare_noise_contour_data_year, | ||
vwl.env_airport_noise_dnl, | ||
vwl.env_airport_noise_data_year, | ||
vwl.school_elementary_district_geoid, | ||
vwl.school_elementary_district_name, | ||
vwl.school_secondary_district_geoid, | ||
vwl.school_secondary_district_name, | ||
vwl.school_unified_district_geoid, | ||
vwl.school_unified_district_name, | ||
vwl.school_school_year, | ||
vwl.school_data_year, | ||
vwl.tax_municipality_num, | ||
vwl.tax_municipality_name, | ||
vwl.tax_school_elementary_district_num, | ||
vwl.tax_school_elementary_district_name, | ||
vwl.tax_school_secondary_district_num, | ||
vwl.tax_school_secondary_district_name, | ||
vwl.tax_school_unified_district_num, | ||
vwl.tax_school_unified_district_name, | ||
vwl.tax_community_college_district_num, | ||
vwl.tax_community_college_district_name, | ||
vwl.tax_fire_protection_district_num, | ||
vwl.tax_fire_protection_district_name, | ||
vwl.tax_library_district_num, | ||
vwl.tax_library_district_name, | ||
vwl.tax_park_district_num, | ||
vwl.tax_park_district_name, | ||
vwl.tax_sanitation_district_num, | ||
vwl.tax_sanitation_district_name, | ||
vwl.tax_special_service_area_num, | ||
vwl.tax_special_service_area_name, | ||
vwl.tax_tif_district_num, | ||
vwl.tax_tif_district_name, | ||
vwl.tax_data_year, | ||
vwl.access_cmap_walk_id, | ||
vwl.access_cmap_walk_nta_score, | ||
vwl.access_cmap_walk_total_score, | ||
vwl.access_cmap_walk_data_year, | ||
vwl.misc_subdivision_id, | ||
vwl.misc_subdivision_data_year | ||
FROM {{ source('iasworld', 'pardat') }} AS par | ||
LEFT JOIN {{ source('iasworld', 'legdat') }} AS leg | ||
ON par.parid = leg.parid | ||
AND par.taxyr = leg.taxyr | ||
AND leg.cur = 'Y' | ||
AND leg.deactivat IS NULL | ||
LEFT JOIN {{ source('spatial', 'parcel') }} AS sp | ||
ON SUBSTR(par.parid, 1, 10) = sp.pin10 | ||
AND par.taxyr = sp.year | ||
LEFT JOIN {{ ref('location.vw_pin10_location') }} AS vwl | ||
ON SUBSTR(par.parid, 1, 10) = vwl.pin10 | ||
AND par.taxyr = vwl.year | ||
LEFT JOIN {{ source('spatial', 'township') }} AS twn | ||
ON leg.user1 = CAST(twn.township_code AS VARCHAR) | ||
LEFT JOIN {{ source('ccao', 'corner_lot') }} AS lot | ||
ON SUBSTR(par.parid, 1, 10) = lot.pin10 | ||
|
||
WHERE par.cur = 'Y' | ||
AND par.deactivat IS NULL | ||
-- Remove any parcels with non-numeric characters | ||
-- or that are not 14 characters long | ||
AND REGEXP_COUNT(par.parid, '[a-zA-Z]') = 0 | ||
AND LENGTH(par.parid) = 14 |
Oops, something went wrong.