stephenbnicar / beadata.jl Goto Github PK
View Code? Open in Web Editor NEWA Julia interface for retrieving data from the Bureau of Economic Analysis (BEA).
License: Other
A Julia interface for retrieving data from the Bureau of Economic Analysis (BEA).
License: Other
It seems like most of the time, I get an error on every other request that I make. If I just submit the same request after receiving the error, it will work fine. I've pasted the stacktrace.
ERROR: IOError: write: broken pipe (EPIPE)
Stacktrace:
[1] try_yieldto(::typeof(Base.ensure_rescheduled), ::Base.RefValue{Task}) at ./event.jl:196
[2] wait() at ./event.jl:255
[3] uv_write(::Sockets.TCPSocket, ::Ptr{UInt8}, ::UInt64) at ./stream.jl:853
[4] unsafe_write(::Sockets.TCPSocket, ::Ptr{UInt8}, ::UInt64) at ./stream.jl:901
[5] f_send(::Ptr{Nothing}, ::Ptr{UInt8}, ::UInt64) at /home/tyler/.julia/packages/MbedTLS/X4xar/src/ssl.jl:255
[6] ssl_close_notify(::MbedTLS.SSLContext) at /home/tyler/.julia/packages/MbedTLS/X4xar/src/ssl.jl:728
[7] close(::MbedTLS.SSLContext) at /home/tyler/.julia/packages/MbedTLS/X4xar/src/ssl.jl:190
[8] close at /home/tyler/.julia/packages/HTTP/GN0Te/src/ConnectionPool.jl:336 [inlined]
[9] close(::HTTP.ConnectionPool.Transaction{MbedTLS.SSLContext}) at /home/tyler/.julia/packages/HTTP/GN0Te/src/ConnectionPool.jl:325
[10] #request#1(::Nothing, ::Type, ::Int64, ::Base.Iterators.Pairs{Symbol,Nothing,Tuple{Symbol},NamedTuple{(:iofunction,),Tuple{Nothing}}}, ::Function, ::Type{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer}}, ::HTTP.URIs.URI, ::HTTP.Messages.Request, ::Array{UInt8,1}) at /home/tyler/.julia/packages/HTTP/GN0Te/src/ConnectionRequest.jl:60
[11] #request at ./none:0 [inlined]
[12] #request#1 at /home/tyler/.julia/packages/HTTP/GN0Te/src/ExceptionRequest.jl:19 [inlined]
[13] (::getfield(HTTP, Symbol("#kw##request")))(::NamedTuple{(:iofunction,),Tuple{Nothing}}, ::typeof(HTTP.request), ::Type{HTTP.ExceptionRequest.ExceptionLayer{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer}}}, ::HTTP.URIs.URI, ::HTTP.Messages.Request, ::Array{UInt8,1}) at ./none:0
[14] (::getfield(Base, Symbol("###48#49#50")){ExponentialBackOff,getfield(HTTP.RetryRequest, Symbol("##2#3")){Bool,HTTP.Messages.Request},typeof(HTTP.request)})(::Base.Iterators.Pairs{Symbol,Nothing,Tuple{Symbol},NamedTuple{(:iofunction,),Tuple{Nothing}}}, ::Function, ::Type, ::Vararg{Any,N} where N) at ./error.jl:231
[15] ##48#51 at ./none:0 [inlined]
[16] #request#1 at /home/tyler/.julia/packages/HTTP/GN0Te/src/RetryRequest.jl:44 [inlined]
[17] #request at ./none:0 [inlined]
[18] #request#1(::VersionNumber, ::String, ::Nothing, ::Nothing, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Type{HTTP.MessageRequest.MessageLayer{HTTP.RetryRequest.RetryLayer{HTTP.ExceptionRequest.ExceptionLayer{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer}}}}}, ::String, ::HTTP.URIs.URI, ::Array{Pair{SubString{String},SubString{String}},1}, ::Array{UInt8,1}) at /home/tyler/.julia/packages/HTTP/GN0Te/src/MessageRequest.jl:47
[19] request at /home/tyler/.julia/packages/HTTP/GN0Te/src/MessageRequest.jl:28 [inlined]
[20] #request#1(::Int64, ::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Type{HTTP.RedirectRequest.RedirectLayer{HTTP.MessageRequest.MessageLayer{HTTP.RetryRequest.RetryLayer{HTTP.ExceptionRequest.ExceptionLayer{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer}}}}}}, ::String, ::HTTP.URIs.URI, ::Array{Pair{SubString{String},SubString{String}},1}, ::Array{UInt8,1}) at /home/tyler/.julia/packages/HTTP/GN0Te/src/RedirectRequest.jl:24
[21] request(::Type{HTTP.RedirectRequest.RedirectLayer{HTTP.MessageRequest.MessageLayer{HTTP.RetryRequest.RetryLayer{HTTP.ExceptionRequest.ExceptionLayer{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer}}}}}}, ::String, ::HTTP.URIs.URI, ::Array{Pair{SubString{String},SubString{String}},1}, ::Array{UInt8,1}) at /home/tyler/.julia/packages/HTTP/GN0Te/src/RedirectRequest.jl:21
[22] #request#5(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::String, ::HTTP.URIs.URI, ::Array{Pair{SubString{String},SubString{String}},1}, ::Array{UInt8,1}) at /home/tyler/.julia/packages/HTTP/GN0Te/src/HTTP.jl:300
[23] request at /home/tyler/.julia/packages/HTTP/GN0Te/src/HTTP.jl:300 [inlined]
[24] #request#6 at /home/tyler/.julia/packages/HTTP/GN0Te/src/HTTP.jl:314 [inlined]
[25] request at /home/tyler/.julia/packages/HTTP/GN0Te/src/HTTP.jl:310 [inlined] (repeats 2 times)
[26] #get#13 at /home/tyler/.julia/packages/HTTP/GN0Te/src/HTTP.jl:382 [inlined]
[27] get at /home/tyler/.julia/packages/HTTP/GN0Te/src/HTTP.jl:382 [inlined]
[28] get_nipa_table(::Bea, ::String, ::String, ::Int64, ::Int64) at /home/tyler/.julia/packages/BeaData/ANv0B/src/get_nipa_table.jl:31
[29] top-level scope at none:0
Nice package BTW
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.)
When NIPA dataset is unavailable, the ["BEAAPI"]["Results"] Dict contains an ["Error"] Dict (instead of a ["Data"] Dict) with two keys: "APIErrorCode" and "APIErrorDescription". Should revise the get_nipa_table function (and others?) to return the error description rather than throwing an exception.
Using GetParameterValues
method.
This issue is used to trigger TagBot; feel free to unsubscribe.
If you haven't already, you should update your TagBot.yml
to include issue comment triggers.
Please see this post on Discourse for instructions and more details.
If you'd like for me to do this for you, comment TagBot fix
on this issue.
I'll open a PR within a few hours, please be patient!
Hi, it seems this is a nice package, however I don't know how to solve this error:
"No BEA UserID found!"
I've tried in this ways:
USER_ID = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
user_id = USER_ID
using DelimitedFiles
BEA_USER_ID = readdlm("bea_key.txt", String)[1];
UserID = readdlm("bea_key.txt", String)[1];
BEA_USER_ID = readdlm(".beadatarc", String)[1];
using BeaData
None of them works. Can you add an example using the User_ID into the code?
BeaData.jl is currently blocking my attempts to update to the latest http.jl version. Changing Project.toml to
HTTP = "^0.8.14, 0.9, 1.2"
works well on my local machine
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.