# johnreyilagan63-ctrl/palaycheck architecture

> Architecture diagram of the GitHub repository johnreyilagan63-ctrl/palaycheck, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/johnreyilagan63-ctrl/palaycheck
- Repository: https://github.com/johnreyilagan63-ctrl/palaycheck

## Overview

Palaycheck is a rice-pest detection and guidance web application: users submit an image, receive model detections matched to pest records, and can save scans for later review. The Laravel application also provides accounts, pest and learning information, advice, and administrative management and reporting. Its inference manager can start and check a separate Python inference process. The graph follows documented routes and sampled calls; some feature links rely on source-index references, and unsampled implementation details are omitted.

Main entry points: [`palaycheck/laravel/routes/web.php`](https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/routes/web.php) (Web routes), [`palaycheck/laravel/app/Http/Controllers/Api/DetectionApiController.php`](https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Http/Controllers/Api/DetectionApiController.php) (Scan API), [`palaycheck/laravel/app/Http/Controllers/Admin/ResourceController.php`](https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Http/Controllers/Admin/ResourceController.php) (Admin resources), [`palaycheck/laravel/app/Http/Controllers/Admin/DashboardController.php`](https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Http/Controllers/Admin/DashboardController.php) (Admin reporting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web and accounts"]
  node_routes["Web routes<br/>[web.php]"]
  node_auth["Authentication<br/>[AuthController.php]"]
  node_user[("User accounts<br/>[User.php]")]
end

subgraph group_detection["Detection workflow"]
  node_detection_api["Scan API"]
  node_detection_service["Detection service"]
  node_matcher["Pest matcher<br/>[PestMatcher.php]"]
  node_inference_manager["Inference manager"]
  node_python_service["Python inference"]
  node_detection_record[("Saved detections<br/>[Detection.php]")]
  node_history["Scan history"]
end

subgraph group_content["Pest and learning content"]
  node_pest[("Pest catalog<br/>[Pest.php]")]
  node_advice[("Pest advice<br/>[Advice.php]")]
  node_learning[("Learning materials")]
  node_content_pages["Content pages"]
  node_pest_pages["Pest pages<br/>[PestController.php]"]
end

subgraph group_admin["Administration"]
  node_admin_resources["Admin resources"]
  node_resource_config["Resource definitions<br/>[AdminResources.php]"]
  node_admin_dashboard["Admin reporting"]
end

node_visitor(("Farmer or admin"))

node_visitor -->|"requests pages"| node_routes
node_routes -->|"dispatches auth"| node_auth
node_routes -->|"dispatches scans"| node_detection_api
node_routes -->|"dispatches history"| node_history
node_routes -->|"dispatches learning"| node_content_pages
node_routes -->|"dispatches pest pages"| node_pest_pages
node_routes -->|"dispatches admin"| node_admin_resources
node_routes -->|"dispatches reporting"| node_admin_dashboard
node_auth -->|"reads and creates"| node_user
node_detection_api -->|"runs detection"| node_detection_service
node_detection_api -->|"matches labels"| node_matcher
node_detection_api -->|"ensures service"| node_inference_manager
node_detection_service -->|"stores detections"| node_detection_record
node_inference_manager -->|"starts process"| node_python_service
node_matcher -->|"looks up pests"| node_pest
node_detection_api -->|"saves scan"| node_detection_record
node_detection_api -->|"loads advice"| node_advice
node_history -->|"reads history"| node_detection_record
node_history -->|"loads advice"| node_advice
node_content_pages -->|"loads materials"| node_learning
node_pest_pages -->|"loads pest details"| node_pest
node_pest_pages -->|"loads advice"| node_advice
node_admin_resources -->|"gets definitions"| node_resource_config
node_admin_resources -->|"reads and edits"| node_pest
node_admin_resources -->|"reads and edits"| node_advice
node_admin_resources -->|"cleans related scans"| node_detection_record
node_admin_resources -.->|"manages accounts"| node_user
node_admin_dashboard -->|"summarizes scans"| node_detection_record
node_admin_dashboard -->|"counts users"| node_user
node_admin_dashboard -->|"counts pests"| node_pest
node_admin_dashboard -->|"counts materials"| node_learning
node_admin_dashboard -->|"counts advice"| node_advice

click node_routes "https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/routes/web.php"
click node_auth "https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Http/Controllers/AuthController.php"
click node_user "https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Models/User.php"
click node_detection_api "https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Http/Controllers/Api/DetectionApiController.php"
click node_detection_service "https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Services/DetectionService.php"
click node_matcher "https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Services/PestMatcher.php"
click node_inference_manager "https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Services/InferenceServiceManager.php"
click node_python_service "https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/inference_service.py"
click node_detection_record "https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Models/Detection.php"
click node_history "https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Http/Controllers/HistoryController.php"
click node_pest "https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Models/Pest.php"
click node_advice "https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Models/Advice.php"
click node_learning "https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Models/LearningMaterial.php"
click node_content_pages "https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Http/Controllers/LearningController.php"
click node_pest_pages "https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Http/Controllers/PestController.php"
click node_admin_resources "https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Http/Controllers/Admin/ResourceController.php"
click node_resource_config "https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Support/AdminResources.php"
click node_admin_dashboard "https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Http/Controllers/Admin/DashboardController.php"

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_routes,node_auth,node_user toneBlue
class node_detection_api,node_detection_service,node_matcher,node_inference_manager,node_python_service,node_detection_record,node_history toneAmber
class node_pest,node_advice,node_learning,node_content_pages,node_pest_pages toneMint
class node_admin_resources,node_resource_config,node_admin_dashboard toneRose
class node_visitor toneIndigo
```

## Components

### Web and accounts

- [Web routes](https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/routes/web.php): `palaycheck/laravel/routes/web.php`
- [Authentication](https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Http/Controllers/AuthController.php): `palaycheck/laravel/app/Http/Controllers/AuthController.php`
- [User accounts](https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Models/User.php): `palaycheck/laravel/app/Models/User.php`

### Detection workflow

- [Scan API](https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Http/Controllers/Api/DetectionApiController.php): `palaycheck/laravel/app/Http/Controllers/Api/DetectionApiController.php`
- [Detection service](https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Services/DetectionService.php): `palaycheck/laravel/app/Services/DetectionService.php`
- [Pest matcher](https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Services/PestMatcher.php): `palaycheck/laravel/app/Services/PestMatcher.php`
- [Inference manager](https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Services/InferenceServiceManager.php): `palaycheck/laravel/app/Services/InferenceServiceManager.php`
- [Python inference](https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/inference_service.py): `palaycheck/inference_service.py`
- [Saved detections](https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Models/Detection.php): `palaycheck/laravel/app/Models/Detection.php`
- [Scan history](https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Http/Controllers/HistoryController.php): `palaycheck/laravel/app/Http/Controllers/HistoryController.php`

### Pest and learning content

- [Pest catalog](https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Models/Pest.php): `palaycheck/laravel/app/Models/Pest.php`
- [Pest advice](https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Models/Advice.php): `palaycheck/laravel/app/Models/Advice.php`
- [Learning materials](https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Models/LearningMaterial.php): `palaycheck/laravel/app/Models/LearningMaterial.php`
- [Content pages](https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Http/Controllers/LearningController.php): `palaycheck/laravel/app/Http/Controllers/LearningController.php`
- [Pest pages](https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Http/Controllers/PestController.php): `palaycheck/laravel/app/Http/Controllers/PestController.php`

### Administration

- [Admin resources](https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Http/Controllers/Admin/ResourceController.php): `palaycheck/laravel/app/Http/Controllers/Admin/ResourceController.php`
- [Resource definitions](https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Support/AdminResources.php): `palaycheck/laravel/app/Support/AdminResources.php`
- [Admin reporting](https://github.com/johnreyilagan63-ctrl/palaycheck/blob/main/palaycheck/laravel/app/Http/Controllers/Admin/DashboardController.php): `palaycheck/laravel/app/Http/Controllers/Admin/DashboardController.php`

### Other components

- **Farmer or admin**

## Connections

- Farmer or admin → Web routes: requests pages
- Web routes → Authentication: dispatches auth (evidence: `palaycheck/laravel/routes/web.php`)
- Web routes → Scan API: dispatches scans (evidence: `palaycheck/laravel/routes/web.php`)
- Web routes → Scan history: dispatches history (evidence: `palaycheck/laravel/routes/web.php`)
- Web routes → Content pages: dispatches learning (evidence: `palaycheck/laravel/routes/web.php`)
- Web routes → Pest pages: dispatches pest pages (evidence: `palaycheck/laravel/routes/web.php`)
- Web routes → Admin resources: dispatches admin (evidence: `palaycheck/laravel/routes/web.php`)
- Web routes → Admin reporting: dispatches reporting (evidence: `palaycheck/laravel/routes/web.php`)
- Authentication → User accounts: reads and creates (evidence: `palaycheck/laravel/app/Http/Controllers/AuthController.php`)
- Scan API → Detection service: runs detection (evidence: `palaycheck/laravel/app/Http/Controllers/Api/DetectionApiController.php`)
- Scan API → Pest matcher: matches labels (evidence: `palaycheck/laravel/app/Http/Controllers/Api/DetectionApiController.php`)
- Scan API → Inference manager: ensures service (evidence: `palaycheck/laravel/app/Http/Controllers/Api/DetectionApiController.php`)
- Detection service → Saved detections: stores detections (evidence: `palaycheck/laravel/app/Services/DetectionService.php`)
- Inference manager → Python inference: starts process (evidence: `palaycheck/laravel/app/Services/InferenceServiceManager.php`)
- Pest matcher → Pest catalog: looks up pests (evidence: `palaycheck/laravel/app/Services/PestMatcher.php`)
- Scan API → Saved detections: saves scan (evidence: `palaycheck/laravel/app/Http/Controllers/Api/DetectionApiController.php`)
- Scan API → Pest advice: loads advice (evidence: `palaycheck/laravel/app/Http/Controllers/Api/DetectionApiController.php`)
- Scan history → Saved detections: reads history (evidence: `palaycheck/laravel/app/Http/Controllers/HistoryController.php`)
- Scan history → Pest advice: loads advice (evidence: `palaycheck/laravel/app/Http/Controllers/HistoryController.php`)
- Content pages → Learning materials: loads materials (evidence: `palaycheck/laravel/app/Http/Controllers/LearningController.php`)
- Pest pages → Pest catalog: loads pest details (evidence: `palaycheck/laravel/app/Http/Controllers/PestController.php`)
- Pest pages → Pest advice: loads advice (evidence: `palaycheck/laravel/app/Http/Controllers/PestController.php`)
- Admin resources → Resource definitions: gets definitions (evidence: `palaycheck/laravel/app/Http/Controllers/Admin/ResourceController.php`)
- Admin resources → Pest catalog: reads and edits (evidence: `palaycheck/laravel/app/Http/Controllers/Admin/ResourceController.php`)
- Admin resources → Pest advice: reads and edits (evidence: `palaycheck/laravel/app/Http/Controllers/Admin/ResourceController.php`)
- Admin resources → Saved detections: cleans related scans (evidence: `palaycheck/laravel/app/Http/Controllers/Admin/ResourceController.php`)
- Admin resources → User accounts: manages accounts (evidence: `palaycheck/laravel/app/Http/Controllers/Admin/ResourceController.php`)
- Admin reporting → Saved detections: summarizes scans (evidence: `palaycheck/laravel/app/Http/Controllers/Admin/DashboardController.php`)
- Admin reporting → User accounts: counts users (evidence: `palaycheck/laravel/app/Http/Controllers/Admin/DashboardController.php`)
- Admin reporting → Pest catalog: counts pests (evidence: `palaycheck/laravel/app/Http/Controllers/Admin/DashboardController.php`)
- Admin reporting → Learning materials: counts materials (evidence: `palaycheck/laravel/app/Http/Controllers/Admin/DashboardController.php`)
- Admin reporting → Pest advice: counts advice (evidence: `palaycheck/laravel/app/Http/Controllers/Admin/DashboardController.php`)
