How roel-karstens/gridlens works
GridLens lets authenticated users explore current and historical electricity demand and generation, and compare supported European countries. Its data path runs from ENTSO-E through fetching, parsing, normalization, ingestion and database storage; authenticated API routes query that data for the React interface. The README also documents project management. Frontend API-client and Supabase implementation files are absent from the supplied tree, so those connections are shown only where the excerpts or README support them; unsampled page internals are not inferred.
Main entry points: electricity.py Electricity endpoints · App.tsx Application shell · DashboardPage.tsx Dashboard · ingestion.py Ingestion service
Components 28
Web experience
- Application shell
frontend/src/App.tsx - Sign-in
frontend/src/pages/AuthPage.tsx - Dashboard
frontend/src/pages/DashboardPage.tsx - History view
frontend/src/pages/HistoryPage.tsx - Country comparison
frontend/src/pages/ComparisonPage.tsx - Metric widgets
frontend/src/components/ElectricityCard.tsx - Generation chart
frontend/src/components/GenerationChart.tsx - Country selector
frontend/src/components/CountrySelector.tsx - Electricity data hook
frontend/src/hooks/useElectricity.ts
API and access
- FastAPI application
backend/app/main.py - Electricity endpoints
backend/app/api/electricity.py - JWT authentication
backend/app/core/auth.py - Database sessions
backend/app/dependencies.py
Electricity data
- Electricity queries
backend/app/services/electricity.py - Observation records
backend/app/models/electricity.py - Ingestion service
backend/app/services/ingestion.py - ENTSO-E client
backend/app/integrations/entsoe/client.py - XML parser
backend/app/integrations/entsoe/parser.py - Response models
backend/app/integrations/entsoe/models.py - Country and technology mappings
backend/app/integrations/entsoe/constants.py
Projects
- Project endpoints
backend/app/api/projects.py - Project operations
backend/app/services/project.py - Project records
backend/app/models/project.py - Project interface
frontend/src/pages/ProjectsPage.tsx - Project form
frontend/src/components/ProjectForm.tsx - Project list
frontend/src/components/ProjectList.tsx
Other components
- User
- ENTSO-E platform
Connections 30
- User → Application shell: uses
- Application shell → Sign-in: shows signed out
frontend/src/App.tsx - Application shell → Dashboard: routes to
frontend/src/App.tsx - Application shell → History view: routes to
frontend/src/App.tsx - Application shell → Country comparison: routes to
frontend/src/App.tsx - Dashboard → Metric widgets: renders
frontend/src/pages/DashboardPage.tsx - Dashboard → Generation chart: renders
frontend/src/pages/DashboardPage.tsx - Dashboard → Country selector: renders
frontend/src/pages/DashboardPage.tsx - Dashboard → Electricity data hook: fetches via
frontend/src/pages/DashboardPage.tsx - Electricity data hook → Electricity endpoints: requests data
- FastAPI application → Electricity endpoints: registers
backend/app/main.py - FastAPI application → Project endpoints: registers
backend/app/main.py - Electricity endpoints → JWT authentication: authenticates with
backend/app/api/electricity.py - Electricity endpoints → Database sessions: gets session
backend/app/api/electricity.py - Electricity endpoints → Electricity queries: queries
backend/app/api/electricity.py - Electricity endpoints → Country and technology mappings: lists supported countries
backend/app/api/electricity.py - Electricity queries → Observation records: queries
backend/app/services/electricity.py - Ingestion service → ENTSO-E client: fetches through
backend/app/services/ingestion.py - Ingestion service → XML parser: parses with
backend/app/services/ingestion.py - Ingestion service → Observation records: writes
backend/app/services/ingestion.py - Ingestion service → Country and technology mappings: uses mappings
backend/app/services/ingestion.py - XML parser → Response models: creates typed data
backend/app/integrations/entsoe/parser.py - XML parser → Country and technology mappings: uses mappings
backend/app/integrations/entsoe/parser.py - ENTSO-E client → ENTSO-E platform: requests data
README.md - Project endpoints → JWT authentication: authenticates with
backend/app/api/projects.py - Project endpoints → Database sessions: gets session
backend/app/api/projects.py - Project endpoints → Project operations: delegates to
backend/app/api/projects.py - Project operations → Project records: queries
backend/app/services/project.py - Project interface → Project form: renders
frontend/src/pages/ProjectsPage.tsx - Project interface → Project list: renders
frontend/src/pages/ProjectsPage.tsx