NYCPlanning / db-housing

1 stars 3 forks source link

Pull in unit_change value from dcp_attributes #53

Closed AmandaEyer closed 6 years ago

AmandaEyer commented 6 years ago

In DCP corrections attributes, a few records have values for unit_change years. (for instance: 121324717, for 2017 and 2018). Can those be pulled into the final output? Or is this complicated because it's spread over various fields?

AmandaDoyle commented 6 years ago

@AmandaEyer this is done See dcpdataattributes.sql Each unit_change_year filed has a code snippet like the one below UPDATE housing a SET unit_change_2011 = TRIM(b.unit_change_2011), x_dcpedited = TRUE FROM housing_input_dcpattributes b WHERE b.unit_change_2011 ~ '[0-9]' AND a.job_number=b.job_number;

If this logic is not correct let me know

AmandaEyer commented 6 years ago

Thanks! From what I can understand from the logic, it's good. Though I don't understand it all ;)

AmandaDoyle commented 6 years ago

Closing unit_change_year values are being individually assigned based on the corresponding unit_change_year field in dcpdataattributes.sql

AmandaDoyle commented 6 years ago

@AmandaEyer moving from Slack to here Okay so the DCP researched unit change values need to be applied after we calculate those fields.
So confirming - if the DCP researched unite_change_year values is not NULL it will overwrite what has been calculated

AmandaEyer commented 6 years ago

Yes, if the change_year value is not blank, it should be overwritten. Also, NULL means blank, correct? Because in a few instances, DCP entered value would be 0.

AmandaDoyle commented 6 years ago

@AmandaEyer yes, NULL means blank