# mrmeralco/teamohmmygrid architecture

> Architecture diagram of the GitHub repository mrmeralco/teamohmmygrid, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mrmeralco/teamohmmygrid
- Repository: https://github.com/mrmeralco/teamohmmygrid

## Overview

KuryenTipid is a consumer energy-management app aimed at preventing electricity bill shock. Users register and configure a budget, then monitor bills and meter usage, explore savings, manage simulated smart plugs, get alerts, and ask Tanong AI for explanations. The map includes billing analysis, AMI and analog-meter workflows, and personalization. Some screen implementations were not sampled; those branches and their user-facing relationships are represented from the README, while source-level links are limited to indexed references and excerpts.

Main entry points: [`src/app/(tabs)/index.tsx`](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/app/(tabs)/index.tsx) (Usage dashboard), [`src/app/(tabs)/plugs.tsx`](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/app/(tabs)/plugs.tsx) (Smart plug controls), [`src/services/analogMeterService.ts`](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/services/analogMeterService.ts) (Analog meter analysis), [`src/services/amiTelemetryService.ts`](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/services/amiTelemetryService.ts) (AMI telemetry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["App experience"]
  node_dashboard["Usage dashboard<br/>[index.tsx]"]
  node_energy["Energy state<br/>[EnergyContext.tsx]"]
end

subgraph group_metering["Metering and billing"]
  node_bill["Bill scanning<br/>[bill.tsx]"]
  node_billverify["Bill verification"]
  node_manual["Manual meter entry"]
  node_analog["Analog meter analysis"]
  node_ami["AMI telemetry"]
  node_meterdata["Meter data types<br/>[amiTelemetry.ts]"]
end

subgraph group_insights["Energy insights"]
  node_budget["Budget setup<br/>[budget-setup.tsx]"]
  node_tariff["Tariff calculations<br/>[tariffEngine.ts]"]
  node_usage["Usage analysis<br/>[usageAnalysis.ts]"]
  node_whatif["Savings scenarios<br/>[whatif.tsx]"]
  node_alerts["Energy alerts<br/>[alerts.tsx]"]
  node_tanong["Tanong assistant<br/>[tanong.tsx]"]
  node_gemini["AI services<br/>[geminiService.ts]"]
end

subgraph group_devices["Plug management"]
  node_plugs["Smart plug controls<br/>[plugs.tsx]"]
  node_simulator["Plug simulator"]
  node_plugdiscovery["Plug discovery"]
end

subgraph group_identity["Identity and preferences"]
  node_login["Sign in<br/>[login.tsx]"]
  node_register["Registration<br/>[register.tsx]"]
  node_auth["Authentication state<br/>[AuthContext.tsx]"]
  node_authservice["Account service<br/>[authService.ts]"]
  node_supabase[("Supabase<br/>[supabase.ts]")]
  node_profile["Profile settings<br/>[profile.tsx]"]
  node_theme["Personalization<br/>[ThemeContext.tsx]"]
end

node_user(("Household user"))

node_user -->|"signs in"| node_login
node_user -->|"registers"| node_register
node_login -.->|"submits credentials"| node_auth
node_register -.->|"submits details"| node_auth
node_auth -->|"uses account service"| node_authservice
node_authservice -->|"uses when configured"| node_supabase
node_user -->|"monitors usage"| node_dashboard
node_dashboard -->|"reads energy state"| node_energy
node_user -->|"scans bill"| node_bill
node_bill -->|"verifies extraction"| node_billverify
node_user -->|"records reading"| node_manual
node_manual -->|"captures and analyzes"| node_analog
node_analog -->|"uses reading types"| node_meterdata
node_dashboard -->|"loads analog data"| node_analog
node_dashboard -->|"loads telemetry"| node_ami
node_ami -->|"uses telemetry types"| node_meterdata
node_energy -->|"uses calculations"| node_tariff
node_user -->|"sets budget"| node_budget
node_user -->|"explores savings"| node_whatif
node_user -->|"views warnings"| node_alerts
node_user -->|"asks questions"| node_tanong
node_tanong -.->|"requests answers"| node_gemini
node_gemini -->|"parses analysis"| node_usage
node_user -->|"manages devices"| node_plugs
node_plugs -->|"controls devices"| node_simulator
node_plugs -->|"requests device advice"| node_gemini
node_plugs -.->|"opens discovery"| node_plugdiscovery
node_user -->|"manages preferences"| node_profile
node_profile -.->|"updates preferences"| node_theme
node_dashboard -->|"shows telemetry charts"| node_ami
node_dashboard -->|"shows tariff breakdown"| node_tariff

click node_dashboard "https://github.com/mrmeralco/teamohmmygrid/blob/main/src/app/(tabs)/index.tsx"
click node_bill "https://github.com/mrmeralco/teamohmmygrid/blob/main/src/app/(tabs)/bill.tsx"
click node_billverify "https://github.com/mrmeralco/teamohmmygrid/blob/main/src/components/BillVerificationDrawer.tsx"
click node_manual "https://github.com/mrmeralco/teamohmmygrid/blob/main/src/app/manual-meter-input.tsx"
click node_analog "https://github.com/mrmeralco/teamohmmygrid/blob/main/src/services/analogMeterService.ts"
click node_ami "https://github.com/mrmeralco/teamohmmygrid/blob/main/src/services/amiTelemetryService.ts"
click node_meterdata "https://github.com/mrmeralco/teamohmmygrid/blob/main/src/types/amiTelemetry.ts"
click node_energy "https://github.com/mrmeralco/teamohmmygrid/blob/main/src/context/EnergyContext.tsx"
click node_budget "https://github.com/mrmeralco/teamohmmygrid/blob/main/src/app/budget-setup.tsx"
click node_tariff "https://github.com/mrmeralco/teamohmmygrid/blob/main/src/lib/tariffEngine.ts"
click node_usage "https://github.com/mrmeralco/teamohmmygrid/blob/main/src/lib/usageAnalysis.ts"
click node_whatif "https://github.com/mrmeralco/teamohmmygrid/blob/main/src/app/whatif.tsx"
click node_alerts "https://github.com/mrmeralco/teamohmmygrid/blob/main/src/app/(tabs)/alerts.tsx"
click node_tanong "https://github.com/mrmeralco/teamohmmygrid/blob/main/src/app/(tabs)/tanong.tsx"
click node_gemini "https://github.com/mrmeralco/teamohmmygrid/blob/main/src/lib/geminiService.ts"
click node_plugs "https://github.com/mrmeralco/teamohmmygrid/blob/main/src/app/(tabs)/plugs.tsx"
click node_simulator "https://github.com/mrmeralco/teamohmmygrid/blob/main/src/lib/smartPlugSimulator.ts"
click node_plugdiscovery "https://github.com/mrmeralco/teamohmmygrid/blob/main/src/components/plugs/PlugDiscoveryModal.tsx"
click node_login "https://github.com/mrmeralco/teamohmmygrid/blob/main/src/app/login.tsx"
click node_register "https://github.com/mrmeralco/teamohmmygrid/blob/main/src/app/register.tsx"
click node_auth "https://github.com/mrmeralco/teamohmmygrid/blob/main/src/context/AuthContext.tsx"
click node_authservice "https://github.com/mrmeralco/teamohmmygrid/blob/main/src/services/authService.ts"
click node_supabase "https://github.com/mrmeralco/teamohmmygrid/blob/main/src/config/supabase.ts"
click node_profile "https://github.com/mrmeralco/teamohmmygrid/blob/main/src/app/(tabs)/profile.tsx"
click node_theme "https://github.com/mrmeralco/teamohmmygrid/blob/main/src/context/ThemeContext.tsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dashboard,node_energy,node_user toneBlue
class node_bill,node_billverify,node_manual,node_analog,node_ami,node_meterdata toneAmber
class node_budget,node_tariff,node_usage,node_whatif,node_alerts,node_tanong,node_gemini toneMint
class node_plugs,node_simulator,node_plugdiscovery toneRose
class node_login,node_register,node_auth,node_authservice,node_supabase,node_profile,node_theme toneIndigo
```

## Components

### App experience

- [Usage dashboard](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/app/(tabs)/index.tsx): `src/app/(tabs)/index.tsx`
- [Energy state](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/context/EnergyContext.tsx): `src/context/EnergyContext.tsx`

### Metering and billing

- [Bill scanning](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/app/(tabs)/bill.tsx): `src/app/(tabs)/bill.tsx`
- [Bill verification](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/components/BillVerificationDrawer.tsx): `src/components/BillVerificationDrawer.tsx`
- [Manual meter entry](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/app/manual-meter-input.tsx): `src/app/manual-meter-input.tsx`
- [Analog meter analysis](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/services/analogMeterService.ts): `src/services/analogMeterService.ts`
- [AMI telemetry](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/services/amiTelemetryService.ts): `src/services/amiTelemetryService.ts`
- [Meter data types](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/types/amiTelemetry.ts): `src/types/amiTelemetry.ts`

### Energy insights

- [Budget setup](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/app/budget-setup.tsx): `src/app/budget-setup.tsx`
- [Tariff calculations](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/lib/tariffEngine.ts): `src/lib/tariffEngine.ts`
- [Usage analysis](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/lib/usageAnalysis.ts): `src/lib/usageAnalysis.ts`
- [Savings scenarios](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/app/whatif.tsx): `src/app/whatif.tsx`
- [Energy alerts](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/app/(tabs)/alerts.tsx): `src/app/(tabs)/alerts.tsx`
- [Tanong assistant](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/app/(tabs)/tanong.tsx): `src/app/(tabs)/tanong.tsx`
- [AI services](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/lib/geminiService.ts): `src/lib/geminiService.ts`

### Plug management

- [Smart plug controls](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/app/(tabs)/plugs.tsx): `src/app/(tabs)/plugs.tsx`
- [Plug simulator](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/lib/smartPlugSimulator.ts): `src/lib/smartPlugSimulator.ts`
- [Plug discovery](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/components/plugs/PlugDiscoveryModal.tsx): `src/components/plugs/PlugDiscoveryModal.tsx`

### Identity and preferences

- [Sign in](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/app/login.tsx): `src/app/login.tsx`
- [Registration](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/app/register.tsx): `src/app/register.tsx`
- [Authentication state](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`
- [Account service](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/services/authService.ts): `src/services/authService.ts`
- [Supabase](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/config/supabase.ts): `src/config/supabase.ts`
- [Profile settings](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/app/(tabs)/profile.tsx): `src/app/(tabs)/profile.tsx`
- [Personalization](https://github.com/mrmeralco/teamohmmygrid/blob/main/src/context/ThemeContext.tsx): `src/context/ThemeContext.tsx`

### Other components

- **Household user**

## Connections

- Household user → Sign in: signs in
- Household user → Registration: registers
- Sign in → Authentication state: submits credentials
- Registration → Authentication state: submits details
- Authentication state → Account service: uses account service (evidence: `src/context/AuthContext.tsx`)
- Account service → Supabase: uses when configured (evidence: `src/services/authService.ts`)
- Household user → Usage dashboard: monitors usage
- Usage dashboard → Energy state: reads energy state (evidence: `src/app/(tabs)/index.tsx`)
- Household user → Bill scanning: scans bill
- Bill scanning → Bill verification: verifies extraction
- Household user → Manual meter entry: records reading
- Manual meter entry → Analog meter analysis: captures and analyzes (evidence: `src/app/manual-meter-input.tsx`)
- Analog meter analysis → Meter data types: uses reading types (evidence: `src/services/analogMeterService.ts`)
- Usage dashboard → Analog meter analysis: loads analog data (evidence: `src/app/(tabs)/index.tsx`)
- Usage dashboard → AMI telemetry: loads telemetry
- AMI telemetry → Meter data types: uses telemetry types (evidence: `src/components/AmiCurveGraphCard.tsx`)
- Energy state → Tariff calculations: uses calculations (evidence: `src/context/EnergyContext.tsx`)
- Household user → Budget setup: sets budget
- Household user → Savings scenarios: explores savings
- Household user → Energy alerts: views warnings
- Household user → Tanong assistant: asks questions
- Tanong assistant → AI services: requests answers
- AI services → Usage analysis: parses analysis (evidence: `src/lib/geminiService.ts`)
- Household user → Smart plug controls: manages devices
- Smart plug controls → Plug simulator: controls devices (evidence: `src/app/(tabs)/plugs.tsx`)
- Smart plug controls → AI services: requests device advice (evidence: `src/app/(tabs)/plugs.tsx`)
- Smart plug controls → Plug discovery: opens discovery
- Household user → Profile settings: manages preferences
- Profile settings → Personalization: updates preferences
- Usage dashboard → AMI telemetry: shows telemetry charts
- Usage dashboard → Tariff calculations: shows tariff breakdown (evidence: `src/app/(tabs)/index.tsx`)
