Inspiration
Ask a general-purpose AI "Can I build a duplex at 1507 Bouldin Ave?" and it responds with absolute certainty—while quietly fabricating setbacks, lot dimensions, and zoning codes. In civic matters, people make high-stakes financial decisions based on public records: renters checking flood risks, small builders budgeting permits, or homeowners investigating neighborhood code compliance. When AI hallucinates civic rules, people pay real penalties.
We were inspired by a radical alternative: grounding by construction. What if an AI assistant never guessed, never hallucinated, cited the exact database query behind every single claim, and deliberately refused to answer when public records lacked supporting evidence? That was the genesis of CivicLens.
What It Does
CivicLens is a civic answer engine for the City of Austin open-data ecosystem. It ingests 9 municipal datasets and provides cited, verified answers for:
- Zoning Feasibility: Looks up parcel zoning (e.g.,
SF-3-NP), verified against live municipal records. - Flood Risk: Intersects parcel polygons with FEMA flood hazard layers and FIRM panels.
- Permit History: Audits over 2.4 million construction permits by street name and parcel history.
- 311 Service Requests: Evaluates infrastructure issues (potholes, code violations) with status timestamps.
- Accountable Citations: Every single fact includes a direct URL query link back to the city's open data API (
data.austintexas.gov) so judges and citizens can audit claims in one click. - Principled Refusal: Declines to state dimensional standards (setbacks, height limits, FAR) from memory; instead, it routes users to governing Land Development Code sections and declines out-of-scope inquiries.
How We Built It
We designed CivicLens with a deterministic, pipeline-first architecture without generative hallucination loops:
- Intent Classification & Slot Extraction: Parses natural-language questions to extract address, intent, radius, and district slots.
- Location Resolution: Cascades through Austin's geocoded address points (
9s7j-tygf) with Nominatim fallback. - Parallel Dataset Enrichment: Runs up to 5 concurrent queries via
ThreadPoolExecutoragainst the Socrata Open Data API (SoQL). - Spatial Geocoding & Filtering:
Because Austin's Socrata instance lacks native radial endpoints (
within_circle), we compute bounding boxes server-side and execute local Haversine calculations: $$d = 2 R \arcsin \left( \sqrt{\sin^2\left(\frac{\Delta \phi}{2}\right) + \cos(\phi_1)\cos(\phi_2)\sin^2\left(\frac{\Delta \lambda}{2}\right)}\right)$$ For polygons (FEMA flood zones, council districts), we use server-sideintersects(geom, 'POINT(lon lat)')and client-side ray-casting point-in-polygon tests. - Confidence Scoring: Blends spatial precision and retrieval evidence: $$\text{Confidence}{\text{final}} = \min(C{\text{base}}, C_{\text{cap}})$$ Where $C_{\text{cap}} = 0.55$ for corridor matches and $1.0$ for exact parcels. When knowledge base retrieval is blended: $$\text{Score} = 0.75 \cdot \text{Confidence}{\text{base}} + 0.25 \cdot \text{Confidence}{\text{KB}}$$
- Stack: Python, FastAPI, Socrata Open Data API (SoQL), SQLite/Disk TTL caching, vanilla HTML/CSS/JS frontend with Leaflet maps.
Challenges We Ran Into
- Socrata Spatial Limitations: The absence of Socrata radial operators required custom geospatial indexing, bounding-box querying, and client-side polygon intersection with hole support.
- Permit Coordinate Gaps: Millions of historical permit records contain no latitude/longitude coordinates. Relying solely on spatial coordinates dropped valid permits; we engineered a street-name normalization fallback to guarantee permit discovery.
- Resisting the LLM Generative Trap: Generative phrasing introduces hallucination risk. We designed deterministic answer builders and citation generators so every value is directly mapped from an API record.
- Handling Data Absences: In public data, absence of evidence is not evidence of absence. We formulated verifiable negative queries (e.g., proving "no historic designation" with an explicit empty query link).
Accomplishments That We're Proud Of
- 100% Evaluation Benchmark: Achieved a 44/44 pass rate across our test suite, including 11 unanswerable questions that CivicLens correctly refused.
- Instant Auditing: Every generated card includes the exact SoQL endpoint URL used to retrieve the data.
- Sub-Second Response Times: Multi-threaded parallel API queries combined with disk-backed TTL caching deliver responsive civic searches without API key requirements.
- Zero Hallucinations by Design: Proof that civic tools do not need generative guesswork to deliver clear answers.
What We Learned
- The Refusal is the Feature: In high-stakes civic contexts, admitting data absence builds far more trust than presenting confident estimates.
- Municipal Data Realities: Real-world civic datasets have discrepancies (missing coordinates, unstandardized abbreviations) that demand resilient normalization pipelines.
- Mathematical Rigor in Civics: Deterministic pipelines combined with formal scoring algorithms provide transparency that opaque neural models cannot match.
What's Next for CivicLens
- Multi-City Portability: Expanding beyond Austin to Dallas, Houston, and other open-data cities by abstracting the Socrata schema catalog.
- Notification Subscriptions: Allowing residents to subscribe to updates on permits or 311 issues within a 500-foot buffer of their home.
- Interactive Zoning Visualizer: Rendering 3D lot envelopes based on zoning classifications and parcel boundaries.
Built With
- css3
- docker
- fastapi
- gis
- html5
- httpx
- javascript
- leaflet.js
- nominatim
- open-data
- openstreetmap
- pydantic
- pytest
- python
- render
- rest-api
- socrata
- soql
- uvicorn
Log in or sign up for Devpost to join the conversation.