Manufacturing Execution System Dashboard — portfolio demonstration. Time-series telemetry, quality views, and ML anomaly detection
This is a sanitized public version of a real-world prototype. Client names, credentials, internal endpoints, and proprietary assets have been removed; all configuration is environment-driven (
.env.example). Authored by Paul Cleenewerck.
Manufacturing Execution System Dashboard
A proof-of-concept MES dashboard demonstrating MongoDB Time Series collections and aggregation pipelines for real-time manufacturing analytics, serving Manufacturing Group Malaysia's OEMPartner motorcycle assembly operations.
This solution provides a modern Manufacturing Execution System (MES) dashboard built on MongoDB Atlas, designed to demonstrate:
| Capability | Description |
|---|---|
| Time Series Analytics | Efficient storage and querying of high-frequency machine telemetry data using MongoDB Time Series collections |
| Cross-Department Insights | Pre-computed materialized views serving Quality, Operations, and Anomaly Detection teams with sub-100ms response times |
| ML-Ready Architecture | Feature engineering pipeline with anomaly detection using Isolation Forest and Random Forest models |
| Scalable Foundation | Architecture designed to evolve from batch processing to real-time streaming via Change Streams or Atlas Stream Processing |
The system monitors 14 machines across 4 assembly lines (Frame Welding, Engine Assembly, Paint Shop, Final Assembly), processing telemetry at 1-minute intervals and generating actionable insights for production optimization.
DATA INGESTION
|
v
+------------------+ +------------------+ +------------------+
| Data Generator |------->| MongoDB Atlas |<-------| ML Pipeline |
| (Telemetry) | | (Time Series) | | (Anomaly Det.) |
+------------------+ +--------+---------+ +------------------+
|
+----------------+----------------+
| |
+-------v--------+ +-------v--------+
| Quality Views | | Operations |
| mv_quality_* | | Views |
| (Pre-computed) | | mv_production_*|
+-------+--------+ +-------+--------+
| |
+----------------+----------------+
|
+--------v--------+
| FastAPI |
| REST API |
+--------+--------+
|
+--------v--------+
| SvelteKit |
| Dashboard |
+-----------------+
| Layer | Technology | Purpose |
|---|---|---|
| Frontend | SvelteKit 5 + Tailwind CSS | Interactive dashboard with real-time charts |
| Backend | FastAPI + PyMongo Async | RESTful API with async database operations |
| Database | MongoDB Atlas (Time Series) | Telemetry storage with automatic compression |
| ML Engine | Scikit-learn / PySpark | Anomaly detection and feature engineering |
| Dashboard | Purpose | Data Source |
|---|---|---|
| Overview | KPI summary across all lines | Aggregated from all views |
| Quality | Defect rates, alert analysis, quality scores | mv_quality_core, mv_quality_analytics |
| Operations | Production output, utilization, downtime | mv_production_core, mv_production_analytics |
| Anomalies | ML-detected anomalies, severity breakdown | anomaly_detections |
| Telemetry | Raw sensor data exploration | machine_telemetry |
Pre-computed aggregations eliminate expensive real-time queries:
| View | Refresh | Window | Purpose |
|---|---|---|---|
mv_quality_core |
15 min | 24 hours | Real-time quality KPIs |
mv_quality_analytics |
30 min | 7 days | Machine health trends |
mv_production_core |
15 min | 24 hours | Production metrics |
mv_production_analytics |
30 min | 7 days | Efficiency analysis |
| Model | Type | Use Case |
|---|---|---|
| Isolation Forest | Unsupervised | Outlier detection without labels |
| Random Forest | Supervised | Anomaly type classification |
Detected anomaly types: temperature_spike, vibration_anomaly, power_surge, cycle_degradation, bearing_failure
| Metric | Raw Query | Materialized View | Improvement |
|---|---|---|---|
| Quality Dashboard | ~2.5s | <100ms | 25x faster |
| Operations Dashboard | ~2.0s | <100ms | 20x faster |
| Documents Scanned | 600,000+ | 20-100 | 6000x fewer |
- Python 3.11+
- Node.js 18+
- MongoDB Atlas account (M0 free tier or higher)
# Navigate to project
cd ManufacturingOEM-MES
# Configure backend environment
cd backend
cp .env.example .envEdit backend/.env with your MongoDB Atlas credentials:
# MongoDB Atlas Connection (REQUIRED)
MONGODB_URI=mongodb+srv://<username>:<password>@<cluster>.mongodb.net/?retryWrites=true&w=majority
MONGODB_DATABASE=ManufacturingOEM_db
# Application Settings
APP_ENV=development
APP_DEBUG=true
TIMEZONE=Asia/Kuala_LumpurImportant: Replace
<username>,<password>, and<cluster>with your actual MongoDB Atlas credentials. These are placeholder values only.
cd backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Generate sample data (7 days by default, or specify days)
python generate_assembly_line_data.py 7
# Refresh materialized views (REQUIRED after data generation)
python refresh_views.py
# Start the API server
uvicorn app.main:app --host 0.0.0.0 --port 8000cd frontend
# Install dependencies
npm install
# Start development server
npm run dev| Service | URL |
|---|---|
| Dashboard | http://localhost:5173 |
| API | http://localhost:8000 |
| API Documentation | http://localhost:8000/docs |
| Health Check | http://localhost:8000/health |
The data generator creates realistic telemetry data with:
- Shift patterns (Morning, Evening, Night)
- Weekend production reduction
- Scheduled maintenance windows
- 2% anomaly injection rate for ML training
# Generate 7 days of data (default)
python generate_assembly_line_data.py
# Generate 30 days of data
python generate_assembly_line_data.py 30Important: After generating data, materialized views must be refreshed to populate the dashboards.
# Refresh all views
python refresh_views.py
# Refresh specific views
python refresh_views.py --view quality
python refresh_views.py --view production
python refresh_views.py --type analyticsNote on Real-Time Updates: This POC uses scheduled batch refresh for materialized views. Automatic real-time refresh via MongoDB Change Streams or Atlas Stream Processing was not implemented for this demo. For production deployment, consider implementing Change Streams for near real-time updates or Atlas Stream Processing for complex streaming transformations.
| Collection | Type | Description |
|---|---|---|
machine_telemetry |
Time Series | Raw sensor readings (1-minute granularity) |
machines |
Document | Machine reference data and thresholds |
mv_quality_core |
Document | Pre-computed quality metrics (24h) |
mv_quality_analytics |
Document | Machine health scores (7 days) |
mv_production_core |
Document | Pre-computed production stats (24h) |
mv_production_analytics |
Document | Weekly efficiency metrics |
anomaly_detections |
Document | ML pipeline output |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/dashboard/summary |
Lightweight KPI summary |
| GET | /api/v1/dashboard/quality |
Quality department metrics |
| GET | /api/v1/dashboard/operations |
Operations/production metrics |
| GET | /api/v1/dashboard/anomalies |
Anomaly detection summary |
| GET | /api/v1/dashboard/lines |
Assembly line reference data |
| POST | /api/v1/dashboard/views/refresh |
Trigger view refresh |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/telemetry |
Query telemetry with filters |
| GET | /api/v1/telemetry/latest |
Latest reading per machine |
| GET | /api/v1/telemetry/machines |
Machine reference data |
| GET | /api/v1/telemetry/stats |
Aggregated statistics |
| GET | /api/v1/telemetry/anomalies |
Anomaly readings |
| Parameter | Endpoints | Description |
|---|---|---|
line_id |
telemetry, stats | Filter by assembly line |
machine_id |
telemetry, stats | Filter by machine |
status |
telemetry | Filter by status (running/idle/maintenance/error) |
start_date |
telemetry, stats | Start of date range (ISO format) |
end_date |
telemetry, stats | End of date range (ISO format) |
limit |
telemetry | Max records to return |
| Line ID | Name | Machines | Description |
|---|---|---|---|
| LINE-1 | Frame Welding | WLD-001, WLD-002, WLD-003 | Robotic welding stations |
| LINE-2 | Engine Assembly | ENG-001 to ENG-004 | Crankshaft, Piston, Cylinder Head, Transmission |
| LINE-3 | Paint Shop | PNT-001, PNT-002 | Paint booths with curing |
| LINE-4 | Final Assembly | FIN-001 to FIN-005 | Electrical, Fuel, Wheels, Body, QC |
ManufacturingOEM-MES/
├── backend/
│ ├── app/
│ │ ├── api/v1/routes/ # API endpoints
│ │ ├── aggregations/ # Materialized view pipelines
│ │ ├── ml/ # ML models and feature engineering
│ │ ├── models/ # Pydantic schemas
│ │ ├── services/ # Business logic
│ │ ├── config.py # Environment settings
│ │ ├── database.py # MongoDB connection
│ │ └── main.py # FastAPI application
│ ├── generate_assembly_line_data.py # Sample data generator
│ ├── refresh_views.py # View refresh utility
│ ├── requirements.txt
│ └── .env.example
├── frontend/
│ ├── src/
│ │ ├── lib/ # Components, API client, stores
│ │ └── routes/ # Page components
│ ├── package.json
│ └── tailwind.config.js
├── TECHNICAL_OVERVIEW.md # Detailed architecture documentation
└── README.md
For production, schedule materialized view refreshes:
# Core pipelines - every 15 minutes
*/15 * * * * cd /path/to/backend && python refresh_views.py --type core
# Analytics pipelines - every 30 minutes
*/30 * * * * cd /path/to/backend && python refresh_views.py --type analytics| Setting | Recommended |
|---|---|
| Cluster Tier | M10+ (for Stream Processing) |
| Storage | Auto-scaling enabled |
| Backup | Continuous backup |
| Retention | 90 days (configured in collection) |
- TECHNICAL_OVERVIEW.md - Detailed architecture, aggregation pipelines, and future enhancement options including Change Streams and Atlas Stream Processing
- Backend: Python 3.11+, FastAPI, PyMongo Async
- Frontend: SvelteKit 5, Svelte 5, Tailwind CSS 4, Chart.js
- Database: MongoDB Atlas with Time Series Collections
- ML: Scikit-learn, NumPy, (optional) PySpark
Manufacturing Group Malaysia - OEMPartner Assembly Line MES Dashboard