# todaysmonkeyjob/pythonproject1 architecture

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

- Interactive diagram: https://gitdiagram.com/todaysmonkeyjob/pythonproject1
- Repository: https://github.com/todaysmonkeyjob/pythonproject1

## Overview

IoT Guard is a local, event-driven security monitoring system. Devices feed camera, microphone, and gas pipelines; their events are routed through trust assessment and aggregation into an LLM decision path. A fuzzy risk corridor constrains GPT’s result before it updates location state and reaches operators. The README documents the main runtime relationships and decision stages; several subsystem internals and optional integrations are unsampled, so the graph omits uncertain links rather than inferring calls.

Main entry points: [`core/orchestrator.py`](https://github.com/todaysmonkeyjob/pythonproject1/blob/master/core/orchestrator.py) (Event orchestrator), [`modules/llm/worker.py`](https://github.com/todaysmonkeyjob/pythonproject1/blob/master/modules/llm/worker.py) (LLM decision worker), [`core/events.py`](https://github.com/todaysmonkeyjob/pythonproject1/blob/master/core/events.py) (Event schema), [`modules/aggregator`](https://github.com/todaysmonkeyjob/pythonproject1/tree/master/modules/aggregator) (Snapshot aggregator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sensing["Sensing and perception"]
  node_vision["Vision perception"]
  node_audio["Audio perception"]
  node_gas["Gas analysis"]
end

subgraph group_runtime["Event runtime and trust"]
  node_events["Event schema<br/>[events.py]"]
  node_orchestrator["Event orchestrator<br/>[orchestrator.py]"]
  node_device_manager["Device discovery<br/>[device_manager.py]"]
  node_devices[("Device registry<br/>[devices.py]")]
  node_identity[("Identity registry<br/>[identity.py]")]
  node_trust["Evidence trust"]
end

subgraph group_decision["Risk decisions"]
  node_aggregator["Snapshot aggregator"]
  node_llm_view["LLM evidence view<br/>[llm_view.py]"]
  node_outbox[("Decision outbox<br/>[outbox.py]")]
  node_llm_worker["LLM decision worker<br/>[worker.py]"]
  node_gating["LLM call gate<br/>[gating.py]"]
  node_gpt["GPT client<br/>[gpt_client.py]"]
  node_envelope["Risk corridor"]
end

subgraph group_operations["State and operator UI"]
  node_locations[("Location state<br/>[state.py]")]
  node_notifications["Notifications<br/>[service.py]"]
  node_dashboard["Operator dashboard<br/>[server.py]"]
end

subgraph group_policy["Fuzzy policy"]
  node_fuzzy["Fuzzy inference<br/>[engine.py]"]
  node_rules["Rule suggestions<br/>[suggester.py]"]
end

node_cameras(("Cameras"))
node_microphones(("Microphones"))
node_gas_sensor(("Gas sensor"))
node_operator(("Operator"))

node_cameras -->|"frames to"| node_vision
node_microphones -->|"audio to"| node_audio
node_gas_sensor -->|"readings to"| node_gas
node_vision -->|"emits events"| node_events
node_audio -->|"emits events"| node_events
node_gas -->|"emits events"| node_events
node_events -->|"routes events"| node_orchestrator
node_device_manager -->|"updates registry"| node_devices
node_device_manager -->|"starts pipelines"| node_orchestrator
node_orchestrator -->|"scores evidence"| node_trust
node_orchestrator -->|"sends events"| node_aggregator
node_aggregator -->|"builds view"| node_llm_view
node_aggregator -->|"writes snapshots"| node_outbox
node_outbox -->|"feeds worker"| node_llm_worker
node_llm_worker -->|"checks need"| node_gating
node_llm_worker -->|"requests analysis"| node_gpt
node_llm_worker -->|"assesses corridor"| node_envelope
node_envelope -->|"uses inference"| node_fuzzy
node_llm_worker -->|"publishes decision"| node_orchestrator
node_orchestrator -->|"updates state"| node_locations
node_orchestrator -->|"forwards events"| node_dashboard
node_locations -->|"drives alerts"| node_notifications
node_dashboard -->|"presents decisions"| node_operator
node_operator -->|"reviews escalation"| node_dashboard
node_orchestrator -->|"records outcomes"| node_rules
node_identity -.->|"supports attribution"| node_audio
node_identity -.->|"supports identity"| node_vision

click node_vision "https://github.com/todaysmonkeyjob/pythonproject1/tree/master/modules/vision"
click node_audio "https://github.com/todaysmonkeyjob/pythonproject1/tree/master/modules/audio"
click node_gas "https://github.com/todaysmonkeyjob/pythonproject1/tree/master/modules/gas"
click node_events "https://github.com/todaysmonkeyjob/pythonproject1/blob/master/core/events.py"
click node_orchestrator "https://github.com/todaysmonkeyjob/pythonproject1/blob/master/core/orchestrator.py"
click node_device_manager "https://github.com/todaysmonkeyjob/pythonproject1/blob/master/core/device_manager.py"
click node_devices "https://github.com/todaysmonkeyjob/pythonproject1/blob/master/core/devices.py"
click node_identity "https://github.com/todaysmonkeyjob/pythonproject1/blob/master/core/identity.py"
click node_trust "https://github.com/todaysmonkeyjob/pythonproject1/tree/master/modules/trust"
click node_aggregator "https://github.com/todaysmonkeyjob/pythonproject1/tree/master/modules/aggregator"
click node_llm_view "https://github.com/todaysmonkeyjob/pythonproject1/blob/master/modules/aggregator/llm_view.py"
click node_outbox "https://github.com/todaysmonkeyjob/pythonproject1/blob/master/modules/aggregator/outbox.py"
click node_llm_worker "https://github.com/todaysmonkeyjob/pythonproject1/blob/master/modules/llm/worker.py"
click node_gating "https://github.com/todaysmonkeyjob/pythonproject1/blob/master/modules/llm/gating.py"
click node_gpt "https://github.com/todaysmonkeyjob/pythonproject1/blob/master/modules/llm/gpt_client.py"
click node_envelope "https://github.com/todaysmonkeyjob/pythonproject1/tree/master/modules/envelope"
click node_fuzzy "https://github.com/todaysmonkeyjob/pythonproject1/blob/master/core/fuzzy/engine.py"
click node_rules "https://github.com/todaysmonkeyjob/pythonproject1/blob/master/modules/rules/suggester.py"
click node_locations "https://github.com/todaysmonkeyjob/pythonproject1/blob/master/modules/locations/state.py"
click node_notifications "https://github.com/todaysmonkeyjob/pythonproject1/blob/master/modules/notify/service.py"
click node_dashboard "https://github.com/todaysmonkeyjob/pythonproject1/blob/master/dashboard/server.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_vision,node_audio,node_gas toneBlue
class node_events,node_orchestrator,node_device_manager,node_devices,node_identity,node_trust toneAmber
class node_aggregator,node_llm_view,node_outbox,node_llm_worker,node_gating,node_gpt,node_envelope toneMint
class node_locations,node_notifications,node_dashboard toneRose
class node_fuzzy,node_rules,node_cameras,node_microphones,node_gas_sensor,node_operator toneIndigo
```

## Components

### Sensing and perception

- [Vision perception](https://github.com/todaysmonkeyjob/pythonproject1/tree/master/modules/vision): `modules/vision`
- [Audio perception](https://github.com/todaysmonkeyjob/pythonproject1/tree/master/modules/audio): `modules/audio`
- [Gas analysis](https://github.com/todaysmonkeyjob/pythonproject1/tree/master/modules/gas): `modules/gas`

### Event runtime and trust

- [Event schema](https://github.com/todaysmonkeyjob/pythonproject1/blob/master/core/events.py): `core/events.py`
- [Event orchestrator](https://github.com/todaysmonkeyjob/pythonproject1/blob/master/core/orchestrator.py): `core/orchestrator.py`
- [Device discovery](https://github.com/todaysmonkeyjob/pythonproject1/blob/master/core/device_manager.py): `core/device_manager.py`
- [Device registry](https://github.com/todaysmonkeyjob/pythonproject1/blob/master/core/devices.py): `core/devices.py`
- [Identity registry](https://github.com/todaysmonkeyjob/pythonproject1/blob/master/core/identity.py): `core/identity.py`
- [Evidence trust](https://github.com/todaysmonkeyjob/pythonproject1/tree/master/modules/trust): `modules/trust`

### Risk decisions

- [Snapshot aggregator](https://github.com/todaysmonkeyjob/pythonproject1/tree/master/modules/aggregator): `modules/aggregator`
- [LLM evidence view](https://github.com/todaysmonkeyjob/pythonproject1/blob/master/modules/aggregator/llm_view.py): `modules/aggregator/llm_view.py`
- [Decision outbox](https://github.com/todaysmonkeyjob/pythonproject1/blob/master/modules/aggregator/outbox.py): `modules/aggregator/outbox.py`
- [LLM decision worker](https://github.com/todaysmonkeyjob/pythonproject1/blob/master/modules/llm/worker.py): `modules/llm/worker.py`
- [LLM call gate](https://github.com/todaysmonkeyjob/pythonproject1/blob/master/modules/llm/gating.py): `modules/llm/gating.py`
- [GPT client](https://github.com/todaysmonkeyjob/pythonproject1/blob/master/modules/llm/gpt_client.py): `modules/llm/gpt_client.py`
- [Risk corridor](https://github.com/todaysmonkeyjob/pythonproject1/tree/master/modules/envelope): `modules/envelope`

### State and operator UI

- [Location state](https://github.com/todaysmonkeyjob/pythonproject1/blob/master/modules/locations/state.py): `modules/locations/state.py`
- [Notifications](https://github.com/todaysmonkeyjob/pythonproject1/blob/master/modules/notify/service.py): `modules/notify/service.py`
- [Operator dashboard](https://github.com/todaysmonkeyjob/pythonproject1/blob/master/dashboard/server.py): `dashboard/server.py`

### Fuzzy policy

- [Fuzzy inference](https://github.com/todaysmonkeyjob/pythonproject1/blob/master/core/fuzzy/engine.py): `core/fuzzy/engine.py`
- [Rule suggestions](https://github.com/todaysmonkeyjob/pythonproject1/blob/master/modules/rules/suggester.py): `modules/rules/suggester.py`

### Other components

- **Cameras**
- **Microphones**
- **Gas sensor**
- **Operator**

## Connections

- Cameras → Vision perception: frames to
- Microphones → Audio perception: audio to
- Gas sensor → Gas analysis: readings to
- Vision perception → Event schema: emits events
- Audio perception → Event schema: emits events (evidence: `modules/audio/mic_controller.py`)
- Gas analysis → Event schema: emits events (evidence: `modules/gas/worker.py`)
- Event schema → Event orchestrator: routes events (evidence: `core/orchestrator.py`)
- Device discovery → Device registry: updates registry (evidence: `core/device_manager.py`)
- Device discovery → Event orchestrator: starts pipelines (evidence: `core/device_manager.py`)
- Event orchestrator → Evidence trust: scores evidence (evidence: `core/orchestrator.py`)
- Event orchestrator → Snapshot aggregator: sends events
- Snapshot aggregator → LLM evidence view: builds view (evidence: `modules/aggregator/llm_view.py`)
- Snapshot aggregator → Decision outbox: writes snapshots
- Decision outbox → LLM decision worker: feeds worker (evidence: `modules/llm/worker.py`)
- LLM decision worker → LLM call gate: checks need (evidence: `modules/llm/worker.py`)
- LLM decision worker → GPT client: requests analysis (evidence: `modules/llm/worker.py`)
- LLM decision worker → Risk corridor: assesses corridor (evidence: `modules/llm/worker.py`)
- Risk corridor → Fuzzy inference: uses inference
- LLM decision worker → Event orchestrator: publishes decision
- Event orchestrator → Location state: updates state
- Event orchestrator → Operator dashboard: forwards events
- Location state → Notifications: drives alerts
- Operator dashboard → Operator: presents decisions
- Operator → Operator dashboard: reviews escalation
- Event orchestrator → Rule suggestions: records outcomes (evidence: `modules/rules/suggester.py`)
- Identity registry → Audio perception: supports attribution (evidence: `modules/audio/mic_controller.py`)
- Identity registry → Vision perception: supports identity
