Spaces:
Running
Running
| """Provenance tracking.""" | |
| from __future__ import annotations | |
| from dataclasses import dataclass | |
| from datetime import datetime | |
| 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, | |
| ) | |