forked from metzgr/pgov-cover-sheet-reader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
23 lines (20 loc) · 1.13 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""
File to be run to generate summary reports for the most recent quarter
"""
import src.output.docx.generator as docx_generator
from src.objects.agency import Agency
from src.input.cover_sheets.reading import process_cover_sheets, get_cover_sheets
from src.input.cover_sheets.upload import update_database
import pandas as pd
from src.constants import AGENCY_ABBREVIATION_TO_NAME, DATABASE_PATH
if __name__ == "__main__":
# Read cover sheet files
new_cover_sheets = get_cover_sheets() # retrieves newly published cover sheets
new_cover_sheets_df = process_cover_sheets(new_cover_sheets) # creates DataFrame using newly retrieved cover sheets
# update_database(DATABASE_PATH, new_cover_sheets_df) # uncomment this line to initiate the reading of cover sheets and storage into the database
# Create summary reports
for agency_abbreviation in AGENCY_ABBREVIATION_TO_NAME.keys():
file_name = f"{agency_abbreviation}_Summary"
agency = Agency(pd.read_csv(DATABASE_PATH), agency_abbreviation, "Q4", 2020)
docx_generator.create_summary_document(agency, file_name)
print(file_name, "created")