You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Using API to Retrieve Data from the World Bank #128
I found that we used static datasets of the World Bank dataset in our lecture. I think packages like wbapi can help us retrieve data conveniently from the World Bank API, and it worked very well when I wrote the lecture on business cycles.
Therefore, I think using the same set of tools across this lecture series can make the lecture more consistent. It also gives us the leverage to show more diverse datasets from different sources and helps us to keep our lectures up to date whenever new data comes out without replacing a lot of static datasets.
Please kindly let me know what are your opinions on this (CC @mmcky and @jstac).
@mmcky For context, @HumphreyYang made some good points about using APIs rather than storing our own smaller versions of data sets. We thought it would be helpful to have an issue where we can discuss this point.
In some cases, we stored our own data because no API was available. I think @shlff 's lecture on inequality fits this pattern.
Are there other cases where we could have used an API? What policy should we adopt?
Using APIs gives some added value by helping students get started on their own data projects...
Our experience in the past with using API based data retrieval is it introduces some stochastic errors into the build process. From time to time the API will time out or change and cause build errors.
In the case of the wbapi I have used it to good effect -- it is one of the higher quality services and could be worth teaching explicitly (as a side benefit of the lecture) so I would be OK if we used the wbapi python application to fetch the wb datasets.
But it really needs to be constrained to these high quality and maintained sources.
The pandas_datareader app has historically been error prone as interfaces to things like Yahoo would be slow to update when yahoo changed its API. This would cause build errors until the reader was updated. This is the main reason we typically use locally stored datasets -- to improve robustness.
In some cases, we stored our own data because no API was available. I think @shlff 's lecture on inequality fits this pattern.
There are a lot of these cases really. The long_run_growth lecture will be the same using the Maddison dataset.
Using APIs gives some added value by helping students get started on their own data projects...
This is a good point @jstac and probably worth the risk for high quality data fetching tools such as wbapi
Would you suggest I store the data I used in #24 from pandas_datareader in a static format?
I think in the case of FRED, unlike Yahoo, it seldom changes its API as an institution, and it has worked out fine in my previous uses. How about if I keep this issue open, and revert back to static datasets if we have a build issue caused by pandas_datareader?
Please let me know if you think it is a good plan.
@HumphreyYang let's go ahead and use the api approach. It isn't always fragility in the api but sometimes build issues caused by frequent access and multiple builds causing 403 responses etc. Let's give this a go and if we get build errors we can move back to static assets.
Activity
jstac commentedon Mar 10, 2023
@mmcky For context, @HumphreyYang made some good points about using APIs rather than storing our own smaller versions of data sets. We thought it would be helpful to have an issue where we can discuss this point.
In some cases, we stored our own data because no API was available. I think @shlff 's lecture on inequality fits this pattern.
Are there other cases where we could have used an API? What policy should we adopt?
Using APIs gives some added value by helping students get started on their own data projects...
mmcky commentedon Mar 16, 2023
Thanks for your thoughts on this @HumphreyYang.
Our experience in the past with using
APIbased data retrieval is it introduces somestochasticerrors into the build process. From time to time theAPIwill time out or change and cause build errors.In the case of the
wbapiI have used it to good effect -- it is one of the higher quality services and could be worth teaching explicitly (as a side benefit of the lecture) so I would be OK if we used thewbapipython application to fetch thewbdatasets.But it really needs to be constrained to these high quality and maintained sources.
The
pandas_datareaderapp has historically been error prone as interfaces to things like Yahoo would be slow to update when yahoo changed its API. This would cause build errors until the reader was updated. This is the main reason we typically use locally stored datasets -- to improverobustness.There are a lot of these cases really. The
long_run_growthlecture will be the same using theMaddisondataset.This is a good point @jstac and probably worth the risk for high quality
datafetching tools such aswbapijstac commentedon Mar 16, 2023
Thanks for those thoughts @mmcky .
@HumphreyYang , thanks for opening the discussion. It sounds like we have a good rule of thumb to proceed. (If you are happy please close the issue.)
HumphreyYang commentedon Mar 16, 2023
Thanks for your thoughtful suggestions @mmcky.
Would you suggest I store the data I used in #24 from
pandas_datareaderin a static format?I think in the case of FRED, unlike Yahoo, it seldom changes its API as an institution, and it has worked out fine in my previous uses. How about if I keep this issue open, and revert back to static datasets if we have a build issue caused by
pandas_datareader?Please let me know if you think it is a good plan.
Many thanks in advance.
jstac commentedon Apr 23, 2023
@mmcky Could you please close this or move it to meta?
mmcky commentedon May 30, 2023
@HumphreyYang let's go ahead and use the
apiapproach. It isn't always fragility in theapibut sometimes build issues caused by frequent access and multiple builds causing403responses etc. Let's give this a go and if we get build errors we can move back to static assets.