How mob-imam-79/airguard-intelligent-air-quality-prediction works
AirGuard is an air-quality prediction and environmental intelligence application. Users submit eight pollutant and weather measurements through the React predictor or model-comparison view; the API validates and processes inputs, produces AQI estimates and health guidance, and stores prediction history. The product also exposes authentication, dashboards, analytics, exports, account tools, and an administrator suite for users, datasets, models, monitoring, and system reports. Edges reflect the sampled calls and README-documented architecture; unsampled feature wiring is represented conservatively.
Main entry points: App.jsx React routes · api.js API client · prediction_service.py Prediction service · database.py SQL database
Components 23
User application
- React routes
frontend/src/App.jsx - Auth context
frontend/src/context/AuthContext.jsx - Prediction views
frontend/src/pages/Prediction.jsx - Model comparison
frontend/src/pages/ModelComparison.jsx - History and charts
frontend/src/pages/History.jsx - Analytics and dashboard
frontend/src/pages/Analytics.jsx - Reports center
frontend/src/pages/Reports.jsx - Admin suite
frontend/src/pages/admin - API client
frontend/src/services/api.js
API and services
- FastAPI application
backend/app/main.py - Authentication
backend/app/services/auth_service.py - API routes
backend/app/api - Report generation
backend/app/services/report_service.py - Runtime configuration
backend/app/config.py
Prediction engine
- Prediction service
backend/app/services/prediction_service.py - Input preprocessing
backend/app/services/preprocessor.py - AQI classification
backend/app/services/classifier.py - Health advisories
backend/app/services/health_advisory.py - Model training
backend/app/ml/train.py
Data and administration
- SQL database
backend/app/database.py - Users, inputs, predictions
backend/app/models/prediction.py - Dataset management
backend/app/services/dataset_service.py
Other components
- User or admin
Connections 32
- User or admin → React routes: uses
- React routes → Auth context: provides auth
frontend/src/App.jsx - React routes → Prediction views: routes to
frontend/src/App.jsx - React routes → Model comparison: routes to
frontend/src/App.jsx - React routes → History and charts: routes to
frontend/src/App.jsx - React routes → Analytics and dashboard: routes to
frontend/src/App.jsx - React routes → Reports center: routes to
frontend/src/App.jsx - React routes → Admin suite: routes to
frontend/src/App.jsx - Auth context → API client: calls
frontend/src/context/AuthContext.jsx - Prediction views → API client: requests inference
frontend/src/pages/Prediction.jsx - Model comparison → API client: requests comparison
frontend/src/pages/ModelComparison.jsx - History and charts → API client: requests history
frontend/src/pages/History.jsx - Analytics and dashboard → API client: requests analytics
- Reports center → API client: requests exports
- Admin suite → API client: requests admin actions
frontend/src/pages/admin/AdminDashboard.jsx - API client → FastAPI application: HTTP JSON
- FastAPI application → API routes: registers
backend/app/main.py - FastAPI application → SQL database: initializes
backend/app/main.py - FastAPI application → Dataset management: seeds dataset
backend/app/main.py - API routes → Authentication: auth dependency
backend/app/api/auth.py - Authentication → SQL database: queries users
backend/app/services/auth_service.py - API routes → Prediction service: dispatches prediction
- Prediction service → Input preprocessing: formats and scales
backend/app/services/prediction_service.py - Prediction service → AQI classification: classifies AQI
backend/app/services/prediction_service.py - Prediction service → Health advisories: gets guidance
backend/app/services/prediction_service.py - Prediction service → SQL database: persists results
backend/app/services/prediction_service.py - API routes → Report generation: exports reports
- Report generation → SQL database: reads predictions
backend/app/services/report_service.py - Dataset management → SQL database: stores metadata
backend/app/services/dataset_service.py - Model training → Prediction service: refreshes models
- Runtime configuration → SQL database: configures
backend/app/database.py - Runtime configuration → Prediction service: sets artifact paths
backend/app/config.py