36 lines
1.1 KiB
Python

"""collection of configured data pipelines, intended to be invoked from C#"""
from datetime import datetime as Datetime
from delta_barth.analysis import forecast
from delta_barth.management import SESSION
from delta_barth.types import JsonExportResponse, JsonResponse, JsonStatus
def pipeline_sales_forecast(
company_id: int | None,
start_date: Datetime | None,
) -> JsonExportResponse:
result = forecast.pipeline_sales(SESSION, company_id=company_id, start_date=start_date)
export = JsonExportResponse(result.model_dump_json())
# response = JsonResponse(result.response.model_dump_json())
# status = JsonStatus(result.status.model_dump_json())
return export
def pipeline_sales_forecast_dummy(
company_id: int | None,
start_date: Datetime | None,
) -> JsonExportResponse:
result = forecast.pipeline_sales_dummy(
SESSION,
company_id=company_id,
start_date=start_date,
)
export = JsonExportResponse(result.model_dump_json())
# response = JsonResponse(result.response.model_dump_json())
# status = JsonStatus(result.status.model_dump_json())
return export