fix: seeder idempotent with firstOrCreate
Use firstOrCreate instead of create so db:seed can run safely on container restart without duplicate key violation.
This commit is contained in:
71
docs/01-OVERVIEW.md
Normal file
71
docs/01-OVERVIEW.md
Normal file
@@ -0,0 +1,71 @@
|
||||
# SIDES - Project Overview
|
||||
|
||||
## What Is SIDES?
|
||||
|
||||
**Sabo Integrated Debris Flow Monitoring and Early Warning System (SIDES)** is a flood and debris flow early warning system for **Sungai Kupang**, Malaysia. It is operated under **Jabatan Pengairan dan Saliran (JPS)** — the Malaysian Department of Irrigation and Drainage.
|
||||
|
||||
The system monitors rainfall, water levels, and siren activations at remote telemetry stations and presents real-time data on a web dashboard with an interactive map.
|
||||
|
||||
## Purpose
|
||||
|
||||
SIDES provides:
|
||||
|
||||
- **Real-time monitoring** of hydrological and meteorological data from field stations
|
||||
- **Early warning alerts** when rainfall or water levels exceed danger thresholds
|
||||
- **Siren status tracking** for stations equipped with warning sirens
|
||||
- **Historical data analysis** with exportable reports (Excel, PDF)
|
||||
- **Push notifications** to mobile devices via Firebase Cloud Messaging (FCM)
|
||||
- **Admin management** of stations, users, and access control
|
||||
|
||||
## Domain Context
|
||||
|
||||
- **Location**: Sungai Kupang, Malaysia (Kedah region based on station IDs)
|
||||
- **Operator**: JPS (Department of Irrigation and Drainage), Malaysia
|
||||
- **Data source**: Remote telemetry stations transmit CSV data via FTP to a central server
|
||||
- **Data pipeline**: Python script (`autoscript/sidesdecode.py`) fetches FTP files, parses CSV, inserts into PostgreSQL, and triggers push notifications
|
||||
|
||||
## User Roles
|
||||
|
||||
| Role | Access Level | Description |
|
||||
|------|-------------|-------------|
|
||||
| **Public** | Unauthenticated | View dashboard map with station data |
|
||||
| **User** | `access_level = 2` | View all monitoring pages, historical data, export reports |
|
||||
| **Admin** | `access_level = 1` | Full access including station management and user management |
|
||||
|
||||
## High-Level Architecture
|
||||
|
||||
```
|
||||
[Telemetry Stations] --CSV/FTP--> [FTP Server (myvscada.com)]
|
||||
|
|
||||
[Python Script (cron)]
|
||||
|
|
||||
v
|
||||
[PostgreSQL Database] <--data-- [sidesdecode.py] --alert--> [Laravel API]
|
||||
|
|
||||
v
|
||||
[Firebase FCM]
|
||||
|
|
||||
v
|
||||
[Mobile Devices]
|
||||
|
||||
[Laravel Web App] <--reads-- [PostgreSQL Database]
|
||||
|
|
||||
v
|
||||
[Web Browser] <--Leaflet Map, Charts, Tables-->
|
||||
```
|
||||
|
||||
## Application Name
|
||||
|
||||
The application is registered as **SIDES** in Laravel config (`APP_NAME=SIDES`).
|
||||
|
||||
## Bilingual Support
|
||||
|
||||
The application supports:
|
||||
- **English** (en) — default
|
||||
- **Bahasa Malaysia** (bm)
|
||||
|
||||
Language files are stored in `src/lang/{en,bm}/` and toggled via `LocaleController` with session-based persistence.
|
||||
|
||||
## Project Name Origin
|
||||
|
||||
The repository is named `tckdev` (likely **TCK Development**), referencing the organization running the SIDES system.
|
||||
Reference in New Issue
Block a user