2
2
3
3
found = []
4
4
5
+ # Read through an export of the City of Chicago Land Inventory, filtering to only buildings with
6
+ # the status 'Owned by City' and Managing Organization = 'AIS'
7
+ #
8
+ # Source: https://data.cityofchicago.org/Community-Economic-Development/City-Owned-Land-Inventory/aksk-kvfp
9
+ #
10
+ # This script will then log the correctly formatted data, and you can copy that into
11
+ # buildings-custom-info.constant
5
12
def find_addresses ():
6
13
with open ('src/data/source/City-Owned_Land_Inventory.csv' ) as source_file :
7
14
city_file = csv .DictReader (source_file )
8
15
MAIN_FILE_ADDRESS_INDEX = 4
9
16
MAIN_FILE_ID_INDEX = 1
10
-
17
+
11
18
with open ('src/data/source/ChicagoEnergyBenchmarking.csv' , newline = '' ) as all_data :
12
19
whole_file = all_data .read ().splitlines ()
13
20
for i , line in enumerate (city_file ):
14
21
if line ["Address" ].strip () == "" or line ["Property Status" ] != "Owned by City" :
15
22
continue
23
+
16
24
for j , whole_file_line in enumerate (whole_file ):
17
25
print (i , j )
18
26
address = whole_file_line .split ("," )[MAIN_FILE_ADDRESS_INDEX ]
27
+
28
+ # Only include buildings that are owned AND managed by the city. Some buildings
29
+ # are on land that appears to be owned by the city from their inventory
19
30
if line ["Address" ].lower ().strip ().replace (" " , "" ) == address .lower ().strip ().replace (" " , "" ) and line ["Managing Organization" ] == "AIS" :
20
31
found .append (whole_file_line .split ("," )[MAIN_FILE_ID_INDEX ])
21
32
break
22
-
33
+
23
34
if i % 50 == 49 :
24
35
with open ("temp.txt" , "w" ) as f :
25
36
f .write (str (len (found )))
26
37
f .write ("/n" )
27
38
f .write (", " .join (found ))
28
-
39
+
29
40
print ("found addresses: " , found .__str__ (), len (found ))
30
41
31
42
def print_tags ():
@@ -39,4 +50,4 @@ def print_tags():
39
50
found .remove (line ["ID" ])
40
51
41
52
find_addresses ()
42
- print_tags ()
53
+ print_tags ()
0 commit comments