Skip to content

Local PC activity analyzer with RAG-powered AI chatbot. Track app usage, visualize digital habits, and get personalized insights.

License

Notifications You must be signed in to change notification settings

busraileri/pc-activity-analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PC Activity Analyzer

πŸ“Œ Overview

PC Activity Analyzer is a privacy-first digital habit tracking tool that monitors your PC usage and provides AI-powered insights. All data processing and AI analysis happens locally on your device - no cloud uploads, no external API calls.


✨ Key Features

  • Real-time Activity Tracking - Monitors active window usage on your PC
  • Interactive Dashboards - Visualize your digital habits with charts and analytics
  • AI-Powered Insights - Natural language chatbot answers questions about your usage patterns
  • Smart Filtering - Filter data by app, date, time, and custom criteria
  • Privacy-First - All data and AI processing stays on your device
  • Data Export - Export your usage data as CSV for external analysis

Dashboard & Analytics

Dashboard Analytics

Detailed analytics with hourly, daily, and weekly breakdowns

Selected App – Avg. Session Duration & Analytics

Avg Session Duration Selected App Analytics

AI-Powered Chat

AI Chat Interface Quick Question - 1 Quick Question - 2 Quick Question - 3 Quick Question - 4

Natural language chatbot for querying your usage patterns

Settings

Settings


πŸ—οΈ Architecture

Core Components

  • Active Window Tracker: Background service that logs app usage to CSV
  • Dashboard & Analytics: Streamlit-based interactive UI for data visualization
  • RAG Chatbot: AI assistant that answers questions using your own usage data
  • ChromaDB: Local vector database for fast semantic search
  • Ollama + LLM: Local large language model for generating AI responses

Data Pipeline

graph TD
    A[Active Window Tracker] --> B[usage_log.csv]
    B --> C[Streamlit App]
    C --> D[Dashboard/Analytics]
    C --> E[RAG Chatbot]
    E --> F[ChromaDB Vector DB]
    E --> G[Ollama + LLM]
Loading

How It Works

  1. Data Collection - Background tracker monitors active windows and logs usage to CSV
  2. Data Processing - Raw data is cleaned and enriched with time-based features
  3. Embedding & Vectorization - Usage summaries are converted to vector embeddings
  4. AI-Powered Insights - RAG pipeline retrieves relevant data and generates natural language responses
  5. Interactive Visualization - Streamlit UI presents dashboards and chatbot interface

πŸ”§ Technical Stack

  • Python 3.11+ - Core programming language
  • Streamlit - Web UI framework for dashboards
  • LangChain - RAG pipeline orchestration
  • Ollama + LLaMA3 - Local large language model
  • ChromaDB - Vector database for embeddings
  • Sentence Transformers - Text embedding generation
  • pywin32 / win32gui - Windows API for activity tracking
  • Plotly - Interactive data visualizations
  • Pandas - Data processing and analysis

πŸ“ Project Structure

pc_activity_analyzer/
β”œβ”€β”€ app.py                      # Main Streamlit application
β”œβ”€β”€ active_windows_tracker.py   # Windows activity logging service
β”œβ”€β”€ analyze_usage.py            # Standalone data analysis script
β”œβ”€β”€ requirements.txt            # Python dependencies
β”œβ”€β”€ README.md                   # Project documentation
β”œβ”€β”€ styles.css                  # Custom Streamlit styles
β”œβ”€β”€ data/
β”‚   └── usage_log.csv           # Generated usage data
β”œβ”€β”€ chroma_db/
β”‚   └── chroma.sqlite3          # ChromaDB vector database
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ ai_chat.py              # AI chatbot UI component
β”‚   β”œβ”€β”€ analytics.py            # Analytics dashboard component
β”‚   β”œβ”€β”€ dashboard.py            # Main dashboard component
β”‚   └── settings.py             # Settings and configuration UI
β”œβ”€β”€ chatbot/
β”‚   β”œβ”€β”€ data_loader.py          # Data loading utilities
β”‚   β”œβ”€β”€ data_processing.py      # Data processing helpers
β”‚   β”œβ”€β”€ document_processor.py   # Document creation for RAG
β”‚   β”œβ”€β”€ embedding_store.py      # Embedding storage management
β”‚   β”œβ”€β”€ llm_handler.py          # Ollama LLM integration
β”‚   β”œβ”€β”€ quick_analysis.py       # Quick analytics processing
β”‚   β”œβ”€β”€ quick_questions.py      # Predefined question patterns
β”‚   β”œβ”€β”€ usage_data_rag.py       # RAG pipeline implementation
β”‚   └── vector_store_manager.py # ChromaDB management
β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ data_loader.py          # General data loading utilities
β”‚   β”œβ”€β”€ helpers.py              # Common helper functions
β”‚   └── instance.py             # Singleton pattern helpers
└── images/                     # Screenshots and documentation assets

πŸ› οΈ Installation

1. Clone the Repository

git clone <repo-url>
cd pc-activity-analyzer

2. Install Python Dependencies

pip install -r requirements.txt

3. Install and Setup Ollama

Download and install Ollama from ollama.com, then:

ollama serve
ollama pull llama3

4. Generate Initial Data

Run the activity tracker to start collecting usage data:

python active_windows_tracker.py

Let it run for a while to collect some initial data, then stop it with Ctrl+C.


⚑ Quick Start

1. Start Ollama Service

ollama serve

2. Launch the Application

streamlit run app.py

3. Access the Dashboard

Open your browser and navigate to http://localhost:8501

4. Explore Features

  • Dashboard - View your usage statistics and trends
  • Analytics - Dive deeper into your digital habits
  • AI Chat - Ask questions about your usage patterns
  • Settings - Configure filters and export options

βš™οΈ Configuration

Data Sources

  • Usage Log: data/usage_log.csv (auto-generated by tracker)
  • Vector Database: chroma_db/ (created automatically)

Customization Options

  • Ollama Model: Default is llama3 (configurable in code)
  • Tracking Interval: Adjustable in active_windows_tracker.py
  • Data Retention: Configure how long to keep historical data
  • UI Themes: Custom styles in styles.css

πŸš€ Performance Features

  • Efficient Caching - Embeddings and processed data are cached for fast access
  • Vector Search - ChromaDB provides millisecond semantic search
  • Streamlit Optimization - Smart caching reduces data processing overhead
  • Local Processing - No network latency from cloud API calls

πŸ”’ Privacy & Security

Complete Data Privacy

  • Local Storage Only - All data remains on your device
  • No Cloud Uploads - Zero external data transmission
  • Local AI Processing - LLM runs entirely on your hardware
  • Open Source - Full transparency of data handling

Data Control

  • Export Options - Full control over your data export
  • Deletion Controls - Easy data cleanup and removal
  • Access Logs - Track what data is being accessed

πŸ“„ License

This project is licensed under the MIT License – see the LICENSE file for details.


πŸ™ Acknowledgments

Inspired by the need for local, privacy-first digital habit analytics and AI-powered insights.

About

Local PC activity analyzer with RAG-powered AI chatbot. Track app usage, visualize digital habits, and get personalized insights.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published