# WiFi DensePose UI A modular, modern web interface for the WiFi DensePose human tracking system. This UI provides real-time monitoring, configuration, and visualization of WiFi-based pose estimation. ## ๐๏ธ Architecture The UI follows a modular architecture with clear separation of concerns: ``` ui/ โโโ app.js # Main application entry point โโโ index.html # Updated HTML with modular structure โโโ style.css # Complete CSS with additional styles โโโ config/ # Configuration modules โ โโโ api.config.js # API endpoints and configuration โโโ services/ # Service layer for API communication โ โโโ api.service.js # HTTP API client โ โโโ websocket.service.js # WebSocket client โ โโโ pose.service.js # Pose estimation API wrapper โ โโโ health.service.js # Health monitoring API wrapper โ โโโ stream.service.js # Streaming API wrapper โโโ components/ # UI components โ โโโ TabManager.js # Tab navigation component โ โโโ DashboardTab.js # Dashboard component with live data โ โโโ HardwareTab.js # Hardware configuration component โ โโโ LiveDemoTab.js # Live demo with streaming โโโ utils/ # Utility functions and helpers โ โโโ mock-server.js # Mock server for testing โโโ tests/ # Comprehensive test suite โโโ test-runner.html # Test runner UI โโโ test-runner.js # Test framework and cases โโโ integration-test.html # Integration testing page ``` ## ๐ Features ### Smart Backend Detection - **Automatic Detection**: Automatically detects if your FastAPI backend is running - **Real Backend Priority**: Always uses the real backend when available - **Mock Fallback**: Falls back to mock server only when backend is unavailable - **Testing Mode**: Can force mock mode for testing and development ### Real-time Dashboard - Live system health monitoring - Real-time pose detection statistics - Zone occupancy tracking - System metrics (CPU, memory, disk) - API status indicators ### Hardware Configuration - Interactive antenna array visualization - Real-time CSI data display - Configuration panels - Hardware status monitoring ### Live Demo - WebSocket-based real-time streaming - Signal visualization - Pose detection visualization - Interactive controls ### API Integration - Complete REST API coverage - WebSocket streaming support - Authentication handling - Error management - Request/response interceptors ## ๐ API Coverage The UI integrates with all WiFi DensePose API endpoints: ### Health Endpoints - `GET /health/health` - System health check - `GET /health/ready` - Readiness check - `GET /health/live` - Liveness check - `GET /health/metrics` - System metrics - `GET /health/version` - Version information ### Pose Estimation - `GET /api/v1/pose/current` - Current pose data - `POST /api/v1/pose/analyze` - Trigger analysis - `GET /api/v1/pose/zones/{zone_id}/occupancy` - Zone occupancy - `GET /api/v1/pose/zones/summary` - All zones summary - `POST /api/v1/pose/historical` - Historical data - `GET /api/v1/pose/activities` - Recent activities - `POST /api/v1/pose/calibrate` - System calibration - `GET /api/v1/pose/stats` - Statistics ### Streaming - `WS /api/v1/stream/pose` - Real-time pose stream - `WS /api/v1/stream/events` - Event stream - `GET /api/v1/stream/status` - Stream status - `POST /api/v1/stream/start` - Start streaming - `POST /api/v1/stream/stop` - Stop streaming - `GET /api/v1/stream/clients` - Connected clients - `DELETE /api/v1/stream/clients/{client_id}` - Disconnect client ## ๐งช Testing ### Test Runner Open `tests/test-runner.html` to run the complete test suite: ```bash # Serve the UI directory on port 3000 (to avoid conflicts with FastAPI on 8000) cd /workspaces/wifi-densepose/ui python -m http.server 3000 # Open http://localhost:3000/tests/test-runner.html ``` ### Test Categories - **API Configuration Tests** - Configuration and URL building - **API Service Tests** - HTTP client functionality - **WebSocket Service Tests** - WebSocket connection management - **Pose Service Tests** - Pose estimation API wrapper - **Health Service Tests** - Health monitoring functionality - **UI Component Tests** - Component behavior and interaction - **Integration Tests** - End-to-end functionality ### Integration Testing Use `tests/integration-test.html` for visual integration testing: ```bash # Open http://localhost:3000/tests/integration-test.html ``` Features: - Mock server with realistic API responses - Visual testing of all components - Real-time data simulation - Error scenario testing - WebSocket stream testing ## ๐ ๏ธ Usage ### Basic Setup ```html