mirror of
https://github.com/Horizontal42/f1-telemetry.git
synced 2026-11-11 01:52:08 +03:00
update docs: recursive rename with folder sorting
README: explain rename behavior with races_dir (recursion, auto-sort, move misplaced files, skip in-place files) ARCHITECTURE: update rename.py description and gotchas section to document races_dir parameter, os.walk, and file movement logic
This commit is contained in:
parent
351e9cdf69
commit
917a66c224
4 changed files with 22 additions and 6 deletions
|
|
@ -18,7 +18,7 @@ telemetry/
|
||||||
report_setup.py Car report (setup, balance, tyres, brakes, suspension, phases).
|
report_setup.py Car report (setup, balance, tyres, brakes, suspension, phases).
|
||||||
report_compare.py Two+ laps side by side, per-corner and cumulative delta.
|
report_compare.py Two+ laps side by side, per-corner and cumulative delta.
|
||||||
report_race.py A folder of laps: lap times (with position), stints, wear, thermals, ERS.
|
report_race.py A folder of laps: lap times (with position), stints, wear, thermals, ERS.
|
||||||
rename.py Insert session type + lap number (e.g. P1_L7) into filenames; skip processed.
|
rename.py Insert session type + lap number (P1_L7) into filenames; with races_dir, sort into races/<track>/<session>/ and recurse subdirectories.
|
||||||
gui.py tkinter window; per-mode browse memory; runs generation/rename on a worker thread.
|
gui.py tkinter window; per-mode browse memory; runs generation/rename on a worker thread.
|
||||||
prompts/ LLM analysis prompts, ru/ and en/ subdirectories, one file per mode. Auto-appended to every report.
|
prompts/ LLM analysis prompts, ru/ and en/ subdirectories, one file per mode. Auto-appended to every report.
|
||||||
tests/ pytest suite + fixture laps.
|
tests/ pytest suite + fixture laps.
|
||||||
|
|
@ -53,6 +53,6 @@ tests/ pytest suite + fixture laps.
|
||||||
|
|
||||||
**The setup row has a trailing comma** (an empty `FuelLoad` tail field in some exports). The parser drops trailing empties so the setup dict has no blank-string key.
|
**The setup row has a trailing comma** (an empty `FuelLoad` tail field in some exports). The parser drops trailing empties so the setup dict has no blank-string key.
|
||||||
|
|
||||||
**Rename idempotency hinges on TWO tokens.** A file is considered processed only when both a session token (`P1`, `Q2`, `R`, …, matched by `_SESSION_PAT`) and a lap token (`L<digits>`) are present in the stem. Both `session_token_present` and `lap_token_present` are the joint source of truth — changing either token format means updating both the insert and the presence-check functions together.
|
**Rename with `races_dir` sorts into folders and walks subdirectories.** `rename_unprocessed(targets, races_dir)` when `races_dir` is set: (1) recursively scans all subdirectories via `os.walk`, (2) reads metadata from each CSV (`read_metadata` → lap, event, track), (3) inserts tokens if absent, (4) creates `races/<track_safe>/Practice|Qualifying|Race|Sprint/` and moves the file there, (5) even already-renamed files are moved if they're in the wrong folder, (6) only skips files that are already in the right place with the right name. Without `races_dir` it works as before — renames in-place in the original folder.
|
||||||
|
|
||||||
**Reports go next to the input, not next to the program.** `report_path` derives the `reports/` directory from the *input CSV's* folder. `race` mode puts the report inside the race session folder (`<race_dir>/reports/`). Moving the tool does not move where reports land.
|
**Reports go next to the input, not next to the program.** `report_path` derives the `reports/` directory from the *input CSV's* folder. `race` mode puts the report inside the race session folder (`<race_dir>/reports/`). Moving the tool does not move where reports land.
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ telemetry/
|
||||||
report_setup.py Отчёт о машине (сетап, баланс, шины, тормоза, подвеска, фазы).
|
report_setup.py Отчёт о машине (сетап, баланс, шины, тормоза, подвеска, фазы).
|
||||||
report_compare.py Два+ круга рядом, дельта по поворотам и накопленная.
|
report_compare.py Два+ круга рядом, дельта по поворотам и накопленная.
|
||||||
report_race.py Папка кругов: лаптаймы (с позицией), стинты, износ, тепло, ERS.
|
report_race.py Папка кругов: лаптаймы (с позицией), стинты, износ, тепло, ERS.
|
||||||
rename.py Вставка типа сессии + номера круга (P1_L7); пропуск обработанных.
|
rename.py Вставка типа сессии + номера круга (P1_L7) в имя; с races_dir — сортировка в races/<track>/<session>/ и рекурсия по подпапкам.
|
||||||
gui.py Окно tkinter; память последней папки по режиму; генерация/переименование в потоке.
|
gui.py Окно tkinter; память последней папки по режиму; генерация/переименование в потоке.
|
||||||
prompts/ Промпты LLM, подпапки ru/ и en/, по одному файлу на режим. Добавляются в конец каждого отчёта.
|
prompts/ Промпты LLM, подпапки ru/ и en/, по одному файлу на режим. Добавляются в конец каждого отчёта.
|
||||||
tests/ Набор pytest + фикстуры-круги.
|
tests/ Набор pytest + фикстуры-круги.
|
||||||
|
|
@ -53,6 +53,6 @@ tests/ Набор pytest + фикстуры-круги.
|
||||||
|
|
||||||
**Строка сетапа заканчивается лишней запятой** (пустой хвост `FuelLoad` в части экспортов). Парсер отбрасывает пустые хвостовые поля, чтобы в словаре сетапа не было ключа с пустой строкой.
|
**Строка сетапа заканчивается лишней запятой** (пустой хвост `FuelLoad` в части экспортов). Парсер отбрасывает пустые хвостовые поля, чтобы в словаре сетапа не было ключа с пустой строкой.
|
||||||
|
|
||||||
**Идемпотентность rename держится на ДВУХ токенах.** Файл считается обработанным только при наличии обоих: токена типа сессии (`P1`, `Q2`, `R`, … — совпадение по `_SESSION_PAT`) и токена `L<цифры>`. `session_token_present` и `lap_token_present` — совместный источник истины. Смена формата любого токена требует обновить и функцию вставки, и функцию проверки одновременно.
|
**Rename с `races_dir` распределяет по папкам и рекурсит.** `rename_unprocessed(targets, races_dir)` когда `races_dir` установлен: (1) сканирует всё дерево подпапок (`os.walk`), (2) читает метаданные из CSV (`read_metadata` → lap, event, track), (3) вставляет токены если их нет, (4) создаёт `races/<track_safe>/Practice|Qualifying|Race|Sprint/` и перемещает туда файл, (5) даже уже переименованные файлы переносятся если лежат не там где надо, (6) пропускаются только файлы, которые уже находятся в нужной папке с нужным именем. Без `races_dir` работает как раньше — переименовывает в исходной папке.
|
||||||
|
|
||||||
**Отчёты выходят рядом с входом, а не рядом с программой.** `report_path` выводит папку `reports/` из папки *входного CSV*. Режим `race` кладёт отчёт внутрь папки сессии (`<race_dir>/reports/`). Перемещение инструмента не меняет, куда попадают отчёты.
|
**Отчёты выходят рядом с входом, а не рядом с программой.** `report_path` выводит папку `reports/` из папки *входного CSV*. Режим `race` кладёт отчёт внутрь папки сессии (`<race_dir>/reports/`). Перемещение инструмента не меняет, куда попадают отчёты.
|
||||||
|
|
|
||||||
10
README.md
10
README.md
|
|
@ -79,7 +79,15 @@ C:\...\Telemetry\reports\lap_technique.md
|
||||||
~33834 tokens (budget 60k)
|
~33834 tokens (budget 60k)
|
||||||
```
|
```
|
||||||
|
|
||||||
**Rename only touches unprocessed files.** A file is "processed" once its name contains both a session token (`P1`, `Q2`, `R`, …) and an `L<number>` token. Re-running rename on the same folder is safe.
|
**Rename inserts tokens AND sorts into folders.** Point it at a folder containing CSVs (e.g., `D:\Games\Telemetry\Data\lapdata\f1_2022`) — the script:
|
||||||
|
- Recursively scans all subdirectories
|
||||||
|
- Reads metadata from each CSV (track, session type)
|
||||||
|
- Inserts `P1_L7` into filenames that don't have both tokens yet
|
||||||
|
- Moves files to `races/<track>/Practice|Qualifying|Race/`
|
||||||
|
- Even already-renamed files are moved if they're not in the right folder
|
||||||
|
- Only skips files that are already in the correct location with the correct name
|
||||||
|
|
||||||
|
Re-running on the same folder is safe — in-place files are left alone.
|
||||||
|
|
||||||
## Input format
|
## Input format
|
||||||
|
|
||||||
|
|
|
||||||
10
README.ru.md
10
README.ru.md
|
|
@ -79,7 +79,15 @@ C:\...\Telemetry\reports\lap_technique.md
|
||||||
~33834 tokens (budget 60k)
|
~33834 tokens (budget 60k)
|
||||||
```
|
```
|
||||||
|
|
||||||
**Rename трогает только необработанные файлы.** Файл считается обработанным, когда в имени есть оба токена: тип сессии (`P1`, `Q2`, `R`, …) и `L<номер>`. Повторный запуск безопасен.
|
**Rename вставляет токены И распределяет по папкам.** Укажи папку, где лежат CSV (например, `D:\Games\Telemetry\Data\lapdata\f1_2022`) — скрипт:
|
||||||
|
- Рекурсивно сканирует все подпапки
|
||||||
|
- Читает метаданные каждого CSV (трасса, тип сессии)
|
||||||
|
- Вставляет `P1_L7` в имя файла, если там ещё нет обоих токенов
|
||||||
|
- Перемещает в `races/<трасса>/Practice|Qualifying|Race/`
|
||||||
|
- Даже уже переименованные файлы, если они лежат не там где надо, перемещаются в нужную папку
|
||||||
|
- Файл пропускается только если он УЖЕ находится именно в нужной папке
|
||||||
|
|
||||||
|
Повторный запуск безопасен — файлы уже на месте не трогаются.
|
||||||
|
|
||||||
## Входной формат
|
## Входной формат
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue