Algorithm, Data, and AI Architecture
TerraIQ combines spatial scoring, local market context, and AI-driven intent parsing to keep recommendations aligned with live manual weights.
Data Sources
TerraIQ now uses a blended local dataset model. The base grid is still driven by OSM and H3, but the final recommendation layer also pulls from the new market, transport, demographic, air-quality, and benchmark tables.
OSM Geometry Layers
Road networks, building footprints, POIs, and land use geometry used to anchor the spatial grid.
Population Signals
population_sectors and h3_grid provide density, income, working population, and household context.
Risk & Air Quality
flood_risk, flood_risk_zones, and air_quality provide hazard exposure and environmental pressure.
Transport & Access
transport_access and roads capture access score, traffic pressure, and transit connectivity.
Commercial Demand Layer
competitors, sales_data, monthly_summary, pois, and site_scores calibrate demand and benchmark fit.
Scoring Model
Weighted Linear Combination (WLC)
The heatmap score is still computed with Weighted Linear Combination, but the model now combines normalized population, road, POI, and flood-risk signals from the citywide grid:
AI Reranking and Live Sync
The AI assistant converts the user prompt into business intent, competitor search terms, and initial weights. When the user changes any slider or the minimum population threshold, TerraIQ now re-runs the AI consult with the same prompt and the live weights so the golden site stays synced with the current heatmap.
Contextual Reranking
After the base heatmap is generated, TerraIQ enriches the best candidate hexagons with nearby demographics, transport accessibility, competitor density, air quality, sales activity, and benchmark scores. That extra context is what makes the final golden site more accurate and more explainable.
H3 Hexagonal Aggregation
Scores are computed on an H3 grid so every candidate cell has consistent neighborhood logic. The grid also makes it easier to combine local features like roads, competitors, and population into a single comparable score.
Analysis Pipeline
1. Ingest and aggregate
CSV and GeoJSON sources are loaded into PostGIS, then summarized into H3 cells for base scoring.
2. Score the grid
The heatmap combines population, road access, POI density, and flood risk with the user's current weights.
3. Add business context
Nearby competitors, demand proxies, air quality, and site-score benchmarks refine the final recommendation.
4. Sync the UI
The dashboard re-runs AI consult after slider changes so the displayed golden site always matches the live heatmap.
Technology Stack
The stack is tuned for spatial queries, contextual AI reranking, and interactive dashboards without losing explainability.
PostGIS
Stores spatial geometry, proximity queries, H3 aggregation, and contextual joins across datasets.
FastAPI + AI Services
Runs heatmap scoring, AI intent parsing, competitor retrieval, and contextual reranking.
Next.js
Delivers the interactive dashboard, live sliders, and debounced AI/heatmap synchronization.
H3 Library
Normalizes scoring on hexagonal cells so all metrics stay comparable across the city.
AI Re-Ranking Layer
Turns a business prompt into weights, competitor intent, and contextual golden-site selection.
Explainability Layer
Surfaces component scores, competitor details, and benchmark context in the UI.