### Setup Workflow Example (Bash) Source: https://github.com/ruvnet/wifi-densepose/blob/main/README.md A step-by-step example of a complete setup workflow, including checking version, initializing configuration and database, starting the server, and verifying its status. Useful for new installations. ```bash wifi-densepose version wifi-densepose --help wifi-densepose config init wifi-densepose db init wifi-densepose start wifi-densepose status ``` -------------------------------- ### Development Setup for WiFi DensePose (Bash) Source: https://github.com/ruvnet/wifi-densepose/blob/main/README.md Guides through the development setup for the WiFi DensePose project. It includes cloning the repository, creating and activating a virtual environment, installing dependencies, and setting up pre-commit hooks. ```bash # Clone the repository git clone https://github.com/ruvnet/wifi-densepose.git cd wifi-densepose # Create virtual environment python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate # Install development dependencies pip install -r requirements-dev.txt pip install -e . # Install pre-commit hooks pre-commit install ``` -------------------------------- ### Production Workflow Example (Bash) Source: https://github.com/ruvnet/wifi-densepose/blob/main/README.md An example of a production workflow, showing how to start the server with a production configuration, check system status, manage the database (migrate, backup), and monitor tasks. Optimized for live environments. ```bash wifi-densepose -c production.yaml start wifi-densepose status wifi-densepose db migrate wifi-densepose db backup wifi-densepose tasks status ``` -------------------------------- ### Development Workflow Example (Bash) Source: https://github.com/ruvnet/wifi-densepose/blob/main/README.md An example of a development workflow, demonstrating how to start the server with debug logging and custom configuration, and manage database and task statuses. Tailored for development environments. ```bash wifi-densepose --debug start wifi-densepose -c dev-config.yaml start wifi-densepose db status wifi-densepose tasks start wifi-densepose tasks list ``` -------------------------------- ### Bash: Manual Development Server Setup Source: https://github.com/ruvnet/wifi-densepose/blob/main/ui/README.md Provides commands for manually setting up the development environment. It includes starting the FastAPI backend and then starting a separate Python HTTP server for the UI. Offers alternative commands using 'npx'. ```bash # First, start your FastAPI backend (runs on port 8000) wifi-densepose start # or from the main project directory: python -m wifi_densepose.main # Then, start the UI server on a different port to avoid conflicts cd /workspaces/wifi-densepose/ui python -m http.server 3000 # or npx http-server . -p 3000 # Open the UI at http://localhost:3000 # The UI will automatically detect and connect to your backend ``` -------------------------------- ### Quick Setup with Claude Flow CLI Source: https://github.com/ruvnet/wifi-densepose/blob/main/CLAUDE.md This snippet provides the essential commands for a quick setup of the Claude Flow CLI and its associated MCP servers. It includes adding MCP servers, starting the daemon, and running the doctor command with the fix option for initial configuration. ```bash # Add MCP servers (auto-detects MCP mode when stdin is piped) claude mcp add claude-flow -- npx -y @claude-flow/cli@latest claude mcp add ruv-swarm -- npx -y ruv-swarm mcp start # Optional claude mcp add flow-nexus -- npx -y flow-nexus@latest mcp start # Optional # Start daemon npx @claude-flow/cli@latest daemon start # Run doctor npx @claude-flow/cli@latest doctor --fix ``` -------------------------------- ### Install Rust and Dependencies for WiFi-Mat Source: https://github.com/ruvnet/wifi-densepose/blob/main/docs/wifi-mat-user-guide.md Installs the Rust toolchain and necessary system dependencies for building WiFi-Mat on Ubuntu/Debian systems. Requires cURL for Rust installation and apt-get for system packages. ```bash # Rust toolchain (1.70+) curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # Required system dependencies (Ubuntu/Debian) sudo apt-get install -y build-essential pkg-config libssl-dev ``` -------------------------------- ### Basic WiFi-DensePose System Setup and Start (Python) Source: https://github.com/ruvnet/wifi-densepose/blob/main/README.md Demonstrates the basic Python API for initializing and starting the WiFi-DensePose system. It shows how to create an instance, begin pose estimation, retrieve the latest pose data, and stop the system. ```python from wifi_densepose import WiFiDensePose # Initialize with default configuration system = WiFiDensePose() # Start pose estimation system.start() # Get latest pose data poses = system.get_latest_poses() print(f"Detected {len(poses)} persons") # Stop the system system.stop() ``` -------------------------------- ### WiFi-DensePose CLI Server Management Commands Source: https://github.com/ruvnet/wifi-densepose/blob/main/README.md Provides examples of common server management commands for the WiFi-DensePose CLI. This includes starting, stopping, checking status, and displaying version information, with options for custom configurations and logging levels. ```bash # Start the WiFi-DensePose API server wifi-densepose start # Start with custom configuration wifi-densepose -c /path/to/config.yaml start # Start with verbose logging wifi-densepose -v start # Start with debug mode wifi-densepose --debug start # Check server status wifi-densepose status # Stop the server wifi-densepose stop # Show version information wifi-densepose version ``` -------------------------------- ### Basic Disaster Response Initialization and Scanning (Rust) Source: https://github.com/ruvnet/wifi-densepose/blob/main/docs/wifi-mat-user-guide.md This example demonstrates how to initialize and configure the DisasterResponse system for earthquake scenarios. It includes setting up disaster type, sensitivity, and monitoring parameters, defining scan zones with specific bounds, and initiating the scanning process to detect potential survivors. ```rust use wifi_densepose_mat::{ DisasterResponse, DisasterConfig, DisasterType, ScanZone, ZoneBounds, }; #[tokio::main] async fn main() -> anyhow::Result<()> { // Configure for earthquake response let config = DisasterConfig::builder() .disaster_type(DisasterType::Earthquake) .sensitivity(0.85) .confidence_threshold(0.5) .max_depth(5.0) .continuous_monitoring(true) .build(); // Initialize the response system let mut response = DisasterResponse::new(config); // Initialize the disaster event let location = geo::Point::new(-122.4194, 37.7749); // San Francisco response.initialize_event(location, "Building collapse - Market Street")?; // Define scan zones let zone_a = ScanZone::new( "North Wing - Ground Floor", ZoneBounds::rectangle(0.0, 0.0, 30.0, 20.0), ); response.add_zone(zone_a)?; let zone_b = ScanZone::new( "South Wing - Basement", ZoneBounds::rectangle(30.0, 0.0, 60.0, 20.0), ); response.add_zone(zone_b)?; // Start scanning println!("Starting survivor detection scan..."); response.start_scanning().await?; // Get detected survivors let survivors = response.survivors(); println!("Detected {} potential survivors", survivors.len()); // Get immediate priority survivors let immediate = response.survivors_by_triage(TriageStatus::Immediate); println!("{} survivors require immediate rescue", immediate.len()); Ok(()) } ``` -------------------------------- ### Initialize and Deploy Disaster Response System (Rust) Source: https://github.com/ruvnet/wifi-densepose/blob/main/docs/wifi-mat-user-guide.md Initializes a disaster response system and adds zones to it. This code snippet demonstrates the setup process before scanning begins, requiring a configuration object and a list of zones. It returns a Result, indicating potential errors during initialization. ```rust let mut response = DisasterResponse::new(config); response.initialize_event(location, description)?; for zone in zones { response.add_zone(zone)?; } ``` -------------------------------- ### Python SDK Quick Example Source: https://github.com/ruvnet/wifi-densepose/blob/main/README.md A concise example demonstrating how to use the WiFi-DensePose Python SDK to interact with the API, specifically for retrieving latest poses. ```APIDOC ## Python SDK Quick Example ### Description Example of using the WiFi-DensePose Python SDK to fetch the latest poses. ### Language Python ### Code Example ```python from wifi_densepose import WiFiDensePoseClient # Initialize client with the base URL of the API server client = WiFiDensePoseClient(base_url="http://localhost:8000") try { # Get latest poses, filtering by a minimum confidence score poses = client.get_latest_poses(min_confidence=0.7) print(f"Detected {len(poses)} persons with confidence above 0.7") # You can further process the 'poses' list here for pose in poses: print(f"- Person ID: {pose['person_id']}, Confidence: {pose['confidence']}") } catch (error) { console.error("An error occurred:", error) } ``` ### Prerequisites - Ensure the `wifi-densepose` Python library is installed (`pip install wifi-densepose`). - The WiFi-DensePose server must be running and accessible at `http://localhost:8000`. ``` -------------------------------- ### Python SDK Quick Example (Python) Source: https://github.com/ruvnet/wifi-densepose/blob/main/README.md A concise example demonstrating how to use the WiFiDensePoseClient from the Python SDK to retrieve the latest pose data with confidence filtering. Shows basic client initialization and data fetching. ```python from wifi_densepose import WiFiDensePoseClient client = WiFiDensePoseClient(base_url="http://localhost:8000") poses = client.get_latest_poses(min_confidence=0.7) print(f"Detected {len(poses)} persons") ``` -------------------------------- ### CI Workflow: Test Suite Setup and Execution Source: https://github.com/ruvnet/wifi-densepose/blob/main/README.md This GitHub Actions workflow automates the testing of the wifi-densepose project. It checks out the code, sets up Python, installs dependencies, runs pytest for code coverage, and uploads the results to Codecov. It triggers on push and pull request events. ```yaml name: Test Suite on: [push, pull_request] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Set up Python uses: actions/setup-python@v2 with: python-version: 3.8 - name: Install dependencies run: | pip install -r requirements.txt pip install -e . - name: Run tests run: pytest --cov=wifi_densepose --cov-report=xml - name: Upload coverage uses: codecov/codecov-action@v1 ``` -------------------------------- ### Start Development Server (Backend) Source: https://github.com/ruvnet/wifi-densepose/blob/main/claude.md Commands to start a development server for Node.js, Python, Go, and Rust projects. ```bash # Start development server (adapt to your framework) npm run dev # Node.js python -m myapp.server # Python go run main.go # Go cargo run # Rust ``` -------------------------------- ### Install Dependencies (Frontend) Source: https://github.com/ruvnet/wifi-densepose/blob/main/claude.md Commands to install frontend dependencies using npm, yarn, and pnpm. ```bash # Install dependencies npm install # Most frontend projects yarn install # Yarn projects pnpm install # PNPM projects ``` -------------------------------- ### Install WiFi-DensePose from Source Source: https://github.com/ruvnet/wifi-densepose/blob/main/README.md Installs WiFi-DensePose by cloning the repository from GitHub and installing dependencies. This method is useful for development or when needing the latest unreleased features. ```bash git clone https://github.com/ruvnet/wifi-densepose.git cd wifi-densepose pip install -r requirements.txt pip install -e . ``` -------------------------------- ### Configure Sensors for 30x20m Zone (Rust) Source: https://github.com/ruvnet/wifi-densepose/blob/main/docs/wifi-mat-user-guide.md Defines an example sensor configuration for a 30x20 meter zone using Rust. It includes sensor ID, position (x, y, z), type, and operational status. This setup is crucial for initial system deployment. ```rust let sensors = vec![ SensorPosition { id: "S1".into(), x: 0.0, y: 0.0, z: 2.0, sensor_type: SensorType::Transceiver, is_operational: true, }, SensorPosition { id: "S2".into(), x: 30.0, y: 0.0, z: 2.0, sensor_type: SensorType::Transceiver, is_operational: true, }, SensorPosition { id: "S3".into(), x: 0.0, y: 20.0, z: 2.0, sensor_type: SensorType::Transceiver, is_operational: true, }, SensorPosition { id: "S4".into(), x: 30.0, y: 20.0, z: 2.0, sensor_type: SensorType::Transceiver, is_operational: true, }, ]; ``` -------------------------------- ### Bash: Development Server Startup Script Source: https://github.com/ruvnet/wifi-densepose/blob/main/ui/README.md A simple bash script to navigate to the UI directory and start the UI development server. This is one of the options for initiating the development environment. ```bash cd /workspaces/wifi-densepose/ui ./start-ui.sh ``` -------------------------------- ### Build WiFi-Mat from Source using Cargo Source: https://github.com/ruvnet/wifi-densepose/blob/main/docs/wifi-mat-user-guide.md Clones the WiFi-DensePose repository and builds the WiFi-Mat Rust crate using Cargo. Includes commands for building in release mode, running tests, and building with all features enabled. ```bash # Clone the repository git clone https://github.com/ruvnet/wifi-densepose.git cd wifi-densepose/rust-port/wifi-densepose-rs # Build the wifi-mat crate cargo build --release --package wifi-densepose-mat # Run tests cargo test --package wifi-densepose-mat # Build with all features cargo build --release --package wifi-densepose-mat --all-features ``` -------------------------------- ### claude-sparc.sh: Frontend-only Development Example Source: https://github.com/ruvnet/wifi-densepose/blob/main/claude.md This example illustrates a frontend-only development setup with a custom test coverage target. It sets the development mode, specifies the desired coverage percentage, and provides the project name and UI specification path. ```bash ./claude-sparc.sh --mode frontend-only --coverage 90 web-app ui-spec.md ``` -------------------------------- ### Initialize Application and Check Backend Status (JavaScript) Source: https://github.com/ruvnet/wifi-densepose/blob/main/ui/tests/integration-test.html Listens for the DOMContentLoaded event to execute initialization logic. It first checks the backend status and then initializes the WiFiDensePoseApp if it doesn't already exist. This code assumes the existence of an async function `checkBackendStatus` and a class `WiFiDensePoseApp`. ```javascript document.addEventListener('DOMContentLoaded', async () => { await checkBackendStatus(); if (!window.app) { window.app = new WiFiDensePoseApp(); await window.app.init(); } }); ``` -------------------------------- ### Triage Classification API Source: https://github.com/ruvnet/wifi-densepose/blob/main/docs/wifi-mat-user-guide.md Classifies individuals based on the START protocol using vital signs and provides detailed reasoning. ```APIDOC ## Triage Classification ### Automatic Triage #### Description Calculates triage status (Immediate, Delayed, Minor, Deceased, Unknown) based on provided vital signs, following the START protocol. ### Method Not applicable (Code example provided) ### Endpoint Not applicable (Code example provided) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```rust use wifi_densepose_mat::domain::triage::{TriageCalculator, TriageStatus}; let calculator = TriageCalculator::new(); let vital_signs = VitalSignsReading { breathing: Some(BreathingPattern { rate_bpm: 24.0, pattern_type: BreathingType::Shallow, .. }), heartbeat: Some(HeartbeatSignature { rate_bpm: 110.0, .. }), movement: MovementProfile { movement_type: MovementType::Fine, .. }, .. }; let triage = calculator.calculate(&vital_signs); match triage { TriageStatus::Immediate => println!("⚠️ IMMEDIATE - Rescue NOW"), TriageStatus::Delayed => println!("🟡 DELAYED - Stable for now"), TriageStatus::Minor => println!("🟢 MINOR - Walking wounded"), TriageStatus::Deceased => println!("⬛ DECEASED - No vital signs"), TriageStatus::Unknown => println!("❓ UNKNOWN - Insufficient data"), } ``` ### Response #### Success Response (200) - **status** (TriageStatus) - The calculated triage status. #### Response Example ```json { "status": "Immediate" } ``` ### Triage Factors #### Description Calculates triage status and provides detailed contributing factors and confidence level. ### Method Not applicable (Code example provided) ### Endpoint Not applicable (Code example provided) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```rust // Access detailed triage reasoning let factors = calculator.calculate_with_factors(&vital_signs); println!("Triage: {:?}", factors.status); println!("Contributing factors:"); for factor in &factors.contributing_factors { println!(" - {} (weight: {:.2})", factor.description, factor.weight); } println!("Confidence: {:.2}", factors.confidence); ``` ### Response #### Success Response (200) - **status** (TriageStatus) - The calculated triage status. - **contributing_factors** (array) - An array of objects detailing factors influencing the triage decision. - **description** (string) - Description of the factor. - **weight** (f32) - Weight of the factor in the decision. - **confidence** (f32) - Confidence level of the triage calculation. #### Response Example ```json { "status": "Immediate", "contributing_factors": [ { "description": "Breathing rate below 10 or above 29", "weight": 0.7 }, { "description": "No radial pulse", "weight": 0.5 } ], "confidence": 0.95 } ``` ``` -------------------------------- ### Basic HTML Setup for WiFi DensePose UI Source: https://github.com/ruvnet/wifi-densepose/blob/main/ui/README.md This snippet shows the basic HTML structure required to integrate the WiFi DensePose UI. It includes linking the main CSS file and the application's JavaScript entry point, ensuring modular components are loaded correctly. ```html