-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Background
Currently, we need a staff member to manually run the town close QC export script in order to deliver the QC workbooks to Valuations. This is usually not too hard (see here for a detailed description of the process) but Valuations often likes to get started QCing very early in the morning, when Data team staff members are generally not available to run the script.
Goal
Add a new argument to the export_qc_town_close_reports.py script to read a configuration from an Excel workbook in order to determine which towns are eligible for export on the current day. Once we've merged this change, we can schedule the script to run daily on the VM and read from a config file on the O Drive in order to automatically generate any town close QC reports that Valuations wants to produce on a given day.
Scope
- Add a new
--township-config-fileargument to theexport_qc_town_close_reports.pyscript that can optionally read a path to an Excel file - Add a new function to the
utils/townships.pymodule calledget_townships_from_config_file()that takes the path to the config file as a string argument, reads the townships and configured date ranges from the file, and returns a list of theTownshipobjects that are configured to run on the current day- See
O:\CCAODATA\Valuations Town Close QC\Valuations Town Close QC Schedule.xlsxfor an example of the config file schema - The function should raise an error if a township code is not in the
TOWNSHIPSlist, or if the township names do not match between the config file and the name as configured inTOWNSHIPS(compare lowercased versions of the strings, to avoid false positives)
- See
- Update the block in
export_qc_town_close_reports.pythat parses the--townshipargument to follow new logic:- If the
--township-config-fileargument is not empty, useget_townships_from_config_file()to get the list of townships to populate thetownshipsvariable - If the
--township-config-fileargument is empty but--townshipis not empty, use--townshipto populate thetownshipsvariable (similar to the current logic) - If both arguments are empty, fall back to
TOWNSHIPS(similar to the current logic) - In all conditional branches, make sure to add a log line to provide a hint as to which source we are drawing the
townshipsvariable from
- If the
- Add optional logging and alerting arguments to the
export_qc_town_close_reports.pyscript so that we can log/alert from AWS in case of errors (see Add remote logging and error reporting to daily IC reference file export script #860 for the pattern that you can follow to implement these arguments)