-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata_profile_runner.py
81 lines (74 loc) · 3.38 KB
/
data_profile_runner.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
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
77
78
79
80
81
#from matplotlib.pyplot import table
from data_profile_spreadsheet import DataProfileSpreadsheets
from PortalExporter import PortalConnector
# from PortalExporter import DatabaseConnector
import yaml
# datasets = [
# { 'census_year': 2021,
# 'census_product': 'acs5',
# 'specifications': {
# "DP02": {'short_title': 'test_dp_social_acs5_2021',
# 'long_title':'Social Characteristics Data Profile, ACS 5-year 2021' }
# }
# }
# ]
datasets = [
{'census_year': 2023,
'census_product': 'acs1',
'specifications': {
"DP02": {'short_title': 'Social Characteristics Data Profle',
'long_title':'ACS Data Profile: Social Characteristics, ACS 2023 1-Year Data'},
"DP03": {'short_title': 'Economic Data Profle',
'long_title':'ACS Data Profile: Economic Characteristics, ACS 2023 1-Year Data' },
"DP04": {'short_title': 'Housing Data Profle',
'long_title':'ACS Data Profile: Housing Characteristics, ACS 2023 1-Year Data' },
"DP05": {'short_title': 'Demographic Data Profle',
'long_title':'ACS Data Profile: Demographic Characteristics, ACS 2023 1-Year Data' }
}
}
]
datasets = [
{'census_year': 2020,
'census_product': 'Decennial',
'specifications': {
"DP1": {'short_title': 'General Population and Housing Characteristics Data Profle',
'long_title':'Decennial Data Profile: General Population and Housing Characteristics, 2020'},
}
}
]
# datasets = [
# { 'census_year': 2021,
# 'census_product': 'acs1',
# 'specifications': {
# "DP02": {'short_title': 'Social Characteristics Data Profle',
# 'long_title':'ACS Data Profile: Social Characteristics, ACS 2021 1-Year Data'},
# "DP03": {'short_title': 'Economic Data Profle',
# 'long_title':'ACS Data Profile: Economic Characteristics, ACS 2021 1-Year Data' },
# "DP04": {'short_title': 'Housing Data Profle',
# 'long_title':'ACS Data Profile: Housing Characteristics, ACS 2021 1-Year Data' },
# "DP05": {'short_title': 'Demographic Data Profle',
# 'long_title':'ACS Data Profile: Demographic Characteristics, ACS 2021 1-Year Data' }
# }
# }
# ]
with open(r'Config\\auth.yml') as file:
auth = yaml.load(file, Loader=yaml.FullLoader)
portal_conn = PortalConnector(
portal_username=auth['arc_gis_online']['username'],
portal_pw=auth['arc_gis_online']['pw'])
gis = portal_conn.gis
for data_group in datasets:
c_year = data_group['census_year']
c_prod = data_group['census_product']
for table_code in data_group['specifications'].keys():
specs = data_group['specifications'][table_code]
census_year = c_year
census_product = c_prod
long_title = specs['long_title']
short_title = specs['short_title']
data_prof = DataProfileSpreadsheets(census_year,
census_product,
table_code,
short_title,
long_title)
data_prof.create_workbooks()