Repository: nycdb/nycdb (language: python)

Issue:
DOB Safety Violations layout change
We got this error when updating the `dob_safety_violations` dataset. Seems like they changed the file layout, so we'll need to update our yaml

```
{'bin': '3116942', 'violationissuedate': '01/06/2006', 'violationnumber': '010606LL629112840', 'violationtype': 'LL6291', 'violationremarks': '', 'violationstatus': 'Active', 'devicenumber': '30000070181Y0001', 'devicetype': 'Boiler', 'cycleenddate': '12/31/2005', 'borough': 'Brooklyn', 'block': '5091', 'lot': '7', 'housenumber': '803', 'street': 'ROGERS AVENUE', 'city': 'New York', 'state': 'New York', 'postcode': '11226', 'latitude': '40.651182', 'longitude': '-73.952513', 'communityboard': '317', 'councildistrict': '40', 'bbl': '3050910007', 'censustract2020': '820', 'neighborhoodtabulationareanta2020': 'East Flatbush-Erasmus'}

  File "/app/load_dataset.py", line 410, in <module>
    main()
  File "/app/load_dataset.py", line 406, in main
    load_dataset(dataset)
  File "/app/load_dataset.py", line 344, in load_dataset
    ds.db_import()
  File "/usr/local/lib/python3.9/site-packages/nycdb/dataset.py", line 86, in db_import
    self.import_schema(schema)
  File "/usr/local/lib/python3.9/site-packages/nycdb/dataset.py", line 132, in import_schema
    batch = list(itertools.islice(rows, 0, BATCH_SIZE))
  File "/usr/local/lib/python3.9/site-packages/nycdb/typecast.py", line 233, in cast_rows
    yield self.cast_row(row)
  File "/usr/local/lib/python3.9/site-packages/nycdb/typecast.py", line 244, in cast_row
    d[column] = self.cast[column.lower()](val)
KeyError: 'postcode'
```


Discussion / hints:

Fix patch:
diff --git a/src/nycdb/datasets/dob_safety_violations.yml b/src/nycdb/datasets/dob_safety_violations.yml
index 8c550806..7f7cc0da 100644
--- a/src/nycdb/datasets/dob_safety_violations.yml
+++ b/src/nycdb/datasets/dob_safety_violations.yml
@@ -24,5 +24,12 @@ schema:
     state: text
     zip: text
     bbl: char(10)
+    postcode: text
+    latitude: double precision
+    longitude: double precision
+    communityboard: text
+    councildistrict: text
+    censustract2020: text
+    neighborhoodtabulationareanta2020: text
 sql:
 - dob_safety_violations.sql
\ No newline at end of file


Test patch:
diff --git a/src/tests/integration/data/dob_safety_violations.csv b/src/tests/integration/data/dob_safety_violations.csv
index 8ac18bb2..b832deac 100644
--- a/src/tests/integration/data/dob_safety_violations.csv
+++ b/src/tests/integration/data/dob_safety_violations.csv
@@ -1,6 +1,10 @@
-BIN,Violation Issue Date,Violation Number,Violation Type,Violation Remarks,Violation Status,Device Number,Device Type,Cycle End Date,Borough,Block,Lot,House Number,Street,City,State,Zip
-4438381,06/01/2016,060116EJVCAT500419,E,,Active,4P5577,Elevator,,MANHATTAN,8401,6,249-14 A,GRAND CENTRAL PARKWAY,New York,New York,11426  
-4438381,10/03/2017,100317EACJ100203,E,,Active,4P5577,Elevator,,MANHATTAN,8401,6,249-14 A,GRAND CENTRAL PARKWAY,New York,New York,11426    
-3001729,12/17/2021,121721EEVCAT500708,E,,Active,3P14612,Elevator,,MANHATTAN,234,1,23,PIERREPONT STREET,New York,New York,11201
-3119942,06/20/2023,062023LBLVIO40932,LBLVIO,VIOLATION ISSUED-FAILURE TO FILE 2019 EXTERNAL LOW PRESSURE INSPECTION,Active,30000072606N0001,Boiler,,BROOKLYN,5193,0,1173,ROGERS AVENUE,New York,New York,11226
-3336806,04/25/2023,042523LBLVIO14451,LBLVIO,VIOLATION ISSUED - FAILURE TO FILE 2022 EXTERNAL LOW PRESSURE INSPECTION,Active,30000097526N0001,Boiler,,BROOKLYN,638,0,64,20 STREET,New York,New York,11232
\ No newline at end of file
+BIN,Violation Issue Date,Violation Number,Violation Type,Violation Remarks,Violation Status,Device Number,Device Type,Cycle End Date,Borough,Block,Lot,House Number,Street,City,State,Postcode,Latitude,Longitude,Community Board,Council District,BBL,Census Tract (2020),Neighborhood Tabulation Area (NTA) (2020)
+3116942,01/06/2006,010606LL629112840,LL6291,,Active,30000070181Y0001,Boiler,12/31/2005,Brooklyn,5091,7,803,ROGERS AVENUE,New York,New York,11226,40.651182,-73.952513,317,40,3050910007,820,East Flatbush-Erasmus
+4233155,03/01/2013,030113LBLVIO15727,LBLVIO,VIOLATION ISSUED FOR FAILURE TO FILE ANNUAL BOILER 2011 INSPECTION REPORT,Active,40000054750N0001,Boiler,11/15/2011,Queens,10898,2,198-03,HOLLIS AVENUE,New York,New York,11412,40.706401,-73.759408,412,27,4108980002,506,Hollis
+3205018,06/20/2023,062023LBLVIO39206,LBLVIO,VIOLATION ISSUED-FAILURE TO FILE 2019 EXTERNAL LOW PRESSURE INSPECTION,Active,30000041009Y0001,Boiler,12/31/2019,Brooklyn,7463,49,1801,VOORHIES AVENUE,New York,New York,11235,40.58605,-73.950924,315,48,3074630049,600,Sheepshead Bay-Manhattan Beach-Gerritsen Beach
+4238340,01/06/2006,010606LL629122660,LL6291,,Active,40000074513N0001,Boiler,12/31/2005,Queens,11066,1,194-15,LINDEN BOULEVARD,New York,New York,11412,40.693003,-73.757516,412,27,4110660001,528,St. Albans
+2021170,06/20/2023,062023LBLVIO31057,LBLVIO,VIOLATION ISSUED-FAILURE TO FILE 2019 EXTERNAL LOW PRESSURE INSPECTION,Active,20000164250N0001,Boiler,12/31/2019,Bronx,3510,29,486,HOWE AVENUE,New York,New York,10473,40.816277,-73.848467,209,18,2035100029,84,Castle Hill-Unionport
+2047876,11/08/2019,110819LBLVIO03726,LBLVIO,VIOLATION ISSUED FOR FAILURE TO FILE ANNUAL BOILER 2017 INSPECTION REPORT,Active,20000011757Y0001,Boiler,12/31/2017,Bronx,4256,14,1980,UNIONPORT ROAD,New York,New York,10462,40.850287,-73.868588,211,13,2042560014,230,Pelham Parkway-Van Nest
+1087701,10/23/2023,VIO-FTC-VT-CAT1-202112-0004936,FTC-VT-CAT1-CO,Violation Issued-Failure To File 2021 Cat1 Test Affirmation of Correction,Active,1E20710,Elevator,12/31/2021,Manhattan,793,7507,605,6 AVENUE,New York,New York,10011,40.739609,-73.995211,104,3,1007937507,81,Chelsea-Hudson Yards
+2056241,10/01/2015,100115LBLVIO04018,LBLVIO,VIOLATION ISSUED FOR FAILURE TO FILE ANNUAL BOILER 2014 INSPECTION REPORT,Active,20000064145N0001,Boiler,12/31/2014,Bronx,4596,15,3234,WHITE PLAINS ROAD,New York,New York,10467,40.872136,-73.867123,212,12,2045960015,374,Williamsbridge-Olinville
+1081110,10/23/2023,VIO-FTC-VT-CAT1-202212-0008409,FTC-VT-CAT1-HA,Violation Issued-Failure To File 2022 Cat1 Test Affirmation of Correction,Dismissed,1P22202,Elevator,12/31/2022,Manhattan,1757,1,2175,5 AVENUE,New York,New York,10037,40.81125,-73.938718,111,9,1017570001,210,East Harlem (North)
diff --git a/src/tests/integration/test_nycdb.py b/src/tests/integration/test_nycdb.py
index 950fa474..406685b1 100644
--- a/src/tests/integration/test_nycdb.py
+++ b/src/tests/integration/test_nycdb.py
@@ -765,7 +765,7 @@ def test_dob_safety_violations(conn):
     drop_table(conn, 'dob_safety_violations')
     dob_safety_violations = nycdb.Dataset('dob_safety_violations', args=ARGS)
     dob_safety_violations.db_import()
-    assert row_count(conn, 'dob_safety_violations') == 5
+    assert row_count(conn, 'dob_safety_violations') == 9
 
 
 def test_shapefile_in_alt_schema_works(conn):