NYCPlanning / ceqr-app-data-archive

(DEPRECATED)data pipelines for CEQR app, managed by data engineering
https://github.com/NYCPlanning/ceqr-app-data
1 stars 1 forks source link

Purge the DEP CATS permtis #52

Closed baolingz closed 4 years ago

baolingz commented 4 years ago

Purge the dep_cats_permits using the following logic

All Cancelled permits All G-prefix permits All C-prefix + Registration (including Registration, Boiler Registration II, and Registration Inspection) All CA-Prefix + Work Permit + Expired permits

baolingz commented 4 years ago
SELECT COUNT(*) FROM dep_cats_permits.latest
WHERE TRIM(status) != 'CANCELLED'
AND LEFT(applicationid, 1) != 'G'
AND (LEFT(applicationid, 1) != 'C' OR (requesttype != 'REGISTRATION' AND requesttype != 'REGISTRATION INSPECTION' AND requesttype != 'BOILER REGISTRATION II'))
AND (LEFT(applicationid, 2) != 'CA' OR requesttype != 'WORK PERMIT' OR TRIM(status) != 'EXPIRED')
;