# glucasbakker-source/cv-hackathon-airi architecture

> Architecture diagram of the GitHub repository glucasbakker-source/cv-hackathon-airi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/glucasbakker-source/cv-hackathon-airi
- Repository: https://github.com/glucasbakker-source/cv-hackathon-airi

## Overview

FruitControl is an offline fruit-station and delivery-basket auditing app. Operators submit a photo, review fruit detections and counts, compare them with a display plan, estimate weight and nutrition, and optionally save or export the scene. The graph also preserves the documented dataset/model workflow. Backend and frontend links are grounded in excerpts and README statements; some UI component interactions and unsampled ML details are not shown, so those connections are omitted.

Main entry points: [`frontend/src/App.tsx`](https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/App.tsx) (App workflow), [`app/main.py`](https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/app/main.py) (HTTP API and inference), [`ml/train_yolo26.py`](https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/ml/train_yolo26.py) (Model training), [`ml/audit_dataset.py`](https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/ml/audit_dataset.py) (Dataset audit)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Operator experience"]
  node_app["App workflow<br/>[App.tsx]"]
  node_camera["Camera capture"]
  node_upload["Photo and demos<br/>[UploadAndDemos.tsx]"]
  node_viewport["Detection review"]
  node_plan["Plan comparison"]
  node_nutrition["Nutrition panel<br/>[NutritionPanel.tsx]"]
  node_historyui["History panel<br/>[HistoryPanel.tsx]"]
  node_modelinfo["Model information<br/>[ModelInfoPanel.tsx]"]
  node_thresholds["Threshold controls"]
  node_header["Application header<br/>[Header.tsx]"]
  node_export["Report and image export<br/>[export.ts]"]
end

subgraph group_service["Local application service"]
  node_api_client["API client<br/>[api.ts]"]
  node_api["HTTP API and inference<br/>[main.py]"]
  node_history[("Scene history<br/>[db.py]")]
end

subgraph group_ml["Model and data workflow"]
  node_audit["Dataset audit<br/>[audit_dataset.py]"]
  node_blocklist["Banned-image guard<br/>[banned_images.py]"]
  node_open_pool["Open-image pool"]
  node_training["Model training<br/>[train_yolo26.py]"]
  node_input_size["ONNX input sizing<br/>[onnx_input.py]"]
  node_batch["Batch inference<br/>[batch_infer.py]"]
end

subgraph group_shared["Shared interfaces"]
  node_classes["Fruit and response types<br/>[types.ts]"]
  node_ui_constants["Fruit and plan defaults<br/>[constants.ts]"]
end

node_operator(("Operator"))

node_operator -->|"uses"| node_app
node_app -->|"requests"| node_api_client
node_api_client -->|"calls API"| node_api
node_api -->|"reads and writes"| node_history
node_app -->|"calculates portion"| node_export
node_app -->|"loads and saves scenes"| node_historyui
node_app -->|"loads model details"| node_modelinfo
node_app -->|"gets prediction"| node_api_client
node_audit -->|"checks images"| node_blocklist
node_training -->|"guards dataset"| node_blocklist
node_audit -.->|"audit then train"| node_training
node_training -.->|"train then infer"| node_batch
node_open_pool -.->|"feeds dataset"| node_audit
node_input_size -->|"sizes model input"| node_batch
node_api -->|"uses input sizing"| node_input_size

click node_app "https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/App.tsx"
click node_camera "https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/components/CameraCaptureModal.tsx"
click node_upload "https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/components/UploadAndDemos.tsx"
click node_viewport "https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/components/DetectionViewport.tsx"
click node_plan "https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/components/StatsAndDisplayPlan.tsx"
click node_nutrition "https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/components/NutritionPanel.tsx"
click node_historyui "https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/components/HistoryPanel.tsx"
click node_modelinfo "https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/components/ModelInfoPanel.tsx"
click node_thresholds "https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/components/ThresholdControls.tsx"
click node_header "https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/components/Header.tsx"
click node_export "https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/utils/export.ts"
click node_api_client "https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/api.ts"
click node_api "https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/app/main.py"
click node_history "https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/app/db.py"
click node_classes "https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/types.ts"
click node_ui_constants "https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/constants.ts"
click node_audit "https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/ml/audit_dataset.py"
click node_blocklist "https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/ml/banned_images.py"
click node_open_pool "https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/ml/download_open_pool.py"
click node_training "https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/ml/train_yolo26.py"
click node_input_size "https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/ml/onnx_input.py"
click node_batch "https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/ml/batch_infer.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_camera,node_upload,node_viewport,node_plan,node_nutrition,node_historyui,node_modelinfo,node_thresholds,node_header,node_export toneBlue
class node_api_client,node_api,node_history toneAmber
class node_audit,node_blocklist,node_open_pool,node_training,node_input_size,node_batch toneMint
class node_classes,node_ui_constants toneRose
class node_operator toneIndigo
```

## Components

### Operator experience

- [App workflow](https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Camera capture](https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/components/CameraCaptureModal.tsx): `frontend/src/components/CameraCaptureModal.tsx`
- [Photo and demos](https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/components/UploadAndDemos.tsx): `frontend/src/components/UploadAndDemos.tsx`
- [Detection review](https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/components/DetectionViewport.tsx): `frontend/src/components/DetectionViewport.tsx`
- [Plan comparison](https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/components/StatsAndDisplayPlan.tsx): `frontend/src/components/StatsAndDisplayPlan.tsx`
- [Nutrition panel](https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/components/NutritionPanel.tsx): `frontend/src/components/NutritionPanel.tsx`
- [History panel](https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/components/HistoryPanel.tsx): `frontend/src/components/HistoryPanel.tsx`
- [Model information](https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/components/ModelInfoPanel.tsx): `frontend/src/components/ModelInfoPanel.tsx`
- [Threshold controls](https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/components/ThresholdControls.tsx): `frontend/src/components/ThresholdControls.tsx`
- [Application header](https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/components/Header.tsx): `frontend/src/components/Header.tsx`
- [Report and image export](https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/utils/export.ts): `frontend/src/utils/export.ts`

### Local application service

- [API client](https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/api.ts): `frontend/src/api.ts`
- [HTTP API and inference](https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/app/main.py): `app/main.py`
- [Scene history](https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/app/db.py): `app/db.py`

### Model and data workflow

- [Dataset audit](https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/ml/audit_dataset.py): `ml/audit_dataset.py`
- [Banned-image guard](https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/ml/banned_images.py): `ml/banned_images.py`
- [Open-image pool](https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/ml/download_open_pool.py): `ml/download_open_pool.py`
- [Model training](https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/ml/train_yolo26.py): `ml/train_yolo26.py`
- [ONNX input sizing](https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/ml/onnx_input.py): `ml/onnx_input.py`
- [Batch inference](https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/ml/batch_infer.py): `ml/batch_infer.py`

### Shared interfaces

- [Fruit and response types](https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/types.ts): `frontend/src/types.ts`
- [Fruit and plan defaults](https://github.com/glucasbakker-source/cv-hackathon-airi/blob/main/frontend/src/constants.ts): `frontend/src/constants.ts`

### Other components

- **Operator**

## Connections

- Operator → App workflow: uses (evidence: `README.md`)
- App workflow → API client: requests (evidence: `frontend/src/App.tsx`)
- API client → HTTP API and inference: calls API (evidence: `README.md`)
- HTTP API and inference → Scene history: reads and writes (evidence: `app/main.py`)
- App workflow → Report and image export: calculates portion (evidence: `frontend/src/App.tsx`)
- App workflow → History panel: loads and saves scenes (evidence: `frontend/src/App.tsx`)
- App workflow → Model information: loads model details (evidence: `frontend/src/App.tsx`)
- App workflow → API client: gets prediction (evidence: `frontend/src/App.tsx`)
- Dataset audit → Banned-image guard: checks images (evidence: `ml/audit_dataset.py`)
- Model training → Banned-image guard: guards dataset (evidence: `ml/train_yolo26.py`)
- Dataset audit → Model training: audit then train (evidence: `README.md`)
- Model training → Batch inference: train then infer (evidence: `README.md`)
- Open-image pool → Dataset audit: feeds dataset
- ONNX input sizing → Batch inference: sizes model input (evidence: `ml/batch_infer.py`)
- HTTP API and inference → ONNX input sizing: uses input sizing (evidence: `app/main.py`)
