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
示例#2
0
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
示例#3
0
def load_recommendations(summary, forecast, analysed_order):
    recommend = run_sku_recommendation(analysed_orders=analysed_order, forecast=forecast)
    for item in summary:
        rec = Recommendations()
        mk = db.session.query(MasterSkuList.id).filter(MasterSkuList.sku_id == item['sku']).first()
        inva = db.session.query(InventoryAnalysis.id).filter(InventoryAnalysis.sku_id == mk.id).first()
        rec.analysis_id = inva.id
        reco = 'There are no recommendation at this time.' if recommend.get(item['sku'],
                                                                            'There are no recommendation at this time.'
                                                                            ) == '' else recommend.get(item['sku'],
                                                                                                       'None')
        rec.statement = reco
        db.session.add(rec)
        db.session.commit()
示例#4
0
def load_recommendations(summary, forecast, analysed_order):
    recommend = run_sku_recommendation(analysed_orders=analysed_order,
                                       forecast=forecast)
    for item in summary:
        rec = Recommendations()
        mk = db.session.query(MasterSkuList.id).filter(
            MasterSkuList.sku_id == item['sku']).first()
        inva = db.session.query(InventoryAnalysis.id).filter(
            InventoryAnalysis.sku_id == mk.id).first()
        rec.analysis_id = inva.id
        reco = 'There are no recommendation at this time.' if recommend.get(
            item['sku'], 'There are no recommendation at this time.'
        ) == '' else recommend.get(item['sku'], 'None')
        rec.statement = reco
        db.session.add(rec)
        db.session.commit()