mirror of
https://github.com/smittix/intercept.git
synced 2026-04-24 14:50:00 -07:00
Add proximity radar visualization and signal history heatmap
Backend: - Add device_key.py for stable device identification (identity > public MAC > fingerprint) - Add distance.py with DistanceEstimator class (path-loss formula, EMA smoothing, confidence scoring) - Add ring_buffer.py for time-windowed RSSI observation storage - Extend BTDeviceAggregate with proximity_band, estimated_distance_m, distance_confidence, rssi_ema - Add new API endpoints: /proximity/snapshot, /heatmap/data, /devices/<key>/timeseries - Update TSCM integration to include new proximity fields Frontend: - Add proximity-radar.js: SVG radar with concentric rings, device dots positioned by distance - Add timeline-heatmap.js: RSSI history grid with time buckets and color-coded signal strength - Update bluetooth.js to initialize and feed data to new components - Replace zone counters with radar visualization and zone summary - Add proximity-viz.css for component styling Tests: - Add test_bluetooth_proximity.py with unit tests for device key stability, EMA smoothing, distance estimation, band classification, and ring buffer functionality Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -120,6 +120,63 @@ RANGE_NEARBY = 'nearby'
|
||||
RANGE_FAR = 'far'
|
||||
RANGE_UNKNOWN = 'unknown'
|
||||
|
||||
# =============================================================================
|
||||
# PROXIMITY BANDS (new visualization system)
|
||||
# =============================================================================
|
||||
|
||||
PROXIMITY_IMMEDIATE = 'immediate' # < 1m
|
||||
PROXIMITY_NEAR = 'near' # 1-3m
|
||||
PROXIMITY_FAR = 'far' # 3-10m
|
||||
PROXIMITY_UNKNOWN = 'unknown'
|
||||
|
||||
# RSSI thresholds for proximity band classification (dBm)
|
||||
PROXIMITY_RSSI_IMMEDIATE = -40 # >= -40 dBm -> immediate
|
||||
PROXIMITY_RSSI_NEAR = -55 # >= -55 dBm -> near
|
||||
PROXIMITY_RSSI_FAR = -75 # >= -75 dBm -> far
|
||||
|
||||
# =============================================================================
|
||||
# DISTANCE ESTIMATION SETTINGS
|
||||
# =============================================================================
|
||||
|
||||
# Path-loss exponent for indoor environments (typical range: 2-4)
|
||||
DISTANCE_PATH_LOSS_EXPONENT = 2.5
|
||||
|
||||
# Reference RSSI at 1 meter (typical BLE value)
|
||||
DISTANCE_RSSI_AT_1M = -59
|
||||
|
||||
# EMA smoothing alpha (higher = more responsive, lower = smoother)
|
||||
DISTANCE_EMA_ALPHA = 0.3
|
||||
|
||||
# Variance thresholds for confidence scoring (dBm^2)
|
||||
DISTANCE_LOW_VARIANCE = 25.0 # High confidence
|
||||
DISTANCE_HIGH_VARIANCE = 100.0 # Low confidence
|
||||
|
||||
# =============================================================================
|
||||
# RING BUFFER SETTINGS
|
||||
# =============================================================================
|
||||
|
||||
# Observation retention period (minutes)
|
||||
RING_BUFFER_RETENTION_MINUTES = 30
|
||||
|
||||
# Minimum interval between observations per device (seconds)
|
||||
RING_BUFFER_MIN_INTERVAL_SECONDS = 2.0
|
||||
|
||||
# Maximum observations stored per device
|
||||
RING_BUFFER_MAX_OBSERVATIONS = 1000
|
||||
|
||||
# =============================================================================
|
||||
# HEATMAP SETTINGS
|
||||
# =============================================================================
|
||||
|
||||
# Default time window for heatmap (minutes)
|
||||
HEATMAP_DEFAULT_WINDOW_MINUTES = 10
|
||||
|
||||
# Default bucket size for downsampling (seconds)
|
||||
HEATMAP_DEFAULT_BUCKET_SECONDS = 10
|
||||
|
||||
# Maximum devices to show in heatmap
|
||||
HEATMAP_MAX_DEVICES = 50
|
||||
|
||||
# =============================================================================
|
||||
# COMMON MANUFACTURER IDS (OUI -> Name mapping for common vendors)
|
||||
# =============================================================================
|
||||
|
||||
Reference in New Issue
Block a user