Skip to content

Instantly share code, notes, and snippets.

View stevevance's full-sized avatar
🏠
Working from home

Steven Vance stevevance

🏠
Working from home
View GitHub Profile
@stevevance
stevevance / two_flats_with_coach_houses.sql
Created November 24, 2023 18:30
Finding assessed values of two-flats in Chicago with and without coach houses
/* select properties with coach houses */
with properties as (select
pt.pin14,
pt.total_assessed_value,
pin_num_cards > 1 as has_coach_house
from assessor_single_mf_characteristics AS ac inner join propertytaxes_combined AS pt on ac.pin = pt.pin14
where year = '2023'
and city = 'CHICAGO'
and property_Class = '2-11'
and ac.units = 2
@stevevance
stevevance / population_density_in_adu_pilot_areas.sql
Created March 22, 2023 00:50
A query that counts the number of people in Census blocks that overlap Chicago's five ADU pilot areas.
WITH place_for_cra_lending AS (
SELECT
geom,
st_area(geom) AS area,
st_buffer(geom, 150) AS geom_buffer
FROM view_places WHERE type = 'chicagoadupilotarea'
), blockgroups as (SELECT
vp.metadata AS geoid,
@stevevance
stevevance / affordable_lasalle.md
Last active February 15, 2023 16:32
affordability requirements for use of city funds in LaSalle Street Reimagined

Affordable Housing

Text from page 11 of the City of Chicago LaSalle Street Reimagined Invitation for Proposals

Housing proposals must provide at least 30% of the total units as on-site affordable units. The affordable units must be affordable to households earning up to 60% of Area Median Income (AMI), as updated annually, provided that (a) the maximum income level for any affordable unit may not exceed 80% of the AMI, (b) at least one-third must be affordable to households at or below 50% of the AMI, of which one-sixth must be affordable to households at or below 40% of the AMI, and (c) all income levels must be multiples of 10% of the AMI.

A selected developer can sell or lease the affordable units to an authorized agency, provided the rental subsidy by the authorized agency to the landlord combined with the rent paid by the eligible household may not exceed an amount affordable to households at 100% of the AMI, unless otherwise permitted by federal or state law. The authorized agency must sign a 30-

@stevevance
stevevance / zoning_capacity_by_communityarea.tsv
Created October 10, 2022 20:16
community areas ordered by zoned dwelling unit capacity
units communityarea
396565 Loop
175567 Near North Side
129848 Near West Side
65285 Lake View
47508 Grand Boulevard
45747 South Shore
44116 West Town
42172 Uptown
39826 Lincoln Park
@stevevance
stevevance / chicago_zoning_capacity.sql
Created October 10, 2022 20:02
Query to calculate how many dwelling units are allowed at each parcel in Chicago
with properties as (
SELECT
data.pin14 AS pin14,
ca.community,
joined_2.zone_class AS zone_class,
CASE WHEN lot_area_per_unit IS NOT NULL AND lot_area_per_unit > 0 AND property_class != '2-99'
/* this excludes condos, property class of 2-99, because those parcels are duplicates of the footprint parcel */
THEN floor(area/lot_area_per_unit)
ELSE null
END AS units_allowed
@stevevance
stevevance / cast_dates.sql
Created October 9, 2022 00:13
handle invalid dates in Illinois Secretary of State incorporation data
create or replace function is_date(s varchar) returns boolean as $$
/* function via https://stackoverflow.com/a/25374982 */
begin
perform s::date;
return true;
exception when others then
return false;
end;
$$ language plpgsql;
@stevevance
stevevance / adjacent_parcels.sql
Created January 25, 2022 03:03
How to find adjacent parcels
/* thanks to https://stackoverflow.com/a/12521268/464883 for help writing the query */
/* find 2 parcels that share an edge */
SELECT DISTINCT v1.pin14, v1.property_class
FROM view_cook_scavenger_sale_2022 v1
WHERE EXISTS (
SELECT v2.pin14 FROM view_cook_scavenger_sale_2022 v2
WHERE st_touches(v1.geom, v2.geom)
and v2.area >= 3000
)
@stevevance
stevevance / gist:fd12a4fbd6a2fc7e33ad71601809f44d
Created December 10, 2021 00:23
Reverse geocoders both think that this Chicago address is in Elmwood Park
api_key='ge-feb60a22792061e2'
curl --get https://api.geocode.earth/v1/reverse \
-d api_key=$api_key \
-d point.lat=41.9305 \
-d point.lon=-87.79511
curl https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode \
-d 'f=pjson' \
-d 'location=-87.79511,41.9305' \
@stevevance
stevevance / foia_request_treasurer_list_of_pins.txt
Created October 27, 2021 17:18
FOIA request language for data in the public interest
Pursuant to the Illinois Freedom of Information Act., I hereby request the following records:
A list of the 14-digit PINs that were active in the 2019 property tax year, preferably in a spreadsheet form like XLS, XLSX, or CSV.
I think that fees should be waived. Publishing a list of properties, identified by their PIN, in the 2019 property tax year is in the public interest because it enables the public to have more insight and transparency around the Cook County property taxing processes which were largely opaque until the Chicago Tribune investigation in 2017 that identified multiple issues.
This list is the basic starting point to any analysis because it shows which properties are active in that and can be analyzed for their tax revenue contributions and compared to previous years.
The requested documents will be made available to the general public, and this request is not being made for commercial purposes.
@stevevance
stevevance / developments_2021_07_05.txt
Last active July 5, 2021 18:22
Significant Neighborhood Development as of July 5, 2021
This text accompanies a tweet posted on Monday, July 5, 2021, at 13:21, that says, "We show "significant neighborhood developments" on our homepage to demonstrate the variety of things happening across the city...What are we missing?" Three images depicting maps were attached.
https://twitter.com/ChiBuildings/status/1412114349871751170
This is the alternative text for the locations and projects shown on the three maps.
Red Line riders who use Lawrence, Argyle, Berwyn, and Bryn Mawr can look forward to brand new stations and faster service by 2025.
A new CTA station will open at Green Line at Damen/Lake, but construction hasn't started.
A landmarked house where Emmett Till grew up and where his mother, Mamie Till-Mobley, lived as she did civil rights activism, will become a house museum to be developed by Blacks In Green.
A landmarked house that once belonged to McKinley Morganfield, known professionally as Muddy Waters, a famous Chicago Blues musician, is being developed into a house museum.
Chicago's pla