# jacobgeorgemathew/electrical_panel_design_automation architecture

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

- Interactive diagram: https://gitdiagram.com/jacobgeorgemathew/electrical_panel_design_automation
- Repository: https://github.com/jacobgeorgemathew/electrical_panel_design_automation

## Overview

This is a web application prototype for generating an electrical distribution-board design package. Users enter requirements, create a project, and request design generation; the backend validates requirements and coordinates electrical calculations, component selection, netlist and schematic generation, physical placement, routing, validation, and CAD-oriented outputs. The CEM and PDM carry traceable design data between stages. The README documents capabilities whose implementation was not sampled; edges for those documented flows cite it. The map omits internal calls not evidenced by the excerpts, index, or README.

Main entry points: [`backend/app/services/orchestrator.py`](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/services/orchestrator.py) (Design orchestrator), [`frontend/src/stores/projectStore.ts`](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/frontend/src/stores/projectStore.ts) (Project state), [`backend/app/main.py`](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/main.py) (FastAPI routes), [`frontend/src/api/client.ts`](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/frontend/src/api/client.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_app["React application<br/>[App.tsx]"]
  node_requirements_ui["Requirements form<br/>[Questionnaire.tsx]"]
  node_state["Project state<br/>[projectStore.ts]"]
  node_api_client["API client<br/>[client.ts]"]
  node_schematic_view["Schematic view"]
  node_layout_view["2D layout view<br/>[Layout2DViewer.tsx]"]
  node_editor3d["3D panel editor<br/>[Panel3DViewer.tsx]"]
  node_validation_ui["Validation panel"]
  node_bom_ui["BOM table<br/>[BOMTable.tsx]"]
end

subgraph group_api["API and projects"]
  node_api["FastAPI routes<br/>[main.py]"]
  node_project_store[("Project repository")]
end

subgraph group_electrical["Electrical design"]
  node_requirements["Requirement engine"]
  node_cem["Canonical model<br/>[cem.py]"]
  node_calculations["Engineering calculations"]
  node_selection["Component selection"]
  node_graph_netlist["Graph and netlist<br/>[netlist_engine.py]"]
  node_schematic["Schematic generation"]
end

subgraph group_physical["Physical design"]
  node_orchestrator["Design orchestrator<br/>[orchestrator.py]"]
  node_enclosure["Enclosure selection"]
  node_placement["Constrained placement"]
  node_routing["Wire routing<br/>[jps_theta_star.py]"]
  node_pdm["Physical model<br/>[pdm.py]"]
  node_validation["Physical validation"]
end

subgraph group_outputs["Outputs and change"]
  node_cad["CAD output<br/>[cad_engine.py]"]
  node_change["Change propagation"]
  node_bom["Bill of materials<br/>[orchestrator.py]"]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"calls API"| node_api_client
node_user -->|"enters requirements"| node_requirements_ui
node_requirements_ui -->|"updates state"| node_state
node_state -->|"requests design"| node_api_client
node_api_client -->|"sends REST"| node_api
node_api -->|"reads and saves"| node_project_store
node_api -->|"generates design"| node_orchestrator
node_api -->|"validates requirements"| node_requirements
node_orchestrator -->|"validates"| node_requirements
node_orchestrator -->|"creates model"| node_cem
node_orchestrator -->|"calculates parameters"| node_calculations
node_orchestrator -->|"selects components"| node_selection
node_orchestrator -->|"builds netlist"| node_graph_netlist
node_graph_netlist -->|"provides graph data"| node_schematic
node_orchestrator -->|"selects enclosure"| node_enclosure
node_orchestrator -->|"places components"| node_placement
node_orchestrator -->|"routes connections"| node_routing
node_orchestrator -->|"produces physical model"| node_pdm
node_orchestrator -->|"validates layout"| node_validation
node_api -->|"validates placement"| node_validation
node_api -->|"requests CAD output"| node_cad
node_orchestrator -->|"generates CAD data"| node_cad
node_orchestrator -->|"assembles BOM"| node_bom
node_api -->|"computes design diff"| node_change
node_change -->|"regenerates designs"| node_orchestrator
node_api_client -->|"returns results"| node_state
node_state -->|"supplies schematic"| node_schematic_view
node_state -->|"supplies layout"| node_layout_view
node_state -->|"supplies PDM"| node_editor3d
node_state -->|"supplies violations"| node_validation_ui
node_state -->|"supplies BOM"| node_bom_ui

click node_app "https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/frontend/src/App.tsx"
click node_requirements_ui "https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/frontend/src/components/requirements/Questionnaire.tsx"
click node_state "https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/frontend/src/stores/projectStore.ts"
click node_api_client "https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/frontend/src/api/client.ts"
click node_schematic_view "https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/frontend/src/components/schematic/SchematicViewer.tsx"
click node_layout_view "https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/frontend/src/components/layout/Layout2DViewer.tsx"
click node_editor3d "https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/frontend/src/components/threeD/Panel3DViewer.tsx"
click node_validation_ui "https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/frontend/src/components/validation/ValidationPanel.tsx"
click node_bom_ui "https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/frontend/src/components/bom/BOMTable.tsx"
click node_api "https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/main.py"
click node_project_store "https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/repositories/project_repository.py"
click node_requirements "https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/services/requirement_engine.py"
click node_cem "https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/models/cem.py"
click node_calculations "https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/services/calculation_engine.py"
click node_selection "https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/services/component_selector.py"
click node_graph_netlist "https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/services/netlist_engine.py"
click node_schematic "https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/services/schematic_engine.py"
click node_orchestrator "https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/services/orchestrator.py"
click node_enclosure "https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/services/enclosure_engine.py"
click node_placement "https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/algorithms/cp_sat_placement.py"
click node_routing "https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/algorithms/jps_theta_star.py"
click node_pdm "https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/models/pdm.py"
click node_validation "https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/services/validation_engine.py"
click node_cad "https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/services/cad_engine.py"
click node_change "https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/services/change_propagation.py"
click node_bom "https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/services/orchestrator.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_app,node_requirements_ui,node_state,node_api_client,node_schematic_view,node_layout_view,node_editor3d,node_validation_ui,node_bom_ui,node_user toneBlue
class node_api,node_project_store toneAmber
class node_requirements,node_cem,node_calculations,node_selection,node_graph_netlist,node_schematic toneMint
class node_orchestrator,node_enclosure,node_placement,node_routing,node_pdm,node_validation toneRose
class node_cad,node_change,node_bom toneIndigo
```

## Components

### Frontend

- [React application](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Requirements form](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/frontend/src/components/requirements/Questionnaire.tsx): `frontend/src/components/requirements/Questionnaire.tsx`
- [Project state](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/frontend/src/stores/projectStore.ts): `frontend/src/stores/projectStore.ts`
- [API client](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`
- [Schematic view](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/frontend/src/components/schematic/SchematicViewer.tsx): `frontend/src/components/schematic/SchematicViewer.tsx`
- [2D layout view](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/frontend/src/components/layout/Layout2DViewer.tsx): `frontend/src/components/layout/Layout2DViewer.tsx`
- [3D panel editor](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/frontend/src/components/threeD/Panel3DViewer.tsx): `frontend/src/components/threeD/Panel3DViewer.tsx`
- [Validation panel](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/frontend/src/components/validation/ValidationPanel.tsx): `frontend/src/components/validation/ValidationPanel.tsx`
- [BOM table](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/frontend/src/components/bom/BOMTable.tsx): `frontend/src/components/bom/BOMTable.tsx`

### API and projects

- [FastAPI routes](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/main.py): `backend/app/main.py`
- [Project repository](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/repositories/project_repository.py): `backend/app/repositories/project_repository.py`

### Electrical design

- [Requirement engine](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/services/requirement_engine.py): `backend/app/services/requirement_engine.py`
- [Canonical model](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/models/cem.py): `backend/app/models/cem.py`
- [Engineering calculations](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/services/calculation_engine.py): `backend/app/services/calculation_engine.py`
- [Component selection](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/services/component_selector.py): `backend/app/services/component_selector.py`
- [Graph and netlist](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/services/netlist_engine.py): `backend/app/services/netlist_engine.py`
- [Schematic generation](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/services/schematic_engine.py): `backend/app/services/schematic_engine.py`

### Physical design

- [Design orchestrator](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/services/orchestrator.py): `backend/app/services/orchestrator.py`
- [Enclosure selection](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/services/enclosure_engine.py): `backend/app/services/enclosure_engine.py`
- [Constrained placement](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/algorithms/cp_sat_placement.py): `backend/app/algorithms/cp_sat_placement.py`
- [Wire routing](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/algorithms/jps_theta_star.py): `backend/app/algorithms/jps_theta_star.py`
- [Physical model](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/models/pdm.py): `backend/app/models/pdm.py`
- [Physical validation](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/services/validation_engine.py): `backend/app/services/validation_engine.py`

### Outputs and change

- [CAD output](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/services/cad_engine.py): `backend/app/services/cad_engine.py`
- [Change propagation](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/services/change_propagation.py): `backend/app/services/change_propagation.py`
- [Bill of materials](https://github.com/jacobgeorgemathew/electrical_panel_design_automation/blob/main/backend/app/services/orchestrator.py): `backend/app/services/orchestrator.py`

### Other components

- **User**

## Connections

- User → React application: uses (evidence: `README.md`)
- React application → API client: calls API (evidence: `frontend/src/api/client.ts`)
- User → Requirements form: enters requirements (evidence: `README.md`)
- Requirements form → Project state: updates state (evidence: `frontend/src/components/requirements/Questionnaire.tsx`)
- Project state → API client: requests design (evidence: `frontend/src/stores/projectStore.ts`)
- API client → FastAPI routes: sends REST (evidence: `README.md`)
- FastAPI routes → Project repository: reads and saves
- FastAPI routes → Design orchestrator: generates design
- FastAPI routes → Requirement engine: validates requirements
- Design orchestrator → Requirement engine: validates (evidence: `backend/app/services/orchestrator.py`)
- Design orchestrator → Canonical model: creates model (evidence: `backend/app/services/orchestrator.py`)
- Design orchestrator → Engineering calculations: calculates parameters (evidence: `backend/app/services/orchestrator.py`)
- Design orchestrator → Component selection: selects components (evidence: `backend/app/services/orchestrator.py`)
- Design orchestrator → Graph and netlist: builds netlist (evidence: `README.md`)
- Graph and netlist → Schematic generation: provides graph data (evidence: `README.md`)
- Design orchestrator → Enclosure selection: selects enclosure (evidence: `README.md`)
- Design orchestrator → Constrained placement: places components (evidence: `backend/app/services/orchestrator.py`)
- Design orchestrator → Wire routing: routes connections (evidence: `backend/app/services/orchestrator.py`)
- Design orchestrator → Physical model: produces physical model (evidence: `README.md`)
- Design orchestrator → Physical validation: validates layout (evidence: `README.md`)
- FastAPI routes → Physical validation: validates placement
- FastAPI routes → CAD output: requests CAD output
- Design orchestrator → CAD output: generates CAD data (evidence: `backend/app/services/orchestrator.py`)
- Design orchestrator → Bill of materials: assembles BOM (evidence: `README.md`)
- FastAPI routes → Change propagation: computes design diff
- Change propagation → Design orchestrator: regenerates designs (evidence: `backend/app/api/routes_design.py`)
- API client → Project state: returns results (evidence: `frontend/src/stores/projectStore.ts`)
- Project state → Schematic view: supplies schematic (evidence: `README.md`)
- Project state → 2D layout view: supplies layout (evidence: `frontend/src/components/layout/Layout2DViewer.tsx`)
- Project state → 3D panel editor: supplies PDM (evidence: `frontend/src/components/threeD/Panel3DViewer.tsx`)
- Project state → Validation panel: supplies violations (evidence: `README.md`)
- Project state → BOM table: supplies BOM (evidence: `README.md`)
