Next.js + PostGIS dashboard for Southern Company network lifecycle analytics.
- Next.js (App Router)
- PostgreSQL + PostGIS
- React Leaflet map visualization
- Recharts for breakdown views
- TypeScript ETL ingestion from Excel
- Copy env file:
cp .env.example .env.local- Start PostGIS:
docker compose up -d postgres- Install dependencies:
npm install- Run migrations:
npm run migrate- Ingest workbook:
npm run ingest -- --file "./data/UAInnovateDataset-SoCo.xlsx"- Start app:
npm run dev- Ensure the workbook exists at
./data/UAInnovateDataset-SoCo.xlsx. - Build and run:
docker compose up --buildThe app container will run migrations, ingest the workbook from /app/data/UAInnovateDataset-SoCo.xlsx, and then start Next.js on http://localhost:3000.
npm run migrate- applies SQL migrations fromdb/migrationsnpm run ingest -- --file <path>- full refresh from Excel workbooknpm run dev- Next.js dev servernpm run lint- ESLintnpm run test- Vitest unit tests
GET /api/healthGET /api/dashboard/filtersGET /api/dashboard/kpisGET /api/dashboard/heatmapGET /api/dashboard/map/statesGET /api/dashboard/map/states/:stateCode/countiesGET /api/dashboard/map/states/:stateCode/counties/:countyFips/sitesGET /api/dashboard/map/states/:stateCode/counties/:countyFips/sites/:siteCodeGET /api/dashboard/breakdownGET /api/dashboard/radius-groupsGET /api/devicesGET /api/exceptionsPOST /api/exceptionsPATCH /api/exceptions/:idDELETE /api/exceptions/:id
- Use a public TLS endpoint for Postgres.
- Set
DATABASE_SSL=truein Vercel env vars. - Use a least-privileged DB user for app runtime.
- Run
npm run migrateandnpm run ingestagainst production DB before enabling app traffic.
See /methodology page in-app for transform assumptions, source precedence, and scoring details.
Current implementation highlights:
- Per-unit device identity (
device_id) is generated asdevice_name::serial(NO-SERIALfallback) and multi-serial rows are expanded. - Exceptions are unit-aware (
device_id) with backward-compatibledeviceNamesupport. - Planning-first defaults are enabled across API/query/UI:
- include out-of-scope = false
- include decom sites = false
- Time preview uses a dynamic as-of date (default current date) and configurable lifecycle window.
- Estimated refresh cost uses total estimated cost (material + labor fallbacks).
- Support/security correlation charts are included; security is lifecycle-derived proxy data.