bfb_delivery.lib.schema package

Subpackages

Submodules

bfb_delivery.lib.schema.schema module

The data schema for ETL steps.

class bfb_delivery.lib.schema.schema.CircuitPlansFromDict

Bases: CircuitPlansOut

The schema for the Circuit plans data from a JSON-esque dict.

bfb_delivery.lib.dispatch.read_circuit._make_plans_df input.

class Config

Bases: object

The configuration for the schema.

from_format = 'dict'
name = 'CircuitPlansFromDict'
strict = False
routes: Series[list[str]] = 'routes'
class bfb_delivery.lib.schema.schema.CircuitPlansOut

Bases: DataFrameModel

The schema for the Circuit plans data.

bfb_delivery.lib.dispatch.read_circuit._make_plans_df output.

class Config

Bases: object

The configuration for the schema.

name = 'CircuitPlansOut'
strict = True
id: Series[str] = 'id'
title: Series[str] = 'title'
class bfb_delivery.lib.schema.schema.CircuitPlansTransformIn

Bases: CircuitPlansOut

The schema for the Circuit plans data.

bfb_delivery.lib.dispatch.read_circuit._transform_routes_df input.

class Config

Bases: Config

name = 'CircuitPlansTransformIn'
class bfb_delivery.lib.schema.schema.CircuitRoutesTransformInFromDict

Bases: DataFrameModel

The schema for the Circuit routes data from a JSON-esque dict.

bfb_delivery.lib.dispatch.read_circuit._transform_routes_df input.

class Config

Bases: object

The configuration for the schema.

address1_in_address = True
address2_in_address = True
contiguous_group = {'contiguous_col': 'stopPosition', 'group_col': 'plan', 'start_idx': 0}
from_format = 'dict'
many_to_one = {'many_col': 'id', 'one_col': 'plan'}
name = 'CircuitRoutesTransformInFromDict'
unique_group = {'group_col': 'plan', 'unique_col': 'stopPosition'}
address: Series[dict[str, Any]] = 'address'
id: Series[str] = 'id'
notes: Series[str] = 'notes'
orderInfo: Series[dict[str, Any]] = 'orderInfo'
packageCount: Series[float] = 'packageCount'
plan: Series[str] = 'plan'
recipient: Series[dict[str, Any]] = 'recipient'
route: Series[dict[str, Any]] = 'route'
stopPosition: Series[int] = 'stopPosition'
class bfb_delivery.lib.schema.schema.CircuitRoutesTransformOut

Bases: DataFrameModel

The schema for the Circuit routes data after transformation.

bfb_delivery.lib.dispatch.read_circuit._transform_routes_df output.

class Config

Bases: object

The configuration for the schema.

at_least_one_in_group = {'at_least_one_col': 'driver_sheet_name', 'group_col': 'plan'}
at_least_one_in_group_route_sheet = True
at_least_one_in_group_sheet_plan = True
at_least_one_in_group_sheet_route = True
at_least_one_in_group_sheet_stop = True
contiguous_group = {'contiguous_col': 'Stop #', 'group_col': 'driver_sheet_name', 'start_idx': 1}
increasing_by = {'cols': ['driver_sheet_name', 'Stop #']}
many_to_one = {'many_col': 'id', 'one_col': 'driver_sheet_name'}
name = 'CircuitRoutesTransformOut'
one_to_one = {'col_a': 'route', 'col_b': 'plan'}
one_to_one_route_sheet = True
unique = ['driver_sheet_name', 'Stop #']
address: Series[str] = 'Address'
box_type: Series[Category] = 'Box Type'
driver_sheet_name: Series[str] = 'driver_sheet_name'
email: Series[str] = 'Email'
id: Series[str] = 'id'
name: Series[str] = 'Name'
neighborhood: Series[str] = 'Neighborhood'
notes: Series[str] = 'Notes'
orderInfo: Series[dict[str, Any]] = 'orderInfo'
order_count: Series[float] = 'Order Count'
phone: Series[str] = 'Phone'
placeId: Series[str] = 'placeId'
plan: Series[str] = 'plan'
route: Series[str] = 'route'
route_title: Series[str] = 'route_title'
stop_no: Series[int] = 'Stop #'
class bfb_delivery.lib.schema.schema.CircuitRoutesWriteIn

Bases: DataFrameModel

The schema for the Circuit routes data before writing.

bfb_delivery.lib.dispatch.read_circuit._write_routes_df input.

class Config

Bases: object

The configuration for the schema.

at_least_one_in_group_route_sheet = True
at_least_one_in_group_sheet_route = True
at_least_one_in_group_sheet_stop = True
contiguous_group = {'contiguous_col': 'Stop #', 'group_col': 'driver_sheet_name', 'start_idx': 1}
increasing_by = {'cols': ['driver_sheet_name', 'Stop #']}
many_to_one = {'many_col': 'id', 'one_col': 'driver_sheet_name'}
name = 'CircuitRoutesWriteIn'
one_to_one = {'col_a': 'route', 'col_b': 'driver_sheet_name'}
unique = ['driver_sheet_name', 'Stop #']
address: Series[str] = 'Address'
box_type: Series[Category] = 'Box Type'
driver_sheet_name: Series[str] = 'driver_sheet_name'
email: Optional[Series[str]] = 'Email'
name: Series[str] = 'Name'
neighborhood: Series[str] = 'Neighborhood'
notes: Series[str] = 'Notes'
order_count: Series[float] = 'Order Count'
phone: Series[str] = 'Phone'
stop_no: Series[int] = 'Stop #'
class bfb_delivery.lib.schema.schema.CircuitRoutesWriteInAllHHs

Bases: CircuitRoutesWriteIn

The schema for the Circuit routes data before writing for “All HHs”.

bfb_delivery.lib.dispatch.read_circuit._write_routes_df_all_hhs input.

class Config

Bases: object

The configuration for the schema.

many_to_one = {'many_col': 'Stop #', 'one_col': 'driver_sheet_name'}
name = 'CircuitRoutesWriteInAllHHs'
email: Series[str] = 'Email'
class bfb_delivery.lib.schema.schema.CircuitRoutesWriteOut

Bases: DataFrameModel

The schema for the Circuit routes data after writing.

bfb_delivery.lib.dispatch.read_circuit._write_routes_df input, called within _write_routes_df as its “output.”

class Config

Bases: object

The configuration for the schema.

name = 'CircuitRoutesWriteOut'
unique = ['Name', 'Address', 'Box Type']
address: Series[str] = 'Address'
box_type: Series[Category] = 'Box Type'
email: Series[str] = 'Email'
name: Series[str] = 'Name'
neighborhood: Series[str] = 'Neighborhood'
notes: Series[str] = 'Notes'
order_count: Series[float] = 'Order Count'
phone: Series[str] = 'Phone'
stop_no: Series[int] = 'Stop #'
class bfb_delivery.lib.schema.schema.DriversAssignDriverIn

Bases: DriversAssignDriversIn

The schema for the driver data before assigning a driver.

class Config

Bases: Config

name: Optional[str] = 'DriversAssignDriverIn'

name of schema

class bfb_delivery.lib.schema.schema.DriversAssignDriversIn

Bases: DriversGetAllDriversOut

The schema for the drivers data before assigning drivers.

class Config

Bases: Config

name: Optional[str] = 'DriversAssignDriversIn'

name of schema

class bfb_delivery.lib.schema.schema.DriversGetAllDriversOut

Bases: DataFrameModel

The schema for the drivers data after getting all drivers.

class Config

Bases: BaseConfig

name: Optional[str] = 'DriversGetAllDriversOut'

name of schema

active: Series[bool] = 'active'
email: Series[str] = 'email'
id: Series[str] = 'id'
name: Series[str] = 'name'
class bfb_delivery.lib.schema.schema.PlansAssignDriverIn

Bases: PlansAssignDriversIn

The schema for the plan data before assigning a driver.

class Config

Bases: Config

name: Optional[str] = 'PlansAssignDriverIn'

name of schema

class bfb_delivery.lib.schema.schema.PlansAssignDriverOut

Bases: PlansAssignDriverIn

The schema for the plan data after assigning a driver.

class Config

Bases: Config

name: Optional[str] = 'PlansAssignDriverOut'

name of schema

class bfb_delivery.lib.schema.schema.PlansAssignDriversIn

Bases: DataFrameModel

The schema for the plans data before assigning drivers.

class Config

Bases: BaseConfig

name: Optional[str] = 'PlansAssignDriversIn'

name of schema

driver_name: Series[str] = 'driver_name'
email: Series[str] = 'email'
id: Series[str] = 'id'
route_title: Series[str] = 'route_title'
class bfb_delivery.lib.schema.schema.PlansAssignDriversOut

Bases: PlansAssignDriverOut

The schema for the plans data after assigning drivers.

class Config

Bases: Config

name: Optional[str] = 'PlansAssignDriversOut'

name of schema

class bfb_delivery.lib.schema.schema.PlansAssignDriversToPlansOut

Bases: PlansAssignDriversOut

The schema for the plans data after assigning drivers.

class Config

Bases: object

The configuration for the schema.

many_to_one = {'many_col': 'route_title', 'one_col': 'id'}
name = 'PlansAssignDriversToPlansOut'
driver_name: Series[str] = 'driver_name'
email: Series[str] = 'email'
id: Series[str] = 'id'
class bfb_delivery.lib.schema.schema.PlansBuildStopsIn

Bases: PlansCreatePlansOut

The schema for the plans data before building stops.

class Config

Bases: Config

name = 'PlansBuildStopsIn'
class bfb_delivery.lib.schema.schema.PlansConfirmOptimizationsIn

Bases: PlansOptimizeRoutesIn

The schema for the plans data after before confirming optimizations.

class Config

Bases: Config

name = 'PlansConfirmOptimizationsIn'
routes_optimized: Series[bool] = 'optimized'
class bfb_delivery.lib.schema.schema.PlansConfirmOptimizationsOut

Bases: PlansConfirmOptimizationsIn

The schema for the plans data after confirming optimizations.

class Config

Bases: Config

name = 'PlansConfirmOptimizationsOut'
routes_optimized: Series = 'optimized'
class bfb_delivery.lib.schema.schema.PlansCreatePlansOut

Bases: PlansInitializePlansOut

The schema for the plans data after creating.

class Config

Bases: Config

name = 'PlansCreatePlansOut'
class bfb_delivery.lib.schema.schema.PlansDistributeRoutesIn

Bases: PlansOptimizeRoutesOut

The schema for the plans data before distributing routes.

class Config

Bases: Config

name = 'PlansDistributeRoutesIn'
class bfb_delivery.lib.schema.schema.PlansDistributeRoutesOut

Bases: PlansDistributeRoutesIn

The schema for the plans data after distributing routes.

class Config

Bases: Config

name = 'PlansDistributeRoutesOut'
distributed: Series[bool] = 'distributed'
class bfb_delivery.lib.schema.schema.PlansInitializePlansIn

Bases: PlansAssignDriversToPlansOut

The schema for the plans data before initializing.

class Config

Bases: Config

name = 'PlansInitializePlansIn'
class bfb_delivery.lib.schema.schema.PlansInitializePlansOut

Bases: PlansInitializePlansIn

The schema for the plans data after initializing.

class Config

Bases: object

The configuration for the schema.

name = 'PlansInitializePlansOut'
one_to_one = {'col_a': 'route_title', 'col_b': 'plan_id'}
initialized: Series[bool] = 'initialized'
optimization: Series[str] = 'optimization'
plan_id: Series[str] = 'plan_id'
writable: Series[bool] = 'writable'
class bfb_delivery.lib.schema.schema.PlansOptimizeRoutesIn

Bases: PlansUploadStopsOut

The schema for the plans data before optimizing routes.

class Config

Bases: Config

name = 'PlansOptimizeRoutesIn'
class bfb_delivery.lib.schema.schema.PlansOptimizeRoutesOut

Bases: PlansConfirmOptimizationsOut

The schema for the plans data after optimizing routes.

class Config

Bases: Config

name = 'PlansOptimizeRoutesOut'
class bfb_delivery.lib.schema.schema.PlansUploadSplitChunkedOut

Bases: PlansDistributeRoutesOut

The schema for the plans data after uploading split chunked routes.

class Config

Bases: Config

name = 'PlansUploadSplitChunkedOut'
class bfb_delivery.lib.schema.schema.PlansUploadStopsIn

Bases: PlansCreatePlansOut

The schema for the plans data before uploading stops.

class Config

Bases: Config

name = 'PlansUploadStopsIn'
class bfb_delivery.lib.schema.schema.PlansUploadStopsOut

Bases: PlansUploadStopsIn

The schema for the plan data after uploading stops.

class Config

Bases: Config

name = 'PlansUploadStopsOut'
stops_uploaded: Series[bool] = 'stops_uploaded'
class bfb_delivery.lib.schema.schema.Stops

Bases: DataFrameModel

The schema for the stops data to upload.

class Config

Bases: object

The configuration for the schema.

name = 'Stops'
unique = ['Name', 'Address', 'Product Type']
address: Series[str] = 'Address'
email: Series[str] = 'Email'
name: Series[str] = 'Name'
neighborhood: Series[str] = 'Neighborhood'
notes: Series[str] = 'Notes'
order_count: Series[float] = 'Order Count'
phone: Series[str] = 'Phone'
product_type: Series[Category] = 'Product Type'
sheet_name: Series[str] = 'sheet_name'

bfb_delivery.lib.schema.utils module

Utility functions for schema validation.

bfb_delivery.lib.schema.utils.schema_error_handler(func)

Custom error handler for the schema validation errors.

Use as decorator to wrap pa.check_types decorator.

Return type:

Callable

Module contents

schema module.