Back to Portfolio
AI Product
GitHub

Bangkok Air Quality (BAQ)

MLOps Engineer

Bangkok Air Quality (BAQ)

Impact

End-to-end PM2.5 forecasting system with CI/CD & MLOps.

Overview

The Problem: The Invisible Silent Killer

Bangkok's skyline is often shrouded in a grey haze—not fog, but PM2.5. This invisible killer fluctuates wildly, making it hard for citizens to plan their outdoor activities or for vulnerable groups to protect themselves. Existing forecasts are often too broad or lack the historical context needed for localized precision. We needed a system that didn't just report the air quality, but understood its temporal patterns.

The Solution: End-to-End MLOps

BAQ (Bangkok Air Quality) isn't just a forecasting model; it's a complete MLOps ecosystem. We built a robust pipeline that ingests meteorological data, processes it through advanced feature engineering, and serves predictions via a scalable API.
MLOps Architecture

Figure: MLOps Architecture

Technical Architecture

We architected a system that bridges the gap between raw data and actionable insights using a modern tech stack.
Tech Stack

Figure: Tech Stack

1. Smart Data Ingestion & Engineering

Air quality depends on more than just previous pollution levels. We engineered a dataset that captures the full environmental context:
  • Temporal Cyclical Encoding: Converting linear time (hours, months) into cyclical sine/cosine features to let models "understand" that midnight follows 11 PM.
  • Meteorological Fusion: Integrating temperature, humidity, wind patterns, and UV indices.
  • Lag & Rolling Features: Creating 100+ derived features to capture short-term spikes and long-term trends.
  • Robust Cleaning: Automated handling of missing values using seasonal medians to prevent data drift artifacts.

2. Multi-Model Forecasting Engine

We didn't rely on a single algorithm. instead, we benchmarked and deployed a suite of models to handle different forecasting horizons:
  • LSTM (Deep Learning): A dual-layer Long Short-Term Memory network designed to capture complex, non-linear temporal dependencies over long sequences. Features early stopping and dropout for robustness.
  • XGBoost & Random Forest: Tree-based ensembles that excel at feature interaction and provide a robust baseline for shorter-term predictions.

3. Production-Grade MLOps & CI/CD

The core of BAQ is reliability. We moved beyond "it works on my machine" to a fully automated deployment strategy.
  • Experiment Tracking: Integrated Weights & Biases (W&B) to track every experiment, visualizing loss curves and hyperparameter impacts in real-time.
  • Human-in-the-Loop CD: Our CI/CD pipeline runs automated unit tests on every commit, but model promotion explicitly requires human approval. This ensures that no model goes live without expert validation.
  • Dynamic Artifact Loading: We decoupled the model artifacts from the code, allowing us to hot-swap improved models without rebuilding Docker containers.

Why This Matters

BAQ demonstrates that tackling environmental challenges requires more than just good data science—it requires robust Software Engineering. By applying MLOps availability principles to climate data, we create systems that are reliable enough for public safety.

🔗 Project Resources

MLOpsAirflowFastAPILSTMDocker

Gallery Overview

Bangkok Air Quality (BAQ) gallery image
Bangkok Air Quality (BAQ) gallery image

Siwarat Laoprom © 2026