chore: simple surge pricer

This commit is contained in:
2025-12-05 12:44:21 +01:00
parent 951b08d65e
commit a38fac9d2b
4 changed files with 52 additions and 8 deletions

View File

@@ -79,7 +79,7 @@ def get_price(mode: Literal['hotel', 'airline'], productId: str, sessionId: Opti
elasticity=None
)
optimal_price = float(product_price_row['predicted_price'].iloc[0])
optimal_price = float(product_price_row['optimal_price'].iloc[0]) # TODO: use optimal_price everywhere as aresult
# get elasticity if available
product_elasticity = None

View File

@@ -12,4 +12,5 @@ graphviz
python-dotenv>=1.0.0
requests>=2.31.0
typing-extensions>=4.8.0
pickle5>=0.0.11; python_version < '3.8'
pypickle
pymc

View File

@@ -292,12 +292,7 @@ async def get_products(
# filter by exact date_index if provided
# dateIndex from frontend is days from today, convert to days since epoch
if dateIndex is not None:
from datetime import datetime
epoch = datetime(1970, 1, 1)
today = datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)
today_index = int((today - epoch).total_seconds() / 86400)
actual_date_index = today_index + dateIndex
query = query.eq('date_index', actual_date_index)
query = query.eq('date_index', dateIndex)
response = query.execute()
results = response.data