Widgets

Urbana Housing Inspection Data

Scope.md

Scope

We will be comparing the distribution of Urbana housing inspection grades as compared to that of Urbana residents who are receiving General or Homeless Assistance support.

Information Already Visualized and Data Availability

As this link shows, we already have a distribution of housing inspection grades for the City of Urbana. The default view is for building inspections between March 20 of 2007 and February 7 of 2019. Over that time range:

  • 153 inspections (8% of inspections) resulted in A’s
  • 1,518 inspections (83% of inspectiosn) resulted in B’s
  • 143 inspections (8% of inspections) resulted in C’s
  • 9 inspections (0% of inspections) resulted in D’s
  • 3 inspections (0% of inspections) resulted in F’s

API Service Used

We have access to data using the SODA API developed by Socrata, which appears to be part of the Open Data Network. Documentation of the API is here. I had pre-emptively gotten an app token for us to use in the even that we want up to 1000 API requests per “rolling hour period.” Our token is “Y6VDhjTt1iHtj2RQmX82shXZ7” and ideally this would be used to automatically aggregate public data.

List of Parameters

The parameters are separated by commas and are organized by the type of information provided.

  • Building Inspection Time
  • “expiration date”, “inspection_date”, “inspection_year”
  • Grade
  • “grade”
  • License Status
  • “license_status”
  • Location
  • “mappable_address”, “mappable_address_address”, “mappable_address_city”, “mappable_address_state”, “parcel_number”, “property_adress”
  • Other
  • “:@computed_region_29jt_857g”, “:@computed_region_3h3r_sq6z”
import requests
import json

urbanaBuildingGrades = requests.get("http://data.urbanaillinois.us/resource/2tkj-9e9d.json?$limit=50000")
urbanaBuildingGrades_data = urbanaBuildingGrades.json()
print(urbanaBuildingGrades_data)
print(urbanaBuildingGrades_data[0:9])
print(urbanaBuildingGrades_data[0]["grade"])
print(type(urbanaBuildingGrades_data[0]["grade"]))

Checkpoint

The below code extracts all building inspections and counts the number of A, B, C, D, and F grades.

import requests
import json
import numpy as np

urbanaBuildingGrades = requests.get("http://data.urbanaillinois.us/resource/2tkj-9e9d.json?$limit=50000")
urbanaBuildingGrades_data = urbanaBuildingGrades.json()

ourGrades = np.empty([len(urbanaBuildingGrades_data),1], dtype = "str")
a = 0
b = 0
c = 0
d = 0
f = 0
for k in range(len(urbanaBuildingGrades_data)):
    temporaryGrade = urbanaBuildingGrades_data[k]["grade"]
    ourGrades[k] = temporaryGrade[6]
    if ourGrades[k] == "A":
        a+=1
    elif ourGrades[k] == "B":
        b+=1
    elif ourGrades[k] == "C":
        c+=1
    elif ourGrades[k] == "D":
        d+=1
    elif ourGrades[k] == "F":
        f+=1
print("a",a,"b",b,"c",c,"d",d,"f",f)
a 153 b 1518 c 143 d 9 f 3

Next Checkpoint

The following are building inspections from the year of 2018.

import requests
import json
import numpy as np

urbanaBuildingGrades = requests.get("http://data.urbanaillinois.us/resource/2tkj-9e9d.json?$limit=50000")
urbanaBuildingGrades_data = urbanaBuildingGrades.json()

ourGrades = np.empty([len(urbanaBuildingGrades_data),1], dtype = "str")
a = 0
b = 0
c = 0
d = 0
f = 0
for k in range(len(urbanaBuildingGrades_data)):
    if urbanaBuildingGrades_data[k]["inspection_year"] == "2018":
        temporaryGrade = urbanaBuildingGrades_data[k]["grade"]
        ourGrades[k] = temporaryGrade[6]
        if ourGrades[k] == "A":
            a+=1
        elif ourGrades[k] == "B":
            b+=1
        elif ourGrades[k] == "C":
            c+=1
        elif ourGrades[k] == "D":
            d+=1
        elif ourGrades[k] == "F":
            f+=1
print("a",a,"b",b,"c",c,"d",d,"f",f)
a 24 b 177 c 20 d 0 f 0