Conversation
- 데이터베이스를 SQLite에서 DuckDB로 변경 (`f1_telemetry.db` 사용). - 텔레메트리 데이터 로거 (`app/telemetry/main.go`)가 DuckDB를 사용하도록 수정. - 백엔드 웹서버 (`app/webserver/main.go`)가 Redis 대신 DuckDB에서 데이터를 조회하도록 수정. - `/api/lap/:lapNumber/timeline` API 엔드포인트 추가하여 특정 랩의 모션 데이터 (위치, 주행 거리)를 시간순으로 제공. - `frontend/index.html` 추가: 여러분이 랩 번호를 입력하면 Chart.js를 사용하여 해당 랩의 주행 거리 타임라인 그래프를 표시합니다.
There was a problem hiding this comment.
Pull Request Overview
A migration from SQLite/Redis to DuckDB for telemetry storage and the addition of a web-based lap timeline graph.
- Switch telemetry logger and server initialization to DuckDB, removing URL parameter.
- Bump Go version, add DuckDB driver and related dependencies.
- Introduce
frontend/index.htmlwith Chart.js to fetch and plot lap distance over time.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| logger/sql.go | Updated NewSqlClient to drop URL arg and hard-code DuckDB DB file |
| go.mod | Bumped Go to 1.24, added DuckDB and other dependencies |
| frontend/index.html | New UI: input lap number, fetch /timeline, render with Chart.js |
| app/telemetry/main.go | Simplified NewSqlClient call by removing DATABASE_URL arg |
| } | ||
|
|
||
| sc.client, err = sql.Open("postgres", sc.Url) | ||
| sc.client, err = sql.Open("duckdb", "f1_telemetry.db") |
There was a problem hiding this comment.
Hard-coding the database file path reduces flexibility. Consider accepting the path as a parameter or loading it from environment/configuration to make it configurable.
| toolchain go1.24.3 | ||
|
|
||
| require ( | ||
| github.com/joho/godotenv v1.5.1 |
There was a problem hiding this comment.
The github.com/joho/godotenv dependency is added but doesn't appear to be used. Removing unused dependencies will reduce maintenance overhead.
| github.com/joho/godotenv v1.5.1 |
| // 페이지 로드 시 기본 랩 데이터 조회 (예: 1번 랩) | ||
| // (async () => { | ||
| // const initialLapNumber = 1; | ||
| // lapNumberInput.value = initialLapNumber; | ||
| // const data = await fetchLapData(initialLapNumber); | ||
| // if (data) { | ||
| // plotData(data); | ||
| // } | ||
| // })(); |
There was a problem hiding this comment.
[nitpick] Remove the commented-out initial fetch block (lines 111–118) or refactor it into a named function to keep the code clean and maintainable.
| // 페이지 로드 시 기본 랩 데이터 조회 (예: 1번 랩) | |
| // (async () => { | |
| // const initialLapNumber = 1; | |
| // lapNumberInput.value = initialLapNumber; | |
| // const data = await fetchLapData(initialLapNumber); | |
| // if (data) { | |
| // plotData(data); | |
| // } | |
| // })(); | |
| // 페이지 로드 시 기본 랩 데이터 조회를 위한 함수 | |
| async function fetchAndPlotInitialLapData() { | |
| const initialLapNumber = 1; | |
| lapNumberInput.value = initialLapNumber; | |
| const data = await fetchLapData(initialLapNumber); | |
| if (data) { | |
| plotData(data); | |
| } | |
| } |
| <button id="fetchButton">데이터 조회</button> | ||
| </div> | ||
| <div id="chartContainer"> | ||
| <canvas id="lapChart"></canvas> |
There was a problem hiding this comment.
Add an accessible name or aria-label (e.g., aria-label="랩 주행 거리 타임라인 그래프") or role="img" to the canvas so screen readers can describe the chart.
| <canvas id="lapChart"></canvas> | |
| <canvas id="lapChart" aria-label="랩 주행 거리 타임라인 그래프"></canvas> |
f1_telemetry.db사용).app/telemetry/main.go)가 DuckDB를 사용하도록 수정.app/webserver/main.go)가 Redis 대신 DuckDB에서 데이터를 조회하도록 수정./api/lap/:lapNumber/timelineAPI 엔드포인트 추가하여 특정 랩의 모션 데이터 (위치, 주행 거리)를 시간순으로 제공.frontend/index.html추가: 여러분이 랩 번호를 입력하면 Chart.js를 사용하여 해당 랩의 주행 거리 타임라인 그래프를 표시합니다.