[PR #278] [MERGED] feat: add Race Control Feed insight window with synced FIA race messages #266

Closed
opened 2026-05-07 00:19:28 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/IAmTomShaw/f1-race-replay/pull/278
Author: @4f4d
Created: 4/17/2026
Status: Merged
Merged: 4/17/2026
Merged by: @IAmTomShaw

Base: mainHead: feature/race-control-feed


📝 Commits (2)

  • 27957a7 feat: add Race Control Feed insight window with synced FIA race messages
  • 87150f9 Merge branch 'main' into feature/race-control-feed

📊 Changes

6 files changed (+391 additions, -10 deletions)

View changed files

📝 main.py (+2 -1)
📝 src/f1_data.py (+46 -0)
📝 src/gui/insights_menu.py (+14 -0)
src/insights/race_control_feed_window.py (+294 -0)
📝 src/interfaces/race_replay.py (+31 -7)
📝 src/run_session.py (+4 -2)

📄 Description

Closes #277

Summary

Adds a new Race Control Feed insight window that displays FIA race control messages (flags, penalties, safety car, DRS, investigations) as a scrolling feed synced to the replay timeline.

Changes

Data Pipeline (src/f1_data.py)

  • Extract session.race_control_messages from FastF1
  • Normalize timestamps (handles both Timedelta and Timestamp formats)
  • Filter pre-race messages, clean NaN values in sector/racing_number fields
  • Include in pickle cache for instant subsequent loads

Broadcast System (src/interfaces/race_replay.py)

  • Broadcast all events up to current frame time so newly opened windows receive full history
  • Add has_rc_data flag for deterministic empty-state handling
  • Sync leader lap calculation with main window (uses _ref_total_length with defensive int() casting)

UI (src/insights/race_control_feed_window.py) [NEW]

  • Dark-themed feed matching app aesthetic (#282828, Arial/Consolas)
  • Color-coded accent bars by event type (flags, SC, DRS, penalties)
  • HTML-based rendering via QTextBrowser for reliable text wrapping
  • Auto-scrolling, content deduplication, rewind/restart detection
  • Styled scrollbar matching the dark theme
  • Graceful empty states: "Waiting..." vs cache regeneration instructions

Integration

  • main.py / run_session.py: Pass RC messages through the replay pipeline
  • insights_menu.py: New "Race Events" category in the Insights Menu

Design Decisions

  • Zero new dependencies — uses existing FastF1 data
  • Backwards compatible.get('race_control_messages', []) handles old cache files gracefully
  • Data available 2018+ — all sessions from 2018 onwards have FIA race control messages

Testing

  • Syntax verified across all 6 files
  • Verified with 2026 Australian & Chinese GP (Rounds 1 & 2) — messages render correctly, timestamps sync with replay, rewind/restart flushes and rebuilds feed
  • All modified files pass py_compile

Screenshots

Added "Race Events" Section in Insights Menu

Screenshot 2026-04-17 at 10 21 13

Race Control Feed Window

Screenshot 2026-04-17 at 10 25 30

How it looks visually for a Race

https://github.com/user-attachments/assets/91131bc5-c244-4a44-8599-7fa2c424de6b


🔄 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/278 **Author:** [@4f4d](https://github.com/4f4d) **Created:** 4/17/2026 **Status:** ✅ Merged **Merged:** 4/17/2026 **Merged by:** [@IAmTomShaw](https://github.com/IAmTomShaw) **Base:** `main` ← **Head:** `feature/race-control-feed` --- ### 📝 Commits (2) - [`27957a7`](https://github.com/IAmTomShaw/f1-race-replay/commit/27957a7bf3cee6c204a7fadcba2da7ee7768afcd) feat: add Race Control Feed insight window with synced FIA race messages - [`87150f9`](https://github.com/IAmTomShaw/f1-race-replay/commit/87150f96429f033d3809fa8466c5e62088d31230) Merge branch 'main' into feature/race-control-feed ### 📊 Changes **6 files changed** (+391 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `main.py` (+2 -1) 📝 `src/f1_data.py` (+46 -0) 📝 `src/gui/insights_menu.py` (+14 -0) ➕ `src/insights/race_control_feed_window.py` (+294 -0) 📝 `src/interfaces/race_replay.py` (+31 -7) 📝 `src/run_session.py` (+4 -2) </details> ### 📄 Description Closes #277 ## Summary Adds a new **Race Control Feed** insight window that displays FIA race control messages (flags, penalties, safety car, DRS, investigations) as a scrolling feed synced to the replay timeline. ## Changes ### Data Pipeline (`src/f1_data.py`) - Extract `session.race_control_messages` from FastF1 - Normalize timestamps (handles both Timedelta and Timestamp formats) - Filter pre-race messages, clean NaN values in sector/racing_number fields - Include in pickle cache for instant subsequent loads ### Broadcast System (`src/interfaces/race_replay.py`) - Broadcast all events up to current frame time so newly opened windows receive full history - Add `has_rc_data` flag for deterministic empty-state handling - Sync leader lap calculation with main window (uses `_ref_total_length` with defensive int() casting) ### UI (`src/insights/race_control_feed_window.py`) [NEW] - Dark-themed feed matching app aesthetic (#282828, Arial/Consolas) - Color-coded accent bars by event type (flags, SC, DRS, penalties) - HTML-based rendering via QTextBrowser for reliable text wrapping - Auto-scrolling, content deduplication, rewind/restart detection - Styled scrollbar matching the dark theme - Graceful empty states: "Waiting..." vs cache regeneration instructions ### Integration - `main.py` / `run_session.py`: Pass RC messages through the replay pipeline - `insights_menu.py`: New "Race Events" category in the Insights Menu ## Design Decisions - **Zero new dependencies** — uses existing FastF1 data - **Backwards compatible** — `.get('race_control_messages', [])` handles old cache files gracefully - **Data available 2018+** — all sessions from 2018 onwards have FIA race control messages ## Testing - Syntax verified across all 6 files - Verified with 2026 Australian & Chinese GP (Rounds 1 & 2) — messages render correctly, timestamps sync with replay, rewind/restart flushes and rebuilds feed - All modified files pass `py_compile` ## Screenshots #### Added "Race Events" Section in Insights Menu <img width="301" height="627" alt="Screenshot 2026-04-17 at 10 21 13" src="https://github.com/user-attachments/assets/2bbe6d83-44d4-4c14-96be-90ec285da61e" /> #### Race Control Feed Window <img width="1468" height="918" alt="Screenshot 2026-04-17 at 10 25 30" src="https://github.com/user-attachments/assets/9f9c7e2b-391f-4888-b775-0c0764de8df2" /> #### How it looks visually for a Race https://github.com/user-attachments/assets/91131bc5-c244-4a44-8599-7fa2c424de6b --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-07 00:19:28 +02:00
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#266
No description provided.