Skip to content

feat: DuckDB 및 웹 기반 타임라인 그래프 기능 추가#1

Open
Ariyn wants to merge 1 commit intomasterfrom
feat/duckdb-timeline-graph
Open

feat: DuckDB 및 웹 기반 타임라인 그래프 기능 추가#1
Ariyn wants to merge 1 commit intomasterfrom
feat/duckdb-timeline-graph

Conversation

@Ariyn
Copy link
Copy Markdown
Owner

@Ariyn Ariyn commented Jun 3, 2025

  • 데이터베이스를 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를 사용하여 해당 랩의 주행 거리 타임라인 그래프를 표시합니다.

- 데이터베이스를 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를 사용하여 해당 랩의 주행 거리 타임라인 그래프를 표시합니다.
@Ariyn Ariyn requested a review from Copilot June 3, 2025 15:03
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.html with 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")
Copy link

Copilot AI Jun 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
toolchain go1.24.3

require (
github.com/joho/godotenv v1.5.1
Copy link

Copilot AI Jun 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The github.com/joho/godotenv dependency is added but doesn't appear to be used. Removing unused dependencies will reduce maintenance overhead.

Suggested change
github.com/joho/godotenv v1.5.1

Copilot uses AI. Check for mistakes.
Comment on lines +110 to +118
// 페이지 로드 시 기본 랩 데이터 조회 (예: 1번 랩)
// (async () => {
// const initialLapNumber = 1;
// lapNumberInput.value = initialLapNumber;
// const data = await fetchLapData(initialLapNumber);
// if (data) {
// plotData(data);
// }
// })();
Copy link

Copilot AI Jun 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Suggested change
// 페이지 로드 시 기본 랩 데이터 조회 (예: 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);
}
}

Copilot uses AI. Check for mistakes.
<button id="fetchButton">데이터 조회</button>
</div>
<div id="chartContainer">
<canvas id="lapChart"></canvas>
Copy link

Copilot AI Jun 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add an accessible name or aria-label (e.g., aria-label="랩 주행 거리 타임라인 그래프") or role="img" to the canvas so screen readers can describe the chart.

Suggested change
<canvas id="lapChart"></canvas>
<canvas id="lapChart" aria-label="랩 주행 거리 타임라인 그래프"></canvas>

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants