leaf_engine.adapt.pipeline.adapt_postprocessing_pipeline

Attributes

AdaptPostprocessingException

BENEFIT_CAPS

BENEFIT_TYPE

DATA_DRIVEN_BENEFIT_ASSUMPTIONS

MANUAL_BENEFIT_ASSUMPTIONS

MARKET_VARIANCE_IMPLEMENTABILITY

MIN_LANE_LENGTH

NETWORK_BENEFIT_IMPLEMENTABILITY

Functions

get_annualization(→ float)

Returns annualization factor.

get_business_impact(→ pandas.DataFrame)

get_business_objectives(→ pandas.DataFrame)

Builds high-level overview of business objectives.

get_co2_emissions(→ int)

Converts total shipment miles to million kilograms CO2.

get_company_stats(→ pandas.DataFrame)

Builds high-level overview of total benefits.

get_daily_pattern_benefit(→ pandas.DataFrame)

Computes lane-level daily flex pattern benefit.

get_flex_lane_summary(→ pandas.DataFrame)

Formats lane level summary to match expected output.

get_lane_summary(→ pandas.DataFrame)

Gets and formats lane-level summary from explorer context.

get_market_rate_variance_benefit(→ pandas.DataFrame)

Computes lane-level market rate variance benefit.

get_network_benefit(→ pandas.DataFrame)

Aggregates network moves and computes lane-level network benefit.

get_network_moves(→ pandas.DataFrame)

Gets and formats network moves from actions context.

get_observations(→ pandas.DataFrame)

Gets and aggregates observations from observation context.

get_portfolio(→ pandas.DataFrame)

Builds adapt portfolio output.

get_ships(→ pandas.DataFrame)

Gets shipments DataFrame from data_context.

get_total_loads(→ int)

Computes number of unique shipments.

get_total_spend(→ float)

Computes total shipment spend.

postprocessing_pipeline(etl_cxt, data_cxt, action_cxt, ...)

Runs postprocessing logic.

Module Contents

leaf_engine.adapt.pipeline.adapt_postprocessing_pipeline.get_annualization(ships_df: pandas.DataFrame) float

Returns annualization factor.

Parameters:

ships_df (pandas.DataFrame) –

Return type:

float

leaf_engine.adapt.pipeline.adapt_postprocessing_pipeline.get_business_impact(case_df: pandas.DataFrame) pandas.DataFrame
Parameters:

case_df (pandas.DataFrame) –

Return type:

pandas.DataFrame

leaf_engine.adapt.pipeline.adapt_postprocessing_pipeline.get_business_objectives(ships_df: pandas.DataFrame, case_df: pandas.DataFrame) pandas.DataFrame

Builds high-level overview of business objectives.

Parameters:
Return type:

pandas.DataFrame

leaf_engine.adapt.pipeline.adapt_postprocessing_pipeline.get_co2_emissions(ships_df: pandas.DataFrame) int

Converts total shipment miles to million kilograms CO2.

Parameters:

ships_df (pandas.DataFrame) –

Return type:

int

leaf_engine.adapt.pipeline.adapt_postprocessing_pipeline.get_company_stats(ships_df: pandas.DataFrame) pandas.DataFrame

Builds high-level overview of total benefits.

Parameters:

ships_df (pandas.DataFrame) –

Return type:

pandas.DataFrame

leaf_engine.adapt.pipeline.adapt_postprocessing_pipeline.get_daily_pattern_benefit(ships_df, action_context: leaf_engine.adapt.context.adapt_contexts.AdaptActionContext) pandas.DataFrame

Computes lane-level daily flex pattern benefit.

Parameters:

action_context (leaf_engine.adapt.context.adapt_contexts.AdaptActionContext) –

Return type:

pandas.DataFrame

leaf_engine.adapt.pipeline.adapt_postprocessing_pipeline.get_flex_lane_summary(case_df: pandas.DataFrame) pandas.DataFrame

Formats lane level summary to match expected output.

Parameters:

case_df (pandas.DataFrame) –

Return type:

pandas.DataFrame

leaf_engine.adapt.pipeline.adapt_postprocessing_pipeline.get_lane_summary(etl_context: leaf_engine.adapt.context.adapt_contexts.AdaptETLContext, explorer_context: leaf_engine.adapt.context.adapt_contexts.AdaptExplorerContext) pandas.DataFrame

Gets and formats lane-level summary from explorer context.

Parameters:
Return type:

pandas.DataFrame

leaf_engine.adapt.pipeline.adapt_postprocessing_pipeline.get_market_rate_variance_benefit(observation_context: leaf_engine.adapt.context.adapt_contexts.AdaptObservationContext) pandas.DataFrame

Computes lane-level market rate variance benefit.

Parameters:

observation_context (leaf_engine.adapt.context.adapt_contexts.AdaptObservationContext) –

Return type:

pandas.DataFrame

leaf_engine.adapt.pipeline.adapt_postprocessing_pipeline.get_network_benefit(ships_df: pandas.DataFrame, action_context: leaf_engine.adapt.context.adapt_contexts.AdaptActionContext) pandas.DataFrame

Aggregates network moves and computes lane-level network benefit.

Parameters:
Return type:

pandas.DataFrame

leaf_engine.adapt.pipeline.adapt_postprocessing_pipeline.get_network_moves(action_context: leaf_engine.adapt.context.adapt_contexts.AdaptActionContext) pandas.DataFrame

Gets and formats network moves from actions context.

Parameters:

action_context (leaf_engine.adapt.context.adapt_contexts.AdaptActionContext) –

Return type:

pandas.DataFrame

leaf_engine.adapt.pipeline.adapt_postprocessing_pipeline.get_observations(observation_context: leaf_engine.adapt.context.adapt_contexts.AdaptObservationContext) pandas.DataFrame

Gets and aggregates observations from observation context.

Parameters:

observation_context (leaf_engine.adapt.context.adapt_contexts.AdaptObservationContext) –

Return type:

pandas.DataFrame

leaf_engine.adapt.pipeline.adapt_postprocessing_pipeline.get_portfolio(ships_df: pandas.DataFrame, case_df: pandas.DataFrame) pandas.DataFrame

Builds adapt portfolio output.

Parameters:
Return type:

pandas.DataFrame

leaf_engine.adapt.pipeline.adapt_postprocessing_pipeline.get_ships(data_context: leaf_engine.adapt.context.adapt_contexts.AdaptDataContext) pandas.DataFrame

Gets shipments DataFrame from data_context.

Parameters:

data_context (leaf_engine.adapt.context.adapt_contexts.AdaptDataContext) –

Return type:

pandas.DataFrame

leaf_engine.adapt.pipeline.adapt_postprocessing_pipeline.get_total_loads(ships_df: pandas.DataFrame) int

Computes number of unique shipments.

Parameters:

ships_df (pandas.DataFrame) –

Return type:

int

leaf_engine.adapt.pipeline.adapt_postprocessing_pipeline.get_total_spend(ships_df: pandas.DataFrame) float

Computes total shipment spend.

Parameters:

ships_df (pandas.DataFrame) –

Return type:

float

leaf_engine.adapt.pipeline.adapt_postprocessing_pipeline.postprocessing_pipeline(etl_cxt: leaf_engine.adapt.context.adapt_contexts.AdaptETLContext, data_cxt: leaf_engine.adapt.context.adapt_contexts.AdaptDataContext, action_cxt: leaf_engine.adapt.context.adapt_contexts.AdaptActionContext, observation_cxt: leaf_engine.adapt.context.adapt_contexts.AdaptObservationContext, explorer_cxt: leaf_engine.adapt.context.adapt_contexts.AdaptExplorerContext)

Runs postprocessing logic.

Parameters:
leaf_engine.adapt.pipeline.adapt_postprocessing_pipeline.AdaptPostprocessingException
leaf_engine.adapt.pipeline.adapt_postprocessing_pipeline.BENEFIT_CAPS
leaf_engine.adapt.pipeline.adapt_postprocessing_pipeline.BENEFIT_TYPE
leaf_engine.adapt.pipeline.adapt_postprocessing_pipeline.DATA_DRIVEN_BENEFIT_ASSUMPTIONS = ['network_moves', 'market_rate_variance', 'daily_flex_contract_priced']
leaf_engine.adapt.pipeline.adapt_postprocessing_pipeline.MANUAL_BENEFIT_ASSUMPTIONS
leaf_engine.adapt.pipeline.adapt_postprocessing_pipeline.MARKET_VARIANCE_IMPLEMENTABILITY = 0.5
leaf_engine.adapt.pipeline.adapt_postprocessing_pipeline.MIN_LANE_LENGTH = 250
leaf_engine.adapt.pipeline.adapt_postprocessing_pipeline.NETWORK_BENEFIT_IMPLEMENTABILITY = 0.1