From df828d15c67fb987e98a5846215ca636e24051e2 Mon Sep 17 00:00:00 2001 From: Damon McCullough Date: Thu, 14 May 2026 16:33:49 -0400 Subject: [PATCH 1/3] add not_null_if_other_not_null test for opname --- products/facilities/models/product/_product.yml | 4 ++++ .../tests/generic/not_null_if_other_not_null.sql | 9 +++++++++ 2 files changed, 13 insertions(+) create mode 100644 products/facilities/tests/generic/not_null_if_other_not_null.sql diff --git a/products/facilities/models/product/_product.yml b/products/facilities/models/product/_product.yml index b2b4cfaaf3..f6244b865b 100644 --- a/products/facilities/models/product/_product.yml +++ b/products/facilities/models/product/_product.yml @@ -18,3 +18,7 @@ models: parent_column: '"FACSUBGRP"' - name: '"FACSUBGRP"' tests: [ not_null ] + - name: '"OPNAME"' + tests: + - not_null_if_other_not_null: + other_column_name: '"OPABBREV"' diff --git a/products/facilities/tests/generic/not_null_if_other_not_null.sql b/products/facilities/tests/generic/not_null_if_other_not_null.sql new file mode 100644 index 0000000000..0377d6ab74 --- /dev/null +++ b/products/facilities/tests/generic/not_null_if_other_not_null.sql @@ -0,0 +1,9 @@ +{% test not_null_if_other_not_null(model, column_name, other_column_name) %} +-- Asserts that whenever `other_column_name` is not null, +-- `column_name` is also not null. +-- Fails on any row where `other_column_name` IS NOT NULL but `column_name` IS NULL. +select * +from {{ model }} +where {{ other_column_name }} is not null + and {{ column_name }} is null +{% endtest %} From ee79f021518fd0d1652e8e72a8c69f915a3e8737 Mon Sep 17 00:00:00 2001 From: Damon McCullough Date: Sat, 16 May 2026 12:13:10 -0400 Subject: [PATCH 2/3] add opname mappings --- products/facilities/facdb/sql/pipelines/dcp_colp.sql | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/products/facilities/facdb/sql/pipelines/dcp_colp.sql b/products/facilities/facdb/sql/pipelines/dcp_colp.sql index 489ef9bb57..7d6599c3d6 100644 --- a/products/facilities/facdb/sql/pipelines/dcp_colp.sql +++ b/products/facilities/facdb/sql/pipelines/dcp_colp.sql @@ -332,6 +332,13 @@ WITH _dcp_colp_tmp AS ( WHEN agency = 'TBTA' THEN 'Metropolitan Transportation Authority' WHEN agency = 'TLC' THEN 'NYC Taxi and Limousine Commission' WHEN agency = 'UNKN' THEN 'NYC Unknown' + WHEN agency = 'BOC' THEN 'NYC Board of Correction' + WHEN agency = 'CNTYC' THEN 'County Clerk' + WHEN agency = 'DVS' THEN 'NYC Department of Veterans'' Services' + WHEN agency = 'EEPC' THEN 'NYC Equal Employment Practices Commission' + WHEN agency = 'NYS' THEN 'New York State' + WHEN agency = 'OTHP' THEN 'Other Public' + WHEN agency = 'RGB' THEN 'NYC Rent Guidelines Board' END ) AS opname, ( From 208af75f72453c65eb43e99a5f55159ef686418e Mon Sep 17 00:00:00 2001 From: Damon McCullough Date: Sat, 16 May 2026 13:08:39 -0400 Subject: [PATCH 3/3] fix new colp usetyp mapping --- products/facilities/facdb/sql/pipelines/dcp_colp.sql | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/products/facilities/facdb/sql/pipelines/dcp_colp.sql b/products/facilities/facdb/sql/pipelines/dcp_colp.sql index 7d6599c3d6..763c4235e2 100644 --- a/products/facilities/facdb/sql/pipelines/dcp_colp.sql +++ b/products/facilities/facdb/sql/pipelines/dcp_colp.sql @@ -40,6 +40,7 @@ WITH _dcp_colp_tmp AS ( WHEN agency LIKE '%DEP%' AND usetype LIKE '%TESTING LABORATORY%' THEN 'Environmental Testing Laboratory' WHEN agency LIKE '%CUNY%' AND usetype LIKE '%RESIDENTIAL%' THEN 'University Residential Structure' WHEN agency LIKE '%HHC%' AND usetype LIKE '%RESIDENTIAL%' THEN 'Hospital Residential Structure' + WHEN agency LIKE '%HHC%' AND usetype LIKE '%EMERGENCY MEDICL STN%' THEN 'Emergency Medical Station' ELSE initcap(replace(usetype, 'OTHER ', '')) END ) AS factype, @@ -119,7 +120,8 @@ WITH _dcp_colp_tmp AS ( usetype LIKE '%TRANSIT%' AND usetype NOT LIKE '%TRANSITIONAL%' ) THEN 'Rail Yards and Maintenance' - WHEN usetype LIKE '%BUS%' THEN 'Bus Depots and Terminals' -- Health and Human + WHEN usetype LIKE '%BUS%' THEN 'Bus Depots and Terminals' + WHEN usetype LIKE '%EMERGENCY MEDICL STN%' THEN 'Other Emergency Services' WHEN agency LIKE '%HHC%' THEN 'Hospitals and Clinics' WHEN usetype LIKE '%HOSPITAL%' THEN 'Hospitals and Clinics' WHEN usetype LIKE '%AMBULATORY HEALTH%' THEN 'Hospitals and Clinics' @@ -203,7 +205,6 @@ WITH _dcp_colp_tmp AS ( AND usetype LIKE '%COURT%' THEN 'Courthouses and Judicial' WHEN agency LIKE '%CORR%' THEN 'Detention and Correctional' WHEN usetype LIKE '%AMBULANCE%' THEN 'Other Emergency Services' - WHEN usetype LIKE '%EMERGENCY MEDICAL%' THEN 'Other Emergency Services' WHEN usetype LIKE '%FIREHOUSE%' THEN 'Fire Services' WHEN usetype LIKE '%POLICE STATION%' THEN 'Police Services' WHEN