First Version EAV Importer. feat: Enhance activity detail retrieval with EAV metrics and refactor activity import logic
Deploy Development / deploy (push) Successful in 53s
Build Test / pytest-backend (push) Successful in 4s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 16s

- Updated the `get_activity_detail` function to include session metrics in the activity detail output, allowing for enriched data representation.
- Refactored the activity import logic to streamline the process of inserting and updating activity records, utilizing new helper functions for better maintainability.
- Improved the handling of duplicate activity entries by implementing a more robust identification mechanism.
- Enhanced the metadata for activity detail registration to reflect the inclusion of EAV metrics and updated source tables.
This commit is contained in:
Lars committed 2026-04-15 07:25:39 +02:00
1 parent c6e8371d5a
commit 934b915357
8 files changed
+550 -361

No files matched your search

+11 -4
View File
@@ -419,14 +419,21 @@ def get_activity_detail(profile_id: str, days: int = 14) -> str:
# Format as readable list (max 20 entries to avoid token bloat)
lines = []
for activity in data['activities'][:20]:
hr_str = f" HF={activity['hr_avg']}" if activity['hr_avg'] else ""
for activity in data["activities"][:20]:
hr_str = f", HF={activity['hr_avg']}" if activity.get("hr_avg") else ""
eav_parts = []
for m in activity.get("session_metrics") or []:
k, v = m.get("key"), m.get("value")
if k is None or v is None:
continue
eav_parts.append(f"{k}={v}")
eav_str = f" | EAV: {'; '.join(eav_parts)}" if eav_parts else ""
lines.append(
f"{activity['date']}: {activity['activity_type']} "
f"({activity['duration_min']}min, {activity['kcal_active']}kcal{hr_str})"
f"({activity['duration_min']}min, {activity['kcal_active']}kcal{hr_str}{eav_str})"
)
return '\n'.join(lines)
return "\n".join(lines)
def get_trainingstyp_verteilung(profile_id: str, days: int = 14) -> str: