generated from edgi-govdata-archiving/Template
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakePer1000.py
51 lines (43 loc) · 1.23 KB
/
MakePer1000.py
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
#!/usr/bin/env python
# coding: utf-8
import AllPrograms_db
import sys, argparse
def main(argv):
parser = argparse.ArgumentParser(
prog="MakePer1000.py",
description="Build summary data tables state_per_1000 and "
"either cd_per_1000 or county_per_1000 "
"for the five years ending with the focus year.",
)
parser.add_argument(
"-b",
"--database",
required=True,
help="The Sqlite3 database",
)
parser.add_argument(
"-f",
"--focus_year",
required=True,
help="The year on which the report will focus",
)
parser.add_argument(
"-m",
"--region_mode",
required=True,
help="County or Congressional District",
)
my_args = parser.parse_args()
_database = my_args.database
_region_mode = my_args.region_mode
_state = my_args.focus_state
_focus_year = my_args.focus_year
AllPrograms_db.make_per_1000(_database, _region_mode, _focus_year)
def usage():
print("Usage: MakePer1000.py -b <database> -m <region_mode> -f <focus_year> ")
exit
if __name__ == "__main__":
if len(sys.argv) < 4:
usage()
else:
main(sys.argv[1])