iDigBio / idigbio-search-api

Server-side code driving iDigBio's search functionality.
GNU General Public License v3.0
24 stars 5 forks source link

Use Case distinct taxon names #1

Closed debpaul closed 9 years ago

debpaul commented 9 years ago

Hi All, does the api support returning a list of distinct taxon names for which we have specimens, if we provide the higher taxonomy or if we search by project, institutioncode, or collection code? A user found all our lichen/bryophytes - and downloaded the dataset - they were very happy. But they said, "now I have to do a lot of work to get just a list of the distinct taxon names present." I'm thinking the api may provide this already? Of course a count(distinct taxon names) would be useful too. If your answer is yes, I'm looking forward to the example.

gete76 commented 9 years ago

there is a Fields option in the API to select which fields to return.

On Fri, Jan 23, 2015 at 11:33 AM, Debbie Paul notifications@github.com wrote:

Hi All, does the api support returning a list of distinct taxon names for which we have specimens, if we provide the higher taxonomy or if we search by project, institutioncode, or collection code? A user found all our lichen/bryophytes - and downloaded the dataset - they were very happy. But they said, "now I have to do a lot of work to get just a list of the distinct taxon names present." I'm thinking the api may provide this already? Of course a count(distinct taxon names) would be useful too. If your answer is yes, I'm looking forward to the example.

— Reply to this email directly or view it on GitHub https://github.com/iDigBio/idigbio-search-api/issues/1.

mjcollin commented 9 years ago

library(ridigbio) ?

R. L. McGregor Herbarium Lichen Collection cd5bc13d-ee5c-4b68-a550-37edb3e7899d

Duke University Herbarium 4830ffb8-669a-4717-bec8-2f2374f52120

recsets <- c("cd5bc13d-ee5c-4b68-a550-37edb3e7899d", "4830ffb8-669a-4717-bec8-2f2374f52120") df <- idig_search(idig_query=list(recordset=recsets), limit=100) namefactor <- as.factor(df$scientificname) print(namefactor)

I haven't written a function to work with the recordsets end point yet so here I've just hard-coded a couple of recordsets from the publishers web page that contain "Lichen" or "Bryophite" in their name. You could also use the search with higher taxonomy to get something that's actually correct but I don't know the genera of all the lichens so I can't do that.

Time, including looking for a pretty-print R function (and failing): 8 minutes.

Matthew Collins IT Expert - Systems Programmer & Administrator Advanced Computing and Information Systems Lab, ECE University of Florida 352-392-5414callto:352-392-5414


From: Greg T. notifications@github.com Sent: Friday, January 23, 2015 12:19 PM To: iDigBio/idigbio-search-api Subject: Re: [idigbio-search-api] Use Case distinct taxon names (#1)

there is a Fields option in the API to select which fields to return.

On Fri, Jan 23, 2015 at 11:33 AM, Debbie Paul notifications@github.com wrote:

Hi All, does the api support returning a list of distinct taxon names for which we have specimens, if we provide the higher taxonomy or if we search by project, institutioncode, or collection code? A user found all our lichen/bryophytes - and downloaded the dataset - they were very happy. But they said, "now I have to do a lot of work to get just a list of the distinct taxon names present." I'm thinking the api may provide this already? Of course a count(distinct taxon names) would be useful too. If your answer is yes, I'm looking forward to the example.

Reply to this email directly or view it on GitHub https://github.com/iDigBio/idigbio-search-api/issues/1.

Reply to this email directly or view it on GitHubhttps://github.com/iDigBio/idigbio-search-api/issues/1#issuecomment-71228719.

godfoder commented 9 years ago

This can also be done via the summary API's top function, although the result is limited to 5000 unique values:

https://github.com/iDigBio/idigbio-search-api/wiki#top-n-records

Example (the top 5000 unique scientific names in the FLMNH collections):

http://beta-search.idigbio.org/v2/summary/top/basic/?rq={%22institutioncode%22:%20[%22uf%22,%22flas%22,%22flmnh%22]}&fields=[%22scientificname%22]&count=5000