# chuajanice/wb4 architecture

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

- Interactive diagram: https://gitdiagram.com/chuajanice/wb4
- Repository: https://github.com/chuajanice/wb4

## Overview

This is a Django water-utility billing and consumer-account management system. Staff use routed web views to manage consumers, meter readings, bills, payments, penalties, and account issues; reporting views provide billing and consumption summaries. Persistent domain records are represented by Django models, with supporting calculation and data-porting modules. The README gives no product detail, so feature coverage comes from the URL routes and sampled source; unsampled view behavior and database configuration are not inferred.

Main entry points: [`index/views.py`](https://github.com/chuajanice/wb4/blob/main/index/views.py) (Web handlers), [`index/dataporter.py`](https://github.com/chuajanice/wb4/blob/main/index/dataporter.py) (Legacy data porting), [`index/functions.py`](https://github.com/chuajanice/wb4/blob/main/index/functions.py) (Billing calculations), [`index/models.py`](https://github.com/chuajanice/wb4/blob/main/index/models.py) (Consumer accounts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_routes["Application routes<br/>[urls.py]"]
  node_handlers["Web handlers<br/>[views.py]"]
  node_access["Role access checks<br/>[decorators.py]"]
  node_forms["Staff and consumer forms<br/>[forms.py]"]
end

subgraph group_billing["Billing operations"]
  node_accounts[("Consumer accounts<br/>[models.py]")]
  node_transactions[("Billing transactions<br/>[models.py]")]
  node_billinglogic["Billing calculations<br/>[functions.py]"]
  node_scheduledpenalties["Scheduled penalties<br/>[tasks.py]"]
end

subgraph group_insights["Reports and data"]
  node_reportviews["Report handlers<br/>[reports.py]"]
  node_dataimport["Legacy data porting<br/>[dataporter.py]"]
  node_columnmapping["Legacy column mapping<br/>[colnames.py]"]
end

subgraph group_domain["Domain support"]
  node_domainmodels[("Utility domain records<br/>[models.py]")]
  node_passwordtokens["Password reset tokens<br/>[tokens.py]"]
end

node_staff(("Staff user"))

node_staff -->|"requests pages"| node_routes
node_routes -->|"routes requests"| node_handlers
node_routes -->|"routes reports"| node_reportviews
node_handlers -->|"imports calculations"| node_billinglogic
node_handlers -->|"imports forms"| node_forms
node_handlers -->|"imports access checks"| node_access
node_handlers -->|"imports tasks"| node_scheduledpenalties
node_handlers -->|"imports tokens"| node_passwordtokens
node_handlers -->|"uses account records"| node_accounts
node_handlers -->|"uses transactions"| node_transactions
node_billinglogic -->|"queries accounts"| node_accounts
node_billinglogic -->|"updates transactions"| node_transactions
node_billinglogic -->|"imports porting helpers"| node_dataimport
node_scheduledpenalties -->|"creates penalties"| node_transactions
node_scheduledpenalties -->|"checks consumers"| node_accounts
node_reportviews -->|"queries billing data"| node_transactions
node_reportviews -->|"queries consumers"| node_accounts
node_dataimport -->|"imports column names"| node_columnmapping
node_dataimport -->|"imports billing helpers"| node_billinglogic
node_dataimport -->|"creates account records"| node_accounts
node_dataimport -->|"creates transactions"| node_transactions
node_handlers -->|"uses utility records"| node_domainmodels

click node_routes "https://github.com/chuajanice/wb4/blob/main/index/urls.py"
click node_handlers "https://github.com/chuajanice/wb4/blob/main/index/views.py"
click node_access "https://github.com/chuajanice/wb4/blob/main/index/decorators.py"
click node_forms "https://github.com/chuajanice/wb4/blob/main/index/forms.py"
click node_accounts "https://github.com/chuajanice/wb4/blob/main/index/models.py"
click node_transactions "https://github.com/chuajanice/wb4/blob/main/index/models.py"
click node_billinglogic "https://github.com/chuajanice/wb4/blob/main/index/functions.py"
click node_scheduledpenalties "https://github.com/chuajanice/wb4/blob/main/index/tasks.py"
click node_reportviews "https://github.com/chuajanice/wb4/blob/main/index/reports.py"
click node_dataimport "https://github.com/chuajanice/wb4/blob/main/index/dataporter.py"
click node_columnmapping "https://github.com/chuajanice/wb4/blob/main/index/colnames.py"
click node_domainmodels "https://github.com/chuajanice/wb4/blob/main/index/models.py"
click node_passwordtokens "https://github.com/chuajanice/wb4/blob/main/index/tokens.py"

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_routes,node_handlers,node_access,node_forms,node_staff toneBlue
class node_accounts,node_transactions,node_billinglogic,node_scheduledpenalties toneAmber
class node_reportviews,node_dataimport,node_columnmapping toneMint
class node_domainmodels,node_passwordtokens toneRose
```

## Components

### Web interface

- [Application routes](https://github.com/chuajanice/wb4/blob/main/index/urls.py): `index/urls.py`
- [Web handlers](https://github.com/chuajanice/wb4/blob/main/index/views.py): `index/views.py`
- [Role access checks](https://github.com/chuajanice/wb4/blob/main/index/decorators.py): `index/decorators.py`
- [Staff and consumer forms](https://github.com/chuajanice/wb4/blob/main/index/forms.py): `index/forms.py`

### Billing operations

- [Consumer accounts](https://github.com/chuajanice/wb4/blob/main/index/models.py): `index/models.py`
- [Billing transactions](https://github.com/chuajanice/wb4/blob/main/index/models.py): `index/models.py`
- [Billing calculations](https://github.com/chuajanice/wb4/blob/main/index/functions.py): `index/functions.py`
- [Scheduled penalties](https://github.com/chuajanice/wb4/blob/main/index/tasks.py): `index/tasks.py`

### Reports and data

- [Report handlers](https://github.com/chuajanice/wb4/blob/main/index/reports.py): `index/reports.py`
- [Legacy data porting](https://github.com/chuajanice/wb4/blob/main/index/dataporter.py): `index/dataporter.py`
- [Legacy column mapping](https://github.com/chuajanice/wb4/blob/main/index/colnames.py): `index/colnames.py`

### Domain support

- [Utility domain records](https://github.com/chuajanice/wb4/blob/main/index/models.py): `index/models.py`
- [Password reset tokens](https://github.com/chuajanice/wb4/blob/main/index/tokens.py): `index/tokens.py`

### Other components

- **Staff user**

## Connections

- Staff user → Application routes: requests pages (evidence: `index/urls.py`)
- Application routes → Web handlers: routes requests (evidence: `index/urls.py`)
- Application routes → Report handlers: routes reports (evidence: `index/urls.py`)
- Web handlers → Billing calculations: imports calculations (evidence: `index/views.py`)
- Web handlers → Staff and consumer forms: imports forms (evidence: `index/views.py`)
- Web handlers → Role access checks: imports access checks (evidence: `index/views.py`)
- Web handlers → Scheduled penalties: imports tasks (evidence: `index/views.py`)
- Web handlers → Password reset tokens: imports tokens (evidence: `index/views.py`)
- Web handlers → Consumer accounts: uses account records (evidence: `index/views.py`)
- Web handlers → Billing transactions: uses transactions (evidence: `index/views.py`)
- Billing calculations → Consumer accounts: queries accounts (evidence: `index/functions.py`)
- Billing calculations → Billing transactions: updates transactions (evidence: `index/functions.py`)
- Billing calculations → Legacy data porting: imports porting helpers (evidence: `index/functions.py`)
- Scheduled penalties → Billing transactions: creates penalties (evidence: `index/tasks.py`)
- Scheduled penalties → Consumer accounts: checks consumers (evidence: `index/tasks.py`)
- Report handlers → Billing transactions: queries billing data (evidence: `index/reports.py`)
- Report handlers → Consumer accounts: queries consumers (evidence: `index/reports.py`)
- Legacy data porting → Legacy column mapping: imports column names (evidence: `index/dataporter.py`)
- Legacy data porting → Billing calculations: imports billing helpers (evidence: `index/dataporter.py`)
- Legacy data porting → Consumer accounts: creates account records (evidence: `index/dataporter.py`)
- Legacy data porting → Billing transactions: creates transactions (evidence: `index/dataporter.py`)
- Web handlers → Utility domain records: uses utility records (evidence: `index/views.py`)
