inou/health-poller/poller/sources/base.py

23 lines
673 B
Python

from abc import ABC, abstractmethod
from dataclasses import dataclass
@dataclass
class Reading:
"""A single normalized vital reading."""
source_type: str # "renpho", "garmin", etc.
source_user_id: str # user identifier within source
metric: str # "weight", "body_fat", "bmi", etc.
value: float
unit: str # "kg", "%", "bpm", etc.
timestamp: int # unix seconds
class Source(ABC):
"""Base class for health data source adapters."""
@abstractmethod
async def fetch(self) -> list[Reading]:
"""Authenticate if needed, fetch measurements, return normalized readings."""
...