NYCPlanning / db-developments

🏠 🏘️ 🏗️ Developments Database
https://nycplanning.github.io/db-developments
8 stars 2 forks source link

Enhancement 22Q2: Existing and Proposed Zoning Use Group #592

Closed td928 closed 2 years ago

td928 commented 2 years ago

New data from DOB NOW includes the existing and proposed zoning use group for a project.

TO DO:

  1. Add the two columns as new columns
  2. Parse the content and ensure repeated use groups are consolidated into one for each column
mbh329 commented 2 years ago

@td928 Do you have the proposed column names written down anywhere? realized that I don't have them in my notes

td928 commented 2 years ago

ZoningUG_init ZoningUG_prop I came up with this based on what is currently in the data dictionary @mbh329

AmandaDoyle commented 2 years ago

@mbh329 Does this help? This gets you distinct values ordered in the column as an array. Happy to help workshop to get exactly what you're looking for, but if it's too hard to implement this in one fell swoop we can always add a script.

SELECT DISTINCT ARRAY(
SELECT DISTINCT e 
FROM unnest(
ARRAY[string_to_array(
regexp_replace(
        trim(LOWER(existing_zoning_used_group)),
        '[^\wa-z0-9,]+', '','g'),',')]) AS a(e)
ORDER BY e)
FROM dob_now_applications_test AS t(a,b,c,d)
LIMIT 1000;