Skip to content

joelin79/PulseOne

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PulseOne - Network Analyzer & Healer

A comprehensive iOS application for monitoring and optimizing network performance using AI-driven anomaly detection and environmental sensor correlation.

🎯 Overview

PulseOne is an MVP for a network analyzer/healer system that:

  • Monitors network performance metrics in real-time
  • Collects environmental sensor data (temperature, humidity, motion, etc.)
  • Uses AI/ML to detect anomalies and predict issues
  • Provides intelligent recommendations for network healing
  • Correlates environmental factors with network degradation

πŸ—οΈ Architecture

iOS App (SwiftUI)
    ↓
Cloud Services (Firestore, Firebase)
    ↓
Raspberry Pi (Data Collector + ML)
    ↓
Arduino (Sensors)

Tech Stack

  • Frontend: SwiftUI (iOS 16+)
  • Backend: Firebase/Firestore
  • AI: Gemini API (replaceable with your own)
  • ML Models:
    • Isolation Forest for anomaly detection
    • Time-series analysis (LSTM Autoencoder/Prophet)
    • Correlation modeling (Random Forest/Gradient Boosting)
  • Data Collection:
    • Network: speedtest-cli, iperf3, ping
    • Sensors: DHT11, MPU6050, current sensors via Arduino

πŸ“± App Features

1. Dashboard

  • Health Score Ring - Overall network health (0-100)
  • Real-time Metrics - Latency, packet loss, throughput, jitter
  • Active Alerts - Current anomalies detected by ML
  • Sensor Status - Quick view of all connected sensors
  • Quick Actions - Refresh data, trigger AI analysis

2. Network Monitor

  • Live Charts - Historical trends for all network metrics
  • Time Range Selector - 1h, 6h, 24h, 7d views
  • Summary Statistics - Average latency, packet loss, etc.
  • Real-time Updates - Live data streaming from Firestore

3. Sensors Dashboard

  • Sensor Cards - Temperature, humidity, motion, vibration, power
  • Environmental Insights - AI-detected correlations
  • Device Management - Connected Arduino devices
  • Health Indicators - Normal/abnormal sensor readings

4. Anomalies & Insights

  • Anomaly Feed - Chronological list of detected issues
  • Severity Filtering - Critical, warning, info
  • Pattern Detection - Recurring issues and trends
  • Root Cause Analysis - ML-driven explanations
  • Resolution Tracking - Resolved vs active anomalies

5. AI Agent Control

  • Agent Status - Current state (idle, analyzing, acting)
  • Action History - Log of automated healing actions
  • Manual Analysis - Request AI insights on-demand
  • Model Metrics - Version, accuracy, performance

6. Settings

  • Device Configuration - Raspberry Pi connection
  • Notification Preferences - Alert severity levels
  • Data Retention - Storage duration settings
  • AI Configuration - Model and API settings

πŸš€ Getting Started

Prerequisites

  • Xcode 15.0+
  • iOS 16.0+ device or simulator
  • Firebase project
  • Gemini API key (or your own AI endpoint)

Installation

  1. Clone the repository

    cd /Users/joelin/Local/PulseOne
  2. Add files to Xcode project

    ./add_to_xcode.sh

    Or manually add the folders in Xcode (see SETUP.md)

  3. Install Firebase SDK

    • Open PulseOne.xcodeproj in Xcode
    • Go to File β†’ Add Package Dependencies
    • Add https://github.com/firebase/firebase-ios-sdk
    • Select FirebaseCore and FirebaseFirestore
  4. Configure Gemini API

    • Open PulseOne/Services/GeminiService.swift
    • Replace YOUR_GEMINI_API_KEY with your API key
    • Or replace the entire service with your own AI endpoint
  5. Build and Run

    • Press Cmd+B to build
    • Press Cmd+R to run on simulator/device

πŸ“Š Data Models

Network Metrics

- latency: Double (ms)
- throughputDown: Double (Mbps)
- throughputUp: Double (Mbps)
- packetLoss: Double (%)
- signalStrength: Double (dBm)
- jitter: Double (ms)
- healthScore: Double (computed)

Sensor Data

- sensorType: enum (temperature, humidity, motion, vibration, powerDraw)
- value: Double
- unit: String
- isNormal: Bool (computed)

Anomalies

- type: enum (latencySpike, packetLoss, temperatureAnomaly, etc.)
- severity: enum (critical, warning, info)
- description: String
- rootCause: String?
- recommendedAction: String?
- isResolved: Bool

AI Agent Actions

- actionType: enum (diagnosticRun, networkRestart, etc.)
- success: Bool
- beforeMetrics: [String: Double]?
- afterMetrics: [String: Double]?
- aiResponse: String?

πŸ—„οΈ Firestore Structure

/network_metrics/{id}
  - timestamp, latency, throughput_down, throughput_up,
    packet_loss, signal_strength, jitter, device_id

/sensor_data/{id}
  - timestamp, sensor_type, value, unit, device_id, arduino_id

/anomalies/{id}
  - timestamp, type, severity, description, root_cause,
    recommended_action, is_resolved, device_id

/agent_actions/{id}
  - timestamp, action_type, description, success, anomaly_id,
    before_metrics, after_metrics, ai_response

/agent_state/current
  - status, current_task, last_action_timestamp,
    model_version, accuracy_score

πŸ€– ML Pipeline (Raspberry Pi)

Data Collection

  • Network metrics via speedtest-cli, iperf3, ping
  • Sensor readings via Arduino (serial/MQTT)
  • Store to Firestore with timestamps

Anomaly Detection

  • Isolation Forest - Statistical outlier detection
  • LSTM Autoencoder - Time-series anomalies
  • Prophet - Trend-based detection
  • Threshold alerts - Rule-based triggers

Correlation Analysis

  • Random Forest to learn sensor β†’ network relationships
  • Identify environmental factors affecting performance

Inference

  • TensorFlow Lite models on Raspberry Pi
  • Edge Impulse for sensor fusion
  • Real-time scoring and alerting

πŸ”§ Configuration

Device ID

Default: raspberry_pi_001

Change in:

  • ViewModels (DashboardViewModel, NetworkMonitorViewModel, etc.)
  • Settings view (runtime configuration)

Refresh Intervals

  • Network metrics: Configurable in Settings (default: 60s)
  • Real-time updates: Via Firestore listeners

Alert Thresholds

Defined in model classes:

  • Latency: >50ms triggers warning
  • Packet Loss: >1% triggers warning
  • Temperature: 15-35Β°C normal range
  • Humidity: 30-70% normal range

πŸ“± Screenshots

(Add screenshots of each main screen)

πŸ› οΈ Development

Project Structure

PulseOne/
β”œβ”€β”€ Models/          # Data models (Codable, Firestore-compatible)
β”œβ”€β”€ Services/        # Firebase, Gemini API services
β”œβ”€β”€ ViewModels/      # ObservableObject view models
β”œβ”€β”€ Views/           # SwiftUI views
β”œβ”€β”€ Components/      # Reusable UI components
β”œβ”€β”€ ContentView.swift
└── PulseOneApp.swift

Adding New Features

  1. Create model in Models/
  2. Add service methods in Services/FirestoreService.swift
  3. Create ViewModel in ViewModels/
  4. Build View in Views/
  5. Add to navigation in ContentView.swift

Testing with Mock Data

Add sample documents to Firestore:

// Example network metric
{
  timestamp: new Date(),
  latency: 45.2,
  throughput_down: 120.5,
  throughput_up: 25.3,
  packet_loss: 0.5,
  signal_strength: -65,
  jitter: 8.2,
  device_id: "raspberry_pi_001"
}

πŸ” Security Notes

  • Move API keys to secure storage (Keychain)
  • Use environment variables for sensitive config
  • Implement Firebase Authentication
  • Add Firestore security rules
  • Validate all sensor inputs

πŸ“ TODO / Future Enhancements

  • Add authentication (Firebase Auth)
  • Implement push notifications
  • Add historical data export
  • Create healing action automation rules
  • Build watchOS companion app
  • Add widget support
  • Implement on-device ML inference
  • Add network topology visualization
  • Create custom chart interactions
  • Add voice commands (Siri)

πŸ› Troubleshooting

Build Errors

  • "Cannot find X in scope" β†’ Add files to Xcode project (see SETUP.md)
  • Firebase errors β†’ Check GoogleService-Info.plist is added
  • Chart errors β†’ Set deployment target to iOS 16.0+

Runtime Issues

  • No data showing β†’ Check Firestore collections exist
  • AI not responding β†’ Verify Gemini API key
  • Sensors offline β†’ Check Arduino/Pi connectivity

πŸ“„ License

MIT License - see LICENSE file

🀝 Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Submit a pull request

πŸ“§ Contact

For questions or support, please open an issue.


Built with ❀️ for better network monitoring

About

dubhacks 25

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors