# marcus4223/beta_projekt architecture

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

- Interactive diagram: https://gitdiagram.com/marcus4223/beta_projekt
- Repository: https://github.com/marcus4223/beta_projekt

## Overview

StressSense is a stress-monitoring system with an ESP32-style sensor client, a server that computes GSR and pulse-rate-variability signals into a stress state, and console/alarm outputs. The main workflow samples PPG and GSR, sends measurements to the server, evaluates the signals, and notifies observers. A separate MAUI app includes a socket server and HRV/pulse processing, but the excerpts do not establish how its UI, networking, and processing are wired. The server’s socket-reader route is also an alternative not shown as active in the sampled entry point.

Main entry points: [`StressSenseServer/BusinessLayer/StressMonitor.cs`](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseServer/BusinessLayer/StressMonitor.cs) (Stress Monitor), [`StressSenseServer/Program.cs`](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseServer/Program.cs) (Server Runtime), [`StressSenseClient/Program.cs`](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseClient/Program.cs) (Client Runtime), [`StressSenseClient/DataLayer/Sampler.cs`](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseClient/DataLayer/Sampler.cs) (Sensor Sampler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Sensor Client"]
  node_client_program["Client Runtime<br/>[Program.cs]"]
  node_sampler["Sensor Sampler<br/>[Sampler.cs]"]
  node_ppg_sensor["PPG Sensor<br/>[PpgSensor.cs]"]
  node_gsr_sensor["GSR Sensor<br/>[GsrSensor.cs]"]
  node_buffer["Measurement Buffer"]
  node_socket_client["TCP Client<br/>[SocketClient.cs]"]
  node_wifi["Wi-Fi Connection<br/>[WifiConnection.cs]"]
end

subgraph group_ingest["Server Ingestion"]
  node_server_program["Server Runtime<br/>[Program.cs]"]
  node_simulator["Sensor Simulator<br/>[SensorSimulator.cs]"]
  node_socket_server["TCP Sensor Server<br/>[SocketServer.cs]"]
  node_sample_queue["Sample Queue"]
end

subgraph group_analysis["Stress Analysis"]
  node_monitor["Stress Monitor<br/>[StressMonitor.cs]"]
  node_gsr_processor["GSR Processor<br/>[GsrProcessor.cs]"]
  node_gsr_calculator["GSR Assessment<br/>[GsrCalculator.cs]"]
  node_ppg_calculator["PPG Calculator<br/>[PpgCalculator.cs]"]
  node_ppg_stages["PPG Signal Stages"]
  node_confirm_state["State Confirmation"]
  node_stress_reading["Stress Reading<br/>[StressReading.cs]"]
end

subgraph group_outputs["Server Outputs"]
  node_console_view["Console View<br/>[ConsoleView.cs]"]
  node_alarm["Alarm Notifier<br/>[AlarmNotifier.cs]"]
  node_gsr_view["GSR Console View<br/>[GsrConsoleView.cs]"]
end

subgraph group_app["MAUI App"]
  node_maui_entry["MAUI Entry<br/>[App.xaml.cs]"]
  node_maui_ui["Main Page<br/>[MainPage.xaml.cs]"]
  node_app_socket["App Socket Server<br/>[SocketServer.cs]"]
  node_hrv_processor["HRV Processor<br/>[HrvProcessor.cs]"]
  node_pulse_calculator["Pulse Calculator<br/>[PulseCalculator.cs]"]
end

node_operator(("Sensor Operator"))

node_operator -->|"starts"| node_client_program
node_client_program -->|"connects through"| node_wifi
node_client_program -->|"starts"| node_sampler
node_client_program -->|"starts"| node_socket_client
node_client_program -->|"creates"| node_buffer
node_sampler -->|"reads"| node_ppg_sensor
node_sampler -->|"reads"| node_gsr_sensor
node_sampler -->|"adds samples"| node_buffer
node_socket_client -->|"takes samples"| node_buffer
node_socket_client -.->|"sends measurements"| node_operator
node_server_program -->|"selects and starts"| node_simulator
node_server_program -->|"starts"| node_monitor
node_simulator -->|"adds samples"| node_sample_queue
node_monitor -->|"takes samples"| node_sample_queue
node_server_program -.->|"alternative reader"| node_socket_server
node_monitor -->|"feeds GSR samples"| node_gsr_processor
node_gsr_processor -->|"processes with"| node_gsr_calculator
node_monitor -->|"feeds PPG samples"| node_ppg_calculator
node_ppg_calculator -->|"uses signal stages"| node_ppg_stages
node_monitor -->|"evaluates levels"| node_confirm_state
node_monitor -->|"creates"| node_stress_reading
node_monitor -->|"notifies"| node_console_view
node_monitor -->|"notifies"| node_alarm
node_server_program -->|"attaches"| node_console_view
node_server_program -->|"attaches"| node_alarm
node_server_program -->|"attaches"| node_gsr_view
node_maui_entry -.->|"launches"| node_maui_ui
node_maui_ui -.->|"uses"| node_app_socket
node_hrv_processor -->|"uses"| node_pulse_calculator

click node_client_program "https://github.com/marcus4223/beta_projekt/blob/main/StressSenseClient/Program.cs"
click node_sampler "https://github.com/marcus4223/beta_projekt/blob/main/StressSenseClient/DataLayer/Sampler.cs"
click node_ppg_sensor "https://github.com/marcus4223/beta_projekt/blob/main/StressSenseClient/DataLayer/PpgSensor.cs"
click node_gsr_sensor "https://github.com/marcus4223/beta_projekt/blob/main/StressSenseClient/DataLayer/GsrSensor.cs"
click node_buffer "https://github.com/marcus4223/beta_projekt/blob/main/StressSenseClient/DataLayer/MeasurementBuffer.cs"
click node_socket_client "https://github.com/marcus4223/beta_projekt/blob/main/StressSenseClient/Network/SocketClient.cs"
click node_wifi "https://github.com/marcus4223/beta_projekt/blob/main/StressSenseClient/Network/WifiConnection.cs"
click node_server_program "https://github.com/marcus4223/beta_projekt/blob/main/StressSenseServer/Program.cs"
click node_simulator "https://github.com/marcus4223/beta_projekt/blob/main/StressSenseServer/DataLayer/SensorSimulator.cs"
click node_socket_server "https://github.com/marcus4223/beta_projekt/blob/main/StressSenseServer/DataLayer/SocketServer.cs"
click node_monitor "https://github.com/marcus4223/beta_projekt/blob/main/StressSenseServer/BusinessLayer/StressMonitor.cs"
click node_gsr_processor "https://github.com/marcus4223/beta_projekt/blob/main/StressSenseServer/BusinessLayer/GSR/GsrProcessor.cs"
click node_gsr_calculator "https://github.com/marcus4223/beta_projekt/blob/main/StressSenseServer/BusinessLayer/GSR/GsrCalculator.cs"
click node_ppg_calculator "https://github.com/marcus4223/beta_projekt/blob/main/StressSenseServer/BusinessLayer/PPG/PpgCalculator.cs"
click node_ppg_stages "https://github.com/marcus4223/beta_projekt/tree/main/StressSenseServer/BusinessLayer/PPG"
click node_confirm_state "https://github.com/marcus4223/beta_projekt/blob/main/StressSenseServer/BusinessLayer/ConfirmStressState.cs"
click node_stress_reading "https://github.com/marcus4223/beta_projekt/blob/main/StressSenseServer/BusinessLayer/StressReading.cs"
click node_console_view "https://github.com/marcus4223/beta_projekt/blob/main/StressSenseServer/PresentationLayer/ConsoleView.cs"
click node_alarm "https://github.com/marcus4223/beta_projekt/blob/main/StressSenseServer/PresentationLayer/AlarmNotifier.cs"
click node_gsr_view "https://github.com/marcus4223/beta_projekt/blob/main/StressSenseServer/PresentationLayer/GsrConsoleView.cs"
click node_maui_entry "https://github.com/marcus4223/beta_projekt/blob/main/StressSenseApp/App.xaml.cs"
click node_maui_ui "https://github.com/marcus4223/beta_projekt/blob/main/StressSenseApp/MainPage.xaml.cs"
click node_app_socket "https://github.com/marcus4223/beta_projekt/blob/main/StressSenseApp/DataLayer/SocketServer.cs"
click node_hrv_processor "https://github.com/marcus4223/beta_projekt/blob/main/StressSenseApp/BusinessLayer/HrvProcessor.cs"
click node_pulse_calculator "https://github.com/marcus4223/beta_projekt/blob/main/StressSenseApp/BusinessLayer/PulseCalculator.cs"

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_client_program,node_sampler,node_ppg_sensor,node_gsr_sensor,node_buffer,node_socket_client,node_wifi toneBlue
class node_server_program,node_simulator,node_socket_server,node_sample_queue toneAmber
class node_monitor,node_gsr_processor,node_gsr_calculator,node_ppg_calculator,node_ppg_stages,node_confirm_state,node_stress_reading toneMint
class node_console_view,node_alarm,node_gsr_view toneRose
class node_maui_entry,node_maui_ui,node_app_socket,node_hrv_processor,node_pulse_calculator,node_operator toneIndigo
```

## Components

### Sensor Client

- [Client Runtime](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseClient/Program.cs): `StressSenseClient/Program.cs`
- [Sensor Sampler](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseClient/DataLayer/Sampler.cs): `StressSenseClient/DataLayer/Sampler.cs`
- [PPG Sensor](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseClient/DataLayer/PpgSensor.cs): `StressSenseClient/DataLayer/PpgSensor.cs`
- [GSR Sensor](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseClient/DataLayer/GsrSensor.cs): `StressSenseClient/DataLayer/GsrSensor.cs`
- [Measurement Buffer](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseClient/DataLayer/MeasurementBuffer.cs): `StressSenseClient/DataLayer/MeasurementBuffer.cs`
- [TCP Client](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseClient/Network/SocketClient.cs): `StressSenseClient/Network/SocketClient.cs`
- [Wi-Fi Connection](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseClient/Network/WifiConnection.cs): `StressSenseClient/Network/WifiConnection.cs`

### Server Ingestion

- [Server Runtime](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseServer/Program.cs): `StressSenseServer/Program.cs`
- [Sensor Simulator](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseServer/DataLayer/SensorSimulator.cs): `StressSenseServer/DataLayer/SensorSimulator.cs`
- [TCP Sensor Server](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseServer/DataLayer/SocketServer.cs): `StressSenseServer/DataLayer/SocketServer.cs`
- **Sample Queue**

### Stress Analysis

- [Stress Monitor](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseServer/BusinessLayer/StressMonitor.cs): `StressSenseServer/BusinessLayer/StressMonitor.cs`
- [GSR Processor](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseServer/BusinessLayer/GSR/GsrProcessor.cs): `StressSenseServer/BusinessLayer/GSR/GsrProcessor.cs`
- [GSR Assessment](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseServer/BusinessLayer/GSR/GsrCalculator.cs): `StressSenseServer/BusinessLayer/GSR/GsrCalculator.cs`
- [PPG Calculator](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseServer/BusinessLayer/PPG/PpgCalculator.cs): `StressSenseServer/BusinessLayer/PPG/PpgCalculator.cs`
- [PPG Signal Stages](https://github.com/marcus4223/beta_projekt/tree/main/StressSenseServer/BusinessLayer/PPG): `StressSenseServer/BusinessLayer/PPG`
- [State Confirmation](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseServer/BusinessLayer/ConfirmStressState.cs): `StressSenseServer/BusinessLayer/ConfirmStressState.cs`
- [Stress Reading](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseServer/BusinessLayer/StressReading.cs): `StressSenseServer/BusinessLayer/StressReading.cs`

### Server Outputs

- [Console View](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseServer/PresentationLayer/ConsoleView.cs): `StressSenseServer/PresentationLayer/ConsoleView.cs`
- [Alarm Notifier](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseServer/PresentationLayer/AlarmNotifier.cs): `StressSenseServer/PresentationLayer/AlarmNotifier.cs`
- [GSR Console View](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseServer/PresentationLayer/GsrConsoleView.cs): `StressSenseServer/PresentationLayer/GsrConsoleView.cs`

### MAUI App

- [MAUI Entry](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseApp/App.xaml.cs): `StressSenseApp/App.xaml.cs`
- [Main Page](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseApp/MainPage.xaml.cs): `StressSenseApp/MainPage.xaml.cs`
- [App Socket Server](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseApp/DataLayer/SocketServer.cs): `StressSenseApp/DataLayer/SocketServer.cs`
- [HRV Processor](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseApp/BusinessLayer/HrvProcessor.cs): `StressSenseApp/BusinessLayer/HrvProcessor.cs`
- [Pulse Calculator](https://github.com/marcus4223/beta_projekt/blob/main/StressSenseApp/BusinessLayer/PulseCalculator.cs): `StressSenseApp/BusinessLayer/PulseCalculator.cs`

### Other components

- **Sensor Operator**

## Connections

- Sensor Operator → Client Runtime: starts
- Client Runtime → Wi-Fi Connection: connects through (evidence: `StressSenseClient/Program.cs`)
- Client Runtime → Sensor Sampler: starts (evidence: `StressSenseClient/Program.cs`)
- Client Runtime → TCP Client: starts (evidence: `StressSenseClient/Program.cs`)
- Client Runtime → Measurement Buffer: creates (evidence: `StressSenseClient/Program.cs`)
- Sensor Sampler → PPG Sensor: reads (evidence: `StressSenseClient/DataLayer/Sampler.cs`)
- Sensor Sampler → GSR Sensor: reads (evidence: `StressSenseClient/DataLayer/Sampler.cs`)
- Sensor Sampler → Measurement Buffer: adds samples (evidence: `StressSenseClient/DataLayer/Sampler.cs`)
- TCP Client → Measurement Buffer: takes samples (evidence: `StressSenseClient/Network/SocketClient.cs`)
- TCP Client → Sensor Operator: sends measurements
- Server Runtime → Sensor Simulator: selects and starts (evidence: `StressSenseServer/Program.cs`)
- Server Runtime → Stress Monitor: starts (evidence: `StressSenseServer/Program.cs`)
- Sensor Simulator → Sample Queue: adds samples (evidence: `StressSenseServer/DataLayer/SensorSimulator.cs`)
- Stress Monitor → Sample Queue: takes samples (evidence: `StressSenseServer/BusinessLayer/StressMonitor.cs`)
- Server Runtime → TCP Sensor Server: alternative reader (evidence: `StressSenseServer/Program.cs`)
- Stress Monitor → GSR Processor: feeds GSR samples (evidence: `StressSenseServer/BusinessLayer/StressMonitor.cs`)
- GSR Processor → GSR Assessment: processes with (evidence: `StressSenseServer/BusinessLayer/GSR/GsrProcessor.cs`)
- Stress Monitor → PPG Calculator: feeds PPG samples (evidence: `StressSenseServer/BusinessLayer/StressMonitor.cs`)
- PPG Calculator → PPG Signal Stages: uses signal stages (evidence: `StressSenseServer/BusinessLayer/PPG/PpgCalculator.cs`)
- Stress Monitor → State Confirmation: evaluates levels (evidence: `StressSenseServer/BusinessLayer/StressMonitor.cs`)
- Stress Monitor → Stress Reading: creates (evidence: `StressSenseServer/BusinessLayer/StressMonitor.cs`)
- Stress Monitor → Console View: notifies (evidence: `StressSenseServer/BusinessLayer/StressMonitor.cs`)
- Stress Monitor → Alarm Notifier: notifies (evidence: `StressSenseServer/BusinessLayer/StressMonitor.cs`)
- Server Runtime → Console View: attaches (evidence: `StressSenseServer/Program.cs`)
- Server Runtime → Alarm Notifier: attaches (evidence: `StressSenseServer/Program.cs`)
- Server Runtime → GSR Console View: attaches (evidence: `StressSenseServer/Program.cs`)
- MAUI Entry → Main Page: launches
- Main Page → App Socket Server: uses
- HRV Processor → Pulse Calculator: uses (evidence: `StressSenseApp/BusinessLayer/HrvProcessor.cs`)
