Logo Lanfrica

kayombo123/powermap

Domain:

digital infrastructureenvironment and energy

Record type:

software
Creator:
kay
Host:
An agent mobile app for reporting and mapping power outages in zambia ## pmap – Power outage mapping and analysis This project is a production-oriented Flutter application for real-time reporting, mapping, and analysis of power outages, backed by Supabase (PostgreSQL, Auth, RLS, Edge Functions), AWS Location Service, and an agentic AI layer. ### Architecture overview - **Flutter app**: role-aware client (Admin vs User) with: - Email/password auth via Supabase. - Outage reporting sheet with GPS resolution via Supabase Edge. - Real-time outage map powered by AWS Location tiles (served via a non-Google tile source). - Admin dashboard view that consumes a Supabase Edge Function summary. - **Supabase**: - Core tables: `profiles`, `raw_outage_reports`, `verified_outages`, `ai_reasoning_logs`. - Strict Row Level Security on all tables; admin role derived from `profiles.role`. - Edge Functions: - `outage-clustering`: DBSCAN-style clustering of raw reports into `verified_outages`. - `ai-agent`: tool-based agent that can answer questions about verified outages only. - **AWS Location Service**: - Used to render map tiles and perform location-aware operations via the Amazon Location Maps API (no Google services). ### Local setup 1. **Flutter** - Install Flutter 3.3+ and Dart 3.3+. - Run `flutter pub get`. 2. **Supabase** - Create a Supabase project. - Apply `supabase/schema.sql` and `supabase/policies.sql` in the SQL editor. - Deploy Edge Functions: - `supabase/functions/outage-clustering` - `supabase/functions/ai-agent` 3. **AWS Location Service** - Region: set `awsRegion` to `eu-north-1` (Stockholm). - Create or reuse a map resource and note its **MapName**; set `awsLocationMapName` to that exact value. - Use your Amazon Location API key: - In `assets/env.json`, set `awsLocationApiKey` to the value shown in the console (for example the `v1.public...` key you created named `pmap`). 4. **Environment configuration** - Copy `assets/env.json.example` to `assets/env.json` and fill in: - `supabaseUrl`, `supabaseAnonKey` - `awsRegion`, `awsLocatio …