How shreyadeshmukh1030/maizescan_lite works
Purpose and Entry Points
MaizeScan is a full-stack maize-seed visual-quality analysis system. A React/Vite client captures or uploads seed images; a FastAPI service runs detection, calculates batch quality, and persists inspection history. Primary entry points are frontend/src/main.jsx, frontend/src/App.jsx, and backend/main.py.
Frontend Application Shell
The SPA is organized around page-level workflows rather than a separate API-client layer visible in the tree. frontend/src/App.jsx defines the application shell/routing; frontend/src/main.jsx bootstraps React. Major user surfaces include detection (frontend/src/pages/DetectionPage.jsx), operational dashboard (frontend/src/pages/DashboardPage.jsx), and analytics (frontend/src/pages/AnalyticsPage.jsx).
Image Detection and Inference Boundary
The backend detection subsystem owns computer-vision processing and model invocation in backend/detection.py. Model material is bundled as backend/seed_model.onnx, indicating ONNX-runtime-compatible inference in the deployed backend rather than browser-side inference. The API boundary is FastAPI in backend/main.py: image input enters here, is passed to detection, and results are returned to the client for visualization and downstream reporting.
Batch Quality and Presentation
Detection output is expected to represent five quality categories and feed aggregate batch metrics/final grading described by the product. The detection UI consumes those results in frontend/src/pages/DetectionPage.jsx; map-oriented quality visualization is isolated in frontend/src/components/QualityMap.jsx. Reporting and certification are separate presentation workflows in frontend/src/pages/ReportsPage.jsx and frontend/src/pages/CertificatePage.jsx.
Persistence and Domain Model
Database connectivity/lifecycle is centralized in backend/database.py. Persistent entities are defined in backend/models.py, while API request/response contracts are defined in backend/schemas.py. This forms the primary boundary between FastAPI handlers and PostgreSQL/NeonDB persistence, supporting user-scoped batch history and dashboard aggregation.
User, History, and Analytics Workflows
Account entry flows are represented by frontend/src/pages/LoginPage.jsx and frontend/src/pages/RegisterPage.jsx; user-facing history/identity surfaces include frontend/src/pages/ProfilePage.jsx. Analytics are presented through frontend/src/pages/AnalyticsPage.jsx, while dashboard summaries live in frontend/src/pages/DashboardPage.jsx. The README specifies JWT authentication, so credentials and authenticated requests are an API concern rooted in backend/main.py.
Data Bootstrap and Deployment
Geographic/reference data can be initialized through backend/seed_geo_data.py (with a root-level seed_geo_data.py also present). Runtime dependencies are Python/FastAPI/SQLAlchemy plus ONNX/OpenCV-class vision dependencies in backend/requirements.txt, and React/Vite in frontend/package.json. Deployment is Vercel-oriented, with frontend routing/build configuration in frontend/vercel.json, plus root Dockerfile for containerized execution. External infrastructure includes PostgreSQL via NeonDB and Vercel hosting.
Components 18
React/Vite Client
- React bootstrap
frontend/src/main.jsx - App shell & routing
frontend/src/App.jsx - Detection workflow · Captures or uploads seed images and displays results.
frontend/src/pages/DetectionPage.jsx - Quality map
frontend/src/components/QualityMap.jsx - Dashboard · Presents operational batch summaries.
frontend/src/pages/DashboardPage.jsx - Analytics
frontend/src/pages/AnalyticsPage.jsx - Reports & certificates
frontend/src/pages/ReportsPage.jsx - Account & profile · Login, registration, and user history surfaces.
frontend/src/pages/LoginPage.jsx
FastAPI Backend
- FastAPI API · Handles JWT-authenticated requests, image input, and API contracts.
backend/main.py - API schemas
backend/schemas.py - Vision detection · Runs seed detection and derives five quality categories and batch metrics.
backend/detection.py - Seed ONNX model
backend/seed_model.onnx - Persistent domain models · Stores users and inspection/batch history.
backend/models.py - Database lifecycle
backend/database.py - Geographic data bootstrap
backend/seed_geo_data.py
Deployment & Data
- NeonDB PostgreSQL
- Vercel hosting
- Container runtime
Dockerfile
Connections 21
- React bootstrap → App shell & routing: mounts
- App shell & routing → Detection workflow: routes to
- App shell & routing → Dashboard: routes to
- App shell & routing → Analytics: routes to
- App shell & routing → Reports & certificates: routes to
- App shell & routing → Account & profile: routes to
- Detection workflow → Quality map: renders results
- Detection workflow → FastAPI API: uploads image
- Dashboard → FastAPI API: loads summaries
- Analytics → FastAPI API: loads history
- Reports & certificates → FastAPI API: requests reports
- Account & profile → FastAPI API: authenticates
- FastAPI API → API schemas: validates and serializes
- FastAPI API → Vision detection: submits image
- Vision detection → Seed ONNX model: runs inference
- FastAPI API → Persistent domain models: reads and writes
- Persistent domain models → Database lifecycle: uses
- Database lifecycle → NeonDB PostgreSQL: connects to
- Geographic data bootstrap → NeonDB PostgreSQL: initializes reference data
- Vercel hosting → App shell & routing: hosts client
- Container runtime → FastAPI API: runs backend