Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for additional datasets #21

Open
jo-fleck opened this issue Aug 24, 2022 · 4 comments
Open

Add support for additional datasets #21

jo-fleck opened this issue Aug 24, 2022 · 4 comments

Comments

@jo-fleck
Copy link

The BEA has expanded the list of datasets accessible via the API.

I can see the updated list with BeaData.jl:

using BeaData
using DelimitedFiles

BEA_USER_ID = readdlm("...", String)[1];

df_BEA_datasets = bea_datasets(; user_id = BEA_USER_ID)

julia> df_BEA_datasets
11×2 DataFrame
 Row │ DatasetName              Description                       
     │ String                   String                            
─────┼────────────────────────────────────────────────────────────
   1 │ NIPA                     Standard NIPA tables
   2 │ NIUnderlyingDetail       Standard NI underlying detail ta…
   3 │ MNE                      Multinational Enterprises
   4 │ FixedAssets              Standard Fixed Assets tables
   5 │ ITA                      International Transactions Accou…
   6 │ IIP                      International Investment Position
   7 │ InputOutput              Input-Output Data
   8 │ IntlServTrade            International Services Trade
   9 │ GDPbyIndustry            GDP by Industry
  10 │ Regional                 Regional data sets
  11 │ UnderlyingGDPbyIndustry  Underlying GDP by Industry

However, when I try to download a table of the Regional dataset, I get an unsupported error:

julia> data_test = bea_table("Regional", "T60500A", "A", 2015, 2018; user_id = BEA_USER_ID)
ERROR: Dataset Regional not supported.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] bea_table(dataset::String, TableName::String, frequency::String, startyear::Int64, endyear::Int64; user_id::String)
   @ BeaData ~/.julia/packages/BeaData/4Rqya/src/bea_table.jl:33
 [3] top-level scope
   @ REPL[26]:1

Any plans to include the additional datasets? (Would be very useful I think.)

@stephenbnicar
Copy link
Owner

@jo-fleck
The supported datasets are listed in the documentation: Supported Datasets

The choice of supported datasets was practical: calls to the API for those datasets all return in the same format. The other datasets return in a different format that would need some non-trivial additional work to implement. It's always been my intention to include them eventually (particularly the International Accounts) but I've never gotten around to it. Honestly, I wasn't sure if anyone other than me was even using this package! Your comment may be the thing to get me to finally start working on it.

I'm also open to pull requests. :)

@jo-fleck
Copy link
Author

Thanks for the explanation. Looking at the number of stars and forks, it seems there is a good amount of interest.

I haven't checked but maybe some of the other tables return fairly similar formats (at least relative to each other)? Also, if you read R, you could get some help with the formats from this package: https://github.com/us-bea/bea.R

(Not sure about the International Accounts, but it definitely supports the Regional Data.)

@stephenbnicar
Copy link
Owner

It's been a while since I looked, but if I recall correctly the other datasets may need to be dealt with individually; I think that's why I put it off, aside from the fact that I don't use any but the NIPA and International accounts and the package was originally written just for my personal use and as a way to learn Julia. I've looked at the BEA's R package before, but it's been a while. Surprisingly perhaps, given the ubiquity of R, my package predates the BEA's package by a year or two. The first version was started when Julia was in version 0.4 or 0.5. Anyway, thanks for the suggestion. If I add the regional sets I'll ping you so you can test it.

@jo-fleck
Copy link
Author

Sounds good. Thanks a lot - will be happy to test!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants