feature: e2e intro pipline surge pricing

This commit is contained in:
2025-12-06 16:30:28 +01:00
parent 503c5e182d
commit e6a5b95875
6 changed files with 41 additions and 110 deletions

View File

@@ -45,6 +45,14 @@ class JoinProductFeaturesStep(BaseContextStep):
"""
demand_df, price_df = data
# get base prices from products if available
products = self.context.products
products['base_price'] = products.apply(
lambda row: float(row['metadata'].get('base_price', 0.0)) if isinstance(row['metadata'], dict) else 0,
axis=1
)
products = products[['id', 'base_price']].rename(columns={'id': 'productId'})
if price_df.empty:
return demand_df
return demand_df.merge(price_df, on='productId', how='left')
return demand_df.merge(price_df, on='productId', how='left').merge(products, on='productId', how='left')