Case Study

Aegis

ML-powered predictive crime safety platform visualizing temporal risk across urban communities.

Overview

Aegis is a cross-platform predictive crime safety platform built with Flutter and FastAPI. It leverages XGBoost-based machine learning models trained on Chicago Open Data to forecast crime risk across 77 community areas. The system provides temporal forecasting (year, month, hour) and interactive heatmap visualization for proactive safety awareness.

System Architecture

High-Level Design

HLD

Low-Level Design

LLD

Key Features

ML-Powered Risk Prediction

XGBoost model trained on temporal and spatial features to forecast crime risk levels.

Interactive Heatmap Visualization

Custom-rendered Chicago community map using Flutter CustomPainter with dynamic risk gradients.

Temporal Forecast Controls

Predict safety risk by selecting year, month, and hour with real-time API updates.

Efficient State Management

Riverpod-powered architecture with API caching to reduce redundant network calls.

Scalability & Performance

Stateless FastAPI prediction endpoints

PostgreSQL indexing for spatial-temporal queries

Modular ML pipeline enabling retraining and multi-city expansion

API response caching for performance optimization

Challenges

  • Engineering meaningful temporal + spatial features from raw crime data
  • Optimizing XGBoost model for balanced bias-variance tradeoff
  • Rendering 77-community SVG maps efficiently in Flutter
  • Designing prediction APIs for low-latency mobile usage

Trade-offs

  • Selected XGBoost over deep learning models for structured tabular performance and faster inference.
  • Used community-level granularity instead of street-level prediction to balance accuracy and reliability.
  • Chose REST-based architecture over real-time streaming to simplify deployment.

Learnings

  • Hands-on experience deploying ML models in production-ready APIs.
  • Improved understanding of feature engineering for time-series prediction.
  • Learned how to balance UX responsiveness with backend computation cost.
  • Strengthened full-stack integration between Flutter frontend and Python backend.