# harshmohite-05/water-analysis-report-generator architecture

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

- Interactive diagram: https://gitdiagram.com/harshmohite-05/water-analysis-report-generator
- Repository: https://github.com/harshmohite-05/water-analysis-report-generator

## Overview

This is a Streamlit water-analysis reporting application for staff at the Mumbai and Ahmedabad offices. The principal workflow is to authenticate, assemble client/sample details, select parameters and remarks, preview an office-specific report, generate DOCX/PDF output, and retain reports for history and audit. Admin capabilities maintain employee/client directories and parameter data. The graph preserves these documented product branches; some page-to-component wiring is based on the source index rather than inspected page bodies, so those relationships are omitted where their call direction is not established.

Main entry points: [`pages/03_Create_Report.py`](https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/pages/03_Create_Report.py) (Create Report), [`database/database.py`](https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/database/database.py) (SQL Database), [`services/auth_service.py`](https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/services/auth_service.py) (Authentication), [`components/report_preview.py`](https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/components/report_preview.py) (Preview & Generate)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access &amp; Directory"]
  node_login["Login &amp; Session<br/>[authentication.py]"]
  node_auth["Authentication<br/>[auth_service.py]"]
  node_directory["Staff &amp; Client Directory<br/>[dataset_service.py]"]
  node_admin["Admin Panel<br/>[05_Admin_Panel.py]"]
end

subgraph group_reporting["Report Preparation"]
  node_create["Create Report"]
  node_client["Client Details<br/>[client_form.py]"]
  node_office["Office Selection<br/>[office_selector.py]"]
  node_parameters["Parameter Selection<br/>[parameter_table.py]"]
  node_samples["Sample Results<br/>[sample_form.py]"]
  node_remarks["Editable Remarks<br/>[remark_editor.py]"]
  node_ai["AI Remark Refinement"]
end

subgraph group_documents["Document Generation"]
  node_preview["Preview &amp; Generate<br/>[report_preview.py]"]
  node_templates["Office Templates"]
  node_docx["DOCX Builder<br/>[docx_generator.py]"]
  node_pdf["PDF Conversion<br/>[pdf_converter.py]"]
end

subgraph group_records["Records &amp; Persistence"]
  node_history["Report History"]
  node_report_service["Report Records<br/>[report_service.py]"]
  node_audit["Audit Records<br/>[audit_service.py]"]
  node_database[("SQL Database<br/>[database.py]")]
  node_models["Data Models<br/>[models.py]"]
  node_parameters_service["Parameter Catalog"]
end

subgraph group_shared["Configuration &amp; UI"]
  node_app["Streamlit App<br/>[app.py]"]
  node_ui["Shared UI<br/>[ui_components.py]"]
end

node_staff(("Employees"))

node_staff -->|"uses"| node_app
node_app -->|"loads"| node_login
node_login -->|"authenticates"| node_auth
node_auth -->|"syncs directory"| node_directory
node_auth -->|"queries users"| node_database
node_auth -->|"logs sign-in"| node_audit
node_admin -->|"manages directory"| node_directory
node_admin -->|"manages parameters"| node_parameters_service
node_create -->|"collects details"| node_client
node_create -->|"selects office"| node_office
node_create -->|"selects parameters"| node_parameters
node_create -->|"enters results"| node_samples
node_create -->|"edits remarks"| node_remarks
node_remarks -.->|"refines optionally"| node_ai
node_create -->|"previews report"| node_preview
node_preview -->|"resolves template"| node_templates
node_preview -->|"builds DOCX"| node_docx
node_preview -->|"converts DOCX"| node_pdf
node_templates -->|"creates template"| node_docx
node_templates -.->|"—"| node_database
node_history -->|"lists reports"| node_report_service
node_report_service -->|"reads and writes"| node_database
node_report_service -->|"records report action"| node_audit
node_database -->|"registers tables"| node_models
node_parameters_service -->|"accesses catalog"| node_database

click node_app "https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/app.py"
click node_login "https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/components/authentication.py"
click node_auth "https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/services/auth_service.py"
click node_directory "https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/services/dataset_service.py"
click node_admin "https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/pages/05_Admin_Panel.py"
click node_create "https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/pages/03_Create_Report.py"
click node_client "https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/components/client_form.py"
click node_office "https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/components/office_selector.py"
click node_parameters "https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/components/parameter_table.py"
click node_samples "https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/components/sample_form.py"
click node_remarks "https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/components/remark_editor.py"
click node_ai "https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/services/remark_ai_service.py"
click node_preview "https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/components/report_preview.py"
click node_templates "https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/services/template_service.py"
click node_docx "https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/report_engine/docx_generator.py"
click node_pdf "https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/report_engine/pdf_converter.py"
click node_history "https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/pages/04_Report_History.py"
click node_report_service "https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/services/report_service.py"
click node_audit "https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/services/audit_service.py"
click node_database "https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/database/database.py"
click node_models "https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/database/models.py"
click node_parameters_service "https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/services/parameter_service.py"
click node_ui "https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/components/ui_components.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_login,node_auth,node_directory,node_admin toneBlue
class node_create,node_client,node_office,node_parameters,node_samples,node_remarks,node_ai toneAmber
class node_preview,node_templates,node_docx,node_pdf toneMint
class node_history,node_report_service,node_audit,node_database,node_models,node_parameters_service toneRose
class node_app,node_ui,node_staff toneIndigo
```

## Components

### Access & Directory

- [Login & Session](https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/components/authentication.py): `components/authentication.py`
- [Authentication](https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/services/auth_service.py): `services/auth_service.py`
- [Staff & Client Directory](https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/services/dataset_service.py): `services/dataset_service.py`
- [Admin Panel](https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/pages/05_Admin_Panel.py): `pages/05_Admin_Panel.py`

### Report Preparation

- [Create Report](https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/pages/03_Create_Report.py): `pages/03_Create_Report.py`
- [Client Details](https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/components/client_form.py): `components/client_form.py`
- [Office Selection](https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/components/office_selector.py): `components/office_selector.py`
- [Parameter Selection](https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/components/parameter_table.py): `components/parameter_table.py`
- [Sample Results](https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/components/sample_form.py): `components/sample_form.py`
- [Editable Remarks](https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/components/remark_editor.py): `components/remark_editor.py`
- [AI Remark Refinement](https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/services/remark_ai_service.py): `services/remark_ai_service.py`

### Document Generation

- [Preview & Generate](https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/components/report_preview.py): `components/report_preview.py`
- [Office Templates](https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/services/template_service.py): `services/template_service.py`
- [DOCX Builder](https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/report_engine/docx_generator.py): `report_engine/docx_generator.py`
- [PDF Conversion](https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/report_engine/pdf_converter.py): `report_engine/pdf_converter.py`

### Records & Persistence

- [Report History](https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/pages/04_Report_History.py): `pages/04_Report_History.py`
- [Report Records](https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/services/report_service.py): `services/report_service.py`
- [Audit Records](https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/services/audit_service.py): `services/audit_service.py`
- [SQL Database](https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/database/database.py): `database/database.py`
- [Data Models](https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/database/models.py): `database/models.py`
- [Parameter Catalog](https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/services/parameter_service.py): `services/parameter_service.py`

### Configuration & UI

- [Streamlit App](https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/app.py): `app.py`
- [Shared UI](https://github.com/harshmohite-05/water-analysis-report-generator/blob/main/components/ui_components.py): `components/ui_components.py`

### Other components

- **Employees**

## Connections

- Employees → Streamlit App: uses (evidence: `README.md`)
- Streamlit App → Login & Session: loads (evidence: `app.py`)
- Login & Session → Authentication: authenticates (evidence: `components/authentication.py`)
- Authentication → Staff & Client Directory: syncs directory (evidence: `services/auth_service.py`)
- Authentication → SQL Database: queries users (evidence: `services/auth_service.py`)
- Authentication → Audit Records: logs sign-in (evidence: `services/auth_service.py`)
- Admin Panel → Staff & Client Directory: manages directory (evidence: `README.md`)
- Admin Panel → Parameter Catalog: manages parameters (evidence: `README.md`)
- Create Report → Client Details: collects details (evidence: `README.md`)
- Create Report → Office Selection: selects office (evidence: `README.md`)
- Create Report → Parameter Selection: selects parameters (evidence: `README.md`)
- Create Report → Sample Results: enters results (evidence: `README.md`)
- Create Report → Editable Remarks: edits remarks (evidence: `README.md`)
- Editable Remarks → AI Remark Refinement: refines optionally (evidence: `README.md`)
- Create Report → Preview & Generate: previews report (evidence: `README.md`)
- Preview & Generate → Office Templates: resolves template (evidence: `components/report_preview.py`)
- Preview & Generate → DOCX Builder: builds DOCX (evidence: `components/report_preview.py`)
- Preview & Generate → PDF Conversion: converts DOCX (evidence: `components/report_preview.py`)
- Office Templates → DOCX Builder: creates template (evidence: `services/template_service.py`)
- Office Templates → SQL Database: —
- Report History → Report Records: lists reports (evidence: `README.md`)
- Report Records → SQL Database: reads and writes (evidence: `services/report_service.py`)
- Report Records → Audit Records: records report action (evidence: `services/report_service.py`)
- SQL Database → Data Models: registers tables (evidence: `database/database.py`)
- Parameter Catalog → SQL Database: accesses catalog (evidence: `services/parameter_service.py`)
