Skip to content

Commit

Permalink
fix city script
Browse files Browse the repository at this point in the history
  • Loading branch information
SuragNuthulapaty committed Jan 17, 2024
1 parent ca06b2c commit 0ef3afe
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 32 deletions.
14 changes: 6 additions & 8 deletions src/constants/buildings-custom-info.constant.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1315,10 +1315,10 @@ export const BuildingsCustomInfo: { [buildingSlug: string]: IBuildingCustomInfo
* City of Chicago
* Helpful source: https://www.chicago.gov/city/en/depts/dcd/supp_info/city-owned_land_inventory.html
*/
// 400 W Superior St
'103812': { owner: BuildingOwners.cityofchicago.key },
// Chicago Indoor Sports
'120015': { owner: BuildingOwners.cityofchicago.key },
// Damen Marketplace
'254152': { owner: BuildingOwners.cityofchicago.key },
// City Hall
'250115': { owner: BuildingOwners.cityofchicago.key },
// Harold Washington Library
Expand All @@ -1329,14 +1329,12 @@ export const BuildingsCustomInfo: { [buildingSlug: string]: IBuildingCustomInfo
'250058': { owner: BuildingOwners.cityofchicago.key },
// Sulzer Library
'250065': { owner: BuildingOwners.cityofchicago.key },
// Lake Village East Apartments
'252070': { owner: BuildingOwners.cityofchicago.key },
// // Museum of Science and Industry
// '102460': { owner: BuildingOwners.cityofchicago.key },
// 1533 W.Warren Blvd
'256759': { owner: BuildingOwners.cityofchicago.key },
// Englewood Health Center
'250057': { owner: BuildingOwners.cityofchicago.key },
// // Gallery 37
// '250063': { owner: BuildingOwners.cityofchicago.key },
// Gallery 37
'250063': { owner: BuildingOwners.cityofchicago.key },
// CDOT Central Office
'250066': { owner: BuildingOwners.cityofchicago.key },
};
Expand Down
44 changes: 20 additions & 24 deletions src/data/scripts/find_city_buildings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import csv

found = []
found = set()

# Read through an export of the City of Chicago Land Inventory, filtering to only buildings with
# the status 'Owned by City' and Managing Organization = 'AIS'
Expand All @@ -14,34 +14,30 @@ def clean_address(address):
return address.lower().strip().replace(" ", "").replace(".", "")

def find_addresses():
benchmark_buildings = {}
with open('src/data/source/City-Owned_Land_Inventory.csv') as source_file:
city_file = csv.DictReader(source_file)
MAIN_FILE_ADDRESS_INDEX = 4
MAIN_FILE_ID_INDEX = 1

with open('src/data/source/ChicagoEnergyBenchmarking.csv', newline='') as all_data:
whole_file = all_data.read().splitlines()
for i, line in enumerate(city_file):
if line["Address"].strip() == "" or line["Property Status"] != "Owned by City":
continue

for j, whole_file_line in enumerate(whole_file):
print(i, j)
address = whole_file_line.split(",")[MAIN_FILE_ADDRESS_INDEX]

# Only include buildings that are owned AND managed by the city. Some buildings
# are on land that appears to be owned by the city from their inventory
if clean_address(line["Address"]) == clean_address(address) and line["Managing Organization"] == "AIS":
found.append(whole_file_line.split(",")[MAIN_FILE_ID_INDEX])
break

if i%50 == 49:
with open("temp.txt", "w") as f:
f.write(str(len(found)))
f.write("/n")
f.write(", ".join(found))

print("found addresses: ", found.__str__(), len(found))
for i, line in enumerate(city_file):
if line["Property Status"] == "Owned by City" and line["Managing Organization"] == "AIS":
benchmark_buildings[clean_address(line["Address"])] = 0

with open('src/data/source/ChicagoEnergyBenchmarking.csv', newline='') as all_data:
whole_file = all_data.read().splitlines()
for i, line in enumerate(whole_file):
address = line.split(",")[MAIN_FILE_ADDRESS_INDEX]
if clean_address(address) in benchmark_buildings:
found.add(line.split(",")[MAIN_FILE_ID_INDEX])

if i%50 == 49:
with open("temp.txt", "w") as f:
f.write(str(len(found)))
f.write("/n")
f.write(", ".join(found))

print("found addresses: ", found.__str__(), len(found))

def print_tags():
with open('src/data/source/ChicagoEnergyBenchmarking.csv', newline='') as all_data:
Expand Down

0 comments on commit 0ef3afe

Please sign in to comment.