diff --git a/DESCRIPTION b/DESCRIPTION index 7f09d72f..7da4b4ca 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -8,7 +8,7 @@ Description: A programmatic interface to the Web Service methods retrieving information on data providers, getting species occurrence records, getting counts of occurrence records, and using the GBIF tile map service to make rasters summarizing huge amounts of data. -Version: 3.8.2.2 +Version: 3.8.2.3 License: MIT + file LICENSE Authors@R: c( person("Scott", "Chamberlain", role = "aut", comment = c("0000-0003-1444-9135")), diff --git a/NAMESPACE b/NAMESPACE index 2cbe0abd..a0300687 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -29,6 +29,8 @@ export(GbifQueue) export(as.download) export(blanktheme) export(check_wkt) +export(collection_export) +export(collection_search) export(count_facet) export(dataset) export(dataset_comment) @@ -70,6 +72,8 @@ export(gbif_oai_list_sets) export(gbif_photos) export(gbif_wkt2bbox) export(installations) +export(institution_export) +export(institution_search) export(lit_count) export(lit_export) export(lit_search) diff --git a/R/collection_search.R b/R/collection_search.R new file mode 100644 index 00000000..ce079344 --- /dev/null +++ b/R/collection_search.R @@ -0,0 +1,320 @@ +#' Search GRSciColl collections +#' +#' @param query Simple full text search parameter. The value for this parameter +#' can be a simple word or a phrase. Wildcards are not supported. +#' @param name Name of a GrSciColl institution or collection. +#' @param fuzzyName It searches by name fuzzily so the parameter doesn't have +#' to be the exact name. +#' @param preservationType Preservation type of a GrSciColl collection. Accepts +#' multiple values. +#' @param contentType Content type of a GrSciColl collection. See here for +#' accepted values : +#' https://techdocs.gbif.org/en/openapi/v1/registry#/Collections/listCollections +#' @param numberSpecimens Number of specimens. It supports ranges and a `*` can +#' be used as a wildcard. +#' @param accessionStatus Accession status of a GrSciColl collection. Accepted +#' values : INSTITUTIONAL, PROJECT +#' @param personalCollection Flag for personal GRSciColl collections. +#' @param sourceId sourceId of MasterSourceMetadata. +#' @param source Source attribute of MasterSourceMetadata. Accepted values : +#' DATASET, ORGANIZATION, IH_IRN +#' @param code Code of a GrSciColl institution or collection. +#' @param alternativeCode Alternative code of a GrSciColl institution or +#' collection. +#' @param contact Filters collections and institutions whose contacts contain +#' the person key specified. +#' @param institutionKey Keys of institutions to filter by. +#' @param country Filters by country given as a ISO 639-1 (2 letter) country +#' code. +#' @param city Filters by the city of the address. It searches in both the +#' physical and the mailing address. +#' @param gbifRegion Filters by a gbif region +#' Available values : AFRICA, ASIA, EUROPE, NORTH_AMERICA, OCEANIA, +#' LATIN_AMERICA, ANTARCTICA. +#' @param machineTagNamespace Filters for entities with a machine tag in the +#' specified namespace. +#' @param machineTagName Filters for entities with a machine tag with the +#' specified name (use in combination with the machineTagNamespace parameter). +#' @param machineTagValue Filters for entities with a machine tag with the +#' specified value (use in combination with the machineTagNamespace and +#' machineTagName parameters). +#' @param identifier An identifier of the type given by the identifierType +#' parameter, for example a DOI or UUID. +#' @param identifierType An identifier type for the identifier parameter. +#' Available values : URL, LSID, HANDLER, DOI, UUID, FTP, URI, UNKNOWN, +#' GBIF_PORTAL, GBIF_NODE, GBIF_PARTICIPANT, GRSCICOLL_ID, GRSCICOLL_URI, +#' IH_IRN, ROR, GRID, CITES, SYMBIOTA_UUID, WIKIDATA, NCBI_BIOCOLLECTION, +#' ISIL, CLB_DATASET_KEY. +#' @param active Active status of a GrSciColl institution or collection. +#' @param displayOnNHCPortal Flag to show this record in the NHC portal. +#' @param alternativeCode Alternative code of a GrSciColl institution or +#' collection. +#' @param masterSourceType The master source type of a GRSciColl institution. +#' or collection. Available values : GRSCICOLL, GBIF_REGISTRY, IH. +#' @param replacedBy Key of the entity that replaced another entity. +#' @param sortBy Field to sort the results by. It only supports the fields +#' contained in the enum. Available values : NUMBER_SPECIMENS. +#' @param sortOrder Sort order to use with the sortBy parameter. +#' Available values : ASC, DESC. +#' @param offset Determines the offset for the search results. +#' @param limit Controls the number of results in the page. Default 20. +#' @param format (character) Format of the export. Default is "TSV". +#' Only used for [collection_export]. +#' @param curlopts curlopts options passed on to [crul::HttpClient]. +#' +#' @details Will return GRSciColl collections data. [collection_export] will +#' return all of the results in a single `tibble`, while [collection_search] will +#' return a sample of results. +#' +#' @return a `list` +#' @export +#' +#' @references +#' https://scientific-collections.gbif.org/connected-systems#grscicoll-data-coming-from-other-sources +#' @examples \dontrun{ +#' collection_search(query="insect",limit=2) +#' collection_search(name="Insects;Entomology", limit=2) +#' collection_search(numberSpecimens = "0,100", limit=1) +#' collection_search(institutionKey = "6a6ac6c5-1b8a-48db-91a2-f8661274ff80" +#' , limit = 1) +#' collection_search(query = "insect", country = "US;GB", limit=1) +#' } +collection_search <- function( + query = NULL, + name = NULL, + fuzzyName = NULL, + preservationType = NULL, + contentType = NULL, + numberSpecimens = NULL, + accessionStatus = NULL, + personalCollection = NULL, + sourceId = NULL, + source = NULL, + code = NULL, + alternativeCode = NULL, + contact = NULL, + institutionKey = NULL, + country = NULL, + city = NULL, + gbifRegion = NULL, + machineTagNamespace = NULL, + machineTagName = NULL, + machineTagValue = NULL, + identifier = NULL, + identifierType = NULL, + active = NULL, + displayOnNHCPortal = NULL, + masterSourceType = NULL, + replacedBy = NULL, + sortBy = NULL, + sortOrder = NULL, + offset = NULL, + limit = NULL, + format = NULL, + curlopts = list() + ) { + + assert(query,"character") + assert(name,"character") + assert(fuzzyName,"character") + assert(preservationType,"character") + assert(contentType, "character") + assert(accessionStatus,"character") + assert(personalCollection,"logical") + assert(source,"character") + assert(code,"character") + assert(alternativeCode,"character") + assert(contact,"character") + assert(institutionKey,"character") + assert(country,"character") + assert(city,"character") + assert(gbifRegion,"character") + assert(machineTagNamespace,"character") + assert(machineTagName,"character") + assert(identifierType,"character") + assert(active,"logical") + assert(displayOnNHCPortal,"logical") + assert(alternativeCode,"character") + assert(masterSourceType,"character") + assert(replacedBy,"character") + assert(sortBy,"character") + assert(limit,"numeric") + assert(offset,"numeric") + + # check for valid values + if(!is.null(sortBy)) { + match.arg(sortBy, c("NUMBER_SPECIMENS")) + } + if(!is.null(sortOrder)) { + match.arg(sortOrder, c("ASC", "DESC")) + } + + args <- as.list( + rgbif_compact(c( + q = query, + numberSpecimens = numberSpecimens, + accessionStatus = accessionStatus, + active = active, + displayOnNHCPortal = displayOnNHCPortal, + replacedBy = replacedBy, + sortBy = sortBy, + sortOrder = sortOrder, + offset = offset, + limit = limit + ))) + + args <- rgbif_compact(c( + args, + convmany(name), + convmany(fuzzyName), + convmany(preservationType), + convmany(contentType), + convmany(personalCollection), + convmany(sourceId), + convmany(source), + convmany(code), + convmany(alternativeCode), + convmany(contact), + convmany(institutionKey), + convmany(country), + convmany(city), + convmany(gbifRegion), + convmany(machineTagNamespace), + convmany(machineTagName), + convmany(machineTagValue), + convmany(identifier), + convmany(identifierType), + convmany(masterSourceType) + )) + + url <- paste0(gbif_base(), '/grscicoll/collection') + tt <- gbif_GET(url, args, TRUE, curlopts) + + meta <- tt[c('offset','limit','endOfRecords','count')] + data <- tibble::as_tibble(tt$results) + + list(meta = as.data.frame(meta), data = data) +} + +#' @export +#' @rdname collection_search +collection_export <- function( + query = NULL, + name = NULL, + fuzzyName = NULL, + preservationType = NULL, + contentType = NULL, + numberSpecimens = NULL, + accessionStatus = NULL, + personalCollection = NULL, + sourceId = NULL, + source = NULL, + code = NULL, + alternativeCode = NULL, + contact = NULL, + institutionKey = NULL, + country = NULL, + city = NULL, + gbifRegion = NULL, + machineTagNamespace = NULL, + machineTagName = NULL, + machineTagValue = NULL, + identifier = NULL, + identifierType = NULL, + active = NULL, + displayOnNHCPortal = NULL, + masterSourceType = NULL, + replacedBy = NULL, + sortBy = NULL, + sortOrder = NULL, + offset = NULL, + limit = NULL, + format = "TSV", + curlopts = list() +) { + + # https://api.gbif.org/v1/grscicoll/collection/export?format=TSV&displayOnNHCPortal=true + assert(query,"character") + assert(name,"character") + assert(fuzzyName,"character") + assert(preservationType,"character") + assert(contentType, "character") + assert(accessionStatus,"character") + assert(personalCollection,"logical") + assert(source,"character") + assert(code,"character") + assert(alternativeCode,"character") + assert(contact,"character") + assert(institutionKey,"character") + assert(country,"character") + assert(city,"character") + assert(gbifRegion,"character") + assert(machineTagNamespace,"character") + assert(machineTagName,"character") + assert(identifierType,"character") + assert(active,"logical") + assert(displayOnNHCPortal,"logical") + assert(alternativeCode,"character") + assert(masterSourceType,"character") + assert(replacedBy,"character") + assert(sortBy,"character") + assert(limit,"numeric") + assert(offset,"numeric") + + if(format != "TSV") { + warning("Only 'TSV' format is supported for collection_export") + } + if(!is.null(limit) | !is.null(offset)) { + warning("Limit and offset are ignored for collection_export. The full export + is returned.") + } + + args <- as.list( + rgbif_compact(c( + q = query, + numberSpecimens = numberSpecimens, + accessionStatus = accessionStatus, + active = active, + displayOnNHCPortal = displayOnNHCPortal, + replacedBy = replacedBy, + sortBy = sortBy, + sortOrder = sortOrder, + offset = offset, + limit = limit, + format = format + ))) + + args <- rgbif_compact(c( + args, + convmany(name), + convmany(fuzzyName), + convmany(preservationType), + convmany(contentType), + convmany(personalCollection), + convmany(sourceId), + convmany(source), + convmany(code), + convmany(alternativeCode), + convmany(contact), + convmany(institutionKey), + convmany(country), + convmany(city), + convmany(gbifRegion), + convmany(machineTagNamespace), + convmany(machineTagName), + convmany(machineTagValue), + convmany(identifier), + convmany(identifierType), + convmany(masterSourceType) + )) + + url_query <- paste0(names(args),"=",args,collapse="&") + url_query <- utils::URLencode(url_query) + url <- paste0(gbif_base(),"/grscicoll/collection/export?",url_query) + temp_file <- tempfile() + utils::download.file(url,destfile=temp_file,quiet=TRUE) + out <- tibble::as_tibble(data.table::fread(temp_file, showProgress=FALSE)) + colnames(out) <- to_camel(colnames(out)) + out +} + diff --git a/R/institution_search.R b/R/institution_search.R new file mode 100644 index 00000000..bec729ba --- /dev/null +++ b/R/institution_search.R @@ -0,0 +1,329 @@ +#' Search GRSciColl institutions +#' +#' @param query (character) Simple full text search parameter. The value for +#' this parameter can be a simple word or a phrase. Wildcards are not supported +#' @param type (character) Type of a GrSciColl institution +#' Available values : BIOMEDICAL_RESEARCH_INSTITUTE, BOTANICAL_GARDEN, +#' HERBARIUM, LIVING_ORGANISM_COLLECTION, MEDICAL_RESEARCH_INSTITUTE, MUSEUM, +#' MUSEUM_HERBARIUM_PRIVATE_NON_PROFIT, OTHER_INSTITUTIONAL_TYPE, +#' OTHER_TYPE_RESEARCH_INSTITUTION_BIOREPOSITORY, UNIVERSITY_COLLEGE, +#' ZOO_AQUARIUM +#' @param institutionalGovernance (character) Instutional governance of a +#' GrSciColl institution Available values : ACADEMIC_FEDERAL, +#' ACADEMIC_FOR_PROFIT, ACADEMIC_LOCAL, ACADEMIC_NON_PROFIT, ACADEMIC_STATE, +#' FEDERAL, FOR_PROFIT, LOCAL, NON_PROFIT, OTHER, STATE. +#' @param disciplines (character) Discipline of a GrSciColl institution. +#' Check available values : +#' https://techdocs.gbif.org/en/openapi/v1/registry#/Institutions/listInstitutions +#' @param name (character) Name of a GrSciColl institution or collection +#' @param fuzzyName (character) It searches by name fuzzily so the parameter +#' doesn't have to be the exact name. +#' @param numberSpecimens (character) Number of specimens. It supports ranges +#' and a `*` can be used as a wildcard. +#' @param occurrenceCount (character) Count of occurrences linked. It supports +#' ranges and a `*` can be used as a wildcard. +#' @param typeSpecimenCount (character) Count of type specimens linked. It +#' supports ranges and a `*` can be used as a wildcard. +#' @param sourceId (character) sourceId of MasterSourceMetadata +#' @param source (character) Source attribute of MasterSourceMetadata +#' Available values : DATASET, ORGANIZATION, IH_IRN +#' @param code (character) Code of a GrSciColl institution or collection. +#' @param alternativeCode (character) Alternative code of a GrSciColl institution. +#' @param contact (character) Filters collections and institutions whose +#' contacts contain the person key specified. +#' @param institutionKey (character) Keys of institutions to filter by. +#' @param country (character) Filters by country given as a ISO 639-1 (2 letter) +#' country code. +#' @param city (character) Filters by the city of the address. It searches in both the +#' physical and the mailing address. +#' @param gbifRegion (character) Filters by a gbif region. Available values : AFRICA, ASIA, +#' EUROPE, NORTH_AMERICA, OCEANIA, LATIN_AMERICA, ANTARCTICA. +#' @param machineTagNamespace (character) Filters for entities with a machine +#' tag in the specified namespace. +#' @param machineTagName (character) Filters for entities with a machine tag +#' with the specified name (use in combination with the machineTagNamespace +#' parameter). +#' @param machineTagValue (character) Filters for entities with a machine tag +#' with the specified value (use in combination with the machineTagNamespace and +#' machineTagName parameters). +#' @param identifier (character) An identifier of the type given by the +#' `identifierType` parameter, for example a DOI or UUID. +#' @param identifierType (character) An identifier type for the +#' identifier parameter. +#' Available values : URL, LSID, HANDLER, DOI, UUID, FTP, URI, UNKNOWN, +#' GBIF_PORTAL, GBIF_NODE, GBIF_PARTICIPANT, GRSCICOLL_ID, GRSCICOLL_URI, +#' IH_IRN, ROR, GRID, CITES, SYMBIOTA_UUID, WIKIDATA, NCBI_BIOCOLLECTION, ISIL, +#' CLB_DATASET_KEY. +#' @param active (logical) Active status of a GrSciColl institution or collection. +#' @param displayOnNHCPortal (logical) Flag to show this record in the NHC +#' portal. +#' @param masterSourceType (character) The master source type of a GRSciColl +#' institution or collection. Available values : GRSCICOLL, GBIF_REGISTRY, IH. +#' @param replacedBy (character) Key of the entity that replaced another entity. +#' @param sortBy (character) Field to sort the results by. It only supports the +#' fields contained in the enum. Available values : NUMBER_SPECIMENS. +#' @param sortOrder (character) Sort order to use with the sortBy parameter. +#' Available values : ASC, DESC. +#' @param offset (numeric) Determines the offset for the search results. +#' @param limit (numeric) Controls the number of results in the page. +#' Default 20. +#' @param format (character) Format of the export. Default is "TSV". Only used +#' for [institution_export]. +#' @param curlopts (list) curlopts options passed on to [crul::HttpClient]. +#' +#' @details Will return GRSciColl collections data. [institution_export] will +#' return all of the results in a single `tibble`, while [institution_search] will +#' return a sample of results. +#' +#' @return A `list` +#' @export +#' +#' @examples \dontrun{ +#' institution_search(query="Kansas",limit=1) +#' institution_search(numberSpecimens = "1000,*",limit=2) +#' institution_search(source = "IH_IRN") +#' institution_search(country = "US;GB") +#' institution_search(typeSpecimenCount = "10,100") +#' +#' } +institution_search <- function( + query = NULL, + type = NULL, + institutionalGovernance = NULL, + disciplines = NULL, + name = NULL, + fuzzyName = NULL, + numberSpecimens = NULL, + occurrenceCount = NULL, + typeSpecimenCount = NULL, + sourceId = NULL, + source = NULL, + code = NULL, + alternativeCode = NULL, + contact = NULL, + institutionKey = NULL, + country = NULL, + city = NULL, + gbifRegion = NULL, + machineTagNamespace = NULL, + machineTagName = NULL, + machineTagValue = NULL, + identifier = NULL, + identifierType = NULL, + active = NULL, + displayOnNHCPortal = NULL, + masterSourceType = NULL, + replacedBy = NULL, + sortBy = NULL, + sortOrder = NULL, + offset = NULL, + limit = NULL, + format = NULL, + curlopts = list() + ) { + assert(query, "character") + assert(type, "character") + assert(institutionalGovernance, "character") + assert(disciplines, "character") + assert(name, "character") + assert(fuzzyName, "character") + assert(source, "character") + assert(sourceId, "character") + assert(code, "character") + assert(alternativeCode, "character") + assert(contact, "character") + assert(institutionKey, "character") + assert(country, "character") + assert(city, "character") + assert(gbifRegion, "character") + assert(machineTagNamespace, "character") + assert(machineTagName, "character") + assert(identifierType, "character") + assert(active, "logical") + assert(displayOnNHCPortal, "logical") + assert(masterSourceType, "character") + assert(replacedBy, "character") + assert(sortBy, "character") + assert(sortOrder, "character") + assert(offset, "numeric") + assert(limit, "numeric") + + # check for valid values + if(!is.null(sortBy)) { + match.arg(sortBy, c("NUMBER_SPECIMENS")) + } + if(!is.null(sortOrder)) { + match.arg(sortOrder, c("ASC", "DESC")) + } + + args <- as.list( + rgbif_compact(c( + q = query, + numberSpecimens = numberSpecimens, + occurrenceCount = occurrenceCount, + typeSpecimenCount = typeSpecimenCount, + active = active, + displayOnNHCPortal = displayOnNHCPortal, + replacedBy = replacedBy, + sortBy = sortBy, + sortOrder = sortOrder, + offset = offset, + limit = limit + ))) + + args <- rgbif_compact( + c( + args, + convmany(type), + convmany(institutionalGovernance), + convmany(disciplines), + convmany(name), + convmany(fuzzyName), + convmany(sourceId), + convmany(source), + convmany(code), + convmany(alternativeCode), + convmany(contact), + convmany(institutionKey), + convmany(country), + convmany(city), + convmany(gbifRegion), + convmany(machineTagNamespace), + convmany(machineTagName), + convmany(machineTagValue), + convmany(identifier), + convmany(identifierType) + )) + + url <- paste0(gbif_base(), "/grscicoll/institution") + tt <- gbif_GET(url, args, TRUE, curlopts) + + meta <- tt[c('offset','limit','endOfRecords','count')] + data <- tibble::as_tibble(tt$results) + + list(meta = as.data.frame(meta), data = data) +} + +#' @export +#' @rdname institution_search +institution_export <- function( + query = NULL, + type = NULL, + institutionalGovernance = NULL, + disciplines = NULL, + name = NULL, + fuzzyName = NULL, + numberSpecimens = NULL, + occurrenceCount = NULL, + typeSpecimenCount = NULL, + sourceId = NULL, + source = NULL, + code = NULL, + alternativeCode = NULL, + contact = NULL, + institutionKey = NULL, + country = NULL, + city = NULL, + gbifRegion = NULL, + machineTagNamespace = NULL, + machineTagName = NULL, + machineTagValue = NULL, + identifier = NULL, + identifierType = NULL, + active = NULL, + displayOnNHCPortal = NULL, + masterSourceType = NULL, + replacedBy = NULL, + sortBy = NULL, + sortOrder = NULL, + offset = NULL, + limit = NULL, + format = "TSV", + curlopts = list() + ){ + assert(query, "character") + assert(type, "character") + assert(institutionalGovernance, "character") + assert(disciplines, "character") + assert(name, "character") + assert(fuzzyName, "character") + assert(source, "character") + assert(sourceId, "character") + assert(code, "character") + assert(alternativeCode, "character") + assert(contact, "character") + assert(institutionKey, "character") + assert(country, "character") + assert(city, "character") + assert(gbifRegion, "character") + assert(machineTagNamespace, "character") + assert(machineTagName, "character") + assert(identifierType, "character") + assert(active, "logical") + assert(displayOnNHCPortal, "logical") + assert(masterSourceType, "character") + assert(replacedBy, "character") + assert(sortBy, "character") + assert(sortOrder, "character") + assert(offset, "numeric") + assert(limit, "numeric") + + if(format != "TSV") { + warning("Only 'TSV' format is supported for institution_export") + } + if(!is.null(limit) | !is.null(offset)) { + warning("Limit and offset are ignored for institution_export. The full export + is returned.") + } + + args <- as.list( + rgbif_compact(c( + q = query, + numberSpecimens = numberSpecimens, + occurrenceCount = occurrenceCount, + typeSpecimenCount = typeSpecimenCount, + active = active, + displayOnNHCPortal = displayOnNHCPortal, + replacedBy = replacedBy, + sortBy = sortBy, + sortOrder = sortOrder, + offset = offset, + limit = limit, + format = format + ))) + + args <- rgbif_compact( + c( + args, + convmany(type), + convmany(institutionalGovernance), + convmany(disciplines), + convmany(name), + convmany(fuzzyName), + convmany(sourceId), + convmany(source), + convmany(code), + convmany(alternativeCode), + convmany(contact), + convmany(institutionKey), + convmany(country), + convmany(city), + convmany(gbifRegion), + convmany(machineTagNamespace), + convmany(machineTagName), + convmany(machineTagValue), + convmany(identifier), + convmany(identifierType) + )) + + url_query <- paste0(names(args),"=",args,collapse="&") + url_query <- utils::URLencode(url_query) + url <- paste0(gbif_base(),"/grscicoll/institution/export?",url_query) + temp_file <- tempfile() + utils::download.file(url,destfile=temp_file,quiet=TRUE) + out <- tibble::as_tibble(data.table::fread(temp_file, showProgress=FALSE)) + colnames(out) <- to_camel(colnames(out)) + out +} + + diff --git a/_pkgdown.yml b/_pkgdown.yml index e27fca46..1feb3ebd 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -59,6 +59,9 @@ reference: contents: - map_fetch - mvt_fetch + - title: "GRSciColl" + - institution_search + - collection_search - title: "Miscellaneous" contents: - rgb_country_codes diff --git a/man/collection_search.Rd b/man/collection_search.Rd new file mode 100644 index 00000000..b323bfde --- /dev/null +++ b/man/collection_search.Rd @@ -0,0 +1,193 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/collection_search.R +\name{collection_search} +\alias{collection_search} +\alias{collection_export} +\title{Search GRSciColl collections} +\usage{ +collection_search( + query = NULL, + name = NULL, + fuzzyName = NULL, + preservationType = NULL, + contentType = NULL, + numberSpecimens = NULL, + accessionStatus = NULL, + personalCollection = NULL, + sourceId = NULL, + source = NULL, + code = NULL, + alternativeCode = NULL, + contact = NULL, + institutionKey = NULL, + country = NULL, + city = NULL, + gbifRegion = NULL, + machineTagNamespace = NULL, + machineTagName = NULL, + machineTagValue = NULL, + identifier = NULL, + identifierType = NULL, + active = NULL, + displayOnNHCPortal = NULL, + masterSourceType = NULL, + replacedBy = NULL, + sortBy = NULL, + sortOrder = NULL, + offset = NULL, + limit = NULL, + format = NULL, + curlopts = list() +) + +collection_export( + query = NULL, + name = NULL, + fuzzyName = NULL, + preservationType = NULL, + contentType = NULL, + numberSpecimens = NULL, + accessionStatus = NULL, + personalCollection = NULL, + sourceId = NULL, + source = NULL, + code = NULL, + alternativeCode = NULL, + contact = NULL, + institutionKey = NULL, + country = NULL, + city = NULL, + gbifRegion = NULL, + machineTagNamespace = NULL, + machineTagName = NULL, + machineTagValue = NULL, + identifier = NULL, + identifierType = NULL, + active = NULL, + displayOnNHCPortal = NULL, + masterSourceType = NULL, + replacedBy = NULL, + sortBy = NULL, + sortOrder = NULL, + offset = NULL, + limit = NULL, + format = "TSV", + curlopts = list() +) +} +\arguments{ +\item{query}{Simple full text search parameter. The value for this parameter +can be a simple word or a phrase. Wildcards are not supported.} + +\item{name}{Name of a GrSciColl institution or collection.} + +\item{fuzzyName}{It searches by name fuzzily so the parameter doesn't have +to be the exact name.} + +\item{preservationType}{Preservation type of a GrSciColl collection. Accepts +multiple values.} + +\item{contentType}{Content type of a GrSciColl collection. See here for +accepted values : +https://techdocs.gbif.org/en/openapi/v1/registry#/Collections/listCollections} + +\item{numberSpecimens}{Number of specimens. It supports ranges and a \code{*} can +be used as a wildcard.} + +\item{accessionStatus}{Accession status of a GrSciColl collection. Accepted +values : INSTITUTIONAL, PROJECT} + +\item{personalCollection}{Flag for personal GRSciColl collections.} + +\item{sourceId}{sourceId of MasterSourceMetadata.} + +\item{source}{Source attribute of MasterSourceMetadata. Accepted values : +DATASET, ORGANIZATION, IH_IRN} + +\item{code}{Code of a GrSciColl institution or collection.} + +\item{alternativeCode}{Alternative code of a GrSciColl institution or +collection.} + +\item{contact}{Filters collections and institutions whose contacts contain +the person key specified.} + +\item{institutionKey}{Keys of institutions to filter by.} + +\item{country}{Filters by country given as a ISO 639-1 (2 letter) country +code.} + +\item{city}{Filters by the city of the address. It searches in both the +physical and the mailing address.} + +\item{gbifRegion}{Filters by a gbif region +Available values : AFRICA, ASIA, EUROPE, NORTH_AMERICA, OCEANIA, +LATIN_AMERICA, ANTARCTICA.} + +\item{machineTagNamespace}{Filters for entities with a machine tag in the +specified namespace.} + +\item{machineTagName}{Filters for entities with a machine tag with the +specified name (use in combination with the machineTagNamespace parameter).} + +\item{machineTagValue}{Filters for entities with a machine tag with the +specified value (use in combination with the machineTagNamespace and +machineTagName parameters).} + +\item{identifier}{An identifier of the type given by the identifierType +parameter, for example a DOI or UUID.} + +\item{identifierType}{An identifier type for the identifier parameter. +Available values : URL, LSID, HANDLER, DOI, UUID, FTP, URI, UNKNOWN, +GBIF_PORTAL, GBIF_NODE, GBIF_PARTICIPANT, GRSCICOLL_ID, GRSCICOLL_URI, +IH_IRN, ROR, GRID, CITES, SYMBIOTA_UUID, WIKIDATA, NCBI_BIOCOLLECTION, +ISIL, CLB_DATASET_KEY.} + +\item{active}{Active status of a GrSciColl institution or collection.} + +\item{displayOnNHCPortal}{Flag to show this record in the NHC portal.} + +\item{masterSourceType}{The master source type of a GRSciColl institution. +or collection. Available values : GRSCICOLL, GBIF_REGISTRY, IH.} + +\item{replacedBy}{Key of the entity that replaced another entity.} + +\item{sortBy}{Field to sort the results by. It only supports the fields +contained in the enum. Available values : NUMBER_SPECIMENS.} + +\item{sortOrder}{Sort order to use with the sortBy parameter. +Available values : ASC, DESC.} + +\item{offset}{Determines the offset for the search results.} + +\item{limit}{Controls the number of results in the page. Default 20.} + +\item{format}{(character) Format of the export. Default is "TSV". +Only used for \link{collection_export}.} + +\item{curlopts}{curlopts options passed on to \link[crul:HttpClient]{crul::HttpClient}.} +} +\value{ +a \code{list} +} +\description{ +Search GRSciColl collections +} +\details{ +Will return GRSciColl collections data. \link{collection_export} will +return all of the results in a single \code{tibble}, while \link{collection_search} will +return a sample of results. +} +\examples{ +\dontrun{ + collection_search(query="insect",limit=2) + collection_search(name="Insects;Entomology", limit=2) + collection_search(numberSpecimens = "0,100", limit=1) + collection_search(institutionKey = "6a6ac6c5-1b8a-48db-91a2-f8661274ff80" + , limit = 1) + collection_search(query = "insect", country = "US;GB", limit=1) +} +} +\references{ +https://scientific-collections.gbif.org/connected-systems#grscicoll-data-coming-from-other-sources +} diff --git a/man/institution_search.Rd b/man/institution_search.Rd new file mode 100644 index 00000000..6c2fd464 --- /dev/null +++ b/man/institution_search.Rd @@ -0,0 +1,204 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/institution_search.R +\name{institution_search} +\alias{institution_search} +\alias{institution_export} +\title{Search GRSciColl institutions} +\usage{ +institution_search( + query = NULL, + type = NULL, + institutionalGovernance = NULL, + disciplines = NULL, + name = NULL, + fuzzyName = NULL, + numberSpecimens = NULL, + occurrenceCount = NULL, + typeSpecimenCount = NULL, + sourceId = NULL, + source = NULL, + code = NULL, + alternativeCode = NULL, + contact = NULL, + institutionKey = NULL, + country = NULL, + city = NULL, + gbifRegion = NULL, + machineTagNamespace = NULL, + machineTagName = NULL, + machineTagValue = NULL, + identifier = NULL, + identifierType = NULL, + active = NULL, + displayOnNHCPortal = NULL, + masterSourceType = NULL, + replacedBy = NULL, + sortBy = NULL, + sortOrder = NULL, + offset = NULL, + limit = NULL, + format = NULL, + curlopts = list() +) + +institution_export( + query = NULL, + type = NULL, + institutionalGovernance = NULL, + disciplines = NULL, + name = NULL, + fuzzyName = NULL, + numberSpecimens = NULL, + occurrenceCount = NULL, + typeSpecimenCount = NULL, + sourceId = NULL, + source = NULL, + code = NULL, + alternativeCode = NULL, + contact = NULL, + institutionKey = NULL, + country = NULL, + city = NULL, + gbifRegion = NULL, + machineTagNamespace = NULL, + machineTagName = NULL, + machineTagValue = NULL, + identifier = NULL, + identifierType = NULL, + active = NULL, + displayOnNHCPortal = NULL, + masterSourceType = NULL, + replacedBy = NULL, + sortBy = NULL, + sortOrder = NULL, + offset = NULL, + limit = NULL, + format = "TSV", + curlopts = list() +) +} +\arguments{ +\item{query}{(character) Simple full text search parameter. The value for +this parameter can be a simple word or a phrase. Wildcards are not supported} + +\item{type}{(character) Type of a GrSciColl institution +Available values : BIOMEDICAL_RESEARCH_INSTITUTE, BOTANICAL_GARDEN, +HERBARIUM, LIVING_ORGANISM_COLLECTION, MEDICAL_RESEARCH_INSTITUTE, MUSEUM, +MUSEUM_HERBARIUM_PRIVATE_NON_PROFIT, OTHER_INSTITUTIONAL_TYPE, +OTHER_TYPE_RESEARCH_INSTITUTION_BIOREPOSITORY, UNIVERSITY_COLLEGE, +ZOO_AQUARIUM} + +\item{institutionalGovernance}{(character) Instutional governance of a +GrSciColl institution Available values : ACADEMIC_FEDERAL, +ACADEMIC_FOR_PROFIT, ACADEMIC_LOCAL, ACADEMIC_NON_PROFIT, ACADEMIC_STATE, +FEDERAL, FOR_PROFIT, LOCAL, NON_PROFIT, OTHER, STATE.} + +\item{disciplines}{(character) Discipline of a GrSciColl institution. +Check available values : +https://techdocs.gbif.org/en/openapi/v1/registry#/Institutions/listInstitutions} + +\item{name}{(character) Name of a GrSciColl institution or collection} + +\item{fuzzyName}{(character) It searches by name fuzzily so the parameter +doesn't have to be the exact name.} + +\item{numberSpecimens}{(character) Number of specimens. It supports ranges +and a \code{*} can be used as a wildcard.} + +\item{occurrenceCount}{(character) Count of occurrences linked. It supports +ranges and a \code{*} can be used as a wildcard.} + +\item{typeSpecimenCount}{(character) Count of type specimens linked. It +supports ranges and a \code{*} can be used as a wildcard.} + +\item{sourceId}{(character) sourceId of MasterSourceMetadata} + +\item{source}{(character) Source attribute of MasterSourceMetadata +Available values : DATASET, ORGANIZATION, IH_IRN} + +\item{code}{(character) Code of a GrSciColl institution or collection.} + +\item{alternativeCode}{(character) Alternative code of a GrSciColl institution.} + +\item{contact}{(character) Filters collections and institutions whose +contacts contain the person key specified.} + +\item{institutionKey}{(character) Keys of institutions to filter by.} + +\item{country}{(character) Filters by country given as a ISO 639-1 (2 letter) +country code.} + +\item{city}{(character) Filters by the city of the address. It searches in both the +physical and the mailing address.} + +\item{gbifRegion}{(character) Filters by a gbif region. Available values : AFRICA, ASIA, +EUROPE, NORTH_AMERICA, OCEANIA, LATIN_AMERICA, ANTARCTICA.} + +\item{machineTagNamespace}{(character) Filters for entities with a machine +tag in the specified namespace.} + +\item{machineTagName}{(character) Filters for entities with a machine tag +with the specified name (use in combination with the machineTagNamespace +parameter).} + +\item{machineTagValue}{(character) Filters for entities with a machine tag +with the specified value (use in combination with the machineTagNamespace and +machineTagName parameters).} + +\item{identifier}{(character) An identifier of the type given by the +\code{identifierType} parameter, for example a DOI or UUID.} + +\item{identifierType}{(character) An identifier type for the +identifier parameter. +Available values : URL, LSID, HANDLER, DOI, UUID, FTP, URI, UNKNOWN, +GBIF_PORTAL, GBIF_NODE, GBIF_PARTICIPANT, GRSCICOLL_ID, GRSCICOLL_URI, +IH_IRN, ROR, GRID, CITES, SYMBIOTA_UUID, WIKIDATA, NCBI_BIOCOLLECTION, ISIL, +CLB_DATASET_KEY.} + +\item{active}{(logical) Active status of a GrSciColl institution or collection.} + +\item{displayOnNHCPortal}{(logical) Flag to show this record in the NHC +portal.} + +\item{masterSourceType}{(character) The master source type of a GRSciColl +institution or collection. Available values : GRSCICOLL, GBIF_REGISTRY, IH.} + +\item{replacedBy}{(character) Key of the entity that replaced another entity.} + +\item{sortBy}{(character) Field to sort the results by. It only supports the +fields contained in the enum. Available values : NUMBER_SPECIMENS.} + +\item{sortOrder}{(character) Sort order to use with the sortBy parameter. +Available values : ASC, DESC.} + +\item{offset}{(numeric) Determines the offset for the search results.} + +\item{limit}{(numeric) Controls the number of results in the page. +Default 20.} + +\item{format}{(character) Format of the export. Default is "TSV". Only used +for \link{institution_export}.} + +\item{curlopts}{(list) curlopts options passed on to \link[crul:HttpClient]{crul::HttpClient}.} +} +\value{ +A \code{list} +} +\description{ +Search GRSciColl institutions +} +\details{ +Will return GRSciColl collections data. \link{institution_export} will +return all of the results in a single \code{tibble}, while \link{institution_search} will +return a sample of results. +} +\examples{ +\dontrun{ +institution_search(query="Kansas",limit=1) +institution_search(numberSpecimens = "1000,*",limit=2) +institution_search(source = "IH_IRN") +institution_search(country = "US;GB") +institution_search(typeSpecimenCount = "10,100") + +} +} diff --git a/tests/fixtures/collection_search.yml b/tests/fixtures/collection_search.yml new file mode 100644 index 00000000..f33ad3fe --- /dev/null +++ b/tests/fixtures/collection_search.yml @@ -0,0 +1,235 @@ +http_interactions: +- request: + method: get + uri: https://api.gbif.org/v1/grscicoll/collection?q=insect&limit=2 + body: + encoding: '' + string: '' + headers: + Accept-Encoding: gzip, deflate + Accept: application/json, text/xml, application/xml, */* + response: + status: + status_code: '200' + message: OK + explanation: Request fulfilled, document follows + headers: + status: HTTP/1.1 200 OK + content-type: application/json + body: + encoding: '' + file: no + string: '{"offset":0,"limit":2,"endOfRecords":false,"count":508,"results":[{"key":"5f024e8c-bbaa-400f-a9ae-b07b2a0ae45a","code":"PSUZC-INSECT","name":"Stock + of insect specimens","description":"Curator: Dr. Sophak Chantharit. Tailed + bugs are small invertebrates. It is classified as a legged animal. It is the + boundary between crustaceans and insects. The stingrays belong to the class + Collembola. Small in shape (0.2-8 mm), they are important in the ecosystem + as a helper for the decomposition of organic matter. At present, there are + more than 8,000 species of stinging insects that have been identified in the + world for Thailand. There are reports of at least 4 stinging tail insects, + 14 families, 53 genera, 194 species. For an example of a flicker-tailed insect + in the Museum of Natural History, the 50th Anniversary of the Royal Highness + Six species of stinging insects were registered and model specimens, categorized + into 4 groups of spiny-tailed stingrays: Cyphoderopsis phangnga Jantarit + et al., 2013. Cyphoderopsis thachana Jantarit et al., 2013 Cyphoderopsis + khaophang Jantarit et . al., 2013, and Cyphoderopsis cavicola Jantarit + et al., 2013, and two species of feather-tailed stingrays, Cyphoderus songkhlaensis Jantarit + et al., 2014, and Cyphoderus khaochakanus Jantarit et al., 2014. due to + knowledge of taxonomy The ecology of the tail bug in Thailand has not been + widely studied and limited knowledge. Classification and Expert Guide This + is why it is important that the number of registered stingray insects and + the prototypes are limited. This resulted in a large number of biodiversity + data of the stingrays in the cave. and many species tend to be new species. + which is in the process of reviewing and disseminating academic results As + a result, there are more than 9 families, 23 genera, and at least 61 species + of bugs waiting to be registered in the museum''s database.","contentTypes":["PreservedOrganisms"],"active":true,"personalCollection":false,"email":["psu.museum@gmail.com"],"phone":[],"homepage":"https://nhm.psu.ac.th/collection-th/insect-collection-th/","catalogUrls":[],"apiUrls":[],"preservationTypes":["StorageIndoors"],"institutionKey":"874ed64b-68f6-421a-a03b-5e64e67388a9","mailingAddress":{"key":44113,"address":"Museum + of Natural History 50th Anniversary of the Royal Highness Princess Maha Chakri + Sirindhorn Prince of Songkhla University 15 Kanchanavanit Road","city":"Hat + Yai","province":"Songkhla","postalCode":"90110","country":"TH"},"address":{"key":44112,"address":"Museum + of Natural History 50th Anniversary of the Royal Highness Princess Maha Chakri + Sirindhorn Prince of Songkhla University 15 Kanchanavanit Road","city":"Hat + Yai","province":"Songkhla","postalCode":"90110","country":"TH"},"createdBy":"cjk","modifiedBy":"gbif-collections","created":"2022-07-18T15:18:26.315+00:00","modified":"2024-05-23T13:14:58.268+00:00","tags":[],"identifiers":[],"contactPersons":[],"machineTags":[],"incorporatedCollections":[],"alternativeCodes":[],"comments":[],"occurrenceMappings":[],"masterSource":"GRSCICOLL","displayOnNHCPortal":true,"occurrenceCount":0,"typeSpecimenCount":0,"institutionName":"Princess + Maha Chakri Sirindhorn Natural History Museum (PSU Museum, Prince of Songkla + University, Thailand)","institutionCode":"PSUZC"},{"key":"35de7962-b673-4f5e-b1f3-da3c5d2ac231","code":"BNHS-Insect","name":"BNHS + Insect Collection","description":"This is one of the important insect collections + in India. There are about 50,000 insects in the collection. \nThe geographical + areas covered are India, Pakistan and Myanmar. The major groups represented + in the \ncollection are Lepidoptera (Butterflies & Moths). Out of the 1500 + species of butterflies found in India, \naround 730 species are present in + the collection. Some of the butterflies were collected from Myanmar \nand + are difficult to get in the present circumstances. There are also collection + of beetles (Coleoptera), \nbugs (Hemiptera), Wasps, bees and ants (Hymenoptera), + Grasshoppers and crickets (Orthoptera), \nMantodea (Prying mantids), Stick + and leaf-insects (Phasmatodea) and Cockroaches (Blattaria). The insects \nare + preserved and stored in wooden boxes and cabinets. The butterflies from Sri + Lanka collected by \nMr. Ormiston are also present in the collection. The + collection is referred by students/scientists from \nForest Research Institute + and was basis for the book “Butterflies of Sikkim Himalayas”.We have 245type + \nspecimens of insects in the collection.","contentTypes":[],"active":true,"personalCollection":false,"email":[],"phone":[],"catalogUrls":[],"apiUrls":[],"preservationTypes":[],"institutionKey":"b560d8ff-4e88-4cb0-99c9-7a43e6a315f0","mailingAddress":{"key":56145,"address":"Hornbill + House, Opp Lion Gate, SBS Road, Fort","city":"Mumbai","province":"Maharashtra","postalCode":"400001","country":"IN"},"address":{"key":56144,"address":"Hornbill + House, Opp Lion Gate, SBS Road, Fort","city":"Mumbai","province":"Maharashtra","postalCode":"400001","country":"IN"},"createdBy":"vijaybarve","modifiedBy":"vijaybarve","created":"2025-07-02T22:06:30.055+00:00","modified":"2025-07-02T22:06:30.055+00:00","tags":[],"identifiers":[],"contactPersons":[],"numberSpecimens":50000,"machineTags":[],"incorporatedCollections":[],"alternativeCodes":[],"comments":[],"occurrenceMappings":[],"masterSource":"GRSCICOLL","displayOnNHCPortal":true,"occurrenceCount":0,"typeSpecimenCount":0,"institutionName":"Bombay + Natural History Society","institutionCode":"BNHS"}]}' + recorded_at: 2025-07-04 12:37:27 GMT + recorded_with: vcr/1.2.0, webmockr/0.9.0 +- request: + method: get + uri: https://api.gbif.org/v1/grscicoll/collection?limit=2&name=Insects&name=Entomology + body: + encoding: '' + string: '' + headers: + Accept-Encoding: gzip, deflate + Accept: application/json, text/xml, application/xml, */* + response: + status: + status_code: '200' + message: OK + explanation: Request fulfilled, document follows + headers: + status: HTTP/1.1 200 OK + content-type: application/json + body: + encoding: '' + file: no + string: '{"offset":0,"limit":2,"endOfRecords":false,"count":136,"results":[{"key":"40091655-14a3-4558-a7b8-640e2e156a92","code":"ENT","name":"Entomology","description":"Entomology + collection (ENT) of the Museu Nacional de História Natural e da Ciência (MNHNC), + Lisbon, PORTUGAL.","contentTypes":["PreservedOrganisms"],"active":true,"personalCollection":false,"email":["geral@museus.ulisboa.pt","rkeller@edu.ulisboa.pt"],"phone":[],"homepage":"https://www.museus.ulisboa.pt/","catalogUrls":[],"apiUrls":[],"preservationTypes":["SamplePinned","SampleFluidPreserved","SampleSlideMount"],"institutionKey":"0fdf8436-0060-4cc4-8235-90526026bccd","mailingAddress":{"key":52829,"address":"Museu + Nacional de História Natural e da Ciência, Rua da Escola Politécnica 56/58","city":"Lisbon","postalCode":"1250-102","country":"PT"},"address":{"key":52828,"address":"Museu + Nacional de História Natural e da Ciência, Rua da Escola Politécnica 56/58","city":"Lisbon","postalCode":"1250-102","country":"PT"},"createdBy":"mgrosjean","modifiedBy":"mgrosjean","created":"2025-01-21T08:49:23.632+00:00","modified":"2025-01-21T15:13:10.506+00:00","tags":[],"identifiers":[],"contactPersons":[],"numberSpecimens":500000,"machineTags":[],"taxonomicCoverage":"Hexapoda","geographicCoverage":"Global","incorporatedCollections":[],"alternativeCodes":[],"comments":[],"occurrenceMappings":[],"masterSource":"GRSCICOLL","displayOnNHCPortal":true,"occurrenceCount":0,"typeSpecimenCount":0,"temporalCoverage":"1858 + - present","institutionName":"Museu Nacional de História Natural e da Ciência","institutionCode":"MNHNC"},{"key":"6d9fa861-1fba-47b5-a90a-735ee007776b","code":"AMBL-BL-ENT","name":"Entomology","description":"Estimated + number of specimens (individual specimen): 275´000. Formation period: 1835-ongoing. + Geologic period: Present. Estimated number of species: 20´000. Number of types: + unknown. SCSPS: 4 [Holger Frick, updated 2024-10-03]","contentTypes":["Biological","PreservedOrganisms","Exoskeletons"],"active":true,"personalCollection":false,"email":["holger.frick@bl.ch"],"phone":[],"catalogUrls":[],"apiUrls":[],"preservationTypes":["StorageControlledAtmosphere","SamplePinned"],"institutionKey":"58f0cf31-4c49-4568-87d5-60d51389230f","mailingAddress":{"key":52093},"address":{"key":52084,"address":"Amtshausgasse + 7","city":"Liestal","postalCode":"CH-4410","country":"CH"},"createdBy":"tschudin","modifiedBy":"sofiawyler","created":"2024-11-27T19:43:26.388+00:00","modified":"2025-02-25T10:13:30.799+00:00","tags":[],"identifiers":[{"key":376510,"type":"UUID","identifier":"b394f0d1-dd46-452c-b2d5-4ffa6290ce37","createdBy":"sofiawyler","created":"2024-11-28T08:35:59.438+00:00","primary":false}],"contactPersons":[{"key":41476,"firstName":"Holger","lastName":"Frick","position":["Head + of Collections","creator","metadataProvider","contact"],"phone":[],"fax":[],"email":["holger.frick@bl.ch"],"address":["Amtshausgasse + 7"],"city":"Liestal","country":"CH","postalCode":"CH-4410","primary":true,"taxonomicExpertise":[],"userIds":[{"type":"ORCID","id":"0000-0003-1971-310X"}],"createdBy":"sofiawyler","modifiedBy":"sofiawyler","created":"2025-02-25T10:13:31.555+00:00","modified":"2025-02-25T10:13:31.555+00:00"}],"numberSpecimens":275000,"machineTags":[],"taxonomicCoverage":"Insecta: + Insecta; Lepidoptera; Coleoptera","notes":"One of the largest collections + of butterflies of the canton (region) of Basel-Country","incorporatedCollections":[],"alternativeCodes":[],"comments":[],"occurrenceMappings":[],"masterSource":"GRSCICOLL","displayOnNHCPortal":true,"occurrenceCount":0,"typeSpecimenCount":0,"temporalCoverage":"Formation + period: 1835-ongoing","institutionName":"Archäologie und Museum Baselland + - Museum.BL","institutionCode":"AMBL"}]}' + recorded_at: 2025-07-04 12:37:28 GMT + recorded_with: vcr/1.2.0, webmockr/0.9.0 +- request: + method: get + uri: https://api.gbif.org/v1/grscicoll/collection?numberSpecimens=0%2C100&limit=1 + body: + encoding: '' + string: '' + headers: + Accept-Encoding: gzip, deflate + Accept: application/json, text/xml, application/xml, */* + response: + status: + status_code: '200' + message: OK + explanation: Request fulfilled, document follows + headers: + status: HTTP/1.1 200 OK + content-type: application/json + body: + encoding: '' + file: no + string: '{"offset":0,"limit":1,"endOfRecords":false,"count":1700,"results":[{"key":"4a5632b8-f86b-4d38-a0cb-12bef927b905","code":"FI-PBP","name":"Erbario + di Onorina Passerini Bargagli Petrucci | Onorina Passerini Bargagli Petrucci''s + herbarium","description":"Contents: 99 specimens, including 42 lichens, 45 + bryophytes, 10 pteridophytes and 2 angiosperms.","contentTypes":["PreservedOrganisms"],"active":false,"personalCollection":true,"email":[],"phone":[],"catalogUrls":[],"apiUrls":[],"preservationTypes":["SamplePressed","SampleDried","StorageIndoors"],"institutionKey":"42038f96-5978-474c-9b0b-4e92450cd1d8","mailingAddress":{"key":56097,"address":"Via + Giorgio La Pira, 4","city":"Firenze","province":"[TOSCANA] Firenze (FI)","postalCode":"IT-50121","country":"IT"},"address":{"key":56096,"address":"Via + Giorgio La Pira, 4","city":"Firenze","province":"[TOSCANA] Firenze (FI)","postalCode":"IT-50121","country":"IT"},"createdBy":"tasmacetus","modifiedBy":"tasmacetus","created":"2025-06-30T07:49:08.366+00:00","modified":"2025-06-30T07:49:08.366+00:00","tags":[],"identifiers":[],"contactPersons":[],"numberSpecimens":97,"machineTags":[],"notes":"This + is a sub-collection of https://registry.gbif.org/collection/19961847-31f6-4abb-9b92-18a391ba9b0d. + Information originally retrieved from internal University of Florence Museal + System (UNIFI-SMA) digitization dashboard, compiled in October 2021.","incorporatedCollections":[],"alternativeCodes":[{"code":"FI999941","description":"Herbarium + barcode"}],"comments":[],"occurrenceMappings":[],"masterSource":"GRSCICOLL","displayOnNHCPortal":true,"occurrenceCount":0,"typeSpecimenCount":0,"institutionName":"Sede + di Via Giorgio La Pira del Museo di Storia naturale di Firenze | Via Giorgio + La Pira headquarter of the Natural History Museum in Florence","institutionCode":"MSNF-GLP"}]}' + recorded_at: 2025-07-04 12:37:28 GMT + recorded_with: vcr/1.2.0, webmockr/0.9.0 +- request: + method: get + uri: https://api.gbif.org/v1/grscicoll/collection?limit=1&institutionKey=6a6ac6c5-1b8a-48db-91a2-f8661274ff80 + body: + encoding: '' + string: '' + headers: + Accept-Encoding: gzip, deflate + Accept: application/json, text/xml, application/xml, */* + response: + status: + status_code: '200' + message: OK + explanation: Request fulfilled, document follows + headers: + status: HTTP/1.1 200 OK + content-type: application/json + body: + encoding: '' + file: no + string: '{"offset":0,"limit":1,"endOfRecords":false,"count":27,"results":[{"key":"745ce2d0-a64b-4089-aae6-3712a39caa2a","code":"RS","name":"The + Scorpiones collection (RS) of the Muséum national d''Histoire naturelle (MNHN + - Paris)","description":"This dataset is the databased part of the Scorpiones + from the terrestrial arthropods collections of the Muséum National d'Histoire + Naturelle (Paris).\n \n\t\t\t\tThe MNHN scorpion collection is one of the + most important in the world, due to a long tradition of work on this group + at the museum. The collection began to be formed towards the middle of the + 19th century and still contains types of some species described from this + period by authors like Audouin, Savigny, Gervais and Guérin-Ménéville. The + collection was considerably augmented during the period 1880‒1910 by E. Simon, + who described numerous species either collected by himself or received through + his extensive network of correspondents. During the 20th century scorpions + were studied at the museum by Fage and by his successor, M. Vachon. Since + the 1970s, systematic activity on the collection has continued intensively + through the work of W. Lourenço, who was a student of Vachon. As a result, + the collection is both large and rich, containing an unusually high proportion + of type material. In addition to material studied by authors working at the + museum, a significant part has come from outside sources, either through gift + or exchange. Thus it also contains material studied by authorities such as + R.I. Pocock, T. Thorell, K. Kraepelin, W.D. Sissom and V. Fet. The scorpion + collection is worldwide in scope, but the best represented regions are tropical + South America, North Africa, the Middle East, Western Africa, Madagascar and + Southeast Asia. It contains over 9000 lots, including about 700 types, preserved + in 80 % alcohol and stored in the museum’s Zoothèque. The collections are + made available to external researchers, either through loans or visits, at + the discretion of the curator. In cases where neither is feasible, photographic + documentation of specimens may be provided on request.","contentTypes":[],"active":true,"personalCollection":false,"email":[],"phone":[],"catalogUrls":[],"apiUrls":[],"preservationTypes":[],"institutionKey":"6a6ac6c5-1b8a-48db-91a2-f8661274ff80","mailingAddress":{"key":43397},"address":{"key":43396,"address":"Muséum + national d''Histoire naturelle 57, rue Cuvier","city":"Paris","postalCode":"75005","country":"FR"},"createdBy":"mgrosjean","modifiedBy":"s.pamerlon","created":"2022-03-25T12:36:16.984+00:00","modified":"2024-04-30T14:12:49.736+00:00","tags":[],"identifiers":[{"key":297946,"type":"DOI","identifier":"10.15468/podyc0","createdBy":"mgrosjean","created":"2022-03-25T12:36:16.984+00:00","primary":false}],"contactPersons":[{"key":38097,"lastName":"MNHN","position":["Provider"],"phone":[],"fax":[],"email":[],"address":[],"primary":true,"taxonomicExpertise":[],"userIds":[],"createdBy":"s.pamerlon","modifiedBy":"s.pamerlon","created":"2024-04-30T14:12:49.736+00:00","modified":"2024-04-30T14:12:49.736+00:00"},{"key":38098,"firstName":"Mark","lastName":"Judson","position":[],"phone":[],"fax":[],"email":[],"address":[],"primary":false,"taxonomicExpertise":[],"userIds":[],"createdBy":"s.pamerlon","modifiedBy":"s.pamerlon","created":"2024-04-30T14:12:49.736+00:00","modified":"2024-04-30T14:12:49.736+00:00"},{"key":38099,"firstName":"Élise-Anne","lastName":"Leguin","position":[],"phone":[],"fax":[],"email":[],"address":[],"primary":false,"taxonomicExpertise":[],"userIds":[],"createdBy":"s.pamerlon","modifiedBy":"s.pamerlon","created":"2024-04-30T14:12:49.736+00:00","modified":"2024-04-30T14:12:49.736+00:00"},{"key":38100,"firstName":"Laurent","lastName":"Albenga","position":["Correspondant"],"phone":[],"fax":[],"email":[],"address":[],"primary":true,"taxonomicExpertise":[],"userIds":[],"createdBy":"s.pamerlon","modifiedBy":"s.pamerlon","created":"2024-04-30T14:12:49.736+00:00","modified":"2024-04-30T14:12:49.736+00:00"}],"machineTags":[],"taxonomicCoverage":"","geographicCoverage":"","incorporatedCollections":[],"alternativeCodes":[],"comments":[],"occurrenceMappings":[{"key":50,"datasetKey":"2f23ac81-674e-4e4e-982f-73f49ccdb9df","createdBy":"mgrosjean","created":"2022-03-25T12:36:17.410+00:00"}],"masterSource":"GBIF_REGISTRY","masterSourceMetadata":{"key":8586,"source":"DATASET","sourceId":"2f23ac81-674e-4e4e-982f-73f49ccdb9df","createdBy":"mgrosjean","created":"2022-03-25T12:36:16.984+00:00"},"displayOnNHCPortal":true,"occurrenceCount":947,"typeSpecimenCount":691,"institutionName":"MNHN + - Museum national d''Histoire naturelle","institutionCode":"MNHN"}]}' + recorded_at: 2025-07-04 12:37:28 GMT + recorded_with: vcr/1.2.0, webmockr/0.9.0 +- request: + method: get + uri: https://api.gbif.org/v1/grscicoll/collection?q=insect&limit=1&country=US&country=GB + body: + encoding: '' + string: '' + headers: + Accept-Encoding: gzip, deflate + Accept: application/json, text/xml, application/xml, */* + response: + status: + status_code: '200' + message: OK + explanation: Request fulfilled, document follows + headers: + status: HTTP/1.1 200 OK + content-type: application/json + body: + encoding: '' + file: no + string: '{"offset":0,"limit":1,"endOfRecords":false,"count":155,"results":[{"key":"e21440ee-0b58-4cfd-b763-5323cbe96ac8","code":"UAA:Ento","name":"University + of Alaska Anchorage Insect Specimens (Arctos)","description":"The UAA Entomology + Collection includes approximately 5,000 specimens with a focus on pollinating + and aquatics insects of Alaska. Collections are managed under the Alaska Center + for Conservation Science, a research center within the University of Alaska + Anchorage. The collection officially joined the Arctos community in 2023. + The UAA Entomology collection is the primary repository of vouchers from the + Alaska Bee Atlas and aquatic insects originate from stream ecology studies + conducted by the Alaska Center for Conservation Science.","contentTypes":[],"active":true,"personalCollection":false,"email":[],"phone":[],"homepage":"https://arctos.database.museum/collection/UAA:Ento","catalogUrls":[],"apiUrls":[],"preservationTypes":["SamplePinned"],"institutionKey":"15e46ee2-f3b2-4723-a0e9-def248a239f8","mailingAddress":{"key":47981,"province":"Alaska"},"address":{"key":47980,"address":"3211 + Providence Dr","city":"Anchorage","province":"AK","postalCode":"99508","country":"US"},"createdBy":"mgrosjean","modifiedBy":"mgrosjean","created":"2023-10-09T06:59:13.816+00:00","modified":"2024-06-04T17:34:59.565+00:00","tags":[],"identifiers":[{"key":356526,"type":"DOI","identifier":"10.15468/ahk383","createdBy":"mgrosjean","created":"2023-10-09T06:59:23.626+00:00","primary":false}],"contactPersons":[{"key":36769,"firstName":"Justin","lastName":"Fulkerson","position":["Botany + Curator"],"phone":[],"fax":[],"email":["jrfulkerson@alaska.edu"],"address":[],"primary":true,"taxonomicExpertise":[],"userIds":[{"type":"ORCID","id":"http://orcid.org/0000-0003-2666-9979"}],"createdBy":"mgrosjean","modifiedBy":"mgrosjean","created":"2023-10-09T06:59:23.626+00:00","modified":"2023-10-09T06:59:23.626+00:00"},{"key":36770,"firstName":"Matthew","lastName":"Carlson","position":["Curator"],"phone":[],"fax":[],"email":["mlcarlson@alaska.edu"],"address":["3211 + Providence Dr"],"city":"Anchorage","province":"AK","country":"US","postalCode":"99508","primary":false,"taxonomicExpertise":[],"userIds":[],"createdBy":"mgrosjean","modifiedBy":"mgrosjean","created":"2023-10-09T06:59:23.626+00:00","modified":"2023-10-09T06:59:23.626+00:00"},{"key":36771,"firstName":"Justin","lastName":"Fulkerson","position":["Collections + Manager"],"phone":[],"fax":[],"email":["jrfulkerson@alaska.edu"],"address":["3211 + Providence Drive"],"city":"Anchorage","province":"Alaska","country":"US","postalCode":"99508","primary":true,"taxonomicExpertise":[],"userIds":[{"type":"ORCID","id":"http://orcid.org/0000-0003-2666-9979"}],"createdBy":"mgrosjean","modifiedBy":"mgrosjean","created":"2023-10-09T06:59:23.626+00:00","modified":"2023-10-09T06:59:23.626+00:00"}],"machineTags":[],"taxonomicCoverage":"Pollinating + and aquatic insects: Insecta, Insects","geographicCoverage":"Alaska, USA","incorporatedCollections":["University + of Alaska Anchorage Entomology Collection"],"alternativeCodes":[],"comments":[],"occurrenceMappings":[],"masterSource":"GBIF_REGISTRY","masterSourceMetadata":{"key":9304,"source":"DATASET","sourceId":"3658ba15-172d-459c-94ab-d565f6550dad","createdBy":"mgrosjean","created":"2023-10-09T06:59:23.626+00:00"},"displayOnNHCPortal":true,"occurrenceCount":0,"typeSpecimenCount":0,"institutionName":"Alaska + Center for Conservation Science","institutionCode":"UAA"}]}' + recorded_at: 2025-07-04 12:37:28 GMT + recorded_with: vcr/1.2.0, webmockr/0.9.0 diff --git a/tests/fixtures/institution_search.yml b/tests/fixtures/institution_search.yml new file mode 100644 index 00000000..cfeddec9 --- /dev/null +++ b/tests/fixtures/institution_search.yml @@ -0,0 +1,222 @@ +http_interactions: +- request: + method: get + uri: https://api.gbif.org/v1/grscicoll/institution?q=Kansas&limit=1 + body: + encoding: '' + string: '' + headers: + Accept-Encoding: gzip, deflate + Accept: application/json, text/xml, application/xml, */* + response: + status: + status_code: '200' + message: OK + explanation: Request fulfilled, document follows + headers: + status: HTTP/1.1 200 OK + content-type: application/json + body: + encoding: '' + file: no + string: '{"offset":0,"limit":1,"endOfRecords":false,"count":19,"results":[{"key":"956f3e1f-ebd2-48e3-a3ee-42bfb1950a47","code":"PECA","name":"Pratt + Education Center and Aquarium","description":"The emphasis of the Pratt Education + Center is to discover the wildlife of Kansas. Numerous displays, dioramas, + and exhibits provide close encounters with the native birds, fish, mammals, + and reptiles of Kansas.\n\nOur \"winter\" diorama provides a glimpse of how + wildlife deals with the snow and cold of Kansas winters.\n\nThe grassland + display depicts the three grasslands (short, mixed and tall) of Kansas and + wildlife common to each region; including a rare black-footed ferret. Our + raptor exhibit features owls, hawks, falcons, and kites; all with hooked beaks + and sharp talons. The wetland wall display includes Cheyenne Bottoms, one + of the five most important wetlands in North America.\n\nThe Aquarium Room + contains twelve, 400-600 gallon aquariums; each displaying fish species native + to Kansas or that have been successfully introduced into Kansas. On the east + wall are two wall panels. One featuring the early history of the Pratt Hatchery. + The other features the catfish rearing program along with a working model + of Seth Way''s ingenious incubating trough. Over one hundred and twenty-eight + species of birds and their eggs","types":[],"active":true,"email":[],"phone":[],"homepage":"https://ksoutdoors.com/KDWP-Info/Locations/Museums-and-Nature-Centers/Pratt-Education-Center","catalogUrls":[],"apiUrls":[],"institutionalGovernances":[],"disciplines":[],"latitude":37.632106,"longitude":-98.693794,"mailingAddress":{"key":46553,"country":"US"},"address":{"key":46554,"province":"KS","country":"US"},"additionalNames":[],"createdBy":"GRBIO","modifiedBy":"gbif-collections","created":"2013-05-21T01:38:00.000+00:00","modified":"2024-05-23T12:37:31.514+00:00","tags":[],"identifiers":[{"key":350269,"type":"NCBI_BIOCOLLECTION","identifier":"945030","createdBy":"mgrosjean","created":"2023-08-15T11:08:06.053+00:00","primary":false},{"key":178149,"type":"GRSCICOLL_URI","identifier":"http://grscicoll.org/institution/pratt-education-center-and-aquarium","createdBy":"registry-migration-grbio.gbif.org","created":"2019-08-15T08:12:27.572+00:00","primary":false},{"key":169988,"type":"GRSCICOLL_URI","identifier":"http://grbio.org/institution/pratt-education-center-and-aquarium","createdBy":"registry-migration-grbio.gbif.org","created":"2019-08-15T08:12:20.362+00:00","primary":false},{"key":134524,"type":"GRSCICOLL_ID","identifier":"17487","createdBy":"registry-migration-grbio.gbif.org","created":"2018-11-15T10:23:01.527+00:00","primary":false},{"key":141621,"type":"GRSCICOLL_URI","identifier":"http://grbio.org/cool/sfj9-st9f","createdBy":"registry-migration-grbio.gbif.org","created":"2018-11-15T10:23:01.527+00:00","primary":false}],"contactPersons":[],"machineTags":[],"alternativeCodes":[],"comments":[],"occurrenceMappings":[],"masterSource":"GRSCICOLL","displayOnNHCPortal":true,"occurrenceCount":0,"typeSpecimenCount":0}]}' + recorded_at: 2025-07-07 11:25:15 GMT + recorded_with: vcr/1.2.0, webmockr/0.9.0 +- request: + method: get + uri: https://api.gbif.org/v1/grscicoll/institution?numberSpecimens=1000%2C%2A&limit=2 + body: + encoding: '' + string: '' + headers: + Accept-Encoding: gzip, deflate + Accept: application/json, text/xml, application/xml, */* + response: + status: + status_code: '200' + message: OK + explanation: Request fulfilled, document follows + headers: + status: HTTP/1.1 200 OK + content-type: application/json + body: + encoding: '' + file: no + string: '{"offset":0,"limit":2,"endOfRecords":false,"count":2796,"results":[{"key":"200dfb5f-58ed-478d-8058-8ac565b509cf","code":"MEMZOO","name":"Memphis + Zoo","description":"The Memphis Zoo is a zoo in Midtown, Memphis, Tennessee, + United States. It is home to more than 3,500 animals representing over 500 + different species. ","types":["ZooAquarium"],"active":true,"email":[],"phone":[],"homepage":"https://www.memphiszoo.org/","catalogUrls":[],"apiUrls":[],"institutionalGovernances":["NonProfit"],"disciplines":["Zoology","Biological"],"latitude":35.150331,"longitude":-89.993305,"mailingAddress":{"key":55998,"address":"2000 + Prentiss Place","city":"Memphis","province":"Tennessee","postalCode":"38112","country":"US"},"address":{"key":55997,"address":"2000 + Prentiss Place","city":"Memphis","province":"Tennessee","postalCode":"38112","country":"US"},"additionalNames":["Memphis + Zoological Society"],"foundingDate":1906,"numberSpecimens":3500,"logoUrl":"https://prod.speakcdn.com/sitefiles/2879/images/white-logo.svg","createdBy":"catchapman","modifiedBy":"catchapman","created":"2025-06-17T15:15:27.291+00:00","modified":"2025-06-17T15:15:27.291+00:00","tags":[],"identifiers":[],"contactPersons":[{"key":42822,"firstName":"Sinlan","lastName":"Poo","position":["Curator + of Research"],"phone":[],"fax":[],"email":["spoo@memphiszoo.org"],"address":[],"city":"Memphis","province":"Tennessee","country":"US","primary":true,"taxonomicExpertise":[],"userIds":[{"type":"ORCID","id":"https://orcid.org/0000-0002-7767-8173"}],"createdBy":"dbloom","modifiedBy":"dbloom","created":"2025-06-18T22:37:57.149+00:00","modified":"2025-06-18T22:37:57.149+00:00"}],"machineTags":[],"alternativeCodes":[],"comments":[],"occurrenceMappings":[],"masterSource":"GRSCICOLL","displayOnNHCPortal":true,"occurrenceCount":0,"typeSpecimenCount":0},{"key":"5cb20aa6-74a7-4e48-ba22-9158f7f60b93","code":"HOKM","name":"Hokkaido + Museum","description":"Hokkaido museum, aka Mori no Charenga, is a museum + introducing the nature, history and culture of Hokkaido.\nThe museum investigates + and researches the relationship between the nature environment and people, + the culture of the Ainu people and their way of living, and the lives of immigrants + from Honshu.\nHokkaido Museum (nicknamed Mori no Charenga) was opened in April + 2015 by integrating the Hokkaido Kaitaku Kinenkan (opened in 1971) and the + Hokkaido Ainu Cultural Research Center (opened in 1994). Inheriting the traditions + and outstanding achievements of the two institutions, the museum will celebrate + its 10th anniversary in 2025 (Reiwa 7) as a \"comprehensive museum\" representing + Hokkaido.\nAs a core museum in Hokkaido, the museum will collaborate with + local museums and other institutions, and as a research museum with approximately + 30 curators and research staff, we will utilize the results of specialized + and comprehensive research to strengthen our functions to meet diverse learning + needs. In addition, as a comprehensive museum that can be proud of the world + for specialized research on Ainu history and tangible and intangible culture, + we will contribute to the promotion of Ainu culture and the realization of + a multicultural society. Furthermore, we will contribute to the revitalization + of the region while placing importance on our role as a cultural tourism base + facility.\nOur museum has a permanent comprehensive exhibition consisting + of five areas that tell the story of Hokkaido''s nature, history, and culture, + as well as special exhibitions and various planned exhibitions.","types":["Museum"],"active":true,"email":["hokkaido.museum@pref.hokkaido.lg.jp"],"phone":["+81-11-898-0456"],"homepage":"https://www.hm.pref.hokkaido.lg.jp","catalogUrls":["https://jmapps.ne.jp/hmcollection1/list.html?keywords=&kwd_and_or=and&f2%5B%5D=生物&title=&f3=&f4=&list_type=LLA001&list_count=10&title_query=yes"],"apiUrls":[],"institutionalGovernances":[],"disciplines":["Biological","Cultural"],"latitude":43.053000,"longitude":141.496500,"mailingAddress":{"key":55971,"address":"Atsubetsu-ku + Atsubetsu-cho Konopporo53-2","city":"Sapporo","province":"HOKKAIDO","postalCode":"004-0006","country":"JP"},"address":{"key":55970,"address":"Atsubetsu-ku + Atsubetsu-cho Konopporo53-2","city":"Sapporo","province":"HOKKAIDO","postalCode":"004-0006","country":"JP"},"additionalNames":["Historical + Museum of Hokkaido"],"foundingDate":2015,"numberSpecimens":2551,"createdBy":"cjk","modifiedBy":"cjk","created":"2025-06-12T02:43:13.348+00:00","modified":"2025-06-12T02:51:48.175+00:00","tags":[],"identifiers":[],"contactPersons":[],"machineTags":[],"alternativeCodes":[],"comments":[],"occurrenceMappings":[],"masterSource":"GRSCICOLL","displayOnNHCPortal":true,"occurrenceCount":0,"typeSpecimenCount":0}]}' + recorded_at: 2025-07-07 11:25:15 GMT + recorded_with: vcr/1.2.0, webmockr/0.9.0 +- request: + method: get + uri: https://api.gbif.org/v1/grscicoll/institution?numberSpecimens=1000%2C%2A&occurrenceCount=10%2C%2A&limit=2 + body: + encoding: '' + string: '' + headers: + Accept-Encoding: gzip, deflate + Accept: application/json, text/xml, application/xml, */* + response: + status: + status_code: '200' + message: OK + explanation: Request fulfilled, document follows + headers: + status: HTTP/1.1 200 OK + content-type: application/json + body: + encoding: '' + file: no + string: '{"offset":0,"limit":2,"endOfRecords":false,"count":1353,"results":[{"key":"15b6b7e3-1d39-463b-9230-3f101fddc582","code":"CBSS","name":"Croatian + Biospeleological Society","description":"The Croatian Biospeleological Society + (CBSS) was founded in 1996 at the Croatian Natural History Museum in Zagreb.\nSince + its founding, CBSS has carried out numerous research projects, including those + aimed at promoting and popularizing cave fauna, bats, and cave habitats. Occurrence + data on cave-dwelling invertebrates from various projects and collecting trips + are compiled in the highly valuable CBSS Collection, which contains data from + more than 1,500 caves.","types":["OtherInstitutionalType"],"active":true,"email":["hbsd@hbsd.hr"],"phone":[],"homepage":"https://www.hbsd.hr/?lang=en","catalogUrls":[],"apiUrls":[],"institutionalGovernances":["NonProfit"],"disciplines":["Zoology","Taxonomy","EvolutionaryBiology","Ecology"],"latitude":45.809145,"longitude":15.967411,"mailingAddress":{"key":55675,"address":"Rooseveltov + trg 6","city":"Zagreb","province":"Grad Zagreb","postalCode":"10000","country":"HR"},"address":{"key":55674,"address":"Rooseveltov + trg 6","city":"Zagreb","province":"Grad Zagreb","postalCode":"10000","country":"HR"},"additionalNames":["Hrvatsko + biospeleološko društvo"],"foundingDate":1996,"numberSpecimens":30000,"logoUrl":"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRgPy831C2dhxu7Z8hsyODPeaS082JvFCObIytOnAbXG695hG0oKaTYcpL5QnynE_YkJU4&usqp=CAU","createdBy":"ajesovnik","modifiedBy":"ajesovnik","created":"2025-04-20T06:44:44.168+00:00","modified":"2025-04-20T06:44:44.168+00:00","tags":[],"identifiers":[],"contactPersons":[],"machineTags":[],"alternativeCodes":[],"comments":[],"occurrenceMappings":[],"masterSource":"GRSCICOLL","displayOnNHCPortal":true,"occurrenceCount":535,"typeSpecimenCount":6},{"key":"88b3fc90-a67e-44ad-9f4b-c265e7d6569e","code":"ETHOIKOS","name":"Fondazione + Ethoikos","description":"The foundation''s aim is to carry out scientific + research, education and promotion in the field of ethology and ecology, and + other related disciplines, as well as to protect natural heritage.","types":["OtherTypeResearchInstitutionBiorepository","MuseumHerbariumPrivateNonProfit"],"active":true,"email":["info@ethoikos.it"],"phone":[],"homepage":"https://ethoikos.it/english.html","catalogUrls":[],"apiUrls":[],"institutionalGovernances":["NonProfit"],"disciplines":["Ecology"],"latitude":43.257700,"longitude":11.043200,"mailingAddress":{"key":52414,"address":"Convento + dell’Osservanza","city":"Radicondoli","province":"[TOSCANA] Siena (SI)","postalCode":"IT-53030","country":"IT"},"address":{"key":52413,"address":"Convento + dell’Osservanza","city":"Radicondoli","province":"[TOSCANA] Siena (SI)","postalCode":"IT-53030","country":"IT"},"additionalNames":[],"numberSpecimens":8300,"createdBy":"tasmacetus","modifiedBy":"mgrosjean","created":"2024-12-18T17:12:26.852+00:00","modified":"2024-12-19T15:00:04.134+00:00","tags":[],"identifiers":[],"contactPersons":[],"machineTags":[],"alternativeCodes":[],"comments":[],"occurrenceMappings":[],"masterSource":"GRSCICOLL","displayOnNHCPortal":true,"occurrenceCount":4868,"typeSpecimenCount":0,"featuredImageUrl":"https://ethoikos.it/images/corbaerea300.jpg","featuredImageLicense":"CC_BY_NC_4_0"}]}' + recorded_at: 2025-07-07 11:25:15 GMT + recorded_with: vcr/1.2.0, webmockr/0.9.0 +- request: + method: get + uri: https://api.gbif.org/v1/grscicoll/institution?limit=1&source=IH_IRN + body: + encoding: '' + string: '' + headers: + Accept-Encoding: gzip, deflate + Accept: application/json, text/xml, application/xml, */* + response: + status: + status_code: '200' + message: OK + explanation: Request fulfilled, document follows + headers: + status: HTTP/1.1 200 OK + content-type: application/json + body: + encoding: '' + file: no + string: '{"offset":0,"limit":1,"endOfRecords":false,"count":3791,"results":[{"key":"473103ee-e47a-4656-8e08-d89be038999f","code":"PSGCASH","name":"PSG + College of Arts & Science","types":[],"active":true,"email":["aryasindu001@gmail.com"],"phone":[],"catalogUrls":[],"apiUrls":[],"institutionalGovernances":[],"disciplines":[],"address":{"key":55986,"address":"PSG + College of Arts & Science, Civil Aerodrome Post","city":"Coimbatore","province":"Tamil + Nadu","postalCode":"641014","country":"IN"},"additionalNames":[],"createdBy":"mgrosjean","modifiedBy":"mgrosjean","created":"2025-06-13T07:36:09.626+00:00","modified":"2025-06-13T07:36:09.626+00:00","tags":[],"identifiers":[{"key":442779,"type":"IH_IRN","identifier":"gbif:ih:irn:267351","createdBy":"mgrosjean","created":"2025-06-13T07:36:09.637+00:00","primary":false}],"contactPersons":[{"key":42806,"firstName":"Arya","lastName":"Sindhu","position":["Assistant + Professor"],"phone":["8891017715"],"fax":[],"email":["aryasindu001@gmail.com"],"address":["Civil + aerodrome Post"],"city":"Coimbatore","province":"Tamil Nadu","country":"IN","postalCode":"695011","primary":false,"taxonomicExpertise":[],"userIds":[{"type":"IH_IRN","id":"267377"}],"createdBy":"mgrosjean","modifiedBy":"mgrosjean","created":"2025-06-13T07:36:09.648+00:00","modified":"2025-06-13T07:36:09.648+00:00"}],"machineTags":[],"alternativeCodes":[],"comments":[],"occurrenceMappings":[],"masterSource":"IH","masterSourceMetadata":{"key":9834,"source":"IH_IRN","sourceId":"267351","createdBy":"mgrosjean","created":"2025-06-13T07:36:09.644+00:00"},"displayOnNHCPortal":true,"occurrenceCount":0,"typeSpecimenCount":0}]}' + recorded_at: 2025-07-07 11:25:15 GMT + recorded_with: vcr/1.2.0, webmockr/0.9.0 +- request: + method: get + uri: https://api.gbif.org/v1/grscicoll/institution?limit=1&country=US&country=GB + body: + encoding: '' + string: '' + headers: + Accept-Encoding: gzip, deflate + Accept: application/json, text/xml, application/xml, */* + response: + status: + status_code: '200' + message: OK + explanation: Request fulfilled, document follows + headers: + status: HTTP/1.1 200 OK + content-type: application/json + body: + encoding: '' + file: no + string: '{"offset":0,"limit":1,"endOfRecords":false,"count":2570,"results":[{"key":"200dfb5f-58ed-478d-8058-8ac565b509cf","code":"MEMZOO","name":"Memphis + Zoo","description":"The Memphis Zoo is a zoo in Midtown, Memphis, Tennessee, + United States. It is home to more than 3,500 animals representing over 500 + different species. ","types":["ZooAquarium"],"active":true,"email":[],"phone":[],"homepage":"https://www.memphiszoo.org/","catalogUrls":[],"apiUrls":[],"institutionalGovernances":["NonProfit"],"disciplines":["Zoology","Biological"],"latitude":35.150331,"longitude":-89.993305,"mailingAddress":{"key":55998,"address":"2000 + Prentiss Place","city":"Memphis","province":"Tennessee","postalCode":"38112","country":"US"},"address":{"key":55997,"address":"2000 + Prentiss Place","city":"Memphis","province":"Tennessee","postalCode":"38112","country":"US"},"additionalNames":["Memphis + Zoological Society"],"foundingDate":1906,"numberSpecimens":3500,"logoUrl":"https://prod.speakcdn.com/sitefiles/2879/images/white-logo.svg","createdBy":"catchapman","modifiedBy":"catchapman","created":"2025-06-17T15:15:27.291+00:00","modified":"2025-06-17T15:15:27.291+00:00","tags":[],"identifiers":[],"contactPersons":[{"key":42822,"firstName":"Sinlan","lastName":"Poo","position":["Curator + of Research"],"phone":[],"fax":[],"email":["spoo@memphiszoo.org"],"address":[],"city":"Memphis","province":"Tennessee","country":"US","primary":true,"taxonomicExpertise":[],"userIds":[{"type":"ORCID","id":"https://orcid.org/0000-0002-7767-8173"}],"createdBy":"dbloom","modifiedBy":"dbloom","created":"2025-06-18T22:37:57.149+00:00","modified":"2025-06-18T22:37:57.149+00:00"}],"machineTags":[],"alternativeCodes":[],"comments":[],"occurrenceMappings":[],"masterSource":"GRSCICOLL","displayOnNHCPortal":true,"occurrenceCount":0,"typeSpecimenCount":0}]}' + recorded_at: 2025-07-07 11:25:15 GMT + recorded_with: vcr/1.2.0, webmockr/0.9.0 +- request: + method: get + uri: https://api.gbif.org/v1/grscicoll/institution?typeSpecimenCount=10%2C100&limit=1 + body: + encoding: '' + string: '' + headers: + Accept-Encoding: gzip, deflate + Accept: application/json, text/xml, application/xml, */* + response: + status: + status_code: '200' + message: OK + explanation: Request fulfilled, document follows + headers: + status: HTTP/1.1 200 OK + content-type: application/json + body: + encoding: '' + file: no + string: '{"offset":0,"limit":1,"endOfRecords":false,"count":608,"results":[{"key":"29658e18-1cef-4773-b81a-92111c9d288f","code":"CBC","name":"Universidade + do Estado de Minas Gerais","types":[],"active":true,"email":["mcbp.passos@uemg.br"],"phone":["[55] + 35 3526 8087","[55] 71 9 9207 9666"],"catalogUrls":[],"apiUrls":[],"institutionalGovernances":[],"disciplines":[],"latitude":-20.722195,"longitude":-46.605107,"mailingAddress":{"key":55656,"address":"Avenida + Expedicionários 333","city":"Passos","province":"Minas Gerais","postalCode":"37900-130","country":"BR"},"address":{"key":55651,"address":"Avenida + Expedicionários 333","city":"Passos","province":"Minas Gerais","postalCode":"37900-130","country":"BR"},"additionalNames":[],"foundingDate":2023,"createdBy":"clara_baringo","modifiedBy":"ih-sync","created":"2025-04-07T21:59:39.815+00:00","modified":"2025-04-09T11:05:38.271+00:00","tags":[],"identifiers":[{"key":439017,"type":"IH_IRN","identifier":"gbif:ih:irn:267802","createdBy":"clara_baringo","created":"2025-04-07T21:59:39.834+00:00","primary":false}],"contactPersons":[{"key":42416,"firstName":"Fernanda + Hurbath","lastName":"Brandão","position":["Professor"],"phone":["[55] 71 99207 + 9666"],"fax":[],"email":["fernanda.hurbath@uemg.br"],"address":["Rua Abolição + 180"],"city":"Passos","province":"Minas Gerais","country":"BR","postalCode":"37904016","primary":false,"taxonomicExpertise":[],"userIds":[{"type":"IH_IRN","id":"267808"}],"createdBy":"clara_baringo","modifiedBy":"clara_baringo","created":"2025-04-07T21:59:39.862+00:00","modified":"2025-04-07T21:59:39.862+00:00"},{"key":42415,"firstName":"Vanessa + Leite","lastName":"Rezende","position":["Professor"],"phone":["[55]35991042537"],"fax":[],"email":["vanessa.leite.rezende@gmail.com"],"address":["Pastor + Pedro Ferreira Lima"],"city":"Passos","province":"Minas Gerais","country":"BR","postalCode":"37904146","primary":false,"taxonomicExpertise":[],"userIds":[{"type":"IH_IRN","id":"267809"}],"createdBy":"clara_baringo","modifiedBy":"clara_baringo","created":"2025-04-07T21:59:39.862+00:00","modified":"2025-04-07T21:59:39.862+00:00"}],"machineTags":[],"alternativeCodes":[],"comments":[],"occurrenceMappings":[],"masterSource":"IH","masterSourceMetadata":{"key":9793,"source":"IH_IRN","sourceId":"267802","createdBy":"clara_baringo","created":"2025-04-07T21:59:39.843+00:00"},"displayOnNHCPortal":true,"occurrenceCount":76,"typeSpecimenCount":14}]}' + recorded_at: 2025-07-07 11:25:15 GMT + recorded_with: vcr/1.2.0, webmockr/0.9.0 diff --git a/tests/testthat/test-collection_search.R b/tests/testthat/test-collection_search.R new file mode 100644 index 00000000..079624f9 --- /dev/null +++ b/tests/testthat/test-collection_search.R @@ -0,0 +1,80 @@ + +test_that("collection_search works as expected", { + vcr::use_cassette("collection_search",{ + q <- collection_search(query="insect",limit=2) + n <- collection_search(name="Insects;Entomology", limit=2) + s <- collection_search(numberSpecimens = "0,100", limit=1) + i <- collection_search(institutionKey = "6a6ac6c5-1b8a-48db-91a2-f8661274ff80" + , limit = 1) + c <- collection_search(query = "insect", country = "US;GB", limit=1) + }) + + expect_is(q, "list") + expect_is(q$data, "tbl_df") + expect_is(q$meta, "data.frame") + expect_true(nrow(q$data) > 0) + expect_gte(q$meta$count, 400) + expect_gte(ncol(q$data), 30) + + expect_is(n, "list") + expect_is(n$data, "tbl_df") + expect_is(n$meta, "data.frame") + expect_true(nrow(n$data) > 0) + expect_gte(n$meta$count, 100) + expect_gte(ncol(n$data), 30) + + expect_is(s, "list") + expect_is(s$data, "tbl_df") + expect_is(s$meta, "data.frame") + expect_true(nrow(s$data) > 0) + expect_gte(s$meta$count, 1000) + expect_gte(ncol(s$data), 30) + + expect_is(i, "list") + expect_is(i$data, "tbl_df") + expect_is(i$meta, "data.frame") + expect_true(nrow(i$data) > 0) + expect_gte(i$meta$count, 20) + expect_gte(ncol(i$data), 30) + + expect_is(c, "list") + expect_is(c$data, "tbl_df") + expect_is(c$meta, "data.frame") + expect_true(nrow(c$data) > 0) + expect_gte(c$meta$count, 100) + expect_gte(ncol(c$data), 30) + +}) + + +test_that("collection_export works as expected", { + skip_on_cran() + skip_on_ci() + + q <- collection_export(query = "insect") + i <- collection_export(name="Insects;Entomology") + s <- collection_export(numberSpecimens = "0,100") + c <- collection_export(query = "insect", country = "US;GB") + + expect_is(q, "tbl_df") + expect_gte(nrow(q), 400) + expect_gte(ncol(q), 30) + expect_true("key" %in% names(q)) + + expect_is(i, "tbl_df") + expect_gte(nrow(i), 100) + expect_gte(ncol(i), 30) + expect_true("key" %in% names(i)) + + expect_is(s, "tbl_df") + expect_gte(nrow(s), 1000) + expect_gte(ncol(s), 30) + expect_true("key" %in% names(s)) + + expect_is(c, "tbl_df") + expect_gte(nrow(c), 100) + expect_gte(ncol(c), 30) + expect_true("key" %in% names(c)) + +}) + diff --git a/tests/testthat/test-institution_search.R b/tests/testthat/test-institution_search.R new file mode 100644 index 00000000..3b6dff02 --- /dev/null +++ b/tests/testthat/test-institution_search.R @@ -0,0 +1,79 @@ +test_that("institution search works as expected", { + vcr::use_cassette("institution_search", { + q <- institution_search(query="Kansas",limit=1) + s <- institution_search(numberSpecimens = "1000,*",limit=2) + o <- institution_search(numberSpecimens = "1000,*", occurrenceCount = "10,*" + ,limit=2) + e <- institution_search(source = "IH_IRN", limit=1) + c <- institution_search(country = "US;GB", limit=1) + t <- institution_search(typeSpecimenCount = "10,100",limit=1) + }) + + expect_is(q, "list") + expect_is(q$data, "tbl_df") + expect_is(q$meta, "data.frame") + expect_true(nrow(q$data) > 0) + expect_gte(q$meta$count, 10) + expect_gte(ncol(q$data), 30) + + expect_is(s, "list") + expect_is(s$data, "tbl_df") + expect_is(s$meta, "data.frame") + expect_true(nrow(s$data) > 0) + expect_gte(s$meta$count, 1000) + expect_gte(ncol(s$data), 30) + + expect_is(o, "list") + expect_is(o$data, "tbl_df") + expect_is(o$meta, "data.frame") + expect_true(nrow(o$data) > 0) + expect_gte(o$meta$count, 1000) + expect_gte(ncol(o$data), 30) + + expect_is(e, "list") + expect_is(e$data, "tbl_df") + expect_is(e$meta, "data.frame") + expect_true(nrow(e$data) > 0) + expect_gte(e$meta$count, 3000) + expect_gte(ncol(e$data), 20) + + expect_is(c, "list") + expect_is(c$data, "tbl_df") + expect_is(c$meta, "data.frame") + expect_true(nrow(c$data) > 0) + expect_gte(c$meta$count, 2000) + expect_gte(ncol(c$data), 30) + + expect_is(t, "list") + expect_is(t$data, "tbl_df") + expect_is(t$meta, "data.frame") + expect_true(nrow(t$data) > 0) + expect_gte(t$meta$count, 500) + expect_gte(ncol(t$data), 30) + + }) + +test_that("institution_export works as expected", { + skip_on_cran() + skip_on_ci() + + q <- institution_export(query = "Kansas") + s <- institution_export(numberSpecimens = "1000,*") + o <- institution_export(numberSpecimens = "1000,*", occurrenceCount = "10,*") + + expect_is(q, "tbl_df") + expect_gte(nrow(q), 10) + expect_gte(ncol(q), 10) + expect_true("key" %in% names(q)) + + expect_is(s, "tbl_df") + expect_gte(nrow(s), 1000) + expect_gte(ncol(s), 10) + expect_true("key" %in% names(s)) + + expect_is(o, "tbl_df") + expect_gte(nrow(o), 1000) + expect_gte(ncol(o), 10) + expect_true("key" %in% names(o)) + +})