17 lines
578 B
Python
17 lines
578 B
Python
class SegmentAdapter:
|
|
def __init__(self, mapping=None):
|
|
self.mapping = mapping or {
|
|
"activation_rate": "activation_rate",
|
|
"funnel_dropoff": "funnel_dropoff",
|
|
"time_to_value": "time_to_value",
|
|
"CAC": "cac",
|
|
"LTV": "ltv",
|
|
}
|
|
|
|
def fill(self, source_metrics: dict) -> dict:
|
|
result = {}
|
|
for std_key, src_key in self.mapping.items():
|
|
if isinstance(src_key, str) and src_key in source_metrics:
|
|
result[std_key] = source_metrics[src_key]
|
|
return result
|