# mierxan/field-survey-report architecture

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

- Interactive diagram: https://gitdiagram.com/mierxan/field-survey-report
- Repository: https://github.com/mierxan/field-survey-report

## Overview

This is a Windows desktop cargo-inspection and warehouse-monitoring application. The main workflow is to sign in, create or open an inspection report, save it as the authoritative record, then derive receiving/withdrawal transactions, inventory, dashboards, and exports from saved reports. Separate branches cover report imports and warehouse reconciliation. The index and excerpts establish several internal links; README statements support the documented product workflows and capabilities. Some UI and storage wiring is unsampled, so those links are omitted rather than inferred.

Main entry points: [`field_survey_report.py`](https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/field_survey_report.py) (Inspection application), [`warehouse_ui/pages.py`](https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/warehouse_ui/pages.py) (Monitoring pages), [`fsr_store.py`](https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/fsr_store.py) (Report store interface), [`warehouse/store.py`](https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/warehouse/store.py) (Warehouse data access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Desktop application"]
  node_entry["Application entry<br/>[main.py]"]
  node_report_app["Inspection application"]
  node_auth["Local accounts<br/>[app_auth.py]"]
end

subgraph group_reports["Inspection reports"]
  node_report_forms["Report forms<br/>[fsr_forms.py]"]
  node_report_import["Report import and review<br/>[fsr_import.py]"]
  node_report_drafts["Draft reports<br/>[fsr_drafts.py]"]
  node_handover["Report handover<br/>[fsr_handover.py]"]
end

subgraph group_persistence["Report persistence"]
  node_store_api["Report store interface<br/>[fsr_store.py]"]
  node_sqlite[("Local reports database")]
  node_excel_data["Workbook data layer<br/>[fsr_storage.py]"]
  node_mysql[("Optional MySQL sync<br/>[db_mysql.py]")]
  node_save_journal["Save recovery journal"]
end

subgraph group_warehouse["Warehouse analytics"]
  node_warehouse_store["Warehouse data access<br/>[store.py]"]
  node_transactions["Transaction mapping<br/>[transactions.py]"]
  node_inventory["Inventory and reconciliation<br/>[inventory.py]"]
  node_analytics["Warehouse analytics<br/>[analytics.py]"]
  node_tables["Shared report tables<br/>[tables.py]"]
end

subgraph group_warehouse_ui["Warehouse screens and reports"]
  node_warehouse_shell["Warehouse UI shell<br/>[shell.py]"]
  node_warehouse_pages["Monitoring pages<br/>[pages.py]"]
  node_warehouse_components["Reusable UI components<br/>[components.py]"]
  node_exports["Excel and PDF reports<br/>[exports.py]"]
  node_settings["Warehouse settings<br/>[settings_page.py]"]
end

node_user(("Inspector or owner"))

node_user -->|"starts"| node_entry
node_entry -->|"opens"| node_report_app
node_report_app -->|"authenticates with"| node_auth
node_report_app -->|"uses forms"| node_report_forms
node_report_app -->|"saves reports through"| node_store_api
node_report_app -->|"imports reports"| node_report_import
node_report_app -->|"manages handover"| node_handover
node_report_app -.->|"manages drafts"| node_report_drafts
node_report_import -->|"writes imported reports"| node_store_api
node_store_api -->|"delegates to"| node_sqlite
node_sqlite -->|"uses report layouts"| node_excel_data
node_store_api -->|"supports workbook storage"| node_excel_data
node_store_api -.->|"coordinates recoverable saves"| node_save_journal
node_report_app -->|"syncs optionally"| node_mysql
node_warehouse_shell -.->|"hosts screens"| node_warehouse_pages
node_warehouse_pages -->|"uses components"| node_warehouse_components
node_warehouse_pages -->|"loads warehouse data"| node_warehouse_store
node_warehouse_store -->|"maps saved reports"| node_transactions
node_transactions -->|"reads report fields"| node_excel_data
node_warehouse_store -->|"builds inventory"| node_inventory
node_warehouse_pages -->|"shows inventory"| node_inventory
node_warehouse_pages -->|"requests summaries"| node_analytics
node_analytics -->|"aggregates transactions"| node_transactions
node_analytics -->|"summarizes balances"| node_inventory
node_warehouse_pages -->|"builds table rows"| node_tables
node_warehouse_pages -->|"exports reports"| node_exports
node_settings -->|"configures warehouse data"| node_warehouse_store
node_user -->|"opens monitoring"| node_warehouse_shell

click node_entry "https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/main.py"
click node_report_app "https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/field_survey_report.py"
click node_auth "https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/app_auth.py"
click node_report_forms "https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/fsr_forms.py"
click node_report_import "https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/fsr_import.py"
click node_report_drafts "https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/fsr_drafts.py"
click node_handover "https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/fsr_handover.py"
click node_store_api "https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/fsr_store.py"
click node_sqlite "https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/fsr_sqlite_store.py"
click node_excel_data "https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/fsr_storage.py"
click node_mysql "https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/db_mysql.py"
click node_save_journal "https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/fsr_save_journal.py"
click node_warehouse_store "https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/warehouse/store.py"
click node_transactions "https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/warehouse/transactions.py"
click node_inventory "https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/warehouse/inventory.py"
click node_analytics "https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/warehouse/analytics.py"
click node_tables "https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/warehouse/tables.py"
click node_warehouse_shell "https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/warehouse_ui/shell.py"
click node_warehouse_pages "https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/warehouse_ui/pages.py"
click node_warehouse_components "https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/warehouse_ui/components.py"
click node_exports "https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/warehouse/exports.py"
click node_settings "https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/warehouse_ui/settings_page.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_entry,node_report_app,node_auth toneBlue
class node_report_forms,node_report_import,node_report_drafts,node_handover toneAmber
class node_store_api,node_sqlite,node_excel_data,node_mysql,node_save_journal toneMint
class node_warehouse_store,node_transactions,node_inventory,node_analytics,node_tables toneRose
class node_warehouse_shell,node_warehouse_pages,node_warehouse_components,node_exports,node_settings,node_user toneIndigo
```

## Components

### Desktop application

- [Application entry](https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/main.py): `main.py`
- [Inspection application](https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/field_survey_report.py): `field_survey_report.py`
- [Local accounts](https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/app_auth.py): `app_auth.py`

### Inspection reports

- [Report forms](https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/fsr_forms.py): `fsr_forms.py`
- [Report import and review](https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/fsr_import.py): `fsr_import.py`
- [Draft reports](https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/fsr_drafts.py): `fsr_drafts.py`
- [Report handover](https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/fsr_handover.py): `fsr_handover.py`

### Report persistence

- [Report store interface](https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/fsr_store.py): `fsr_store.py`
- [Local reports database](https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/fsr_sqlite_store.py): `fsr_sqlite_store.py`
- [Workbook data layer](https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/fsr_storage.py): `fsr_storage.py`
- [Optional MySQL sync](https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/db_mysql.py): `db_mysql.py`
- [Save recovery journal](https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/fsr_save_journal.py): `fsr_save_journal.py`

### Warehouse analytics

- [Warehouse data access](https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/warehouse/store.py): `warehouse/store.py`
- [Transaction mapping](https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/warehouse/transactions.py): `warehouse/transactions.py`
- [Inventory and reconciliation](https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/warehouse/inventory.py): `warehouse/inventory.py`
- [Warehouse analytics](https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/warehouse/analytics.py): `warehouse/analytics.py`
- [Shared report tables](https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/warehouse/tables.py): `warehouse/tables.py`

### Warehouse screens and reports

- [Warehouse UI shell](https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/warehouse_ui/shell.py): `warehouse_ui/shell.py`
- [Monitoring pages](https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/warehouse_ui/pages.py): `warehouse_ui/pages.py`
- [Reusable UI components](https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/warehouse_ui/components.py): `warehouse_ui/components.py`
- [Excel and PDF reports](https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/warehouse/exports.py): `warehouse/exports.py`
- [Warehouse settings](https://github.com/mierxan/field-survey-report/blob/improvements/excel-dashboard/warehouse_ui/settings_page.py): `warehouse_ui/settings_page.py`

### Other components

- **Inspector or owner**

## Connections

- Inspector or owner → Application entry: starts
- Application entry → Inspection application: opens
- Inspection application → Local accounts: authenticates with (evidence: `field_survey_report.py`)
- Inspection application → Report forms: uses forms (evidence: `field_survey_report.py`)
- Inspection application → Report store interface: saves reports through (evidence: `field_survey_report.py`)
- Inspection application → Report import and review: imports reports (evidence: `field_survey_report.py`)
- Inspection application → Report handover: manages handover (evidence: `field_survey_report.py`)
- Inspection application → Draft reports: manages drafts
- Report import and review → Report store interface: writes imported reports (evidence: `fsr_import.py`)
- Report store interface → Local reports database: delegates to (evidence: `fsr_store.py`)
- Local reports database → Workbook data layer: uses report layouts (evidence: `fsr_sqlite_store.py`)
- Report store interface → Workbook data layer: supports workbook storage (evidence: `fsr_store.py`)
- Report store interface → Save recovery journal: coordinates recoverable saves (evidence: `fsr_store.py`)
- Inspection application → Optional MySQL sync: syncs optionally (evidence: `field_survey_report.py`)
- Warehouse UI shell → Monitoring pages: hosts screens
- Monitoring pages → Reusable UI components: uses components (evidence: `warehouse_ui/pages.py`)
- Monitoring pages → Warehouse data access: loads warehouse data (evidence: `warehouse_ui/pages.py`)
- Warehouse data access → Transaction mapping: maps saved reports (evidence: `warehouse/store.py`)
- Transaction mapping → Workbook data layer: reads report fields (evidence: `warehouse/transactions.py`)
- Warehouse data access → Inventory and reconciliation: builds inventory (evidence: `warehouse/store.py`)
- Monitoring pages → Inventory and reconciliation: shows inventory (evidence: `warehouse_ui/warehouse_page.py`)
- Monitoring pages → Warehouse analytics: requests summaries (evidence: `warehouse_ui/pages.py`)
- Warehouse analytics → Transaction mapping: aggregates transactions (evidence: `warehouse/analytics.py`)
- Warehouse analytics → Inventory and reconciliation: summarizes balances (evidence: `warehouse/analytics.py`)
- Monitoring pages → Shared report tables: builds table rows (evidence: `warehouse_ui/pages.py`)
- Monitoring pages → Excel and PDF reports: exports reports (evidence: `warehouse_ui/pages.py`)
- Warehouse settings → Warehouse data access: configures warehouse data (evidence: `warehouse_ui/settings_page.py`)
- Inspector or owner → Warehouse UI shell: opens monitoring
