Skip to content

Commit c7fd0d8

Browse files
Upload CT scorecard data (#316)
We're still missing the parking lot and boundaries, but this gets the city stats uploaded at least. This demonstrates that some entries are too long: <img width="280" alt="Screenshot 2025-01-26 at 6 49 17 PM" src="https://github.com/user-attachments/assets/0646b02b-3b15-42f6-b89e-a5f319e43cbd" /> JSON was generated with this script: ```python import csv import json from pathlib import Path def read_data() -> list[dict[str, str]]: with Path("ct-scripts/ct-scorecards.csv").open(newline="") as csvfile: reader = csv.DictReader(csvfile) return sorted(reader, key=lambda row: row["Name"]) def name_to_id(v: str) -> str: return v.lower().replace(" - ", "-").replace(" ", "-") def fix_percentage(v: str) -> str: num = float(v.replace("%", "")) return f"{round(num)}%" def transform_data(csv_data: list[dict[str, str]]) -> dict[str, dict[str, str | None]]: return { name_to_id(row["Name"]): { "name": row["Name"], "percentage": fix_percentage(row["Parking %"]), "population": "121,054", "transitStation": row["Transit Station"] or None, "county": row["County"], } for row in csv_data } def main() -> None: csv_data = read_data() transformed_data = transform_data(csv_data) Path("packages/ct/data/city-stats.json").write_text(json.dumps(transformed_data)) if __name__ == "__main__": main() ```
1 parent 2e1318e commit c7fd0d8

File tree

10 files changed

+1442
-60
lines changed

10 files changed

+1442
-60
lines changed

packages/ct/data/city-boundaries.geojson

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
{
1212
"type": "Feature",
1313
"properties": {
14-
"id": "hartford"
14+
"id": "hartford-downtown"
1515
},
1616
"geometry": {
1717
"type": "Polygon",
@@ -171,7 +171,7 @@
171171
{
172172
"type": "Feature",
173173
"properties": {
174-
"id": "new-haven"
174+
"id": "new-haven-downtown"
175175
},
176176
"geometry": {
177177
"type": "Polygon",

0 commit comments

Comments
 (0)