Closed tpoisot closed 5 years ago
@tpoisot Let's see if I can do this in half an hour!
:tada: make your PR on master
, and @ me if you have questions!
I don't have much experience with querying a database:
taxon(taxonID::Int)
to indicate that we have a key?args = Dict{String, Any}("name" => 216, "strict" => strict, "verbose" => verbose)
sp_s_url = gbifurl * "species/match"
should then be
sp_s_url = gbifurl * "species"
This is how I understand it from the API, though the body which is collected always matches WELP...
.
Can you point me in the right direction?
@MichielStock the taxa informations are stored as a Pair
: name => id
, so maybe the function can have a method that accepts this. I would see two of them, in fact:
taxon(t::Pair) = taxon(t.second)
function taxon(id::Int)
# general case with only the ID
end
And I think that in your example query, name
should be id
instead.
OK, seems to work, though the result of such a query does not have the keys status
, confidence
and matchType
, which are required by GBIFTaxon(o::Dict{String, Any})
.
I can either
GBIFTaxon
@MichielStock can you open a pull request? I'll have a look at what the changes were, and can give better advice on status
, etc.
By the way, please also add your name to the .zenodo.json
file at the root of the project.
Currently,
taxon
performs only text search, but sometimes the ID of the taxon is known (for example, when we want the genus of a given species). This would require a second method.The
taxon
function is defined here: https://github.com/EcoJulia/GBIF.jl/blob/master/src/taxon.jlThe GBIF API endpoint for taxa by ID is here: http://api.gbif.org/v1/species/216