opengrowth-privacy-preservi.../opengrowth_privacy_preservi.../adapters/dsl_bridge.py

25 lines
739 B
Python

from typing import Dict, Any
from .ga4 import GA4Adapter
from .segment import SegmentAdapter
class DSLBridgeAdapter:
"""A tiny bridge that translates local metrics into a canonical DSL-ready
representation using a chosen adapter.
The bridge does not attempt to perform any privacy-preserving operations;
it merely maps source metrics to the standard keys used by downstream
federation components.
"""
def __init__(self, adapter: object = None):
self.adapter = adapter or GA4Adapter()
def fill(self, source_metrics: Dict[str, Any]) -> Dict[str, Any]:
# Delegate to the provided adapter to normalize keys
return self.adapter.fill(source_metrics)
__all__ = ["DSLBridgeAdapter"]