from typing import Optional, Any from dataclasses import dataclass, field # A nomie habit tracker. Tracks anything whose value can be encapsulated in a numerical value. @dataclass class Tracker: color: str emoji: str hidden: bool id: str ignore_zeros: bool label: str math: str one_tap: bool tag: str type: str uom: str # TODO no idea what include does include: str min: Optional[int] = 0 max: Optional[int] = 0 goal: Optional[int] = 0 default: Optional[int] = 0 # TODO score can be string (if custom) or int (if simple good/bad) score: Optional[str] = "" score_calc: Optional[list[dict[str, Any]]] = field(default_factory=lambda: []) # A nomie note. Records any circumstance of 'something happened' through prose. # These are undigested events, whose changed trackers are still encapsulated # in the 'note' field as continuous text. @dataclass class Event: id: str text: str start: int end: int score: int lat: float lng: float modified: Optional[bool] = False source: Optional[str] = "n5" offset: Optional[str] = "" location: Optional[str] = "" @dataclass class Activity: tracker: Tracker value: Optional[int] = 1 @dataclass class NomieImport: version: str trackers: list[Tracker] events: list[Event] activities: list[Activity]