leaf_engine.etl.fsc

Functions

_get_lane_level_fuel_surcharge_schedule(→ pandas.DataFrame)

Retrieves the latest applicable fuel surcharge schedule.

_get_shipment_level_fuel_surcharge_schedule(...)

Retrieves the latest applicable fuel surcharge schedule.

_match_fsc(→ pandas.Series)

Matches the shipment to the proper fuel surcharge schedule.

_match_lane_level_fsc(→ pandas.Series)

Matches the row to the proper fuel surcharge schedule.

_match_shipment_level_fsc(→ pandas.Series)

Matches the row to the proper fuel surcharge schedule.

fsc_pipeline(→ pandas.DataFrame)

Module Contents

leaf_engine.etl.fsc._get_lane_level_fuel_surcharge_schedule(df: pandas.DataFrame) pandas.DataFrame

Retrieves the latest applicable fuel surcharge schedule.

Retrieved on an origin state/shipment date basis.

Parameters:

df (pandas.DataFrame) – <DataFrame> shipments to operate on.

Returns:

<DataFrame> shipments with fuel schedule columns.

Return type:

df

leaf_engine.etl.fsc._get_shipment_level_fuel_surcharge_schedule(df: pandas.DataFrame) pandas.DataFrame

Retrieves the latest applicable fuel surcharge schedule.

Retrieved on an origin state/shipment date basis.

Parameters:

df (pandas.DataFrame) – <DataFrame> shipments to operate on.

Returns:

<DataFrame> shipments with fuel schedule columns.

Return type:

df

leaf_engine.etl.fsc._match_fsc(fsc_df: pandas.DataFrame, company_id: int, ship_date: str, o_state: str) pandas.Series

Matches the shipment to the proper fuel surcharge schedule.

Parameters:
  • fsc_df (pandas.DataFrame) – <DataFrame> fuel surcharge schedules.

  • company_id (int) – <int> company id.

  • ship_date (str) – <str> shipment date.

  • o_state (str) – <str> origin state.

Return type:

pandas.Series

leaf_engine.etl.fsc._match_lane_level_fsc(row: pandas.Series, fsc_df: pandas.DataFrame) pandas.Series

Matches the row to the proper fuel surcharge schedule.

Finds the closest valid_from date that is <= shipment date.

If there are multiple matches, it will choose the one with the highest hierarchy level.

Rows are matched on the origin state or NA (matches all origin states).

Parameters:
Return type:

pandas.Series

leaf_engine.etl.fsc._match_shipment_level_fsc(row: pandas.Series, fsc_df: pandas.DataFrame) pandas.Series

Matches the row to the proper fuel surcharge schedule.

Finds the closest valid_from date that is <= shipment date.

If there are multiple matches, it will choose the one with the highest hierarchy level.

Rows are matched on the origin state or NA (matches all origin states).

Parameters:
Return type:

pandas.Series

leaf_engine.etl.fsc.fsc_pipeline(df: pandas.DataFrame, lane_level: bool = False) pandas.DataFrame
Parameters:
Return type:

pandas.DataFrame