openbench-privacy-preservin.../openbench_privacy_preservin.../adapters/pos.py

45 lines
1.3 KiB
Python

from __future__ import annotations
from typing import List
from .base import Adapter
from openbench_privacy_preserving_benchmarkin.core import KPIRecord
from openbench_privacy_preserving_benchmarkin.contracts import DataContract
class POSAdapter(Adapter):
"""A toy POS (Point-of-Sale) adapter that yields KPIRecords."""
def __init__(self, name: str, contract: DataContract, seed: int = 42):
super().__init__(name, contract)
self._seed = seed
def collect(self) -> List[KPIRecord]:
# For MVP: generate two deterministic KPI records as samples
# In a real implementation this would pull from a POS feed.
k1 = KPIRecord(
revenue=1000.0,
cogs=600.0,
inventory_turns=2.5,
lead_time=2.0,
cac=50.0,
ltv=1200.0,
region="default",
industry="Retail",
anon_id=f"{self.name}-sample1",
timestamp="2020-01-01T00:00:00Z",
)
k2 = KPIRecord(
revenue=1500.0,
cogs=900.0,
inventory_turns=3.0,
lead_time=3.0,
cac=60.0,
ltv=1700.0,
region="default",
industry="Retail",
anon_id=f"{self.name}-sample2",
timestamp="2020-01-02T00:00:00Z",
)
return [k1, k2]