Format Manifests¶
After you’ve combined your optimized routes into a single workbook, using combine_route_tables
(see Combine Driver Route Tables into a Single Workbook), you’ll need to format the combined routes into printable manifests for the drivers. This can be done using the format_combined_routes
tool.
This tool replaces the Excel macro previously used, as well as some manual steps afterward. The output is ready to print.
Note
Uses the date of the front of each CSV name to set the manifest date field. I.e., each sheet should be named something like “02.12 Bill C”, and, e.g., this would set the manifest date field to “Date: 02.12”.
Note
create_manifests
wraps this tool and combine_route_tables
into one tool. You can still use them if you wish, but you can instead use create_manifests
. See Create Printable Manifests from Downloaded Optimized Routes and Combine Driver Route Tables into a Single Workbook.
Python API documentation at bfb_delivery.api.public.format_combined_routes()
.
CLI documentation at CLI.
Setup¶
This tool requires a local config file with phone numbers. We store them locally so we don’t put phone numbers in the codebase. The config file should be named config.ini
and should be in the same directory as where you’re running the tool. The file should look like this:
[phone_numbers]
driver_support = 555-555-5555
recipient_support = 555-555-5555 x5
Usage¶
When you ran combine_route_tables
, you received a single workbook with all the optimized routes combined. Now, you can pass that file to format_combined_routes
, along with any other optional arguments, to create printable manifests for your drivers. If you ran the CLI, the filepath to the combined file was printed to the console. If you used the Python API, the function will return the filepath to the formatted file.
You must at least pass input_path
to format_combined_routes
.
In Python:
from bfb_delivery import format_combined_routes
format_route_table(input_path="path/to/combined_workbook.xlsx")
With CLI:
format_route_table --input_path path/to/combined_workbook.xlsx
The function will return the filepath to the formatted manifest workbook, which you can then open, review, and print. If you’re using the CLI, the filepath will be printed to the console.
Note
You can pass the combine_route_tables
ouput to format_combined_routes
without reviewing the combined file first. We’re going to soon wrap these two steps into a single tool. But, for now, you need to run them separately.
Optional arguments¶
You can specify a few things about the formatted manifest workbook. Use –help to see all the optional arguments in the CLI.
format_route_table --help
Output directory¶
Use the optional argument output_dir
to specify the filepath where the combined file will be saved.
In Python:
format_route_table(
input_path="path/to/combined_workbook.xlsx",
output_dir="path/to/output_dir/",
)
With CLI:
format_route_table --input_path path/to/combined_workbook.xlsx --output_dir path/to/output_dir
Output filename¶
Choose the filename with output_name
. The default filename will be combined_routes_{today's date}.xlsx
(e.g., combined_routes_19991231.xlsx
). But, you can pass a preferred name that will be used instead.
In Python:
format_route_table(
input_path="path/to/combined_workbook.xlsx",
output_name="manifests.xlsx",
)
With CLI:
format_route_table --input_path path/to/combined_workbook.xlsx --output_name manifests.xlsx
Supplying extra notes¶
Use the optional argument extra_notes_file
to specify a CSV file with extra notes to include in the manifest. The CSV file should have two columns: tag
and note
. The tag is the text (usually asterisked) that appears in the standard notes field for a delivery. The note is then added to the bottom of the manifest with the tag. For example:
tag,note
Cedarwood Apartments*,Please call the recipient when you arrive.
This file will put the note “Please call the recipient when you arrive.” at the bottom of the manifest (once) if a stop has a note that contains the text “Cedarwood Apartments special instructions *”.
If extra_notes_file
is not provided, the tool will use the constant notes in the codebase: bfb_delivery.lib.constants.ExtraNotes
.
In Python:
format_route_table(
input_path="path/to/combined_workbook.xlsx",
extra_notes_file="path/to/extra_notes.csv",
)
With CLI:
format_route_table --input_path path/to/combined_workbook.xlsx --extra_notes_file path/to/extra_notes.csv
See Also¶
Create Printable Manifests from Downloaded Optimized Routes
The Delivery-Planning Workflow