Checking access level...

📊 TX Trainer Analytics Documentation

Complete guide to the comprehensive analytics system that tracks your Morse code training progress across all training modes with word-level precision and character-level insights.

Word Analytics Character Tracking Session Statistics Live APIs

📋 Quick Navigation

🎯 System Overview

The TX Trainer Analytics system provides unprecedented insight into Morse code learning progress through comprehensive multi-level data collection and analysis. Every training session automatically captures detailed performance metrics across word accuracy, character-level errors, and session statistics.

🔧 Core Problem Solved

Before: Character error counts were inflated (25 errors reported when user made only 5 actual character mistakes)
After: Accurate character-by-character comparison with proper error calculation plus comprehensive word-level analytics

📝 Word Analytics

Track words trained, correct, and incorrect per training mode

🔤 Character Tracking

Individual character errors with substitution/missing/extra analysis

📊 Session Statistics

Speed (WPM), accuracy, duration, and progress tracking

📊 Three Levels of Analytics

1. Session Level Analytics

Database Table: stats (legacy compatibility)

Captures:

  • • Basic session: correct/total words, accuracy, mode, date
  • • Compatible with existing statistics system
  • • Used for general progress tracking

2. Word Level Analytics ✨ NEW

Database Table: tx_word_sessions

Captures:

  • Words trained: Total words attempted in session
  • Words correct: Words eventually successful (after 1+ attempts)
  • Words incorrect: Words failed after maximum attempts
  • Per-mode tracking: Separate analytics for realWords, callsigns, abbreviations, etc.
  • • Speed (WPM), effective WPM, session duration
  • • Character error counts and accuracy percentages

3. Character Level Analytics

Database Table: tx_character_errors

Captures:

  • Individual character errors: Expected vs received characters
  • Error types: Substitution (Q→O), Missing, Extra characters
  • Problem identification: Which characters cause most trouble
  • Context tracking: Word being practiced when error occurred
  • • Session metadata: accuracy, duration, mode, date

🎯 Training Modes Tracked

Supported Training Modes

realWords - Common English words
callsigns - Amateur radio callsigns
abbreviations - Common CW abbreviations
qrCodes - Q-codes for amateur radio
topWords - Most common words in CW
mixed - Mixed content training

Per-Mode Analytics Available

  • Total sessions per mode
  • Words trained/correct/incorrect counts
  • Average accuracy by mode
  • Speed (WPM) progression
  • Best performance records
  • Character error patterns by mode
  • Practice time per mode
  • Progress trends over time

🗄️ Database Schema

tx_word_sessions Table

CREATE TABLE tx_word_sessions (
    id INT AUTO_INCREMENT PRIMARY KEY,
    username VARCHAR(255) NOT NULL,           -- User identification
    training_mode VARCHAR(50) NOT NULL,       -- realWords, callsigns, etc.
    words_trained INT NOT NULL DEFAULT 0,     -- Total words attempted
    words_correct INT NOT NULL DEFAULT 0,     -- Words eventually correct
    words_incorrect INT NOT NULL DEFAULT 0,   -- Words failed after 3 attempts
    accuracy_percentage DECIMAL(5,2) NOT NULL DEFAULT 0.00,
    session_duration DECIMAL(8,2) NOT NULL DEFAULT 0.00,
    character_errors INT DEFAULT 0,           -- Character-level errors
    total_characters INT DEFAULT 0,           -- Total characters sent
    speed_wpm DECIMAL(6,2) DEFAULT 0.00,      -- Words per minute
    effective_wpm DECIMAL(6,2) DEFAULT 0.00,  -- Effective WPM
    session_date DATETIME DEFAULT CURRENT_TIMESTAMP,
    
    -- Performance indexes
    INDEX idx_username (username),
    INDEX idx_training_mode (training_mode),
    INDEX idx_session_date (session_date),
    INDEX idx_username_mode (username, training_mode)
)

tx_character_errors Table

CREATE TABLE tx_character_errors (
    id INT AUTO_INCREMENT PRIMARY KEY,
    username VARCHAR(255) NOT NULL,
    mode VARCHAR(50) NOT NULL,
    expected_char VARCHAR(10) NOT NULL,       -- Character that should have been sent
    received_char VARCHAR(10) NOT NULL,       -- Character that was actually sent
    error_type ENUM('substitution', 'missing', 'extra') NOT NULL,
    word_context VARCHAR(50) DEFAULT NULL,    -- Word being practiced
    session_accuracy DECIMAL(5,2) DEFAULT 0.00,
    session_total_words INT DEFAULT 0,
    session_correct_words INT DEFAULT 0,
    session_duration DECIMAL(8,2) DEFAULT 0.00,
    date_created DATETIME DEFAULT CURRENT_TIMESTAMP,
    
    -- Analytics indexes
    INDEX idx_username (username),
    INDEX idx_expected_char (expected_char),
    INDEX idx_error_type (error_type),
    INDEX idx_date_created (date_created)
)

🔗 API Endpoints

Word Session Analytics API

Save Session Data (POST)

/api/tx-word-analytics.php

Automatically called after each training session

Request Example:

{
    "mode": "callsigns",
    "words_trained": 25,        // Total words attempted
    "words_correct": 22,        // Words eventually successful  
    "words_incorrect": 3,       // Words failed after 3 attempts
    "session_duration": 180.5,  // Session length in seconds
    "character_errors": 8,      // Character-level errors
    "total_characters": 125,    // Total characters sent
    "speed_wpm": 11.2,         // Speed calculation
    "effective_wpm": 10.1      // Effective speed
}

Retrieve Analytics (GET)

/api/tx-word-analytics.php

Query Parameters:

  • mode: realWords, callsigns, all (default: all)
  • timeframe: 7d, 30d, 90d, all (default: 30d)
  • group_by: day, week, month (default: day)

Example Queries:

# Overall last 30 days
GET /api/tx-word-analytics.php?timeframe=30d

# Callsign training last week
GET /api/tx-word-analytics.php?mode=callsigns&timeframe=7d

# All-time real words
GET /api/tx-word-analytics.php?mode=realWords&timeframe=all

Character Error Analytics API

Save Character Errors (POST)

/api/tx-character-errors.php

Request Example:

{
    "mode": "realWords",
    "character_errors": [
        {
            "expected": "I",
            "received": "H", 
            "type": "substitution",
            "word": "INSIDE"
        },
        {
            "expected": "O",
            "received": "",
            "type": "missing", 
            "word": "HELLO"
        }
    ],
    "total_words": 20,
    "correct_words": 18,
    "session_duration": 120.5,
    "accuracy_percentage": 90.0
}

Retrieve Character Analytics (GET)

/api/tx-character-analytics.php

Response Includes:

{
    "most_problematic_characters": [
        {
            "expected_char": "Q",
            "error_count": 15,
            "common_mistakes": "O, G, Y"
        }
    ],
    "error_types_breakdown": [
        {"error_type": "substitution", "count": 45, "percentage": 67.2}
    ],
    "mode_analysis": [...],
    "recent_trends": [...]
}

📊 Analytics Dashboard

Live Dashboard Interface

🚀 Launch Dashboard

Professional analytics interface: tx-trainer-analytics.html

Dashboard Features

  • Mode Filtering: View specific training types or all
  • Time Range Selection: 7d/30d/90d/all time
  • Real-time Updates: Fresh data from database
  • Professional Styling: Color-coded mode badges
  • Performance Metrics: Speed, accuracy, trends
  • Session Details: Recent and best sessions

Analytics Sections

  • Overall Statistics: Total sessions, words, accuracy
  • Mode Performance: Breakdown by training type
  • Recent Sessions: Latest training activity
  • Best Sessions: Top performing sessions
  • Progress Charts: Visual trends (coming soon)

🤖 Automatic Data Collection

Zero User Intervention Required

The analytics system operates completely automatically. Every time a user completes a TX Trainer session, all three levels of analytics data are saved to the database without any user action required.

Session End Flow:

async function endSession() {
    // ... session completion logic ...
    
    // Save comprehensive analytics (AUTOMATIC)
    await saveWordSessionAnalytics(sessionData);  // ✅ NEW: Word analytics
    await saveCharacterErrors(sessionData);       // ✅ Character analytics  
    await saveSessionStats(sessionData);          // ✅ Legacy compatibility
    
    console.log('📊 All analytics data saved automatically');
}

✅ What Gets Saved Automatically

  • • Word counts (trained/correct/incorrect)
  • • Training mode identification
  • • Session duration and timing
  • • Speed calculations (WPM/effective WPM)
  • • Character-level error details
  • • Accuracy percentages
  • • User identification and timestamps

🔄 When Data Becomes Available

  • Immediately: After first completed session
  • Analytics Dashboard: Real-time updates
  • API Access: Instant data retrieval
  • Historical Data: All sessions preserved
  • Progress Tracking: Trends visible immediately
  • Cross-Session: Comprehensive comparisons

💡 Use Cases & Examples

👤 Individual Users

🎯 Focus Training

"My callsign accuracy is only 87% while real words is 92% - I need more callsign practice."

GET /api/tx-word-analytics.php?mode=callsigns&timeframe=30d

📈 Track Improvement

"My speed improved from 9.2 WPM to 11.5 WPM over the last month!"

GET /api/tx-word-analytics.php?timeframe=30d&group_by=week

🔤 Character Problems

"I keep confusing Q with O - focus practice needed on these characters."

GET /api/tx-character-analytics.php?timeframe=7d

👨‍🏫 Instructors & Admins

📊 Student Analysis

"Students are struggling with abbreviations mode - adjust curriculum."

Aggregate analytics across multiple users

🎯 Targeted Assignments

"Assign more callsign practice to students with <85% accuracy."

Data-driven training recommendations

📈 Class Progress

"Track overall class improvement and identify students needing help."

Comparative performance analysis

⚙️ Technical Implementation

🔒 Security & Privacy

  • Users can only access their own analytics data
  • Session-based authentication required
  • No cross-user data exposure in API responses
  • All database operations logged for audit
  • Data retention policies configurable

🚀 Performance Features

  • Comprehensive database indexes for fast queries
  • Efficient aggregation queries for analytics
  • Minimal storage overhead per session
  • No impact on training session performance
  • Asynchronous database operations

🚀 Future Enhancements

🎯 Planned Features

  • 🔄 Character-Specific Practice: Generate sessions focused on problem characters
  • 📊 Progress Visualization: Charts showing improvement over time
  • 👥 Comparative Analytics: Anonymous comparison with other users
  • 🤖 Smart Recommendations: AI-driven practice suggestions
  • 🏆 Achievement System: Badges for milestones and consistency

📈 Advanced Analytics

  • 🧮 Learning Curve Analysis: Mathematical modeling of improvement
  • Optimal Practice Patterns: Data-driven practice schedules
  • 🎚️ Difficulty Progression: Automatic advancement recommendations
  • 🔮 Performance Prediction: Expected improvement timelines
  • 📤 Data Export Options: CSV/JSON for external analysis

🚀 Getting Started

🎯 Ready to Use - No Setup Required!

1️⃣

Complete Training

Run any TX Trainer session to automatically save analytics data

2️⃣

View Analytics

Visit the analytics dashboard to see your progress insights

3️⃣

Use API

Integrate analytics data with external tools via API endpoints

📞 Support & Documentation

📚 Additional Resources

🔧 Technical Files

  • 🗄️ api/tx-word-analytics.php - Word analytics API
  • 🔤 api/tx-character-analytics.php - Character analytics API
  • 💾 api/tx-character-errors.php - Character error saving
  • 🎯 tx-trainer.html - Training interface with analytics