Code Monkey home page Code Monkey logo

beadata.jl's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

beadata.jl's Issues

Return error description if request returns "Error" Dict

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.

No BEA UserID found!

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?

Error on every other pull

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

TagBot trigger issue

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!

Add support for additional datasets

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.)

http update

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.