# gamency/smartmeter architecture

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

- Interactive diagram: https://gitdiagram.com/gamency/smartmeter
- Repository: https://github.com/gamency/smartmeter

## Overview

SmartMeter is an Android app for rental-property electricity management. Its main workflow presents dashboard totals, room-level usage and trends from the backend; users can also photograph meter readings, select rooms, and review pending recognition results. The README documents these capabilities and API endpoints. The sampled implementation excerpts are from backup_func rather than the app’s main source tree, so links between unsampled app components are omitted; the RAG/agent assistant is documented, but its backend implementation is not present in the tree.

Main entry points: [`app/src/main/java/com/example/smartmeter/OverviewFragment.java`](https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/OverviewFragment.java) (Overview), [`app/src/main/java/com/example/smartmeter/SmartPhotoActivity.java`](https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/SmartPhotoActivity.java) (Photo capture), [`app/src/main/java/com/example/smartmeter/MainActivity.java`](https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/MainActivity.java) (Android app), [`app/src/main/java/com/example/smartmeter/SmartReviewActivity.java`](https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/SmartReviewActivity.java) (Reading review)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Usage dashboard"]
  node_app["Android app<br/>[MainActivity.java]"]
  node_overview["Overview"]
  node_distribution["Room details"]
end

subgraph group_meter["Meter readings"]
  node_photo["Photo capture"]
  node_roomselect["Room selection"]
  node_review["Reading review"]
end

subgraph group_assistant["Assistant"]
  node_chat["Chat interface<br/>[ChatActivity.java]"]
  node_sessions["Chat sessions<br/>[ChatSession.java]"]
  node_agent["RAG agent service"]
end

subgraph group_local["Local data"]
  node_readingdb[("Reading database")]
  node_readingdao["Reading access"]
  node_readingentity["Reading records"]
  node_roomitem["Room model<br/>[RoomItem.java]"]
end

node_landlord(("Landlord or tenant"))
node_backend["Meter backend"]

node_landlord -->|"uses"| node_app
node_app -->|"shows"| node_overview
node_overview -->|"fetches dashboard data"| node_backend
node_overview -->|"fetches room usage"| node_backend
node_overview -->|"fetches daily trends"| node_backend
node_landlord -->|"captures readings"| node_photo
node_photo -->|"uploads photos"| node_backend
node_photo -.->|"selects room"| node_roomselect
node_landlord -->|"reviews readings"| node_review
node_review -->|"loads pending records"| node_backend
node_photo -.->|"caches readings"| node_readingdb
node_readingdb -.->|"provides access"| node_readingdao
node_readingdao -.->|"stores records"| node_readingentity
node_landlord -->|"views details"| node_distribution
node_chat -.->|"sends queries"| node_agent
node_agent -.->|"uses tools"| node_backend

click node_app "https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/MainActivity.java"
click node_overview "https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/OverviewFragment.java"
click node_distribution "https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/DistributionActivity.java"
click node_photo "https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/SmartPhotoActivity.java"
click node_roomselect "https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/RoomSelectorAdapter.java"
click node_review "https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/SmartReviewActivity.java"
click node_chat "https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/ChatActivity.java"
click node_sessions "https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/ChatSession.java"
click node_readingdb "https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/SmartReadingDatabase.java"
click node_readingdao "https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/SmartReadingDao.java"
click node_readingentity "https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/SmartReadingEntity.java"
click node_roomitem "https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/RoomItem.java"

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_app,node_overview,node_distribution toneBlue
class node_photo,node_roomselect,node_review toneAmber
class node_chat,node_sessions,node_agent toneMint
class node_readingdb,node_readingdao,node_readingentity,node_roomitem toneRose
class node_landlord,node_backend toneIndigo
```

## Components

### Usage dashboard

- [Android app](https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/MainActivity.java): `app/src/main/java/com/example/smartmeter/MainActivity.java`
- [Overview](https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/OverviewFragment.java): `app/src/main/java/com/example/smartmeter/OverviewFragment.java`
- [Room details](https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/DistributionActivity.java): `app/src/main/java/com/example/smartmeter/DistributionActivity.java`

### Meter readings

- [Photo capture](https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/SmartPhotoActivity.java): `app/src/main/java/com/example/smartmeter/SmartPhotoActivity.java`
- [Room selection](https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/RoomSelectorAdapter.java): `app/src/main/java/com/example/smartmeter/RoomSelectorAdapter.java`
- [Reading review](https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/SmartReviewActivity.java): `app/src/main/java/com/example/smartmeter/SmartReviewActivity.java`

### Assistant

- [Chat interface](https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/ChatActivity.java): `app/src/main/java/com/example/smartmeter/ChatActivity.java`
- [Chat sessions](https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/ChatSession.java): `app/src/main/java/com/example/smartmeter/ChatSession.java`
- **RAG agent service**

### Local data

- [Reading database](https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/SmartReadingDatabase.java): `app/src/main/java/com/example/smartmeter/SmartReadingDatabase.java`
- [Reading access](https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/SmartReadingDao.java): `app/src/main/java/com/example/smartmeter/SmartReadingDao.java`
- [Reading records](https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/SmartReadingEntity.java): `app/src/main/java/com/example/smartmeter/SmartReadingEntity.java`
- [Room model](https://github.com/gamency/smartmeter/blob/main/app/src/main/java/com/example/smartmeter/RoomItem.java): `app/src/main/java/com/example/smartmeter/RoomItem.java`

### Other components

- **Landlord or tenant**
- **Meter backend**

## Connections

- Landlord or tenant → Android app: uses (evidence: `README.md`)
- Android app → Overview: shows (evidence: `README.md`)
- Overview → Meter backend: fetches dashboard data (evidence: `README.md`)
- Overview → Meter backend: fetches room usage (evidence: `README.md`)
- Overview → Meter backend: fetches daily trends (evidence: `README.md`)
- Landlord or tenant → Photo capture: captures readings (evidence: `README.md`)
- Photo capture → Meter backend: uploads photos (evidence: `README.md`)
- Photo capture → Room selection: selects room
- Landlord or tenant → Reading review: reviews readings (evidence: `README.md`)
- Reading review → Meter backend: loads pending records (evidence: `README.md`)
- Photo capture → Reading database: caches readings
- Reading database → Reading access: provides access
- Reading access → Reading records: stores records
- Landlord or tenant → Room details: views details (evidence: `README.md`)
- Chat interface → RAG agent service: sends queries
- RAG agent service → Meter backend: uses tools
