diff --git a/.claude-flow/daemon-state.json b/.claude-flow/daemon-state.json
index b478623..bdcb617 100644
--- a/.claude-flow/daemon-state.json
+++ b/.claude-flow/daemon-state.json
@@ -1,50 +1,50 @@
{
"running": true,
- "startedAt": "2026-01-13T03:24:14.137Z",
+ "startedAt": "2026-01-13T18:06:18.421Z",
"workers": {
"map": {
- "runCount": 3,
- "successCount": 3,
+ "runCount": 8,
+ "successCount": 8,
"failureCount": 0,
- "averageDurationMs": 1.3333333333333333,
- "lastRun": "2026-01-13T03:39:14.149Z",
- "nextRun": "2026-01-13T03:39:14.144Z",
+ "averageDurationMs": 1.25,
+ "lastRun": "2026-01-13T18:21:18.435Z",
+ "nextRun": "2026-01-13T18:21:18.428Z",
"isRunning": false
},
"audit": {
- "runCount": 2,
+ "runCount": 5,
"successCount": 0,
- "failureCount": 2,
+ "failureCount": 5,
"averageDurationMs": 0,
- "lastRun": "2026-01-13T03:31:14.142Z",
- "nextRun": "2026-01-13T03:41:14.143Z",
+ "lastRun": "2026-01-13T18:13:18.424Z",
+ "nextRun": "2026-01-13T18:23:18.425Z",
"isRunning": false
},
"optimize": {
- "runCount": 2,
+ "runCount": 4,
"successCount": 0,
- "failureCount": 2,
+ "failureCount": 4,
"averageDurationMs": 0,
- "lastRun": "2026-01-13T03:33:14.140Z",
- "nextRun": "2026-01-13T03:48:14.141Z",
+ "lastRun": "2026-01-13T18:15:18.424Z",
+ "nextRun": "2026-01-13T18:30:18.424Z",
"isRunning": false
},
"consolidate": {
- "runCount": 1,
- "successCount": 1,
+ "runCount": 3,
+ "successCount": 3,
"failureCount": 0,
- "averageDurationMs": 0,
- "lastRun": "2026-01-13T03:11:00.656Z",
- "nextRun": "2026-01-13T03:41:00.656Z",
+ "averageDurationMs": 0.6666666666666666,
+ "lastRun": "2026-01-13T18:13:18.428Z",
+ "nextRun": "2026-01-13T18:42:18.422Z",
"isRunning": false
},
"testgaps": {
- "runCount": 1,
+ "runCount": 3,
"successCount": 0,
- "failureCount": 1,
+ "failureCount": 3,
"averageDurationMs": 0,
- "lastRun": "2026-01-13T03:37:14.141Z",
- "nextRun": "2026-01-13T03:57:14.142Z",
+ "lastRun": "2026-01-13T18:19:18.457Z",
+ "nextRun": "2026-01-13T18:39:18.457Z",
"isRunning": false
},
"predict": {
@@ -131,5 +131,5 @@
}
]
},
- "savedAt": "2026-01-13T03:39:14.149Z"
+ "savedAt": "2026-01-13T18:21:18.435Z"
}
\ No newline at end of file
diff --git a/.claude-flow/metrics/codebase-map.json b/.claude-flow/metrics/codebase-map.json
index 911d4e2..67afbb4 100644
--- a/.claude-flow/metrics/codebase-map.json
+++ b/.claude-flow/metrics/codebase-map.json
@@ -1,5 +1,5 @@
{
- "timestamp": "2026-01-13T03:39:14.148Z",
+ "timestamp": "2026-01-13T18:21:18.434Z",
"projectRoot": "/home/user/wifi-densepose",
"structure": {
"hasPackageJson": false,
@@ -7,5 +7,5 @@
"hasClaudeConfig": true,
"hasClaudeFlow": true
},
- "scannedAt": 1768275554149
+ "scannedAt": 1768328478434
}
\ No newline at end of file
diff --git a/.claude-flow/metrics/consolidation.json b/.claude-flow/metrics/consolidation.json
index 33013a6..6c7f08d 100644
--- a/.claude-flow/metrics/consolidation.json
+++ b/.claude-flow/metrics/consolidation.json
@@ -1,5 +1,5 @@
{
- "timestamp": "2026-01-13T03:11:00.656Z",
+ "timestamp": "2026-01-13T18:13:18.428Z",
"patternsConsolidated": 0,
"memoryCleaned": 0,
"duplicatesRemoved": 0
diff --git a/README.md b/README.md
index 84962ef..a231791 100644
--- a/README.md
+++ b/README.md
@@ -73,6 +73,61 @@ Mathematical correctness validated:
See [Rust Port Documentation](/rust-port/wifi-densepose-rs/docs/) for ADRs and DDD patterns.
+## π¨ WiFi-Mat: Disaster Response Module
+
+A specialized extension for **search and rescue operations** - detecting and localizing survivors trapped in rubble, earthquakes, and natural disasters.
+
+### Key Capabilities
+
+| Feature | Description |
+|---------|-------------|
+| **Vital Signs Detection** | Breathing (4-60 BPM), heartbeat via micro-Doppler |
+| **3D Localization** | Position estimation through debris up to 5m depth |
+| **START Triage** | Automatic Immediate/Delayed/Minor/Deceased classification |
+| **Real-time Alerts** | Priority-based notifications with escalation |
+
+### Use Cases
+
+- Earthquake search and rescue
+- Building collapse response
+- Avalanche victim location
+- Mine collapse detection
+- Flood rescue operations
+
+### Quick Example
+
+```rust
+use wifi_densepose_mat::{DisasterResponse, DisasterConfig, DisasterType, ScanZone, ZoneBounds};
+
+let config = DisasterConfig::builder()
+ .disaster_type(DisasterType::Earthquake)
+ .sensitivity(0.85)
+ .max_depth(5.0)
+ .build();
+
+let mut response = DisasterResponse::new(config);
+response.initialize_event(location, "Building collapse")?;
+response.add_zone(ScanZone::new("North Wing", ZoneBounds::rectangle(0.0, 0.0, 30.0, 20.0)))?;
+response.start_scanning().await?;
+
+// Get survivors prioritized by triage status
+let immediate = response.survivors_by_triage(TriageStatus::Immediate);
+println!("{} survivors require immediate rescue", immediate.len());
+```
+
+### Documentation
+
+- **[WiFi-Mat User Guide](docs/wifi-mat-user-guide.md)** - Complete setup, configuration, and field deployment
+- **[Architecture Decision Record](docs/adr/ADR-001-wifi-mat-disaster-detection.md)** - Design decisions and rationale
+- **[Domain Model](docs/ddd/wifi-mat-domain-model.md)** - DDD bounded contexts and entities
+
+**Build:**
+```bash
+cd rust-port/wifi-densepose-rs
+cargo build --release --package wifi-densepose-mat
+cargo test --package wifi-densepose-mat
+```
+
## π Table of Contents
@@ -81,6 +136,8 @@ See [Rust Port Documentation](/rust-port/wifi-densepose-rs/docs/) for ADRs and D
**π Getting Started**
- [Key Features](#-key-features)
+- [Rust Implementation (v2)](#-rust-implementation-v2)
+- [WiFi-Mat Disaster Response](#-wifi-mat-disaster-response-module)
- [System Architecture](#οΈ-system-architecture)
- [Installation](#-installation)
- [Using pip (Recommended)](#using-pip-recommended)
diff --git a/docs/adr/ADR-001-wifi-mat-disaster-detection.md b/docs/adr/ADR-001-wifi-mat-disaster-detection.md
new file mode 100644
index 0000000..f03c553
--- /dev/null
+++ b/docs/adr/ADR-001-wifi-mat-disaster-detection.md
@@ -0,0 +1,173 @@
+# ADR-001: WiFi-Mat Disaster Detection Architecture
+
+## Status
+Accepted
+
+## Date
+2026-01-13
+
+## Context
+
+Natural disasters such as earthquakes, building collapses, avalanches, and floods trap victims under rubble or debris. Traditional search and rescue methods using visual inspection, thermal cameras, or acoustic devices have significant limitations:
+
+- **Visual/Optical**: Cannot penetrate rubble, debris, or collapsed structures
+- **Thermal**: Limited penetration depth, affected by ambient temperature
+- **Acoustic**: Requires victim to make sounds, high false positive rate
+- **K9 Units**: Limited availability, fatigue, environmental hazards
+
+WiFi-based sensing offers a unique advantage: **RF signals can penetrate non-metallic debris** (concrete, wood, drywall) and detect subtle human movements including breathing patterns and heartbeats through Channel State Information (CSI) analysis.
+
+### Problem Statement
+
+We need a modular extension to the WiFi-DensePose Rust implementation that:
+
+1. Detects human presence in disaster scenarios with high sensitivity
+2. Localizes survivors within rubble/debris fields
+3. Classifies victim status (conscious movement, breathing only, critical)
+4. Provides real-time alerts to rescue teams
+5. Operates in degraded/field conditions with portable hardware
+
+## Decision
+
+We will create a new crate `wifi-densepose-mat` (Mass Casualty Assessment Tool) as a modular addition to the existing Rust workspace with the following architecture:
+
+### 1. Domain-Driven Design (DDD) Approach
+
+The module follows DDD principles with clear bounded contexts:
+
+```
+wifi-densepose-mat/
+βββ src/
+β βββ domain/ # Core domain entities and value objects
+β β βββ survivor.rs # Survivor entity with status tracking
+β β βββ disaster_event.rs # Disaster event aggregate root
+β β βββ scan_zone.rs # Geographic zone being scanned
+β β βββ alert.rs # Alert value objects
+β βββ detection/ # Life sign detection bounded context
+β β βββ breathing.rs # Breathing pattern detection
+β β βββ heartbeat.rs # Micro-doppler heartbeat detection
+β β βββ movement.rs # Gross/fine movement classification
+β β βββ classifier.rs # Multi-modal victim classifier
+β βββ localization/ # Position estimation bounded context
+β β βββ triangulation.rs # Multi-AP triangulation
+β β βββ fingerprinting.rs # CSI fingerprint matching
+β β βββ depth.rs # Depth/layer estimation in rubble
+β βββ alerting/ # Notification bounded context
+β β βββ priority.rs # Triage priority calculation
+β β βββ dispatcher.rs # Alert routing and dispatch
+β β βββ protocols.rs # Emergency protocol integration
+β βββ integration/ # Anti-corruption layer
+β βββ signal_adapter.rs # Adapts wifi-densepose-signal
+β βββ nn_adapter.rs # Adapts wifi-densepose-nn
+```
+
+### 2. Core Architectural Decisions
+
+#### 2.1 Event-Driven Architecture
+- All survivor detections emit domain events
+- Events enable audit trails and replay for post-incident analysis
+- Supports distributed deployments with multiple scan teams
+
+#### 2.2 Configurable Detection Pipeline
+```rust
+pub struct DetectionPipeline {
+ breathing_detector: BreathingDetector,
+ heartbeat_detector: HeartbeatDetector,
+ movement_classifier: MovementClassifier,
+ ensemble_classifier: EnsembleClassifier,
+}
+```
+
+#### 2.3 Triage Classification (START Protocol Compatible)
+| Status | Detection Criteria | Priority |
+|--------|-------------------|----------|
+| Immediate (Red) | Breathing detected, no movement | P1 |
+| Delayed (Yellow) | Movement + breathing, stable vitals | P2 |
+| Minor (Green) | Strong movement, responsive patterns | P3 |
+| Deceased (Black) | No vitals for >30 minutes continuous scan | P4 |
+
+#### 2.4 Hardware Abstraction
+Supports multiple deployment scenarios:
+- **Portable**: Single TX/RX with handheld device
+- **Distributed**: Multiple APs deployed around collapse site
+- **Drone-mounted**: UAV-based scanning for large areas
+- **Vehicle-mounted**: Mobile command post with array
+
+### 3. Integration Strategy
+
+The module integrates with existing crates through adapters:
+
+```
+βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
+β wifi-densepose-mat β
+βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
+β βββββββββββββββ βββββββββββββββ βββββββββββββββββββββββ β
+β β Detection β β Localizationβ β Alerting β β
+β β Context β β Context β β Context β β
+β ββββββββ¬βββββββ ββββββββ¬βββββββ ββββββββββββ¬βββββββββββ β
+β β β β β
+β ββββββββββββββββββΌββββββββββββββββββββββ β
+β β β
+β βββββββββββββΌββββββββββββ β
+β β Integration Layer β β
+β β (Anti-Corruption) β β
+β βββββββββββββ¬ββββββββββββ β
+ββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββ
+ β
+ ββββββββββββββββββββΌβββββββββββββββββββ
+ β β β
+ βΌ βΌ βΌ
+βββββββββββββββββ βββββββββββββββββ βββββββββββββββββ
+βwifi-densepose β βwifi-densepose β βwifi-densepose β
+β -signal β β -nn β β -hardware β
+βββββββββββββββββ βββββββββββββββββ βββββββββββββββββ
+```
+
+### 4. Performance Requirements
+
+| Metric | Target | Rationale |
+|--------|--------|-----------|
+| Detection Latency | <500ms | Real-time feedback for rescuers |
+| False Positive Rate | <5% | Minimize wasted rescue efforts |
+| False Negative Rate | <1% | Cannot miss survivors |
+| Penetration Depth | 3-5m | Typical rubble pile depth |
+| Battery Life (portable) | >8 hours | Full shift operation |
+| Concurrent Zones | 16+ | Large disaster site coverage |
+
+### 5. Safety and Reliability
+
+- **Fail-safe defaults**: Always assume life present on ambiguous signals
+- **Redundant detection**: Multiple algorithms vote on presence
+- **Continuous monitoring**: Re-scan zones periodically
+- **Offline operation**: Full functionality without network
+- **Audit logging**: Complete trace of all detections
+
+## Consequences
+
+### Positive
+- Modular design allows independent development and testing
+- DDD ensures domain experts can validate logic
+- Event-driven enables distributed deployments
+- Adapters isolate from upstream changes
+- Compatible with existing WiFi-DensePose infrastructure
+
+### Negative
+- Additional complexity from event system
+- Learning curve for rescue teams
+- Requires calibration for different debris types
+- RF interference in disaster zones
+
+### Risks and Mitigations
+| Risk | Mitigation |
+|------|------------|
+| Metal debris blocking signals | Multi-angle scanning, adaptive frequency |
+| Environmental RF interference | Spectral sensing, frequency hopping |
+| False positives from animals | Size/pattern classification |
+| Power constraints in field | Low-power modes, solar charging |
+
+## References
+
+- [WiFi-based Vital Signs Monitoring](https://dl.acm.org/doi/10.1145/3130944)
+- [Through-Wall Human Sensing](https://ieeexplore.ieee.org/document/8645344)
+- [START Triage Protocol](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3088332/)
+- [CSI-based Human Activity Recognition](https://arxiv.org/abs/2004.03661)
diff --git a/docs/ddd/wifi-mat-domain-model.md b/docs/ddd/wifi-mat-domain-model.md
new file mode 100644
index 0000000..5f52ffa
--- /dev/null
+++ b/docs/ddd/wifi-mat-domain-model.md
@@ -0,0 +1,497 @@
+# WiFi-Mat Domain Model
+
+## Domain-Driven Design Specification
+
+### Ubiquitous Language
+
+| Term | Definition |
+|------|------------|
+| **Survivor** | A human detected within a scan zone, potentially trapped |
+| **Vital Signs** | Detectable life indicators: breathing, heartbeat, movement |
+| **Scan Zone** | A defined geographic area being actively monitored |
+| **Detection Event** | An occurrence of vital signs being detected |
+| **Triage Status** | Medical priority classification (Immediate/Delayed/Minor/Deceased) |
+| **Confidence Score** | Statistical certainty of detection (0.0-1.0) |
+| **Penetration Depth** | Estimated distance through debris to survivor |
+| **Debris Field** | Collection of materials between sensor and survivor |
+
+---
+
+## Bounded Contexts
+
+### 1. Detection Context
+
+**Responsibility**: Analyze CSI data to detect and classify human vital signs
+
+```
+βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
+β Detection Context β
+βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
+β β
+β ββββββββββββββββ ββββββββββββββββ β
+β β Breathing β β Heartbeat β β
+β β Detector β β Detector β β
+β ββββββββ¬ββββββββ ββββββββ¬ββββββββ β
+β β β β
+β βββββββββββ¬ββββββββββ β
+β βΌ β
+β βββββββββββββββββββ β
+β β Movement β β
+β β Classifier β β
+β ββββββββββ¬βββββββββ β
+β βΌ β
+β βββββββββββββββββββ β
+β β Ensemble ββββΆ VitalSignsReading β
+β β Classifier β β
+β βββββββββββββββββββ β
+β β
+βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
+```
+
+**Aggregates**:
+- `VitalSignsReading` (Aggregate Root)
+
+**Value Objects**:
+- `BreathingPattern`
+- `HeartbeatSignature`
+- `MovementProfile`
+- `ConfidenceScore`
+
+### 2. Localization Context
+
+**Responsibility**: Estimate survivor position within debris field
+
+```
+βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
+β Localization Context β
+βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
+β β
+β ββββββββββββββββ ββββββββββββββββ β
+β βTriangulation β βFingerprintingβ β
+β β Engine β β Matcher β β
+β ββββββββ¬ββββββββ ββββββββ¬ββββββββ β
+β β β β
+β βββββββββββ¬ββββββββββ β
+β βΌ β
+β βββββββββββββββββββ β
+β β Depth β β
+β β Estimator β β
+β ββββββββββ¬βββββββββ β
+β βΌ β
+β βββββββββββββββββββ β
+β β Position ββββΆ SurvivorLocation β
+β β Fuser β β
+β βββββββββββββββββββ β
+β β
+βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
+```
+
+**Aggregates**:
+- `SurvivorLocation` (Aggregate Root)
+
+**Value Objects**:
+- `Coordinates3D`
+- `DepthEstimate`
+- `LocationUncertainty`
+- `DebrisProfile`
+
+### 3. Alerting Context
+
+**Responsibility**: Generate and dispatch alerts based on detections
+
+```
+βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
+β Alerting Context β
+βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
+β β
+β ββββββββββββββββ ββββββββββββββββ β
+β β Triage β β Alert β β
+β β Calculator β β Generator β β
+β ββββββββ¬ββββββββ ββββββββ¬ββββββββ β
+β β β β
+β βββββββββββ¬ββββββββββ β
+β βΌ β
+β βββββββββββββββββββ β
+β β Dispatcher ββββΆ Alert β
+β βββββββββββββββββββ β
+β β
+βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
+```
+
+**Aggregates**:
+- `Alert` (Aggregate Root)
+
+**Value Objects**:
+- `TriageStatus`
+- `Priority`
+- `AlertPayload`
+
+---
+
+## Core Domain Entities
+
+### Survivor (Entity)
+
+```rust
+pub struct Survivor {
+ id: SurvivorId,
+ detection_time: DateTime,
+ location: Option,
+ vital_signs: VitalSignsHistory,
+ triage_status: TriageStatus,
+ confidence: ConfidenceScore,
+ metadata: SurvivorMetadata,
+}
+```
+
+**Invariants**:
+- Must have at least one vital sign detection to exist
+- Triage status must be recalculated on each vital sign update
+- Confidence must be >= 0.3 to be considered valid detection
+
+### DisasterEvent (Aggregate Root)
+
+```rust
+pub struct DisasterEvent {
+ id: DisasterEventId,
+ event_type: DisasterType,
+ start_time: DateTime,
+ location: GeoLocation,
+ scan_zones: Vec,
+ survivors: Vec,
+ status: EventStatus,
+}
+```
+
+**Invariants**:
+- Must have at least one scan zone
+- All survivors must be within a scan zone
+- Cannot add survivors after event is closed
+
+### ScanZone (Entity)
+
+```rust
+pub struct ScanZone {
+ id: ScanZoneId,
+ bounds: ZoneBounds,
+ sensor_positions: Vec,
+ scan_parameters: ScanParameters,
+ status: ZoneStatus,
+ last_scan: DateTime,
+}
+```
+
+---
+
+## Value Objects
+
+### VitalSignsReading
+
+```rust
+pub struct VitalSignsReading {
+ breathing: Option,
+ heartbeat: Option,
+ movement: MovementProfile,
+ timestamp: DateTime,
+ confidence: ConfidenceScore,
+}
+```
+
+### TriageStatus (Enumeration)
+
+```rust
+pub enum TriageStatus {
+ /// Immediate - Life-threatening, requires immediate intervention
+ Immediate, // Red tag
+
+ /// Delayed - Serious but can wait for treatment
+ Delayed, // Yellow tag
+
+ /// Minor - Walking wounded, minimal treatment needed
+ Minor, // Green tag
+
+ /// Deceased - No vital signs detected over threshold period
+ Deceased, // Black tag
+
+ /// Unknown - Insufficient data for classification
+ Unknown,
+}
+```
+
+### BreathingPattern
+
+```rust
+pub struct BreathingPattern {
+ rate_bpm: f32, // Breaths per minute (normal: 12-20)
+ amplitude: f32, // Signal strength
+ regularity: f32, // 0.0-1.0, consistency of pattern
+ pattern_type: BreathingType,
+}
+
+pub enum BreathingType {
+ Normal,
+ Shallow,
+ Labored,
+ Irregular,
+ Agonal,
+}
+```
+
+### HeartbeatSignature
+
+```rust
+pub struct HeartbeatSignature {
+ rate_bpm: f32, // Beats per minute (normal: 60-100)
+ variability: f32, // Heart rate variability
+ strength: SignalStrength,
+}
+```
+
+### Coordinates3D
+
+```rust
+pub struct Coordinates3D {
+ x: f64, // East-West offset from reference (meters)
+ y: f64, // North-South offset from reference (meters)
+ z: f64, // Depth below surface (meters, negative = below)
+ uncertainty: LocationUncertainty,
+}
+
+pub struct LocationUncertainty {
+ horizontal_error: f64, // meters (95% confidence)
+ vertical_error: f64, // meters (95% confidence)
+}
+```
+
+---
+
+## Domain Events
+
+### Detection Events
+
+```rust
+pub enum DetectionEvent {
+ /// New survivor detected
+ SurvivorDetected {
+ survivor_id: SurvivorId,
+ zone_id: ScanZoneId,
+ vital_signs: VitalSignsReading,
+ location: Option,
+ timestamp: DateTime,
+ },
+
+ /// Survivor vital signs updated
+ VitalsUpdated {
+ survivor_id: SurvivorId,
+ previous: VitalSignsReading,
+ current: VitalSignsReading,
+ timestamp: DateTime,
+ },
+
+ /// Survivor triage status changed
+ TriageStatusChanged {
+ survivor_id: SurvivorId,
+ previous: TriageStatus,
+ current: TriageStatus,
+ reason: String,
+ timestamp: DateTime,
+ },
+
+ /// Survivor location refined
+ LocationRefined {
+ survivor_id: SurvivorId,
+ previous: Coordinates3D,
+ current: Coordinates3D,
+ timestamp: DateTime,
+ },
+
+ /// Survivor no longer detected (may have been rescued or false positive)
+ SurvivorLost {
+ survivor_id: SurvivorId,
+ last_detection: DateTime,
+ reason: LostReason,
+ },
+}
+
+pub enum LostReason {
+ Rescued,
+ FalsePositive,
+ SignalLost,
+ ZoneDeactivated,
+}
+```
+
+### Alert Events
+
+```rust
+pub enum AlertEvent {
+ /// New alert generated
+ AlertGenerated {
+ alert_id: AlertId,
+ survivor_id: SurvivorId,
+ priority: Priority,
+ payload: AlertPayload,
+ },
+
+ /// Alert acknowledged by rescue team
+ AlertAcknowledged {
+ alert_id: AlertId,
+ acknowledged_by: TeamId,
+ timestamp: DateTime,
+ },
+
+ /// Alert resolved
+ AlertResolved {
+ alert_id: AlertId,
+ resolution: AlertResolution,
+ timestamp: DateTime,
+ },
+}
+```
+
+---
+
+## Domain Services
+
+### TriageService
+
+Calculates triage status based on vital signs using START protocol:
+
+```rust
+pub trait TriageService {
+ fn calculate_triage(&self, vitals: &VitalSignsReading) -> TriageStatus;
+ fn should_upgrade_priority(&self, history: &VitalSignsHistory) -> bool;
+}
+```
+
+**Rules**:
+1. No breathing detected β Check for movement
+2. Movement but no breathing β Immediate (airway issue)
+3. Breathing > 30/min β Immediate
+4. Breathing < 10/min β Immediate
+5. No radial pulse equivalent (weak heartbeat) β Immediate
+6. Cannot follow commands (no responsive movement) β Immediate
+7. Otherwise β Delayed or Minor based on severity
+
+### LocalizationService
+
+Fuses multiple localization techniques:
+
+```rust
+pub trait LocalizationService {
+ fn estimate_position(
+ &self,
+ csi_data: &[CsiReading],
+ sensor_positions: &[SensorPosition],
+ ) -> Result;
+
+ fn estimate_depth(
+ &self,
+ signal_attenuation: f64,
+ debris_profile: &DebrisProfile,
+ ) -> Result;
+}
+```
+
+---
+
+## Context Map
+
+```
+ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
+β WiFi-Mat System β
+ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
+β β
+β βββββββββββββββ βββββββββββββββ β
+β β Detection ββββββββββΊβ Localizationβ β
+β β Context β Partner β Context β β
+β ββββββββ¬βββββββ ββββββββ¬βββββββ β
+β β β β
+β β Publishes β Publishes β
+β βΌ βΌ β
+β βββββββββββββββββββββββββββββββββββββββ β
+β β Event Bus (Domain Events) β β
+β βββββββββββββββββββ¬ββββββββββββββββββββ β
+β β β
+β β Subscribes β
+β βΌ β
+β βββββββββββββββ β
+β β Alerting β β
+β β Context β β
+β βββββββββββββββ β
+β β
+βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
+β UPSTREAM (Conformist) β
+β βββββββββββββββββ βββββββββββββββββ βββββββββββββββββ β
+β βwifi-densepose β βwifi-densepose β βwifi-densepose β β
+β β -signal β β -nn β β -hardware β β
+β βββββββββββββββββ βββββββββββββββββ βββββββββββββββββ β
+βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
+```
+
+**Relationship Types**:
+- Detection β Localization: **Partnership** (tight collaboration)
+- Detection β Alerting: **Customer/Supplier** (Detection publishes, Alerting consumes)
+- WiFi-Mat β Upstream crates: **Conformist** (adapts to their models)
+
+---
+
+## Anti-Corruption Layer
+
+The integration module provides adapters to translate between upstream crate models and WiFi-Mat domain:
+
+```rust
+/// Adapts wifi-densepose-signal types to Detection context
+pub struct SignalAdapter {
+ processor: CsiProcessor,
+ feature_extractor: FeatureExtractor,
+}
+
+impl SignalAdapter {
+ pub fn extract_vital_features(
+ &self,
+ raw_csi: &[Complex],
+ ) -> Result;
+}
+
+/// Adapts wifi-densepose-nn for specialized detection models
+pub struct NeuralAdapter {
+ breathing_model: OnnxModel,
+ heartbeat_model: OnnxModel,
+}
+
+impl NeuralAdapter {
+ pub fn classify_breathing(
+ &self,
+ features: &VitalFeatures,
+ ) -> Result;
+}
+```
+
+---
+
+## Repository Interfaces
+
+```rust
+#[async_trait]
+pub trait SurvivorRepository {
+ async fn save(&self, survivor: &Survivor) -> Result<(), RepositoryError>;
+ async fn find_by_id(&self, id: &SurvivorId) -> Result