digest_store
digest_store
¶
DigestStore — SQLite-backed storage for pre-computed digest artifacts.
Classes¶
DigestArtifact
dataclass
¶
DigestArtifact(
text: str,
audio_path: Path,
sections: Dict[str, str],
sources_used: List[str],
generated_at: datetime,
model_used: str,
voice_used: str,
quality_score: float = 0.0,
evaluator_feedback: str = "",
)
A pre-computed morning digest ready for delivery.
DigestStore
¶
SQLite store for digest artifacts.
Source code in src/diapason/agents/digest_store.py
Methods:¶
save
¶
save(artifact: DigestArtifact) -> None
Save a digest artifact.
Source code in src/diapason/agents/digest_store.py
get_latest
¶
get_latest() -> Optional[DigestArtifact]
Return the most recent digest, or None.
Source code in src/diapason/agents/digest_store.py
get_today
¶
get_today(
timezone_name: str = "",
) -> Optional[DigestArtifact]
Return today's digest if it exists, or None.
timezone_name must be the timezone the digest was generated in
— digest.timezone in the config. The stored generated_at
carries that zone, so its date prefix is the reader's calendar day,
and comparing it against today in the same zone is like for like.
This defaulted to "UTC" while generated_at was written with a
naive datetime.now(), i.e. machine-local. West of Greenwich the
two dates diverge every evening: at 21:00 in Toronto it is already
tomorrow in UTC, so the morning's digest stopped matching and the API
answered "No digest for today" about a digest sitting in the table.
The window was four hours a day, every day. East of Greenwich it
fails the other way round, in the early morning.
The fallback is the machine's own zone rather than UTC: rows written before this fix are naive local, and local is what they mean.
Source code in src/diapason/agents/digest_store.py
history
¶
history(limit: int = 10) -> List[DigestArtifact]
Return the N most recent digests.