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

Getting 404 error for some species #13

Open
CottonRockwood opened this issue Oct 27, 2014 · 6 comments
Open

Getting 404 error for some species #13

CottonRockwood opened this issue Oct 27, 2014 · 6 comments

Comments

@CottonRockwood
Copy link

It looks like there is still an issue with the Openfisheries database/API. For some species codes, I'm getting a 404 error from of_landings. For example:

sp_to_get$a3_code[c(1,10, 11, 13)]
[1] "GGG" "OPL" "DUF" "LLE"
of_landings("OPL")
Error in of_landings("OPL") : client error: (404) Not Found
of_landings("DUF")
Error in of_landings("DUF") : client error: (404) Not Found
of_landings("LLE")
Error in of_landings("LLE") : client error: (404) Not Found

Perhaps these are the species with no landings data?

@andrewjdyck
Copy link
Member

I believe that these are species codes with no landings data. I think there are three ways to address this: 1. Remove species codes with zero landings from species.json in the api. 2. Handle 404 better in the api. 3. Handle 404 differently in the rfisheries package.

I'm not a huge fan of option #1 as that data for other species could be useful to some people. I think that the solution would be in a combination of 2&3.

@karthik
Copy link
Member

karthik commented Oct 29, 2014

@andrewjdyck Serving empty strings instead of a 404 would be ideal (I believe that's how it worked before).

@CottonRockwood
Copy link
Author

If indeed these are all species with no landings, then returning an empty string seems like a good solution.

@CottonRockwood
Copy link
Author

Looks like none of my examples are listed in the FAO Global Catch statistics, so it looks like the conjecture that they are species with no landings is probably correct.

@andrewjdyck
Copy link
Member

After a bit more research, I'm thinking that the best solution for the time being will be to update the species json file so that only those with landings are included. I'll open a few issues under the openfisheries project to highlight the development plan for adding a separate section of the api for species info, including those without landings.

I'll also highlight that the preferred method for serving null info from the API will be to serve a null string, however, I think this is lower priority at the moment. I'm hosting the API on github right now and it appears non-trivial to implement this way. Other github based apis such as the UNDP serve 404.html for improperly formatted API queries. I'd rather focus my energy on some other enhancements over serving empty strings.

Also, @CottonRockwood, I suspect that you might be interested in checking out the openfisheries project to find the raw CSV data I use for the API. There are some R utilities in there for massaging the data into a more useful format as well if you are looking at getting something out of the API that doesn't currently exist. Of course, I'd love to incorporate any additions/improvements to the openfisheries project if you have them. Please, feel free to e-mail me directly if you are interested.

@CottonRockwood
Copy link
Author

Thanks, Andrew. I'll check out the openfisheries csv and your R utilities.

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

No branches or pull requests

3 participants