# using76/typeevacsafe architecture

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

- Interactive diagram: https://gitdiagram.com/using76/typeevacsafe
- Repository: https://github.com/using76/typeevacsafe

## Overview

TypeEvacSafe combines a typed, per-person decision engine with a fire-evacuation simulation. Its documented workflow prepares or generates FDS cases, converts fire-simulator slices into 2D hazard fields, then combines Jev-style decisions with shared movement and exposure physics to produce trajectories and evaluations. The source excerpts show key decision, conversion, and environment code; links for unsampled subsystems are included only where the README or SOURCE INDEX documents them.

Main entry points: [`typeevac/env2.py`](https://github.com/using76/typeevacsafe/blob/main/typeevac/env2.py) (Multi-agent environment), [`typeevac/jev_decide.py`](https://github.com/using76/typeevacsafe/blob/main/typeevac/jev_decide.py) (Typed decision engine), [`typeevac/gen_bigspace_v2.py`](https://github.com/using76/typeevacsafe/blob/main/typeevac/gen_bigspace_v2.py) (Building cases), [`typeevac/convert_sf2d.py`](https://github.com/using76/typeevacsafe/blob/main/typeevac/convert_sf2d.py) (Hazard conversion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_case_prep["Case preparation"]
  node_case_generator["Building cases<br/>[gen_bigspace_v2.py]"]
  node_judgment_cases["Judgment cases<br/>[gen_judgment.py]"]
  node_cad_prep["CAD/FDS preparation<br/>[prep_cad.py]"]
  node_field_converter["Hazard conversion<br/>[convert_sf2d.py]"]
end

subgraph group_decision["Decision engine"]
  node_prompt_rules["Rules and options<br/>[jev_prompts.py]"]
  node_jev_decider["Typed decision engine<br/>[jev_decide.py]"]
  node_teacher_data["Teacher decisions<br/>[jev_teacher.py]"]
end

subgraph group_simulation["Evacuation simulation"]
  node_evac_core["Evacuation physics<br/>[env_v1.py]"]
  node_evac_multi["Multi-agent environment<br/>[env2.py]"]
  node_scenario_runner["Scenario runner<br/>[jev_scenario.py]"]
end

subgraph group_analysis["Results and evaluation"]
  node_decision_benchmark["Decision benchmark<br/>[jev_bench.py]"]
  node_trajectory_output["Trajectories and video<br/>[hall_frames.py]"]
  node_behavior_eval["Behavior evaluation<br/>[jev_eval.py]"]
end

node_engineer(("Scenario author"))
node_fds_cases["FDS cases"]
node_bulc["BULC fire simulator"]
node_model_services["Decision backends"]
node_hazard_fields[("2D hazard fields")]

node_engineer -->|"defines layouts"| node_case_generator
node_engineer -->|"supplies CAD"| node_cad_prep
node_case_generator -->|"generates FDS"| node_fds_cases
node_judgment_cases -->|"uses building model"| node_case_generator
node_cad_prep -->|"uses conversion logic"| node_field_converter
node_fds_cases -->|"simulates fire"| node_bulc
node_bulc -->|"provides slices"| node_field_converter
node_field_converter -->|"writes fields"| node_hazard_fields
node_hazard_fields -->|"supplies hazard data"| node_evac_multi
node_prompt_rules -->|"provides rules"| node_jev_decider
node_jev_decider -->|"reads option scores"| node_model_services
node_jev_decider -->|"provides decisions"| node_evac_multi
node_evac_multi -->|"uses movement physics"| node_evac_core
node_scenario_runner -->|"runs scenarios"| node_evac_multi
node_scenario_runner -->|"configures decisions"| node_jev_decider
node_teacher_data -->|"runs episodes"| node_evac_multi
node_teacher_data -->|"records decisions"| node_jev_decider
node_decision_benchmark -->|"benchmarks choices"| node_jev_decider
node_evac_multi -->|"produces trajectories"| node_trajectory_output
node_evac_multi -->|"provides outcomes"| node_behavior_eval
node_trajectory_output -.->|"supports evaluation"| node_behavior_eval

click node_case_generator "https://github.com/using76/typeevacsafe/blob/main/typeevac/gen_bigspace_v2.py"
click node_judgment_cases "https://github.com/using76/typeevacsafe/blob/main/typeevac/gen_judgment.py"
click node_cad_prep "https://github.com/using76/typeevacsafe/blob/main/typeevac/prep_cad.py"
click node_field_converter "https://github.com/using76/typeevacsafe/blob/main/typeevac/convert_sf2d.py"
click node_prompt_rules "https://github.com/using76/typeevacsafe/blob/main/typeevac/jev_prompts.py"
click node_jev_decider "https://github.com/using76/typeevacsafe/blob/main/typeevac/jev_decide.py"
click node_decision_benchmark "https://github.com/using76/typeevacsafe/blob/main/typeevac/jev_bench.py"
click node_evac_core "https://github.com/using76/typeevacsafe/blob/main/typeevac/env_v1.py"
click node_evac_multi "https://github.com/using76/typeevacsafe/blob/main/typeevac/env2.py"
click node_scenario_runner "https://github.com/using76/typeevacsafe/blob/main/typeevac/jev_scenario.py"
click node_teacher_data "https://github.com/using76/typeevacsafe/blob/main/typeevac/jev_teacher.py"
click node_trajectory_output "https://github.com/using76/typeevacsafe/blob/main/typeevac/hall_frames.py"
click node_behavior_eval "https://github.com/using76/typeevacsafe/blob/main/typeevac/jev_eval.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_case_generator,node_judgment_cases,node_cad_prep,node_field_converter toneBlue
class node_prompt_rules,node_jev_decider,node_teacher_data,node_hazard_fields toneAmber
class node_evac_core,node_evac_multi,node_scenario_runner toneMint
class node_decision_benchmark,node_trajectory_output,node_behavior_eval toneRose
class node_engineer,node_fds_cases,node_bulc,node_model_services toneIndigo
```

## Components

### Case preparation

- [Building cases](https://github.com/using76/typeevacsafe/blob/main/typeevac/gen_bigspace_v2.py): `typeevac/gen_bigspace_v2.py`
- [Judgment cases](https://github.com/using76/typeevacsafe/blob/main/typeevac/gen_judgment.py): `typeevac/gen_judgment.py`
- [CAD/FDS preparation](https://github.com/using76/typeevacsafe/blob/main/typeevac/prep_cad.py): `typeevac/prep_cad.py`
- [Hazard conversion](https://github.com/using76/typeevacsafe/blob/main/typeevac/convert_sf2d.py): `typeevac/convert_sf2d.py`

### Decision engine

- [Rules and options](https://github.com/using76/typeevacsafe/blob/main/typeevac/jev_prompts.py): `typeevac/jev_prompts.py`
- [Typed decision engine](https://github.com/using76/typeevacsafe/blob/main/typeevac/jev_decide.py): `typeevac/jev_decide.py`
- [Teacher decisions](https://github.com/using76/typeevacsafe/blob/main/typeevac/jev_teacher.py): `typeevac/jev_teacher.py`

### Evacuation simulation

- [Evacuation physics](https://github.com/using76/typeevacsafe/blob/main/typeevac/env_v1.py): `typeevac/env_v1.py`
- [Multi-agent environment](https://github.com/using76/typeevacsafe/blob/main/typeevac/env2.py): `typeevac/env2.py`
- [Scenario runner](https://github.com/using76/typeevacsafe/blob/main/typeevac/jev_scenario.py): `typeevac/jev_scenario.py`

### Results and evaluation

- [Decision benchmark](https://github.com/using76/typeevacsafe/blob/main/typeevac/jev_bench.py): `typeevac/jev_bench.py`
- [Trajectories and video](https://github.com/using76/typeevacsafe/blob/main/typeevac/hall_frames.py): `typeevac/hall_frames.py`
- [Behavior evaluation](https://github.com/using76/typeevacsafe/blob/main/typeevac/jev_eval.py): `typeevac/jev_eval.py`

### Other components

- **Scenario author**
- **FDS cases**
- **BULC fire simulator**
- **Decision backends**
- **2D hazard fields**

## Connections

- Scenario author → Building cases: defines layouts (evidence: `README.md`)
- Scenario author → CAD/FDS preparation: supplies CAD (evidence: `README.md`)
- Building cases → FDS cases: generates FDS (evidence: `README.md`)
- Judgment cases → Building cases: uses building model (evidence: `typeevac/gen_judgment.py`)
- CAD/FDS preparation → Hazard conversion: uses conversion logic (evidence: `typeevac/prep_cad.py`)
- FDS cases → BULC fire simulator: simulates fire (evidence: `README.md`)
- BULC fire simulator → Hazard conversion: provides slices (evidence: `README.md`)
- Hazard conversion → 2D hazard fields: writes fields (evidence: `README.md`)
- 2D hazard fields → Multi-agent environment: supplies hazard data (evidence: `README.md`)
- Rules and options → Typed decision engine: provides rules (evidence: `typeevac/jev_decide.py`)
- Typed decision engine → Decision backends: reads option scores (evidence: `README.md`)
- Typed decision engine → Multi-agent environment: provides decisions (evidence: `README.md`)
- Multi-agent environment → Evacuation physics: uses movement physics (evidence: `typeevac/env2.py`)
- Scenario runner → Multi-agent environment: runs scenarios (evidence: `typeevac/jev_scenario.py`)
- Scenario runner → Typed decision engine: configures decisions (evidence: `typeevac/jev_scenario.py`)
- Teacher decisions → Multi-agent environment: runs episodes (evidence: `typeevac/jev_teacher.py`)
- Teacher decisions → Typed decision engine: records decisions (evidence: `typeevac/jev_teacher.py`)
- Decision benchmark → Typed decision engine: benchmarks choices (evidence: `typeevac/jev_bench.py`)
- Multi-agent environment → Trajectories and video: produces trajectories (evidence: `README.md`)
- Multi-agent environment → Behavior evaluation: provides outcomes (evidence: `README.md`)
- Trajectories and video → Behavior evaluation: supports evaluation
