many updates

This commit is contained in:
2026-01-13 09:42:16 -08:00
parent 4bb86b603e
commit 362f4cb5aa
81 changed files with 3106 additions and 336 deletions

View File

@@ -1,4 +1,4 @@
from sqlalchemy import Column, Integer, String, DateTime, Text, LargeBinary, Float, ForeignKey
from sqlalchemy import Column, Integer, String, DateTime, Text, LargeBinary, Float, ForeignKey, Boolean, JSON
from sqlalchemy.orm import relationship
from sqlalchemy.sql import func
from ..models import Base
@@ -13,6 +13,7 @@ class Activity(Base):
start_time = Column(DateTime, nullable=True) # Start time of the activity
duration = Column(Integer, nullable=True) # Duration in seconds
duration = Column(Integer, nullable=True) # Duration in seconds
last_segment_scan_timestamp = Column(DateTime, nullable=True)
# Location (added for optimization)
start_lat = Column(Float, nullable=True)
@@ -37,7 +38,32 @@ class Activity(Base):
norm_power = Column(Integer, nullable=True) # watts
tss = Column(Float, nullable=True) # Training Stress Score
vo2_max = Column(Float, nullable=True) # ml/kg/min
avg_temperature = Column(Float, nullable=True) # degrees Celsius
# Cycling Dynamics & Power
total_work = Column(Float, nullable=True) # Joules
intensity_factor = Column(Float, nullable=True) # IF
threshold_power = Column(Integer, nullable=True) # FTP
is_estimated_power = Column(Boolean, default=False)
avg_right_pedal_smoothness = Column(Float, nullable=True) # %
avg_left_torque_effectiveness = Column(Float, nullable=True) # %
avg_right_torque_effectiveness = Column(Float, nullable=True) # %
# MTB Metrics
grit = Column(Float, nullable=True)
flow = Column(Float, nullable=True)
# Health Metrics
avg_respiration_rate = Column(Float, nullable=True)
max_respiration_rate = Column(Float, nullable=True)
avg_stress = Column(Float, nullable=True)
avg_spo2 = Column(Float, nullable=True)
# Swimming / Other
total_strokes = Column(Integer, nullable=True)
avg_stroke_distance = Column(Float, nullable=True)
streams_json = Column(JSON, nullable=True) # Cached downsampled streams
file_content = Column(LargeBinary, nullable=True) # Activity file content stored in database (base64 encoded)
file_type = Column(String, nullable=True) # File type (.fit, .gpx, .tcx, etc.)
download_status = Column(String, default='pending') # 'pending', 'downloaded', 'failed'

View File

@@ -15,7 +15,11 @@ class SegmentEffort(Base):
end_time = Column(DateTime, nullable=False)
avg_power = Column(Integer, nullable=True)
max_power = Column(Integer, nullable=True)
avg_hr = Column(Integer, nullable=True)
avg_speed = Column(Float, nullable=True) # m/s
avg_cadence = Column(Integer, nullable=True) # rpm
avg_respiration_rate = Column(Float, nullable=True) # breaths/min
# Potential for ranking (1 = KOM/PR, etc.) - calculated dynamically or stored
kom_rank = Column(Integer, nullable=True)