[PR #217] Add Race Incidents & Overtakes Tracker #226

Open
opened 2026-05-07 00:19:18 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/IAmTomShaw/f1-race-replay/pull/217
Author: @Anipaleja
Created: 2/4/2026
Status: 🔄 Open

Base: mainHead: main


📝 Commits (4)

  • b349d15 Added Incident Detection Module
  • 55b06e6 Added Incident Detection Feature
  • 73f3d39 Added Incident Detection Modules
  • 35a30fd Merge branch 'main' into main

📊 Changes

5 files changed (+766 additions, -1 deletions)

View changed files

src/incident_detection.py (+260 -0)
📝 src/interfaces/race_replay.py (+42 -1)
src/ui_components_incidents.py (+209 -0)
tests/__init__.py (+1 -0)
tests/test_incidents.py (+254 -0)

📄 Description

Description

This PR adds a real-time incident detection system that automatically identifies key moments during F1 races—overtakes, near-misses, and pit stops. Users can now navigate through these moments instantly with keyboard shortcuts, making it easier to review critical race events without scrubbing through the entire replay.

Key Features:

  • Automatic detection of overtakes by analyzing driver position changes
  • Identifies dangerous moments when drivers are in close proximity at speed
  • Detects pit stop moments via speed analysis
  • Interactive on-screen panel showing all detected incidents with color-coded types
  • Keyboard navigation: Press N/P to jump between incidents, C to toggle the panel, F to filter by incident type
  • Incidents panel auto-scrolls to keep selected incident visible
  • Proper window resize handling for the incidents panel

How it works:
The system analyzes telemetry data once at startup to build an incidents list. Each incident stores the frame number, lap, involved drivers, and type. When users navigate with N or P, the replay automatically jumps to that moment and pauses, allowing them to watch the action unfold.

Technical improvements:

  • Fixed rank comparisons in overtake detection to properly identify position changes
  • Implemented scroll offset system for large incident lists
  • Added robust exception handling with fallback empty state
  • All 13 unit tests passing

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/IAmTomShaw/f1-race-replay/pull/217 **Author:** [@Anipaleja](https://github.com/Anipaleja) **Created:** 2/4/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (4) - [`b349d15`](https://github.com/IAmTomShaw/f1-race-replay/commit/b349d15fdb5a577de68ee59b7ab5314853ba20e5) Added Incident Detection Module - [`55b06e6`](https://github.com/IAmTomShaw/f1-race-replay/commit/55b06e6b384ae36be12ab59694db3f347d165584) Added Incident Detection Feature - [`73f3d39`](https://github.com/IAmTomShaw/f1-race-replay/commit/73f3d3967398a42437f4dc4d9e5cf1922a46be80) Added Incident Detection Modules - [`35a30fd`](https://github.com/IAmTomShaw/f1-race-replay/commit/35a30fdf8f81143fa93fb903132f9a018351a5b1) Merge branch 'main' into main ### 📊 Changes **5 files changed** (+766 additions, -1 deletions) <details> <summary>View changed files</summary> ➕ `src/incident_detection.py` (+260 -0) 📝 `src/interfaces/race_replay.py` (+42 -1) ➕ `src/ui_components_incidents.py` (+209 -0) ➕ `tests/__init__.py` (+1 -0) ➕ `tests/test_incidents.py` (+254 -0) </details> ### 📄 Description ## Description This PR adds a real-time incident detection system that automatically identifies key moments during F1 races—overtakes, near-misses, and pit stops. Users can now navigate through these moments instantly with keyboard shortcuts, making it easier to review critical race events without scrubbing through the entire replay. **Key Features:** - Automatic detection of overtakes by analyzing driver position changes - Identifies dangerous moments when drivers are in close proximity at speed - Detects pit stop moments via speed analysis - Interactive on-screen panel showing all detected incidents with color-coded types - Keyboard navigation: Press `N`/`P` to jump between incidents, `C` to toggle the panel, `F` to filter by incident type - Incidents panel auto-scrolls to keep selected incident visible - Proper window resize handling for the incidents panel **How it works:** The system analyzes telemetry data once at startup to build an incidents list. Each incident stores the frame number, lap, involved drivers, and type. When users navigate with `N` or `P`, the replay automatically jumps to that moment and pauses, allowing them to watch the action unfold. **Technical improvements:** - Fixed rank comparisons in overtake detection to properly identify position changes - Implemented scroll offset system for large incident lists - Added robust exception handling with fallback empty state - All 13 unit tests passing --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/f1-race-replay#226
No description provided.