# razeflow/deped-drrmis architecture

> Architecture diagram of the GitHub repository razeflow/deped-drrmis, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/razeflow/deped-drrmis
- Repository: https://github.com/razeflow/deped-drrmis

## Overview

DRRMIS is a division-wide disaster preparedness and incident-management platform for DepEd Abra schools. School and division users move through preparedness, event response and damage reporting, review, and recovery; division teams also coordinate assistance and produce reports. Offline submission and external summary access are distinct supporting capabilities. The sampled source confirms the transition gateway, offline submission dispatch, and report reads; several other connections below reflect documented product capabilities and route/module responsibilities rather than inspected implementation details.

Main entry points: [`lib/supabase/server.ts`](https://github.com/razeflow/deped-drrmis/blob/main/lib/supabase/server.ts) (Supabase data store), [`app/api/v1/summary/route.ts`](https://github.com/razeflow/deped-drrmis/blob/main/app/api/v1/summary/route.ts) (External summary API), [`app/(school)/school/preparedness/page.tsx`](https://github.com/razeflow/deped-drrmis/blob/main/app/(school)/school/preparedness/page.tsx) (Preparedness), [`app/api/offline/submit/route.ts`](https://github.com/razeflow/deped-drrmis/blob/main/app/api/offline/submit/route.ts) (Offline submission)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_registry["Registry and access"]
  node_school_portal["School workspace<br/>[page.tsx]"]
  node_division_portal["Division workspace<br/>[page.tsx]"]
  node_school_registry["School registry<br/>[page.tsx]"]
  node_maps["Maps<br/>[page.tsx]"]
end

subgraph group_preparedness["Preparedness"]
  node_preparedness_ui["Preparedness<br/>[page.tsx]"]
  node_preparedness_logic["Preparedness records<br/>[preparedness.ts]"]
end

subgraph group_incident["Incident response"]
  node_event_ui["Events<br/>[page.tsx]"]
  node_school_response["School incident response<br/>[page.tsx]"]
  node_impact_detail["Impact records<br/>[page.tsx]"]
  node_offline_submit["Offline submission<br/>[route.ts]"]
  node_submission_core["Submission handlers<br/>[submit-core.ts]"]
  node_transition_api["Validated transitions<br/>[route.ts]"]
end

subgraph group_recovery["Recovery and reporting"]
  node_recovery_ui["Recovery tracking<br/>[page.tsx]"]
  node_recovery_logic["Recovery verification"]
  node_report_center["Reports<br/>[page.tsx]"]
  node_impact_docx["Impact report export<br/>[route.ts]"]
end

subgraph group_platform["Platform services"]
  node_gateway["Write gateway<br/>[gateway.ts]"]
  node_summary_api["External summary API<br/>[route.ts]"]
  node_supabase[("Supabase data store<br/>[server.ts]")]
end

node_school_user(("School user"))
node_division_user(("Division user"))
node_regional_consumer(("Regional or LGU consumer"))

node_school_user -->|"uses"| node_school_portal
node_division_user -->|"uses"| node_division_portal
node_division_user -->|"manages"| node_school_registry
node_division_user -->|"views"| node_maps
node_school_user -->|"records readiness"| node_preparedness_ui
node_preparedness_ui -->|"uses"| node_preparedness_logic
node_division_user -->|"coordinates"| node_event_ui
node_school_user -->|"reports response"| node_school_response
node_school_user -.->|"submits queued report"| node_offline_submit
node_offline_submit -->|"dispatches submission"| node_submission_core
node_submission_core -->|"writes records"| node_supabase
node_transition_api -->|"calls"| node_gateway
node_gateway -->|"writes"| node_supabase
node_division_user -->|"reviews"| node_impact_detail
node_school_user -->|"updates recovery"| node_recovery_ui
node_recovery_ui -->|"uses"| node_recovery_logic
node_division_user -->|"generates reports"| node_report_center
node_impact_docx -->|"reads impact data"| node_supabase
node_division_user -->|"issues API access"| node_summary_api
node_regional_consumer -->|"requests totals"| node_summary_api
node_summary_api -->|"reads aggregates"| node_supabase

click node_school_portal "https://github.com/razeflow/deped-drrmis/blob/main/app/(school)/school/page.tsx"
click node_division_portal "https://github.com/razeflow/deped-drrmis/blob/main/app/(app)/overview/page.tsx"
click node_school_registry "https://github.com/razeflow/deped-drrmis/blob/main/app/(app)/schools/page.tsx"
click node_maps "https://github.com/razeflow/deped-drrmis/blob/main/app/(app)/map/page.tsx"
click node_preparedness_ui "https://github.com/razeflow/deped-drrmis/blob/main/app/(school)/school/preparedness/page.tsx"
click node_preparedness_logic "https://github.com/razeflow/deped-drrmis/blob/main/lib/drrm/preparedness.ts"
click node_event_ui "https://github.com/razeflow/deped-drrmis/blob/main/app/(app)/events/page.tsx"
click node_school_response "https://github.com/razeflow/deped-drrmis/blob/main/app/(school)/school/incidents/page.tsx"
click node_impact_detail "https://github.com/razeflow/deped-drrmis/blob/main/app/(app)/impacts/%5Bid%5D/page.tsx"
click node_offline_submit "https://github.com/razeflow/deped-drrmis/blob/main/app/api/offline/submit/route.ts"
click node_submission_core "https://github.com/razeflow/deped-drrmis/blob/main/lib/drrm/submit-core.ts"
click node_transition_api "https://github.com/razeflow/deped-drrmis/blob/main/app/api/transition/route.ts"
click node_gateway "https://github.com/razeflow/deped-drrmis/blob/main/lib/drrm/gateway.ts"
click node_recovery_ui "https://github.com/razeflow/deped-drrmis/blob/main/app/(school)/school/recovery/page.tsx"
click node_recovery_logic "https://github.com/razeflow/deped-drrmis/blob/main/lib/drrm/recovery-verification.ts"
click node_report_center "https://github.com/razeflow/deped-drrmis/blob/main/app/(app)/reports/page.tsx"
click node_impact_docx "https://github.com/razeflow/deped-drrmis/blob/main/app/api/impacts/%5Bid%5D/docx/route.ts"
click node_summary_api "https://github.com/razeflow/deped-drrmis/blob/main/app/api/v1/summary/route.ts"
click node_supabase "https://github.com/razeflow/deped-drrmis/blob/main/lib/supabase/server.ts"

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_school_portal,node_division_portal,node_school_registry,node_maps,node_school_user,node_division_user toneBlue
class node_preparedness_ui,node_preparedness_logic toneAmber
class node_event_ui,node_school_response,node_impact_detail,node_offline_submit,node_submission_core,node_transition_api toneMint
class node_recovery_ui,node_recovery_logic,node_report_center,node_impact_docx toneRose
class node_gateway,node_summary_api,node_supabase,node_regional_consumer toneIndigo
```

## Components

### Registry and access

- [School workspace](https://github.com/razeflow/deped-drrmis/blob/main/app/(school)/school/page.tsx): `app/(school)/school/page.tsx`
- [Division workspace](https://github.com/razeflow/deped-drrmis/blob/main/app/(app)/overview/page.tsx): `app/(app)/overview/page.tsx`
- [School registry](https://github.com/razeflow/deped-drrmis/blob/main/app/(app)/schools/page.tsx): `app/(app)/schools/page.tsx`
- [Maps](https://github.com/razeflow/deped-drrmis/blob/main/app/(app)/map/page.tsx): `app/(app)/map/page.tsx`

### Preparedness

- [Preparedness](https://github.com/razeflow/deped-drrmis/blob/main/app/(school)/school/preparedness/page.tsx): `app/(school)/school/preparedness/page.tsx`
- [Preparedness records](https://github.com/razeflow/deped-drrmis/blob/main/lib/drrm/preparedness.ts): `lib/drrm/preparedness.ts`

### Incident response

- [Events](https://github.com/razeflow/deped-drrmis/blob/main/app/(app)/events/page.tsx): `app/(app)/events/page.tsx`
- [School incident response](https://github.com/razeflow/deped-drrmis/blob/main/app/(school)/school/incidents/page.tsx): `app/(school)/school/incidents/page.tsx`
- [Impact records](https://github.com/razeflow/deped-drrmis/blob/main/app/(app)/impacts/%5Bid%5D/page.tsx): `app/(app)/impacts/[id]/page.tsx`
- [Offline submission](https://github.com/razeflow/deped-drrmis/blob/main/app/api/offline/submit/route.ts): `app/api/offline/submit/route.ts`
- [Submission handlers](https://github.com/razeflow/deped-drrmis/blob/main/lib/drrm/submit-core.ts): `lib/drrm/submit-core.ts`
- [Validated transitions](https://github.com/razeflow/deped-drrmis/blob/main/app/api/transition/route.ts): `app/api/transition/route.ts`

### Recovery and reporting

- [Recovery tracking](https://github.com/razeflow/deped-drrmis/blob/main/app/(school)/school/recovery/page.tsx): `app/(school)/school/recovery/page.tsx`
- [Recovery verification](https://github.com/razeflow/deped-drrmis/blob/main/lib/drrm/recovery-verification.ts): `lib/drrm/recovery-verification.ts`
- [Reports](https://github.com/razeflow/deped-drrmis/blob/main/app/(app)/reports/page.tsx): `app/(app)/reports/page.tsx`
- [Impact report export](https://github.com/razeflow/deped-drrmis/blob/main/app/api/impacts/%5Bid%5D/docx/route.ts): `app/api/impacts/[id]/docx/route.ts`

### Platform services

- [Write gateway](https://github.com/razeflow/deped-drrmis/blob/main/lib/drrm/gateway.ts): `lib/drrm/gateway.ts`
- [External summary API](https://github.com/razeflow/deped-drrmis/blob/main/app/api/v1/summary/route.ts): `app/api/v1/summary/route.ts`
- [Supabase data store](https://github.com/razeflow/deped-drrmis/blob/main/lib/supabase/server.ts): `lib/supabase/server.ts`

### Other components

- **School user**
- **Division user**
- **Regional or LGU consumer**

## Connections

- School user → School workspace: uses
- Division user → Division workspace: uses
- Division user → School registry: manages
- Division user → Maps: views
- School user → Preparedness: records readiness
- Preparedness → Preparedness records: uses
- Division user → Events: coordinates
- School user → School incident response: reports response
- School user → Offline submission: submits queued report
- Offline submission → Submission handlers: dispatches submission
- Submission handlers → Supabase data store: writes records
- Validated transitions → Write gateway: calls
- Write gateway → Supabase data store: writes
- Division user → Impact records: reviews
- School user → Recovery tracking: updates recovery
- Recovery tracking → Recovery verification: uses
- Division user → Reports: generates reports
- Impact report export → Supabase data store: reads impact data
- Division user → External summary API: issues API access
- Regional or LGU consumer → External summary API: requests totals
- External summary API → Supabase data store: reads aggregates
