changed to db for fit streams
This commit is contained in:
@@ -14,4 +14,5 @@ from .health_state import HealthSyncState
|
||||
from .scheduled_job import ScheduledJob
|
||||
from .bike_setup import BikeSetup
|
||||
from .segment import Segment
|
||||
from .segment_effort import SegmentEffort
|
||||
from .segment_effort import SegmentEffort
|
||||
from .stream import ActivityStream
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -73,4 +73,7 @@ class Activity(Base):
|
||||
|
||||
bike_setup_id = Column(Integer, ForeignKey("bike_setups.id"), nullable=True)
|
||||
bike_match_confidence = Column(Float, nullable=True) # 0.0 to 1.0 score of match confidence
|
||||
bike_setup = relationship("BikeSetup")
|
||||
bike_setup = relationship("BikeSetup")
|
||||
|
||||
# Relationship to streams
|
||||
streams = relationship("ActivityStream", back_populates="activity", uselist=False)
|
||||
@@ -21,3 +21,7 @@ class Segment(Base):
|
||||
activity_type = Column(String, nullable=False) # 'cycling', 'running'
|
||||
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
|
||||
# PostGIS Geometry
|
||||
from geoalchemy2 import Geometry
|
||||
geom = Column(Geometry('LINESTRING', srid=4326), index=True)
|
||||
|
||||
30
FitnessSync/backend/src/models/stream.py
Normal file
30
FitnessSync/backend/src/models/stream.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from sqlalchemy import Column, Integer, ForeignKey, Float, Boolean, ARRAY
|
||||
from sqlalchemy.orm import relationship
|
||||
from geoalchemy2 import Geometry
|
||||
from .base import Base
|
||||
|
||||
class ActivityStream(Base):
|
||||
__tablename__ = "activity_streams"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
activity_id = Column(Integer, ForeignKey("activities.id"), nullable=False, index=True)
|
||||
|
||||
# Time Series Data (Arrays)
|
||||
time_offset = Column(ARRAY(Integer)) # seconds from start
|
||||
latitude = Column(ARRAY(Float))
|
||||
longitude = Column(ARRAY(Float))
|
||||
elevation = Column(ARRAY(Float))
|
||||
heart_rate = Column(ARRAY(Integer))
|
||||
power = Column(ARRAY(Integer))
|
||||
cadence = Column(ARRAY(Integer))
|
||||
speed = Column(ARRAY(Float))
|
||||
distance = Column(ARRAY(Float))
|
||||
temperature = Column(ARRAY(Float))
|
||||
moving = Column(ARRAY(Boolean))
|
||||
grade_smooth = Column(ARRAY(Float))
|
||||
|
||||
# Derived Spatial Data
|
||||
# SRID 4326 = WGS 84 (Lat/Lon)
|
||||
geom = Column(Geometry('LINESTRING', srid=4326), index=True)
|
||||
|
||||
activity = relationship("Activity", back_populates="streams")
|
||||
Reference in New Issue
Block a user