How kaxil07/3d-printer-maintenance works
Project Type and Purpose
• This is a full-stack application combining a React/TypeScript frontend, a Python/Flask backend that hosts ML models, and a simple data persistence layer. Its goal is to ingest real-time printer data, run predictive analytics, generate alerts, and present dashboards and reports to users.
High-Level Component Identification
From the file tree and README, the main components are:
a. External Data Sources
• 3D printers or simulated sensor streams (temperature, vibration, flow, power, environment).
b. Data Ingestion & API Layer
• Flask app (model/src/api.py, api_new.py, wsgi.py)
• Configuration & validation modules (model/src/config.py, maintenance_rules.py)
c. Data Storage
• Historical CSV files (model/data/data.csv) or a time-series/relational DB if added
d. Analytics Engine
• Preprocessor and predictive models (.pkl files in model/models & model/src/models)
• Training pipeline (train_model.py, printer_dataset.py)
e. Alert & Notification Manager
• Logic in maintenance_rules.py + alert endpoints served by the API
f. Cost-Benefit Engine
• Calculation modules invoked by the API and exposed via REST (frontend uses costBenefitService.ts)
g. Frontend Application
• Vite + React + TypeScript (src/, public/)
• Component hierarchy under src/components/ (Dashboard, MaintenancePanel, PredictionPage, etc.)
• Service layer under src/services/ for each API endpoint (printer data, maintenance, prediction, costBenefit, printerManagement)
h. CI/CD and Deployment
• GitHub Actions (.github/workflows/deploy.yml)
• Environment files (.env.*), DEPLOYMENT.md
Relationships & Data Flows
• Sensors → Flask API (HTTP/WebSocket) → Data validation → Data store
• Flask API → Analytics Engine → Predictions & health scores
• Analytics Engine → Alert Manager → Alert queue/notification service
• Flask API ↔ Frontend (REST endpoints for real-time metrics, alerts, cost-benefit, maintenance tasks)
• Frontend → User interactions (submit new printers, trigger manual predictions)
Architectural Patterns & Design Principles
• Layered Architecture:
• Presentation (React UI)
• Application / API (Flask)
• Domain / Analytics (ML models + rules)
• Data (CSV or database)
• Separation of Concerns: each service in the frontend and each module in the backend has a focused responsibility
• Modular ML pipeline: preprocessor, model inference, and training are decoupled
• Extensibility: plugin-style rules in maintenance_rules.py and swappable ML models
Putting It All Together
• Middle section, left to right:
1. Flask API
2. Data Validation & Storage
3. Analytics Engine (Preprocessor + Model)
4. Alert Manager & Cost-Benefit Engine
• Bottom section: Frontend UI components consuming API