-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
76 lines (58 loc) · 2.48 KB
/
main.py
File metadata and controls
76 lines (58 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Main control flow for the SANDAG Estimates Program. For runtime instructions, refer
# to the repository README.md. For methodology and other documentation, refer to the
# Wiki which can be found at https://github.com/SANDAG/Estimates-Program/wiki
###########
# Imports #
###########
import logging
import python.startup as startup
import python.hs_hh as hs_hh
import python.pop_type as pop
import python.ase as ase
import python.hh_characteristics as hh_characteristics
import python.employment as employment
import python.staging as staging
import python.utils as utils
logger = logging.getLogger(__name__)
################
# Control flow #
################
# Run the Startup module first. Since this module contains only year agnostic data, it
# is run outside the main year loop
if utils.RUN_INSTRUCTIONS["startup"]:
utils.display_ascii_art("data/welcome.txt")
logger.info("Running Startup module...\n")
startup.run_startup(debug=utils.DEBUG)
# Loop through the years first
for year in utils.RUN_INSTRUCTIONS["years"]:
logger.info(f"Running {year}...")
# Go through each module in the correct order for the specified year
# Housing and Households module
if utils.RUN_INSTRUCTIONS["housing_and_households"]:
logger.info("Running Housing and Households module...")
hs_hh.run_hs_hh(year, debug=utils.DEBUG)
# Population module
if utils.RUN_INSTRUCTIONS["population"]:
logger.info("Running Population module...")
pop.run_pop(year, debug=utils.DEBUG)
# Population by Age/Sex/Ethnicity module
if utils.RUN_INSTRUCTIONS["population_by_ase"]:
logger.info("Running Population by Age/Sex/Ethnicity module...")
ase.run_ase(year, debug=utils.DEBUG)
# Household Characteristics module
if utils.RUN_INSTRUCTIONS["household_characteristics"]:
logger.info("Running Household Characteristics module...")
hh_characteristics.run_hh_characteristics(year, debug=utils.DEBUG)
# Employment module
if utils.RUN_INSTRUCTIONS["employment"]:
logger.info("Running Employment module...")
employment.run_employment(year, debug=utils.DEBUG)
# Diagnostic print for this year
logger.info(f"Finished running {year}\n")
# Staging module. For now, all this does is mark this run as completed in the
# [metadata].[run] table
if utils.RUN_INSTRUCTIONS["staging"]:
logger.info("Running Staging module...")
staging.run_staging(debug=utils.DEBUG)
# Final print for completion
logger.info("Completed")