Spaces:
Running
Running
File size: 746 Bytes
877add7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | """Provenance tracking."""
from __future__ import annotations
from dataclasses import dataclass
from datetime import datetime
@dataclass(slots=True)
class ProvenanceRecord:
source: str
source_type: str
fetched_at: str
transform: str
def to_dict(self) -> dict[str, str]:
return {
"source": self.source,
"source_type": self.source_type,
"fetched_at": self.fetched_at,
"transform": self.transform,
}
def make_provenance(source: str, source_type: str, transform: str) -> ProvenanceRecord:
return ProvenanceRecord(
source=source,
source_type=source_type,
fetched_at=datetime.utcnow().isoformat(),
transform=transform,
)
|