def load_profile_recommendations(analysed_order, forecast, transaction_log_id): recommend = run_profile_recommendation(analysed_orders=analysed_order, forecast=forecast) rec = ProfileRecommendation() rec.transaction_id = int(transaction_log_id.id) rec.statement = recommend.get('profile') db.session.add(rec) db.session.commit()
def recommendations(analysed_orders: UncertainDemand, forecast: dict) -> dict: """ Generate Recommendations for each SKU and the inventory Profile. Args: analysed_orders (UncertainDemand): UncertainDemand object of analysed orders. forecast (dict): Output from a Forecast. Returns: dict: Returns recommendations for each sku and for the inventory profile. Examples: >>> from decimal import Decimal >>> from supplychainpy.sample_data.config import ABS_FILE_PATH >>> from supplychainpy.model_inventory import analyse >>> from supplychainpy.model_inventory import recommendations ... >>> analysed_order = analyse(file_path=ABS_FILE_PATH['COMPLETE_CSV_SM'], ... z_value=Decimal(1.28), ... reorder_cost=Decimal(5000), ... file_type="csv", length=12,currency='USD') ... >>> holts_forecast = {analysis.sku_id: analysis.holts_trend_corrected_forecast for analysis in ... analyse(file_path=ABS_FILE_PATH['COMPLETE_CSV_SM'], z_value=Decimal(1.28), ... reorder_cost=Decimal(5000), file_type="csv", ... length=12,currency='USD')} ... >>> recommend = recommendations(analysed_orders=analysed_order, forecast=holts_forecast) """ recommend = {'sku_recommendations': run_sku_recommendation(analysed_orders=analysed_orders, forecast=forecast), 'profile_recommendations': run_profile_recommendation(analysed_orders=analysed_orders, forecast=forecast), } return recommend