# shinjuchiro/crop-damage-report-system architecture

> Architecture diagram of the GitHub repository shinjuchiro/crop-damage-report-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shinjuchiro/crop-damage-report-system
- Repository: https://github.com/shinjuchiro/crop-damage-report-system

## Overview

This is a municipal agriculture and disaster-assistance portal serving farmers, technicians, associations, and MAO staff. The main workflow is farmer registration and farm activity or damage reporting, technician assignment and field validation, MAO review and assistance allocation, followed by association distribution and reporting. Cross-role alerts support those workflows, with optional SMS delivery. The repository uses Laravel web routes, role-specific controllers, Eloquent models, and services. Relationships below are limited to route references, source-index references, and explicit model documentation; unsampled transitions are left unverified.

Main entry points: [`routes/web.php`](https://github.com/shinjuchiro/crop-damage-report-system/blob/main/routes/web.php) (Web routes), [`app/Models/DamageReport.php`](https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Models/DamageReport.php) (Damage reports), [`app/Http/Controllers/Auth/RegisterController.php`](https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Http/Controllers/Auth/RegisterController.php) (Farmer registration), [`app/Http/Controllers/Technician/InspectionController.php`](https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Http/Controllers/Technician/InspectionController.php) (Field inspection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and routing"]
  node_users[("Accounts and roles<br/>[User.php]")]
  node_web["Web routes<br/>[web.php]"]
  node_registration["Farmer registration"]
end

subgraph group_farmer["Farmer records"]
  node_farmer_reports["Damage reporting"]
  node_planting["Planting records"]
  node_damage[("Damage reports<br/>[DamageReport.php]")]
  node_farmer_data[("Farmer profiles<br/>[Farmer.php]")]
end

subgraph group_field["Field verification"]
  node_technician_assign["Report assignment"]
  node_inspection["Field inspection"]
  node_validation[("Inspection validation<br/>[Validation.php]")]
end

subgraph group_office["MAO operations"]
  node_mao_monitor["Damage review"]
  node_allocation["Assistance allocation"]
  node_reports["Monthly reports"]
  node_report_builder["Report builders"]
end

subgraph group_delivery["Distribution and alerts"]
  node_allocation_data[("Allocation records")]
  node_association_assistance["Association distribution"]
  node_broadcast[("Alert broadcasts")]
  node_sms["SMS provider"]
end

node_farmer_actor(("Farmer"))
node_technician_actor(("Technician"))
node_mao_actor(("MAO staff"))
node_association_actor(("Association officer"))

node_farmer_actor -->|"opens portal"| node_web
node_technician_actor -->|"opens portal"| node_web
node_mao_actor -->|"opens portal"| node_web
node_association_actor -->|"opens portal"| node_web
node_web -->|"routes to"| node_registration
node_web -->|"routes to"| node_farmer_reports
node_web -->|"routes to"| node_planting
node_web -->|"routes to"| node_technician_assign
node_web -->|"routes to"| node_inspection
node_web -->|"routes to"| node_mao_monitor
node_web -->|"routes to"| node_allocation
node_web -->|"routes to"| node_association_assistance
node_web -->|"routes to"| node_reports
node_registration -->|"creates account"| node_users
node_registration -->|"creates profile"| node_farmer_data
node_farmer_reports -->|"records report"| node_damage
node_planting -->|"records activity"| node_farmer_data
node_technician_assign -.->|"assigns report"| node_damage
node_inspection -->|"records assessment"| node_validation
node_inspection -->|"updates report"| node_damage
node_mao_monitor -->|"reviews reports"| node_damage
node_allocation -->|"creates allocations"| node_allocation_data
node_association_assistance -->|"handles allocations"| node_allocation_data
node_reports -->|"uses builder"| node_report_builder
node_broadcast -->|"sends SMS"| node_sms

click node_users "https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Models/User.php"
click node_web "https://github.com/shinjuchiro/crop-damage-report-system/blob/main/routes/web.php"
click node_registration "https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Http/Controllers/Auth/RegisterController.php"
click node_farmer_reports "https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Http/Controllers/Farmer/DamageReportController.php"
click node_planting "https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Http/Controllers/Farmer/PlantingController.php"
click node_damage "https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Models/DamageReport.php"
click node_farmer_data "https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Models/Farmer.php"
click node_technician_assign "https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Http/Controllers/Technician/AssignmentController.php"
click node_inspection "https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Http/Controllers/Technician/InspectionController.php"
click node_validation "https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Models/Validation.php"
click node_mao_monitor "https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Http/Controllers/MAO/DamageReportMonitorController.php"
click node_allocation "https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Http/Controllers/MAO/AssistanceAllocationController.php"
click node_allocation_data "https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Models/AssistanceAllocation.php"
click node_association_assistance "https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Http/Controllers/Association/AssistanceController.php"
click node_reports "https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Http/Controllers/Association/ReportController.php"
click node_report_builder "https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Services/MonthlyReportBuilder.php"
click node_broadcast "https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Models/NotificationBroadcast.php"
click node_sms "https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Services/SemaphoreSmsService.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_users,node_web,node_registration toneBlue
class node_farmer_reports,node_planting,node_damage,node_farmer_data toneAmber
class node_technician_assign,node_inspection,node_validation toneMint
class node_mao_monitor,node_allocation,node_reports,node_report_builder toneRose
class node_allocation_data,node_association_assistance,node_broadcast,node_sms,node_farmer_actor,node_technician_actor,node_mao_actor,node_association_actor toneIndigo
```

## Components

### Access and routing

- [Accounts and roles](https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Models/User.php): `app/Models/User.php`
- [Web routes](https://github.com/shinjuchiro/crop-damage-report-system/blob/main/routes/web.php): `routes/web.php`
- [Farmer registration](https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Http/Controllers/Auth/RegisterController.php): `app/Http/Controllers/Auth/RegisterController.php`

### Farmer records

- [Damage reporting](https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Http/Controllers/Farmer/DamageReportController.php): `app/Http/Controllers/Farmer/DamageReportController.php`
- [Planting records](https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Http/Controllers/Farmer/PlantingController.php): `app/Http/Controllers/Farmer/PlantingController.php`
- [Damage reports](https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Models/DamageReport.php): `app/Models/DamageReport.php`
- [Farmer profiles](https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Models/Farmer.php): `app/Models/Farmer.php`

### Field verification

- [Report assignment](https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Http/Controllers/Technician/AssignmentController.php): `app/Http/Controllers/Technician/AssignmentController.php`
- [Field inspection](https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Http/Controllers/Technician/InspectionController.php): `app/Http/Controllers/Technician/InspectionController.php`
- [Inspection validation](https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Models/Validation.php): `app/Models/Validation.php`

### MAO operations

- [Damage review](https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Http/Controllers/MAO/DamageReportMonitorController.php): `app/Http/Controllers/MAO/DamageReportMonitorController.php`
- [Assistance allocation](https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Http/Controllers/MAO/AssistanceAllocationController.php): `app/Http/Controllers/MAO/AssistanceAllocationController.php`
- [Monthly reports](https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Http/Controllers/Association/ReportController.php): `app/Http/Controllers/Association/ReportController.php`
- [Report builders](https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Services/MonthlyReportBuilder.php): `app/Services/MonthlyReportBuilder.php`

### Distribution and alerts

- [Allocation records](https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Models/AssistanceAllocation.php): `app/Models/AssistanceAllocation.php`
- [Association distribution](https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Http/Controllers/Association/AssistanceController.php): `app/Http/Controllers/Association/AssistanceController.php`
- [Alert broadcasts](https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Models/NotificationBroadcast.php): `app/Models/NotificationBroadcast.php`
- [SMS provider](https://github.com/shinjuchiro/crop-damage-report-system/blob/main/app/Services/SemaphoreSmsService.php): `app/Services/SemaphoreSmsService.php`

### Other components

- **Farmer**
- **Technician**
- **MAO staff**
- **Association officer**

## Connections

- Farmer → Web routes: opens portal (evidence: `routes/web.php`)
- Technician → Web routes: opens portal (evidence: `routes/web.php`)
- MAO staff → Web routes: opens portal (evidence: `routes/web.php`)
- Association officer → Web routes: opens portal (evidence: `routes/web.php`)
- Web routes → Farmer registration: routes to (evidence: `routes/web.php`)
- Web routes → Damage reporting: routes to (evidence: `routes/web.php`)
- Web routes → Planting records: routes to (evidence: `routes/web.php`)
- Web routes → Report assignment: routes to (evidence: `routes/web.php`)
- Web routes → Field inspection: routes to (evidence: `routes/web.php`)
- Web routes → Damage review: routes to (evidence: `routes/web.php`)
- Web routes → Assistance allocation: routes to (evidence: `routes/web.php`)
- Web routes → Association distribution: routes to (evidence: `routes/web.php`)
- Web routes → Monthly reports: routes to (evidence: `routes/web.php`)
- Farmer registration → Accounts and roles: creates account (evidence: `app/Http/Controllers/Auth/RegisterController.php`)
- Farmer registration → Farmer profiles: creates profile (evidence: `app/Http/Controllers/Auth/RegisterController.php`)
- Damage reporting → Damage reports: records report (evidence: `app/Http/Controllers/Farmer/DamageReportController.php`)
- Planting records → Farmer profiles: records activity (evidence: `app/Models/Farmer.php`)
- Report assignment → Damage reports: assigns report (evidence: `app/Http/Controllers/Technician/AssignmentController.php`)
- Field inspection → Inspection validation: records assessment (evidence: `app/Http/Controllers/Technician/InspectionController.php`)
- Field inspection → Damage reports: updates report (evidence: `app/Http/Controllers/Technician/InspectionController.php`)
- Damage review → Damage reports: reviews reports (evidence: `app/Http/Controllers/MAO/DamageReportMonitorController.php`)
- Assistance allocation → Allocation records: creates allocations (evidence: `app/Http/Controllers/MAO/AssistanceAllocationController.php`)
- Association distribution → Allocation records: handles allocations (evidence: `app/Http/Controllers/Association/AssistanceController.php`)
- Monthly reports → Report builders: uses builder (evidence: `app/Http/Controllers/Association/ReportController.php`)
- Alert broadcasts → SMS provider: sends SMS (evidence: `app/Models/NotificationBroadcast.php`)
