56 lines
1.0 KiB
Markdown
56 lines
1.0 KiB
Markdown
# eco-aip-backend
|
|
|
|
Minimal backend skeleton for AIP Ecology Analytics.
|
|
|
|
## Quick start
|
|
1) Copy `.env.example` to `.env` and edit values if needed.
|
|
2) Run:
|
|
|
|
```bash
|
|
docker compose up -d --build
|
|
```
|
|
|
|
## Verify
|
|
- API health:
|
|
|
|
```bash
|
|
curl http://localhost:9501/health
|
|
```
|
|
|
|
- Summary (last 24h by default):
|
|
|
|
```bash
|
|
curl "http://localhost:9501/aip/waqi/summary"
|
|
```
|
|
|
|
- Anomalies (last 24h by default):
|
|
|
|
```bash
|
|
curl "http://localhost:9501/aip/waqi/anomalies"
|
|
```
|
|
|
|
- History (daily measurements, MSK date):
|
|
|
|
```bash
|
|
curl "http://localhost:9501/aip/waqi/history?date=2025-12-22"
|
|
```
|
|
|
|
- DB tables:
|
|
|
|
```bash
|
|
docker compose exec db psql -U aip_user -d aip_ecology -c "\dt"
|
|
```
|
|
|
|
- Worker ticks:
|
|
|
|
```bash
|
|
docker compose logs -f worker
|
|
```
|
|
|
|
## Notes
|
|
- Times are stored as UTC (`timestamptz`).
|
|
- Schema is initialized from `db/init/001_init.sql` on first DB start.
|
|
- Worker ingests WAQI bounds data using `WAQI_TOKEN` and bbox env values.
|
|
- Database files are stored in `db/data` (bind mount).
|
|
- Worker detects basic anomalies (delay/stuck/spike) using observed_ts and env thresholds.
|