mirror of
https://github.com/sstent/FitTrack_ReportGenerator.git
synced 2026-01-25 16:41:55 +00:00
3.1 KiB
3.1 KiB
Tasks: Use CentralDB for Activities
Feature Branch: 002-feature-use-centraldb
Date: 2025-10-11
Spec: /home/sstent/Projects/FitTrack_ReportGenerator/specs/002-feature-use-centraldb/spec.md
Summary
This document outlines the tasks required to implement the "Use CentralDB for Activities" feature.
Phase 1: Setup
- T001: Add
httpxto the project dependencies inpyproject.toml. - T002: Add configuration for the CentralDB API base URL to the application settings.
Phase 2: Foundational Components
- T003: Implement a
CentralDBClientclass insrc/clients/centraldb_client.pyto interact with the CentralDB API. This client should usehttpxfor making asynchronous requests. - T004: Implement methods in
CentralDBClientfor:- Downloading a FIT file (
GET /activities/{activity_id}/file). - Getting an analysis artifact (
GET /activities/{activity_id}/analysis). - Creating an analysis artifact (
POST /activities/{activity_id}/analysis). - Uploading a chart (
POST /activities/{activity_id}/analysis/charts). - Retrieving a chart (
GET /activities/{activity_id}/analysis/charts/{chart_type}).
- Downloading a FIT file (
- T005: Implement an in-memory cache in
src/core/cache.pyto store the last 5 analysis results.
Phase 3: User Story 1 - Retrieve analysis from CentralDB
Goal: Enable users to retrieve analysis charts and summaries for activities stored in CentralDB.
Independent Test Criteria: A user can request a chart or a summary for an activity ID that exists in CentralDB and receive the correct analysis without having to upload the file.
- T006 [US1]: Update the
GET /api/analysis/{analysis_id}/summaryendpoint inapi/routers/analysis.py. - T007 [US1]: In the summary endpoint, implement the logic to:
- Check the local cache for the analysis.
- If not in cache, check CentralDB for the analysis artifact.
- If not in CentralDB, download the FIT file, perform the analysis, and store the results in CentralDB and the local cache.
- T008 [US1]: Update the
GET /api/analysis/{analysis_id}/chartsendpoint inapi/routers/analysis.py. - T009 [US1]: In the charts endpoint, implement the logic to:
- Check the local cache for the chart.
- If not in cache, check CentralDB for the chart.
- If not in CentralDB, download the FIT file, perform the analysis, generate the chart, and store it in CentralDB and the local cache.
- T010 [US1]: Write integration tests for the updated endpoints to verify the interaction with the CentralDB API. (tests/integration/test_centraldb_integration.py)
Phase 4: Polish & Cross-Cutting Concerns
- T011: Review and refine error handling for the new CentralDB integration.
- T012: Add logging for all interactions with the CentralDB API.
Dependencies
- Phase 1 must be completed before Phase 2.
- Phase 2 must be completed before Phase 3.
- Phase 3 must be completed before Phase 4.
Parallel Execution Examples
User Story 1 (P1)
- T006 and T008 can be worked on in parallel.
- T007 and T009 can be worked on in parallel after T006 and T008 are complete.