Commit d149b997 authored by Bruno Duyé's avatar Bruno Duyé

Add GDPbyIndustry (Appendix F)

parent 5880b75a
......@@ -38,13 +38,24 @@ APPENDIX_TO_DOWNLOAD = [
'datasets_list_url': 'https://bea.gov/api/data/?&UserID={api_user_id}&method=GetParameterValues&DataSetName={appendix_code}&ParameterName=TableID',
'series_data_url': 'https://www.bea.gov/api/data/?&UserID={api_user_id}&method=GetData&DataSetName={appendix_code}&TableID={dataset_code}&Year=X',
}
}
},
# 'MNE', # Appendix E – Direct Investment and Multinational Enterprises (MNEs)
# Direct Investment (DI) OR Activities of Multinational Enterprises (AMNE)
# => TODO
# 'GDPbyIndustry', # Appendix F – Gross Domestic Product by Industry (GDPbyIndustry)
# frequency_code = frequency_dict['Key']
# 'series_data': 'https://www.bea.gov/api/data/?&UserID={api_user_id}&method=GetData&DataSetName={appendix_code}&TableID={dataset_code}&Frequency={frequency_code}&Industry=ALL&Year=ALL',
{
'code': 'GDPbyIndustry',
'name': 'Appendix F – Gross Domestic Product by Industry (GDPbyIndustry)',
'cut_on_dimension': True,
'dimension_code': 'FREQ',
'dimension_label': 'Frequency',
'api': {
# "TableID" is deprecated in API doc, but "TableName" is not supported here ...
'datasets_list_url': 'https://bea.gov/api/data/?&UserID={api_user_id}&method=GetParameterValues&DataSetName={appendix_code}&ParameterName=TableID',
'dimensions_values_list_url': 'https://bea.gov/api/data/?&UserID={api_user_id}&method=GetParameterValues&DataSetName={appendix_code}&ParameterName=Frequency',
'dimensions_values_keyname': 'Key',
'series_data_url': 'https://www.bea.gov/api/data/?&UserID={api_user_id}&method=GetData&DataSetName={appendix_code}&TableID={dataset_code}&Frequency={dimension_value_code}&Industry=ALL&Year=ALL',
}
},
# 'ITA', # Appendix G – ITA (International Transactions)
# cut sur AreaOrCountry:
# https://www.bea.gov/api/data/?&UserID=BD92A097-6B55-4FB6-A522-F89DF5A452A7&method=GetParameterValues&DataSetName=ITA&ParameterName=AreaOrCountry
......
......@@ -91,7 +91,7 @@ def main():
datasets_json = [] # Data to be written to datasets.json
# For each dataset
for dataset_info in datasets_list["ParamValue"]:
dataset_code = dataset_info.get('TableName') or dataset_info.get('TableID') or dataset_info.get('TableNumber')
dataset_code = dataset_info.get('TableName') or dataset_info.get('TableID') or dataset_info.get('TableNumber') or dataset_info.get('Key')
assert dataset_code, "Error: can't find dataset code in dataset_info (dataset {!r}):\n{!r}".format(appendix_code, dataset_info)
# Download series data and write series file
if args['--limit_nb_datasets'] and nb_tables_downloaded >= int(args['--limit_nb_datasets']):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment