---
# System prepended metadata

title: Data colection for IA

---

# AlterMundi Network Data Collection Standard

This document defines a standardized approach for network data collection and analysis within AlterMundi's community networks. The standard addresses the need for scalable, automated, and intelligent network monitoring that supports both community autonomy and centralized support capabilities.

## Analisys: Project Context

AlterMundi has experimented with various network data collection solutions, each with limitations in implementation ease, configuration automation, centralization balance, and monitoring overhead. This standard establishes a unified framework that can evolve over time while supporting AI-driven network analysis and community empowerment.


This standard builds upon lessons learned from existing solutions, particularly LibreMesh's lime-report utility which outputs reports about node status and configuration for debugging and issue reporting. The lime-report tool provides valuable insights into effective data collection patterns, collecting:

- **System Information**: Hardware details, firmware versions, uptime statistics
- **Configuration Data**: Network, wireless, and community-specific settings  
- **Operational Status**: Routing tables, mesh protocol states, system logs

Our standard extends beyond lime-report's diagnostic focus to provide:
- **Real-time monitoring** vs. on-demand reporting
- **Structured API access** vs. shell script output  
- **AI-ready data formats** vs. human-readable reports
- **Privacy-preserving aggregation** vs. full configuration dumps
- **Automated configuration management** vs. manual intervention

While maintaining compatibility with LibreMesh ecosystems, this standard addresses the broader needs of continuous monitoring, predictive analysis, and community network evolution. This standard uses  **OGC SensorThings API** as foundation for data collection.

### LibreMesh Ecosystem Integration

The standard recognizes and integrates with key LibreMesh components:

#### Core Packages
- **lime-report**: Status reporting utility for debugging
- **lime-debug**: Debug utilities including bandwidth-test, netperf, iperf3
- **shared-state**: Distributed database for mesh network state
- **lime-app**: Web interface for node management
- **bandwidth-test**: Network performance testing utility

#### Mesh Protocols  
- **batman-adv**: Layer 2 mesh protocol with batctl management
- **babeld**: Babel routing protocol integration

#### Configuration System
- **lime-node**: Node-specific configuration
- **lime-community**: Community-wide settings  
- **lime-defaults**: Default configuration templates

The data collection agents will interface directly with these systems to gather comprehensive mesh network metrics while respecting LibreMesh's architecture and community autonomy principles.

### AI Assistant Use Cases and Information Requirements

#### 1. Network Performance Analysis
- **Objective**: Identify performance bottlenecks and optimization opportunities
- **Data Requirements**:
  - Real-time and historical bandwidth utilization
  - Latency measurements (RTT, jitter)
  - Packet loss statistics
  - Quality of Service (QoS) metrics
  - Node-to-node connectivity patterns

#### 2. Predictive Maintenance
- **Objective**: Anticipate hardware failures and network degradation
- **Data Requirements**:
  - Device temperature and power consumption
  - Signal strength variations over time
  - Error rate trends
  - Hardware status indicators
  - Environmental conditions (when available)

#### 3. Network Topology Optimization
- **Objective**: Suggest improvements to network architecture
- **Data Requirements**:
  - Current topology mapping
  - Traffic flow patterns
  - Geographic node distribution
  - Link quality metrics
  - Coverage area analysis

#### 4. Automated Troubleshooting
- **Objective**: Diagnose and suggest solutions for network issues
- **Data Requirements**:
  - Real-time alerts and error logs
  - Historical incident patterns
  - Configuration change history
  - Service availability metrics
  - User experience indicators

#### 5. Community Network Planning
- **Objective**: Support expansion and capacity planning decisions
- **Data Requirements**:
  - Growth trend analysis
  - Usage pattern forecasting
  - Resource utilization projections
  - Community engagement metrics
  - Cost-benefit analysis data


#### Information Architecture

```
Network Data Hierarchy:
├── Physical Layer
│   ├── Hardware status
│   ├── Environmental conditions
│   └── Power metrics
├── Link Layer
│   ├── Wi-Fi spectrum data
│   ├── Signal quality
│   └── Interference patterns
├── Network Layer
│   ├── Routing information
│   ├── Topology data
│   └── IP allocation
├── Transport Layer
│   ├── Bandwidth utilization
│   ├── Connection statistics
│   └── QoS metrics
└── Application Layer
    ├── Service performance
    ├── User experience metrics
    └── Traffic classification
```

## Design: System Architecture 

### Overview

The system implements a **distributed agent-based architecture** with lightweight data collection agents installed on each router node, pushing telemetry data to a centralized server infrastructure for analysis and storage.

```
┌─────────────────────────────────────────────────────────────────┐
│                    Central Server Infrastructure (Kafka)        │
├─────────────────────────────────────────────────────────────────┤
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐  ┌─────────┐ │
│  │ API Gateway │  │ Message     │  │             │  │ AI/ML   │ │
│  │             │  │ Queue       │  │ Database    │  │ Engine  │ │
│  └─────────────┘  └─────────────┘  └─────────────┘  └─────────┘ │
└─────────────────────────────────────────────────────────────────┘
                              ▲
                              │ HTTPS/JSON
                              │ Push Data
                              │
┌─────────────────────────────────────────────────────────────────┐
│                    Community Mesh Network                       │
├─────────────────────────────────────────────────────────────────┤
│  ┌───────────────┐                                              │
│  │   Router 1    │  ...  Router N                               │
│  │ ┌───────────┐ │                                              │
│  │ │ Integrator│ │                                              │
│  │ │ percecptor│ │                                              │
│  │ │ sensor    │ │                                              │
│  │ └───────────┘ │                                              │
│  └───────────────┘                                              │
├─────────────────────────────────────────────────────────────────┤
```

### Agent (integrators) Architecture
Agents will be composed of integrators, perceptors and sensors.

#### Agent Components
- **Sensors (Data Collectors)**: Lightweight modules for specific metrics (system, network, spectrum)
- **Configuration Manager (mesh config)**: Handles remote configuration updates
- **Perceptor & integrator**
    - **Data Processor**: Local aggregation and privacy filtering
    - **Transmission Engine**: Reliable data delivery to central server


#### Agent Installation
Agents will be deployed as OpenWrt packages compatible with LibreMesh

### Core Entities mapping
OGC SensorThings API is the base standard 

| **AlterMundi Concept** | **SensorThings Entity** | **Description** |
|-------------------------|--------------------------|-----------------|
| **Router/Node** | `Thing` | Physical device in the mesh network |
| **Node location** | `Location` + `HistoricalLocation` | Current and historical geographic position |
| **Monitoring agent** | `Sensor` | Software/module that collects data |
| **Specific metric** | `ObservedProperty` | CPU, bandwidth, WiFi signal, etc. |
| **Data series** | `Datastream` | Stream of observations for a metric |
| **Individual measurement** | `Observation` | Specific value at a point in time |
| **Coverage area** | `FeatureOfInterest` | Geographic area served by the node |

#### Implementation Example

```json
{
  "@iot.context": "https://api.altermundi.net/v1.1",
  "Things": [
    {
      "@iot.id": "altermundi-node-001",
      "name": "Villa 31 Node - Main Router",
      "description": "LibreMesh router serving Villa 31 community",
      "properties": {
        "hardware": "LibreRouter v1.3",
        "firmware": "LibreMesh 2023.05.1", 
        "community": "villa31-mesh",
        "deployment_date": "2023-03-15",
        "maintainer": "cooperative-villa31"
      },
      "Locations": [{
        "name": "Villa 31 - Community Center",
        "description": "Router located at community center",
        "encodingType": "application/vnd.geo+json",
        "location": {
          "type": "Point",
          "coordinates": [-58.3747, -34.5945]
        }
      }],
      "Datastreams": [
        {
          "name": "CPU Usage",
          "description": "Processor utilization percentage",
          "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement",
          "unitOfMeasurement": {
            "name": "Percentage",
            "symbol": "%",
            "definition": "http://www.qudt.org/2.1/vocab/unit/PERCENT"
          },
          "ObservedProperty": {
            "name": "CPU Utilization",
            "description": "System processor utilization",
            "definition": "https://schemas.altermundi.net/properties/cpu-usage"
          },
          "Sensor": {
            "name": "System Monitor Agent",
            "description": "AlterMundi data collection agent",
            "encodingType": "application/json",
            "metadata": {
              "agent_version": "2.1.0",
              "collection_method": "/proc/stat",
              "update_interval": "30s"
            }
          }
        }
      ]
    }
  ]
}
```

## Detailed desing: Datastreams

### Datastream of interest and Push Intervals

#### High-Frequency Metrics (Every 30 seconds)
- **System vitals**: CPU usage, memory usage, temperature
- **Network interface counters**:Latency, RX/TX bytes, packet counts, errors (retransmisions)
- **Wireless signal quality**: RSSI, noise floor, channel utilization
- **Critical alerts**: Hardware failures, connectivity loss

#### Medium-Frequency Metrics (Every 5 minutes) 
- **Bandwidth utilization**: Per-interface throughput analysis
- **Mesh protocol status**: Neighbor discovery, routing table size
- **Service availability**: DNS resolution, internet connectivity
- **Flow statistics**: Traffic pattern analysis (anonymized)

#### Low-Frequency Metrics (Every 30 minutes)
- **Spectrum analysis**: Channel occupancy, interference detection
- **Topology mapping**: Network graph updates
- **Configuration snapshots**: System configuration changes
- **Performance benchmarks**: Latency tests, throughput measurements

#### Configuration Updates (On-demand)
- **Push notifications**: Immediate configuration changes via webhooks
- **Pull requests**: Periodic configuration synchronization (every 6 hours)
- **Emergency updates**: Security patches, critical fixes

### Datastream definitions

#### System Information Datastreams

Based on lime-report's system data collection, we define the following datastreams:

```json
{
  "SystemDatastreams": [
    {
      "name": "CPU Load Average (1min)",
      "description": "1-minute load average from /proc/loadavg",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement",
      "unitOfMeasurement": {"name": "Load", "symbol": "", "definition": "http://schemas.altermundi.net/units/load"},
      "ObservedProperty": {
        "name": "System Load 1min",
        "description": "Average system load over 1 minute",
        "definition": "https://schemas.altermundi.net/properties/load-1min"
      },
      "collection_source": "/proc/loadavg"
    },
    {
      "name": "CPU Load Average (5min)",
      "description": "5-minute load average from /proc/loadavg",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement",
      "unitOfMeasurement": {"name": "Load", "symbol": "", "definition": "http://schemas.altermundi.net/units/load"},
      "ObservedProperty": {
        "name": "System Load 5min",
        "description": "Average system load over 5 minutes",
        "definition": "https://schemas.altermundi.net/properties/load-5min"
      }
    },
    {
      "name": "Memory Total",
      "description": "Total system memory from /proc/meminfo",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement",
      "unitOfMeasurement": {"name": "Kilobytes", "symbol": "kB", "definition": "http://www.qudt.org/2.1/vocab/unit/KiloB"},
      "ObservedProperty": {
        "name": "Memory Total",
        "description": "Total system memory available",
        "definition": "https://schemas.altermundi.net/properties/memory-total"
      }
    },
    {
      "name": "Memory Available",
      "description": "Available memory from /proc/meminfo",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement",
      "unitOfMeasurement": {"name": "Kilobytes", "symbol": "kB", "definition": "http://www.qudt.org/2.1/vocab/unit/KiloB"},
      "ObservedProperty": {
        "name": "Memory Available",
        "description": "Available system memory",
        "definition": "https://schemas.altermundi.net/properties/memory-available"
      }
    },
    {
      "name": "System Uptime",
      "description": "System uptime in seconds from /proc/uptime",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement",
      "unitOfMeasurement": {"name": "Seconds", "symbol": "s", "definition": "http://www.qudt.org/2.1/vocab/unit/SEC"},
      "ObservedProperty": {
        "name": "System Uptime",
        "description": "Time since system boot",
        "definition": "https://schemas.altermundi.net/properties/uptime"
      }
    },
    {
      "name": "CPU Temperature",
      "description": "CPU temperature if available",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement",
      "unitOfMeasurement": {"name": "Celsius", "symbol": "°C", "definition": "http://www.qudt.org/2.1/vocab/unit/DEG_C"},
      "ObservedProperty": {
        "name": "CPU Temperature",
        "description": "Processor temperature",
        "definition": "https://schemas.altermundi.net/properties/cpu-temperature"
      }
    }
  ]
}
```

#### Network Interface Datastreams

lime-report collects network interface statistics. Each interface generates multiple datastreams:

```json
{
  "NetworkDatastreams": [
    {
      "name": "Interface RX Bytes",
      "description": "Bytes received per network interface",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement",
      "unitOfMeasurement": {"name": "Bytes", "symbol": "B", "definition": "http://www.qudt.org/2.1/vocab/unit/BYTE"},
      "ObservedProperty": {
        "name": "Network Interface RX Bytes",
        "description": "Total bytes received on network interface",
        "definition": "https://schemas.altermundi.net/properties/interface-rx-bytes"
      },
      "properties": {"interface": "eth0", "direction": "rx"}
    },
    {
      "name": "Interface TX Bytes",
      "description": "Bytes transmitted per network interface",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement",
      "unitOfMeasurement": {"name": "Bytes", "symbol": "B", "definition": "http://www.qudt.org/2.1/vocab/unit/BYTE"},
      "ObservedProperty": {
        "name": "Network Interface TX Bytes",
        "description": "Total bytes transmitted on network interface",
        "definition": "https://schemas.altermundi.net/properties/interface-tx-bytes"
      },
      "properties": {"interface": "eth0", "direction": "tx"}
    },
    {
      "name": "Interface RX Packets",
      "description": "Packets received per network interface",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Count",
      "unitOfMeasurement": {"name": "Packets", "symbol": "pkt", "definition": "http://schemas.altermundi.net/units/packets"},
      "ObservedProperty": {
        "name": "Network Interface RX Packets",
        "description": "Total packets received on network interface",
        "definition": "https://schemas.altermundi.net/properties/interface-rx-packets"
      }
    },
    {
      "name": "Interface TX Packets",
      "description": "Packets transmitted per network interface",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Count",
      "unitOfMeasurement": {"name": "Packets", "symbol": "pkt", "definition": "http://schemas.altermundi.net/units/packets"},
      "ObservedProperty": {
        "name": "Network Interface TX Packets",
        "description": "Total packets transmitted on network interface",
        "definition": "https://schemas.altermundi.net/properties/interface-tx-packets"
      }
    },
    {
      "name": "Interface Errors",
      "description": "Error packets per network interface",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Count",
      "unitOfMeasurement": {"name": "Errors", "symbol": "err", "definition": "http://schemas.altermundi.net/units/errors"},
      "ObservedProperty": {
        "name": "Network Interface Errors",
        "description": "Total error packets on network interface",
        "definition": "https://schemas.altermundi.net/properties/interface-errors"
      }
    }
  ]
}
```

#### Wireless Interface Datastreams

WiFi-specific metrics from lime-report wireless analysis:

```json
{
  "WirelessDatastreams": [
    {
      "name": "WiFi Signal Strength (RSSI)",
      "description": "Received Signal Strength Indicator",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement",
      "unitOfMeasurement": {"name": "dBm", "symbol": "dBm", "definition": "http://www.qudt.org/2.1/vocab/unit/DeciB_M"},
      "ObservedProperty": {
        "name": "WiFi RSSI",
        "description": "WiFi signal strength in dBm",
        "definition": "https://schemas.altermundi.net/properties/wifi-rssi"
      },
      "properties": {"interface": "wlan0", "band": "2.4GHz"}
    },
    {
      "name": "WiFi Noise Floor",
      "description": "Background noise level",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement",
      "unitOfMeasurement": {"name": "dBm", "symbol": "dBm", "definition": "http://www.qudt.org/2.1/vocab/unit/DeciB_M"},
      "ObservedProperty": {
        "name": "WiFi Noise Floor",
        "description": "Background noise level measurement",
        "definition": "https://schemas.altermundi.net/properties/wifi-noise-floor"
      }
    },
    {
      "name": "WiFi Channel",
      "description": "Current WiFi channel",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_CategoryObservation",
      "unitOfMeasurement": {"name": "Channel", "symbol": "ch", "definition": "http://schemas.altermundi.net/units/wifi-channel"},
      "ObservedProperty": {
        "name": "WiFi Channel",
        "description": "Active WiFi channel number",
        "definition": "https://schemas.altermundi.net/properties/wifi-channel"
      }
    },
    {
      "name": "WiFi Frequency",
      "description": "Operating frequency",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement",
      "unitOfMeasurement": {"name": "Megahertz", "symbol": "MHz", "definition": "http://www.qudt.org/2.1/vocab/unit/MegaHZ"},
      "ObservedProperty": {
        "name": "WiFi Frequency",
        "description": "WiFi operating frequency",
        "definition": "https://schemas.altermundi.net/properties/wifi-frequency"
      }
    },
    {
      "name": "WiFi TX Power",
      "description": "Transmission power level",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement",
      "unitOfMeasurement": {"name": "dBm", "symbol": "dBm", "definition": "http://www.qudt.org/2.1/vocab/unit/DeciB_M"},
      "ObservedProperty": {
        "name": "WiFi TX Power",
        "description": "WiFi transmission power level",
        "definition": "https://schemas.altermundi.net/properties/wifi-tx-power"
      }
    },
    {
      "name": "Associated Stations",
      "description": "Number of connected clients",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Count",
      "unitOfMeasurement": {"name": "Stations", "symbol": "sta", "definition": "http://schemas.altermundi.net/units/wifi-stations"},
      "ObservedProperty": {
        "name": "WiFi Associated Stations",
        "description": "Number of WiFi clients connected",
        "definition": "https://schemas.altermundi.net/properties/wifi-stations"
      }
    }
  ]
}
```

#### Mesh Protocol Datastreams

Based on lime-report's mesh protocol integration (batman-adv, bmx6, babeld):

```json
{
  "MeshProtocolDatastreams": [
    {
      "name": "Batman-adv Neighbor Count",
      "description": "Number of direct batman-adv neighbors",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Count",
      "unitOfMeasurement": {"name": "Neighbors", "symbol": "nb", "definition": "http://schemas.altermundi.net/units/neighbors"},
      "ObservedProperty": {
        "name": "Mesh Neighbor Count",
        "description": "Number of direct mesh neighbors",
        "definition": "https://schemas.altermundi.net/properties/mesh-neighbors"
      },
      "properties": {"protocol": "batman-adv"}
    },
    {
      "name": "Batman-adv Routing Table Size",
      "description": "Number of entries in batman routing table",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Count",
      "unitOfMeasurement": {"name": "Routes", "symbol": "rt", "definition": "http://schemas.altermundi.net/units/routes"},
      "ObservedProperty": {
        "name": "Mesh Routing Table Size",
        "description": "Number of routes in mesh routing table",
        "definition": "https://schemas.altermundi.net/properties/mesh-routes"
      }
    },
    {
      "name": "BMX6 Neighbor Quality",
      "description": "Average link quality to BMX6 neighbors",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement",
      "unitOfMeasurement": {"name": "Quality", "symbol": "", "definition": "http://schemas.altermundi.net/units/link-quality"},
      "ObservedProperty": {
        "name": "Mesh Link Quality",
        "description": "Average quality of mesh links",
        "definition": "https://schemas.altermundi.net/properties/mesh-link-quality"
      },
      "properties": {"protocol": "bmx6"}
    },
    {
      "name": "Mesh Gateway Status",
      "description": "Gateway connectivity status",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_TruthObservation",
      "unitOfMeasurement": {"name": "Boolean", "symbol": "", "definition": "http://schemas.altermundi.net/units/boolean"},
      "ObservedProperty": {
        "name": "Internet Gateway Status",
        "description": "Connectivity to internet gateway",
        "definition": "https://schemas.altermundi.net/properties/gateway-status"
      }
    }
  ]
}
```

#### LibreMesh Configuration Datastreams

Configuration and status information from lime-report:

```json
{
  "ConfigurationDatastreams": [
    {
      "name": "Firmware Version",
      "description": "LibreMesh firmware version",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_CategoryObservation",
      "unitOfMeasurement": {"name": "Version", "symbol": "", "definition": "http://schemas.altermundi.net/units/version"},
      "ObservedProperty": {
        "name": "Firmware Version",
        "description": "Current firmware version string",
        "definition": "https://schemas.altermundi.net/properties/firmware-version"
      }
    },
    {
      "name": "Configuration Change Hash",
      "description": "Hash of configuration files for change detection",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_CategoryObservation",
      "unitOfMeasurement": {"name": "Hash", "symbol": "", "definition": "http://schemas.altermundi.net/units/hash"},
      "ObservedProperty": {
        "name": "Configuration Hash",
        "description": "Configuration change detection hash",
        "definition": "https://schemas.altermundi.net/properties/config-hash"
      }
    },
    {
      "name": "Mesh Protocol Active",
      "description": "Currently active mesh routing protocol",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_CategoryObservation",
      "unitOfMeasurement": {"name": "Protocol", "symbol": "", "definition": "http://schemas.altermundi.net/units/protocol"},
      "ObservedProperty": {
        "name": "Active Mesh Protocol",
        "description": "Currently running mesh routing protocol",
        "definition": "https://schemas.altermundi.net/properties/mesh-protocol"
      }
    },
    {
      "name": "Community Network ID",
      "description": "LibreMesh community network identifier",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_CategoryObservation",
      "unitOfMeasurement": {"name": "Network ID", "symbol": "", "definition": "http://schemas.altermundi.net/units/network-id"},
      "ObservedProperty": {
        "name": "Community Network",
        "description": "Community network identifier",
        "definition": "https://schemas.altermundi.net/properties/community-network"
      }
    }
  ]
}
```

#### Service and Connectivity Datastreams

Service availability metrics from lime-report's connectivity tests:

```json
{
  "ConnectivityDatastreams": [
    {
      "name": "DNS Resolution Status",
      "description": "DNS resolution functionality test",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_TruthObservation",
      "unitOfMeasurement": {"name": "Boolean", "symbol": "", "definition": "http://schemas.altermundi.net/units/boolean"},
      "ObservedProperty": {
        "name": "DNS Service Status",
        "description": "DNS resolution service availability",
        "definition": "https://schemas.altermundi.net/properties/dns-status"
      }
    },
    {
      "name": "Internet Connectivity",
      "description": "Internet connectivity test result",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_TruthObservation",
      "unitOfMeasurement": {"name": "Boolean", "symbol": "", "definition": "http://schemas.altermundi.net/units/boolean"},
      "ObservedProperty": {
        "name": "Internet Connectivity",
        "description": "Internet access availability",
        "definition": "https://schemas.altermundi.net/properties/internet-connectivity"
      }
    },
    {
      "name": "Captive Portal Status",
      "description": "Captive portal service status",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_TruthObservation",
      "unitOfMeasurement": {"name": "Boolean", "symbol": "", "definition": "http://schemas.altermundi.net/units/boolean"},
      "ObservedProperty": {
        "name": "Captive Portal Status",
        "description": "Captive portal service availability",
        "definition": "https://schemas.altermundi.net/properties/captive-portal-status"
      }
    },
    {
      "name": "Ping Response Time",
      "description": "Network latency measurement",
      "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement",
      "unitOfMeasurement": {"name": "Milliseconds", "symbol": "ms", "definition": "http://www.qudt.org/2.1/vocab/unit/MilliSEC"},
      "ObservedProperty": {
        "name": "Network Latency",
        "description": "Round-trip network latency",
        "definition": "https://schemas.altermundi.net/properties/network-latency"
      }
    }
  ]
}
```


## Detailed Design: SensorThings API Endpoints and Queries

### Core Endpoint Structure

```
Base URL: https://api.altermundi.net/v1.1/

# Core entities
GET    /Things                          # All mesh nodes
GET    /Things(node-001)                # Specific node  
GET    /Things(node-001)/Datastreams    # Node's data streams
GET    /Things(node-001)/Locations      # Node locations

# Observations
GET    /Observations                    # All observations
GET    /Datastreams(cpu-001)/Observations  # CPU observations
POST   /Observations                    # Single observation
POST   /CreateObservations              # Batch observations

# Advanced queries (OData)
GET    /Things?$expand=Datastreams,Locations
GET    /Observations?$filter=result gt 80
GET    /Things?$filter=st_within(location, geography'POLYGON(...)')
GET    /Datastreams?$select=name,unitOfMeasurement&$top=10
```

### Community Network Specific Queries

```javascript
// High CPU load nodes in the last 24 hours
const highCpuNodes = await fetch(`
  ${baseUrl}/Things?$expand=Datastreams/Observations
  &$filter=Datastreams/ObservedProperty/name eq 'System Load 1min' 
  and Datastreams/Observations/result gt 2.0 
  and Datastreams/Observations/phenomenonTime ge ${yesterday}
`);

// Geographic coverage analysis
const coverageAnalysis = await fetch(`
  ${baseUrl}/Things?$expand=Locations
  &$filter=st_within(Locations/location, geography'POLYGON((${boundingBox}))')
  &$select=name,properties,Locations
`);

// Mesh connectivity health
const meshHealth = await fetch(`
  ${baseUrl}/Datastreams?$expand=Thing,Observations
  &$filter=ObservedProperty/name eq 'Mesh Neighbor Count'
  and Observations/phenomenonTime ge ${lastHour}
  &$orderby=Observations/result desc
`);

// WiFi spectrum utilization
const spectrumAnalysis = await fetch(`
  ${baseUrl}/Observations?$expand=Datastream/Thing/Locations
  &$filter=Datastream/ObservedProperty/name eq 'WiFi Channel Utilization'
  and phenomenonTime ge ${lastDay}
  and result gt 70
`);

// Internet connectivity status across network
const connectivityStatus = await fetch(`
  ${baseUrl}/Observations?$expand=Datastream/Thing
  &$filter=Datastream/ObservedProperty/name eq 'Internet Connectivity'
  and phenomenonTime ge ${lastHour}
  &$orderby=phenomenonTime desc
`);
```

## Detailed design: Data Collection API and Server Infrastructure

### API Design Principles

- **RESTful Architecture**: Standard HTTP methods for consistency
- **JSON Data Format**: Lightweight and widely supported
- **Authentication**: Token-based authentication for security (in a seccond stage)
- **Rate Limiting**: Prevent system overload
- **Versioning**: Support for API evolution
- **Compression**: Efficient data transmission

### API Endpoints Structure

```
Base URL: https://api.altermundi.net/v1/

Authentication:
POST /auth/login
POST /auth/refresh

Node Management:
GET    /nodes
POST   /nodes
GET    /nodes/{node_id}
PUT    /nodes/{node_id}
DELETE /nodes/{node_id}

Data Collection:
POST   /data/metrics
GET    /data/metrics/{node_id}
POST   /data/bandwidth
POST   /data/spectrum
POST   /data/topology

Analytics:
GET    /analytics/summary/{node_id}
GET    /analytics/trends
POST   /analytics/query
```

## Privacy Considerations

- **Data Anonymization**: Remove personally identifiable information
- **IP Address Hashing**: Use consistent hashing for flow analysis
- **Aggregation**: Provide aggregated statistics to minimize privacy impact
- **Retention Limits**: Automatic deletion of detailed records after specified periods


## Migration from Existing Solutions

### LibreMesh lime-report Transition

For communities currently using LibreMesh with lime-report, migration follows a phased approach:

#### Phase 1: Parallel Operation
- Deploy data collection agents alongside existing lime-report
- Maintain backward compatibility with existing debugging workflows
- Collect comparative data to validate new system accuracy

#### Phase 2: Enhanced Integration
- Replace lime-report calls with enhanced versions that output to both formats
- Provide lime-report compatibility layer for existing tools


## Implementation Roadmap

### Phase 1: Foundation
- [x] API design and server infrastructure setup
- [ ] Basic data collection agents for system metrics 
- [x] Configuration management system
- [ ] Database schema implementation
- [ ] LibreMesh compatibility layer development
- [ ] lime-report integration and testing

### Phase 2: Bandwidth Monitoring 
- [ ] Interface-level bandwidth monitoring
- [ ] Privacy-preserving data aggregation
- [ ] LibreMesh babel/batman-adv protocol integration

### Phase 3: Spectrum Analysis 
- [ ] Wi-Fi spectrum scanning implementation
- [ ] Interference detection algorithms
- [ ] Channel quality assessment

### Phase 4: AI Integration 
- [ ] Design and propose data preprocessing for ML models


## Conclusion

This standardized approach to network data collection provides a scalable foundation for improving AlterMundi's community networks. By combining automated data collection, intelligent analysis, and community empowerment, this system will enable more effective network management and support the growth of community networking initiatives.

The modular design allows for gradual implementation and continuous improvement, ensuring that the system can evolve with changing needs and technologies while maintaining backward compatibility and community autonomy.