How ke8vpc/river-watch works
River Watch is a standalone PHP/SQLite flood-monitoring and SITREP application. Operators manage gauges and dashboards, retain and review readings, then create event-linked SITREPs whose finalized contents are frozen. The README also documents CoCoRaHS precipitation, USGS discovery and polling, camera observations and private attachments, notifications, audit, branding, and account roles. The graph follows documented workflows and visible calls; several implementation details are unsampled, so their internal links are omitted.
Main entry points: api.php Action API · app.js Web client · operations.php SITREP lifecycle · worker.php Scheduled worker
Components 23
Web monitoring
- Dashboards
public/app.js - Web client
public/app.js - Action API
public/api.php - Camera views
public/camera.js
Gauge data
- Gauge management
public/operations.js - Readings and history
app/core.php - USGS discovery and polling
app/core.php - CoCoRaHS rainfall
app/rain.php
Events and SITREPs
- Flood events
app/operations.php - SITREP lifecycle
app/operations.php - Report preview and export
public/report.php - Private attachments
public/attachment.php - Report branding
app/branding.php - Event audit
app/event-audit.php
Operations
- Scheduled worker
app/worker.php - Notifications and outbox
app/worker.php
Application foundation
- Accounts and roles
app/users.php - Sessions
app/session.php - Private SQLite data
data
Other components
- Operator
- USGS service
- CoCoRaHS service
- Webhook endpoint
Connections 23
- Operator → Web client: uses
README.md - Web client → Action API: requests actions
public/app.js - Web client → Dashboards: refreshes
public/app.js - Web client → Camera views: shows feeds
- Action API → Accounts and roles: authenticates
- Action API → Gauge management: manages gauges
- Action API → Readings and history: records and queries
- Action API → Flood events: manages events
- Action API → SITREP lifecycle: saves and finalizes
- Action API → CoCoRaHS rainfall: configures rainfall
- USGS discovery and polling → USGS service: requests data
app/core.php - Readings and history → Private SQLite data: stores readings
app/core.php - CoCoRaHS rainfall → CoCoRaHS service: fetches reports
README.md - Scheduled worker → USGS discovery and polling: polls gauges
app/worker.php - Scheduled worker → CoCoRaHS rainfall: polls regions
app/worker.php - Scheduled worker → Notifications and outbox: evaluates alerts
app/worker.php - Notifications and outbox → Webhook endpoint: delivers outbox
app/worker.php - SITREP lifecycle → Report preview and export: renders report
README.md - SITREP lifecycle → Private attachments: attaches images
README.md - SITREP lifecycle → Report branding: uses branding
- SITREP lifecycle → Event audit: records changes
- Accounts and roles → Sessions: validates user
app/session.php - Web client → Accounts and roles: signs in
public/app.js