# shashidharreddy59/building-structural-safety-scorer architecture

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

- Interactive diagram: https://gitdiagram.com/shashidharreddy59/building-structural-safety-scorer
- Repository: https://github.com/shashidharreddy59/building-structural-safety-scorer

## Overview

This is a browser-based municipal building-safety prioritization dashboard. Municipal staff add or inspect buildings, the rule-based assessment produces scores and findings, and the dashboard ranks structures for inspection and supports audit, dispatch, print, and export workflows. Photo analysis is an additional input path, with optional Gemini assistance and local fallback. The README documents the major capabilities; source excerpts confirm the scoring rules, vision engine, persistence, and dataset processing, but do not expose all controller wiring.

Main entry points: [`js/app.js`](https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/js/app.js) (App Controller), [`js/models.js`](https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/js/models.js) (Assessment Engine), [`process_dataset.js`](https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/process_dataset.js) (Dataset Processor), [`js/vision.js`](https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/js/vision.js) (Vision Analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_assessment["Safety Assessment"]
  node_building["Building Record<br/>[models.js]"]
  node_rules["Inspection Rules<br/>[models.js]"]
  node_assessment_engine["Assessment Engine<br/>[models.js]"]
  node_score_result["Score Findings<br/>[models.js]"]
end

subgraph group_inspection["Photo Inspection"]
  node_photo_input["Photo Capture<br/>[app.js]"]
  node_vision_engine["Vision Analysis<br/>[vision.js]"]
end

subgraph group_operations["Municipal Operations"]
  node_dashboard["Safety Dashboard<br/>[index.html]"]
  node_controller["App Controller<br/>[app.js]"]
  node_priority_queue["Priority Queue<br/>[app.js]"]
  node_audit_notice["Audit And Print<br/>[app.js]"]
  node_dispatch["Field Dispatch<br/>[app.js]"]
  node_export["CSV Export<br/>[app.js]"]
end

subgraph group_data["Building Data"]
  node_local_storage[("Browser Storage<br/>[app.js]")]
  node_dataset_processor["Dataset Processor<br/>[process_dataset.js]"]
  node_building_csv["Buildings CSV"]
  node_generated_dataset["Dataset Bundle<br/>[dataset_1000.js]"]
end

node_staff(("Municipal Staff"))
node_gemini{{"Gemini Vision API"}}

node_staff -->|"uses"| node_dashboard
node_dashboard -->|"provides interface"| node_controller
node_controller -->|"creates records"| node_building
node_controller -->|"assesses buildings"| node_assessment_engine
node_assessment_engine -->|"evaluates rules"| node_rules
node_assessment_engine -->|"finalizes score"| node_score_result
node_controller -->|"ranks results"| node_priority_queue
node_controller -->|"accepts photos"| node_photo_input
node_photo_input -->|"analyzes image"| node_vision_engine
node_vision_engine -.->|"requests analysis"| node_gemini
node_controller -->|"shows findings"| node_audit_notice
node_controller -->|"manages dispatch"| node_dispatch
node_controller -->|"exports roster"| node_export
node_controller -->|"persists state"| node_local_storage
node_dataset_processor -->|"reads rows"| node_building_csv
node_dataset_processor -->|"writes bundle"| node_generated_dataset
node_controller -->|"loads dataset"| node_generated_dataset

click node_dashboard "https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/index.html"
click node_controller "https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/js/app.js"
click node_building "https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/js/models.js"
click node_rules "https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/js/models.js"
click node_assessment_engine "https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/js/models.js"
click node_score_result "https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/js/models.js"
click node_photo_input "https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/js/app.js"
click node_vision_engine "https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/js/vision.js"
click node_priority_queue "https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/js/app.js"
click node_audit_notice "https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/js/app.js"
click node_dispatch "https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/js/app.js"
click node_export "https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/js/app.js"
click node_local_storage "https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/js/app.js"
click node_dataset_processor "https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/process_dataset.js"
click node_building_csv "https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/data/buildings_dataset.csv"
click node_generated_dataset "https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/data/dataset_1000.js"

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_building,node_rules,node_assessment_engine,node_score_result toneBlue
class node_photo_input,node_vision_engine toneAmber
class node_dashboard,node_controller,node_priority_queue,node_audit_notice,node_dispatch,node_export,node_gemini toneMint
class node_local_storage,node_dataset_processor,node_building_csv,node_generated_dataset toneRose
class node_staff toneIndigo
```

## Components

### Safety Assessment

- [Building Record](https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/js/models.js): `js/models.js`
- [Inspection Rules](https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/js/models.js): `js/models.js`
- [Assessment Engine](https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/js/models.js): `js/models.js`
- [Score Findings](https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/js/models.js): `js/models.js`

### Photo Inspection

- [Photo Capture](https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/js/app.js): `js/app.js`
- [Vision Analysis](https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/js/vision.js): `js/vision.js`

### Municipal Operations

- [Safety Dashboard](https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/index.html): `index.html`
- [App Controller](https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/js/app.js): `js/app.js`
- [Priority Queue](https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/js/app.js): `js/app.js`
- [Audit And Print](https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/js/app.js): `js/app.js`
- [Field Dispatch](https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/js/app.js): `js/app.js`
- [CSV Export](https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/js/app.js): `js/app.js`

### Building Data

- [Browser Storage](https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/js/app.js): `js/app.js`
- [Dataset Processor](https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/process_dataset.js): `process_dataset.js`
- [Buildings CSV](https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/data/buildings_dataset.csv): `data/buildings_dataset.csv`
- [Dataset Bundle](https://github.com/shashidharreddy59/building-structural-safety-scorer/blob/main/data/dataset_1000.js): `data/dataset_1000.js`

### Other components

- **Municipal Staff**
- **Gemini Vision API**

## Connections

- Municipal Staff → Safety Dashboard: uses (evidence: `README.md`)
- Safety Dashboard → App Controller: provides interface (evidence: `README.md`)
- App Controller → Building Record: creates records (evidence: `js/app.js`)
- App Controller → Assessment Engine: assesses buildings (evidence: `README.md`)
- Assessment Engine → Inspection Rules: evaluates rules (evidence: `js/models.js`)
- Assessment Engine → Score Findings: finalizes score (evidence: `js/models.js`)
- App Controller → Priority Queue: ranks results (evidence: `README.md`)
- App Controller → Photo Capture: accepts photos (evidence: `README.md`)
- Photo Capture → Vision Analysis: analyzes image (evidence: `README.md`)
- Vision Analysis → Gemini Vision API: requests analysis (evidence: `js/vision.js`)
- App Controller → Audit And Print: shows findings (evidence: `README.md`)
- App Controller → Field Dispatch: manages dispatch (evidence: `README.md`)
- App Controller → CSV Export: exports roster (evidence: `README.md`)
- App Controller → Browser Storage: persists state (evidence: `README.md`)
- Dataset Processor → Buildings CSV: reads rows (evidence: `process_dataset.js`)
- Dataset Processor → Dataset Bundle: writes bundle (evidence: `process_dataset.js`)
- App Controller → Dataset Bundle: loads dataset (evidence: `js/app.js`)
