Skip to content

Latest commit

History

420 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

NYC DOT SIM Analyst Toolkit

Python 3.9+License: MIT30+ Visualizations75+ Features

A unified Streamlit Mission Control dashboard and Python CLI toolkit for NYC DOT analysts. It ingests live Socrata open data, runs Bayesian SLA forecasting, performs spatial conflict detection, and surfaces 30+ interactive visualizations — all backed by a DuckDB L2 cache and a natural-language query interface powered by the Claude API.


Feature Matrix

FeatureStatus
Streamlit Mission Control
GIS Dashboard (10 charts)
Advanced Analytics (13 charts)
Spatial Conflict Detection
Contract Analytics & Gantt
Bayesian SLA Forecasting
DuckDB L2 Cache
Nightly Prefetch Scheduler
NL Query (Claude API)
PDF/Excel/PPTX Reports
CLI Analyst Commands
Data Quality Scorecard

Architecture

┌─────────────────────────────────────────────┐
│ NYC DOT SIM Analyst Toolkit │
├──────────────┬──────────────┬────────────────┤
│ Streamlit │ CLI Toolkit │ Python API │
│ Mission │ socrata │ socrata_ │
│ Control │ commands │ toolkit │
├──────────────┴──────────────┴────────────────┤
│ Data Layer │
│ ┌──────────────┐ ┌───────────────────┐ │
│ │ Socrata SODA │ │ L2 Parquet Cache │ │
│ │ NYC Open Data│ │ DuckDB Store │ │
│ └──────────────┘ └───────────────────┘ │
└─────────────────────────────────────────────┘

Quickstart

pip install -e ".[mission]"
streamlit run app/app.py
# CLI:
socrata --help
socrata dataset health
socrata nl-query "How many inspections per borough?" --dataset sidewalk_inspections

Open http://localhost:8501 — demo mode loads automatically (no token needed).

With live data: add SOCRATA_APP_TOKEN=your_token to a .env file.


Dataset Registry

All 26 datasets are defined in config/datasets.yaml and loaded at runtime.

KeyDescriptionFourfourCategory
inspectionSMD Inspectiondntt-gqwqcore_smd
violationsSMD Violations6kbp-uz6mcore_smd
builtSMD Builtugc8-s3f6core_smd
lot_infoSMD Lot Infoi642-2fxqcore_smd
reinspectionSMD ReInspectiongx72-kirfcore_smd
tree_damageAll Tree Damagej6v2-6uxqcore_smd
dismissalsSidewalk Dismissal Inspection Trackingp4u2-3jgxcore_smd
correspondencesSidewalk Correspondencesbheb-sjficore_smd
curb_metal_protrudingCurb Metal Protruding Datai2y3-sx2ecore_smd
ramp_locationsPedestrian Ramp Locationsufzp-rrquaccessibility
ramp_complaintsRamp Complaintsjagj-gttdaccessibility
ramp_progressRamp Program Progresse7gc-ub6zaccessibility
street_permitsStreet Construction Permitstqtj-sjs8coordination
weekly_constructionWeekly Construction Scheduler528-jckscoordination
capital_blocksCapital Reconstruction Blocksjvk9-k4recoordination
capital_intersectionsCapital Reconstruction Projects - Intersection97nd-ff3icoordination
street_construction_inspectionsStreet Construction Inspections (HIQA)ydkf-mpxbcoordination
street_closures_blockStreet Closures by Blocki6b5-j7bucoordination
permit_stipulationsStreet Construction Permit Stipulationsgsgx-6efwcoordination
street_resurfacing_scheduleStreet Resurfacing Schedulexnfm-u3k5coordination
street_resurfacing_inhouseDOT In-house Street Resurfacing Projectsffaf-8mrvcoordination
step_streetsStep Streets Locationsu9au-h79yoverlays
sidewalk_planimetricPlanimetric Sidewalksvfx9-tbb6overlays
pedestrian_demandPedestrian Demandfwpa-qxafoverlays
mapplutoMapPLUTO6fi9-q3taoverlays
complaints_311311 Sidewalk/Curberm2-nwe9overlays

CLI Reference

CommandDescription
socrata conflict-detect --borough MNDetect spatial conflicts
socrata report contractGenerate contract report
socrata dataset health --all --stale 7 --sort-by stalenessCheck dataset status (row count, staleness, emptiness)
socrata dataset ramp-analysis --full-corpus --borough MNAnalyze pedestrian ramp completion rates by borough
socrata cache refresh <key>Refresh L2 cache
socrata export <key> --format csvExport dataset
socrata nl-query "<question>"Natural language query

Environment Variables

VariableDescriptionRequired
SOCRATA_APP_TOKENSocrata API tokenNo
ANTHROPIC_API_KEYClaude API key for NL queriesNo
SLACK_WEBHOOK_URLSlack alerts webhookNo
SOCRATA_CACHE_DIRL2 cache directoryNo

Docker

docker build -f Dockerfile.mission -t mission-control .
docker run -p 8501:8501 --env-file .env mission-control

Development

# Run tests
python -m pytest tests/ -q --tb=short
# Lint
ruff check src/socrata_toolkit tests app
# Format
black src/socrata_toolkit tests app

Local Pre-Push Testing

Before pushing to main, run the CI simulation on your local Python version to catch failures early:

# Simulates GitHub Actions matrix (ruff + pytest) on current Python version
make ci-check

This runs the same quality checks that GitHub Actions will run on Python 3.10, 3.11, and 3.12:

  • Ruff linting — Validates code style and correctness (E, F, W, I, UP, B rules)
  • Pytest — Runs unit and integration test suite (excluding heavy tests)

The workflow matrix is defined in .github/workflows/python-package.yml and tests against Python 3.10, 3.11, and 3.12. The make ci-check target acts as a local pre-flight check on your current Python version to save CI time.

See CONTRIBUTING.md for the full development guide.


Documentation

DocDescription
CONTRIBUTING.mdDevelopment setup and PR guidelines
CHANGELOG.mdVersion history
CLAUDE.mdAI assistant guidance for this repo
data-analytics-skills/QUICKSTART.md31-skill analytics library

Built for NYC DOT Sidewalk Inspection & Management · Powered by NYC Open Data

About

A pipeline to pull and analyze SIM unit data from NYC Open Data.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages