How nikdonthala/microplastics works
MicroScan AI is a web app for screening water-sample photos for suspected microplastics. Users upload an image with optional calibration and detection settings; the API returns candidate-particle measurements, morphology classes when a model is available, and visualizable results. The README documents this workflow and additional health, model-status, metrics, and training endpoints. The graph includes the training and synthetic-data capabilities as well as the main analysis path. Some detailed backend call order is not visible in the excerpts, so those connections are omitted rather than inferred.
Main entry points: analysis.py Analysis and model routes · api.ts API client · training_service.py Training pipeline · main.py FastAPI application
Components 20
Web interface
- Screening interface
frontend/src/App.tsx - API client
frontend/src/api.ts - Result charts
frontend/src/charts.tsx
API and contracts
- FastAPI application
backend/app/main.py - Analysis and model routes
backend/app/routes/analysis.py - Health route
backend/app/routes/health.py - API schemas
backend/app/schemas/analysis.py
Image analysis
- Image preprocessing
backend/app/services/image_processing.py - Particle detection
backend/app/services/detector.py - Morphology features
backend/app/services/feature_extraction.py - Image utilities
backend/app/utils/image_utils.py - Image annotation
backend/app/services/annotator.py - Evaluation and size metrics
backend/app/services/metrics.py
Models and training
- Model inference
backend/app/services/classifier.py - Model artifacts
backend/app/models - Training pipeline
backend/app/services/training_service.py - Synthetic data generator
backend/training/generate_demo_data.py - Training command
backend/training/train_model.py
Other components
- Water-sample user
- API service
Connections 26
- Water-sample user → Screening interface: uploads image
README.md - Screening interface → API client: submits settings
frontend/src/App.tsx - API client → Analysis and model routes: requests analysis
README.md - Analysis and model routes → Image preprocessing: uses
backend/app/routes/analysis.py - Analysis and model routes → Particle detection: uses
backend/app/routes/analysis.py - Analysis and model routes → Morphology features: uses
backend/app/routes/analysis.py - Analysis and model routes → Model inference: uses
backend/app/routes/analysis.py - Analysis and model routes → Image annotation: uses
backend/app/routes/analysis.py - Analysis and model routes → Evaluation and size metrics: uses
backend/app/routes/analysis.py - Analysis and model routes → Image utilities: uses
backend/app/routes/analysis.py - Analysis and model routes → API schemas: uses contracts
backend/app/routes/analysis.py - FastAPI application → Analysis and model routes: registers
backend/app/main.py - FastAPI application → Health route: registers
backend/app/main.py - FastAPI application → Model inference: checks availability
backend/app/main.py - API client → API service: calls API
README.md - Analysis and model routes → API service: serves endpoints
README.md - API service → API client: returns results
README.md - Screening interface → Result charts: renders results
frontend/src/App.tsx - Analysis and model routes → Training pipeline: starts training
backend/app/routes/analysis.py - Training command → Training pipeline: runs pipeline
backend/training/train_model.py - Training pipeline → Model artifacts: writes artifacts
backend/app/services/training_service.py - Model inference → Model artifacts: loads artifacts
backend/app/services/classifier.py - Synthetic data generator → Morphology features: uses feature schema
backend/training/generate_demo_data.py - Training pipeline → Evaluation and size metrics: computes evaluation
backend/app/services/training_service.py - API client → Analysis and model routes: checks model status
README.md - API client → Analysis and model routes: fetches metrics
README.md