Skip to content

zujajahbatool/TypingFlow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

⌨️ TypingFlow AI

The Intelligent Behavioral Analytics & Real-Time Performance Benchmarking Suite


🧠 What is TypingFlow AI?

TypingFlow AI is a dual-platform analytical suite (Chrome Extension + VS Code Extension) that goes far beyond standard WPM trackers. It uses Big Data Analytics and Machine Learning to understand how you type not just how fast.

Most typing trackers treat every pause the same. TypingFlow AI doesn't. Its core AI engine distinguishes between a "productive thinking pause" (you're mentally composing your next sentence or debugging a function) and genuine idle time so your performance stats are always accurate and meaningful.


❗ Problem Statement

Standard typing trackers fail in two key ways:

  • Skewed averages β€” A hard-coded 3-second idle reset penalises deep thinkers and complex coders unfairly
  • No context awareness β€” Typing speed while coding Python is very different from typing in a WhatsApp chat, yet most tools treat them identically

TypingFlow AI solves both problems with ML and Big Data.


✨ Key Features

πŸ€– AI Thinking-Pause Engine

  • A Random Forest model trained on 200,000 labelled sessions predicts whether a pause is productive thinking or genuine idle time
  • Contextual awareness β€” longer pauses are allowed in VS Code coding sessions than in chat windows
  • Real-time prediction via REST API with confidence scores

πŸ“Š Global Benchmarking (Big Data)

  • Individual sessions benchmarked against a 1.1 million+ session data lake
  • Real-time percentile ranking: "Your Python coding speed is in the top 5% globally!"
  • K-Means Clustering assigns every user one of 5 Typing Archetypes

🎭 Typing Archetypes

Archetype Description
⚑ The Rapid Streamer High WPM, high consistency, born for flow
πŸ›οΈ The Deliberate Architect Slow, precise, virtually error-free
πŸ’₯ The Bursty Coder Explosive bursts followed by deep thinking pauses
πŸ‚ The Steady Workhorse Reliable, consistent, always getting the job done
πŸš€ The Sprinter Blazing fast with corrections to match

πŸ“ˆ Advanced Metrics

  • Consistency Score β€” standard deviation of keystroke intervals
  • Burst WPM β€” peak speed during flow state periods
  • Error Recovery Rate β€” backspace ratio vs WPM
  • Hourly Trends β€” when do you type fastest during the day?

πŸ—οΈ System Architecture

TypingFlow/
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ generate_dataset.py       # Generates 1.1M synthetic sessions
β”‚   └── typing_sessions.parquet   # Compressed dataset (~60MB)
β”œβ”€β”€ analytics/
β”‚   β”œβ”€β”€ duckdb_benchmarks.py      # DuckDB SQL analytics + K-Means
β”‚   └── benchmarks/               # 5 JSON benchmark files
β”‚       β”œβ”€β”€ global_benchmarks.json
β”‚       β”œβ”€β”€ hourly_trends.json
β”‚       β”œβ”€β”€ top_performer_thresholds.json
β”‚       β”œβ”€β”€ archetype_profiles.json
β”‚       └── user_archetypes.json
β”œβ”€β”€ models/
β”‚   β”œβ”€β”€ thinking_pause_model.py   # Random Forest trainer
β”‚   β”œβ”€β”€ thinking_pause_model.pkl  # Trained model
β”‚   β”œβ”€β”€ platform_encoder.pkl      # Label encoders
β”‚   └── model_metrics.json        # Accuracy + feature importance
β”œβ”€β”€ backend/
β”‚   └── main.py                   # FastAPI server (7 endpoints)
└── extensions/
    β”œβ”€β”€ chrome/                   # Chrome Extension
    β”‚   β”œβ”€β”€ manifest.json
    β”‚   β”œβ”€β”€ content.js            # Keystroke listener
    β”‚   β”œβ”€β”€ background.js
    β”‚   β”œβ”€β”€ popup.html            # Speedometer UI
    β”‚   β”œβ”€β”€ popup.js
    β”‚   β”œβ”€β”€ dashboard.html        # Full analytics dashboard
    β”‚   β”œβ”€β”€ dashboard.js
    β”‚   └── icons/
    └── vscode/                   # VS Code Extension
        └── typingflow-ai/
            β”œβ”€β”€ src/
            β”‚   └── extension.ts  # Main tracking logic
            └── package.json

πŸ› οΈ Tech Stack

Layer Technology Purpose
Data Generation Python, NumPy, Faker 1.1M synthetic sessions
Big Data Analytics DuckDB, Pandas Percentiles, trends, benchmarks
Machine Learning Scikit-learn (Random Forest, K-Means) Pause detection + archetypes
Backend API FastAPI, Uvicorn REST endpoints
Chrome Extension JavaScript, Chrome APIs Web typing tracker
VS Code Extension TypeScript, VS Code API Code editor tracker
Dashboard UI HTML, CSS, Chart.js Analytics visualisation
Storage Parquet, JSON Efficient data storage

πŸš€ Getting Started

Prerequisites

  • Python 3.10+
  • Node.js 18+
  • Google Chrome

1. Clone the Repository

git clone https://github.com/zujajahbatool/TypingFlow.git
cd TypingFlow

2. Install Python Dependencies

pip install pandas numpy scikit-learn faker duckdb fastapi uvicorn

3. Generate the Dataset

python data/generate_dataset.py

This generates 1.1M typing sessions (~60MB parquet file) in ~30 seconds.

4. Run Analytics + Clustering

python analytics/duckdb_benchmarks.py

Computes global benchmarks and K-Means archetypes. Saves 5 JSON files.

5. Train the AI Model

python models/thinking_pause_model.py

Trains the Random Forest model. Saves .pkl files.

6. Start the Backend

uvicorn backend.main:app --reload --port 8000

API available at http://127.0.0.1:8000 Interactive docs at http://127.0.0.1:8000/docs

7. Load the Chrome Extension

  1. Open Chrome β†’ chrome://extensions
  2. Enable Developer Mode
  3. Click Load unpacked β†’ select extensions/chrome/
  4. Click the TypingFlow AI icon in your toolbar

8. Run the VS Code Extension

cd extensions/vscode/typingflow-ai
npm install
npm run compile

Press F5 in VS Code to launch the Extension Development Host.


πŸ”Œ API Endpoints

Method Endpoint Description
GET /health Server health check
POST /predict/pause AI thinking-pause prediction
GET /benchmarks/global Global WPM benchmarks
POST /benchmarks/rank User percentile ranking
GET /benchmarks/hourly Hourly typing trends
GET /user/archetype/{id} User typing archetype
POST /session/save Save a typing session

🎨 UI Design β€” Midnight Cyber Theme

Token Color Usage
Background #0A0A0A App background
Cards #1C1C1E UI cards
Accent 1 #00F5FF WPM, active tracking
Accent 2 #BF40BF Flow state, archetypes
Gold #FFD700 Thinking pause indicator
Text #F5F5F5 Body text

πŸ“Š ML Model Performance

Metric Value
Model Random Forest (100 estimators)
Training samples 160,000
Test accuracy 100% (rule-based labels)
Top feature WPM (0.506 importance)
Classes thinking_pause, idle

πŸ”’ Privacy

No actual text is ever recorded. TypingFlow AI only tracks:

  • Keystroke timestamps
  • Character counts
  • Word boundary counts (spaces/enters)

Your actual words, sentences, and content are never captured, stored, or transmitted.


πŸ“ Key Files Reference

File What it does
data/generate_dataset.py Generates 1.1M synthetic typing sessions
analytics/duckdb_benchmarks.py SQL analytics + K-Means clustering
models/thinking_pause_model.py Trains AI pause detection model
backend/main.py FastAPI REST API server
extensions/chrome/content.js Live keystroke tracking on web pages
extensions/chrome/popup.js Speedometer popup logic
extensions/chrome/dashboard.js Full dashboard analytics
extensions/vscode/typingflow-ai/src/extension.ts VS Code tracking + stats panel

πŸ™ Acknowledgements

Built with:


πŸ“„ License

MIT License β€” feel free to use, modify, and distribute.


Made with ⌨️ and lots of thinking pauses

About

AI-powered typing analytics suite for developers & writers. Tracks WPM, detects productive thinking pauses via Machine Learning, and benchmarks your speed against 1M+ global sessions in real-time. Built with FastAPI, DuckDB, Random Forest & Chrome/VS Code Extensions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Contributors