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

https changeover #51

Merged
merged 7 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/R-Git-Check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ jobs:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
Expand Down
7 changes: 4 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: ridigbio
Title: Interface to the iDigBio Data API
Version: 0.3.9
Date: 2024-7-02
Date: 2024-8-19
Encoding: UTF-8
Authors@R: c(person("Francois", "Michonneau", comment="Original Author", role=c("aut", "cph"),
email="[email protected]"),
Expand All @@ -22,7 +22,7 @@ Description: An interface to iDigBio's search API that allows downloading
such as the metadata end points return lists of information. iDigBio is a US
project focused on digitizing and serving museum specimen collections on the
web. See <https://www.idigbio.org> for information on iDigBio.
URL: https://github.com/iDigBio/ridigbio, http://idigbio.github.io/ridigbio/
URL: https://github.com/iDigBio/ridigbio, https://idigbio.github.io/ridigbio/
BugReports: https://github.com/iDigBio/ridigbio/issues
Depends:
R (>= 3.0.1)
Expand All @@ -33,7 +33,8 @@ Imports:
jsonlite,
leaflet,
kableExtra,
tidyverse
tidyverse,
cowplot
License: MIT + file LICENSE
LazyData: true
Suggests:
Expand Down
5 changes: 3 additions & 2 deletions R/base.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
##' @author Francois Michonneau
idig_url <- function(dev = FALSE) {
if (dev) {
"http://beta-search.idigbio.org"
"https://beta-search.idigbio.org"
} else {
"http://search.idigbio.org"
"https://search.idigbio.org"
}
}

Expand Down Expand Up @@ -134,4 +134,5 @@ ignore_unused_imports <- function() {
leaflet::`%>%`()
kableExtra::kable()
tidyverse::tidyverse_logo()
cowplot::theme_minimal_grid()
}
10 changes: 5 additions & 5 deletions R/idig_search_media.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@
##' \item{dqs: Data quality score assigned by iDigBio.}
##' \item{etag: Tag assigned by iDigBio.}
##' \item{flags: Data quality flag assigned by iDigBio.}
##' \item{[format](http://purl.org/dc/terms/format) }
##' \item{[format](https://purl.org/dc/terms/format) }
##' \item{hasSpecimen: TRUE or FALSE, indicates if there is an associated record for this media.}
##' \item{[licenselogourl](https://ac.tdwg.org/termlist/#ac_licenseLogoURL)}
##' \item{mediatype: Media object type.}
##' \item{[modified](http://purl.org/dc/terms/modified)}
##' \item{[modified](https://purl.org/dc/terms/modified)}
##' \item{recordids: List of UUID for associated records.}
##' \item{records: UUID for the associated record.}
##' \item{recordset: Record set ID assigned by iDigBio.}
##' \item{[rights](http://purl.org/dc/terms/rights)}
##' \item{[tag](http://rs.tdwg.org/ac/terms/tag)}
##' \item{[type](http://purl.org/dc/terms/type)}
##' \item{[rights](https://purl.org/dc/terms/rights)}
##' \item{[tag](https://rs.tdwg.org/ac/terms/tag)}
##' \item{[type](https://purl.org/dc/terms/type)}
##' \item{uuid: Unique identifier assigned by iDigBio.}
##' \item{version: Media record version assigned by iDigBio.}
##' \item{[webstatement](https://developer.adobe.com/xmp/docs/XMPNamespaces/xmpRights/)}
Expand Down
10 changes: 5 additions & 5 deletions R/idig_search_records.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@
##' \itemize{
##' \item{UUID: Unique identifier assigned by iDigBio.}
##' \item{[occurrenceID](https://dwc.tdwg.org/list/#dwc_occurrenceID)}
##' \item{[catalognumber](http://rs.tdwg.org/dwc/terms/catalogNumber)}
##' \item{[family](http://rs.tdwg.org/dwc/terms/family) - may be reassigned by iDigBio}
##' \item{[catalognumber](https://rs.tdwg.org/dwc/terms/catalogNumber)}
##' \item{[family](https://rs.tdwg.org/dwc/terms/family) - may be reassigned by iDigBio}
##' \item{[genus](https://dwc.tdwg.org/list/#dwc_genus) - may be reassigned by iDigBio}
##' \item{[scientificname](http://rs.tdwg.org/dwc/terms/scientificName) - may be reassigned by iDigBio}
##' \item{[country](http://rs.tdwg.org/dwc/terms/country) - may be modified by iDigBio}
##' \item{[stateprovince](http://rs.tdwg.org/dwc/terms/stateProvince) }
##' \item{[scientificname](https://rs.tdwg.org/dwc/terms/scientificName) - may be reassigned by iDigBio}
##' \item{[country](https://rs.tdwg.org/dwc/terms/country) - may be modified by iDigBio}
##' \item{[stateprovince](https://rs.tdwg.org/dwc/terms/stateProvince) }
##' \item{geopoint: Assigned by iDigBio.}
##' \item{[data.dwc:eventDate](https://dwc.tdwg.org/list/#dwc_eventDate)}
##' \item{[data.dwc:year](https://dwc.tdwg.org/list/#dwc_year)}
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ sudo apt install libcurl4
## Getting Started
There are several articles that can help get you started:

* [Introduction to ridigbio](http://idigbio.github.io/ridigbio/articles/BasicUsage.html)
* [Record API Demo](http://idigbio.github.io/ridigbio/articles/RecordAPIDemo.html)
* [Media API Demo](http://idigbio.github.io/ridigbio/articles/MediaAPIDemo.html)
* [Fields in ridigibio](http://idigbio.github.io/ridigbio/articles/Fields.html)
* [Tissue Samples Locator Demo](http://idigbio.github.io/ridigbio/articles/FindTissue.html)
* [Identification of Modified Data](http://idigbio.github.io/ridigbio/articles/ModifiedDataID.html)
* [Identification of Suspicious Coordinates](http://idigbio.github.io/ridigbio/articles/BadCoordinateID.html)
* [Identification of Data Flags](http://idigbio.github.io/ridigbio/articles/IDDataFlags.html)
* [Introduction to ridigbio](https://idigbio.github.io/ridigbio/articles/BasicUsage.html)
* [Record API Demo](https://idigbio.github.io/ridigbio/articles/RecordAPIDemo.html)
* [Media API Demo](https://idigbio.github.io/ridigbio/articles/MediaAPIDemo.html)
* [Fields in ridigibio](https://idigbio.github.io/ridigbio/articles/Fields.html)
* [Tissue Samples Locator Demo](https://idigbio.github.io/ridigbio/articles/FindTissue.html)
* [Identification of Modified Data](https://idigbio.github.io/ridigbio/articles/ModifiedDataID.html)
* [Identification of Suspicious Coordinates](https://idigbio.github.io/ridigbio/articles/BadCoordinateID.html)
* [Identification of Data Flags](https://idigbio.github.io/ridigbio/articles/IDDataFlags.html)


Most iDigBio users are interested in downloading occurrence records:
Expand Down
2 changes: 1 addition & 1 deletion _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
url: http://idigbio.github.io/ridigbio/
url: https://idigbio.github.io/ridigbio/
template:
bootstrap: 5
params:
Expand Down
10 changes: 5 additions & 5 deletions man/idig_search_media.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions man/idig_search_records.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/ridigbio-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 27 additions & 5 deletions vignettes/BadCoordinateID.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ library(kableExtra)

# Load libraries for visualizing geographic data
library(leaflet)

library(cowplot)
```

## Write a query to search for specimen records

First, let's find all the specimen records for the data quality flag we are interested in. Do this using the `idig_search_records` function from the `ridigbio` package. You can learn more about this function from the [iDigBio API documentation](https://github.com/iDigBio/idigbio-search-api/wiki) and [ridigbio documentation](https://cran.r-project.org/web/packages/ridigbio/ridigbio.pdf). In this example, we want to start by searching for specimens flagged with "rev_geocode_corrected."
First, let's find all the specimen records for the data quality flag we are interested in. Do this using the `idig_search_records` function from the `ridigbio` package. You can learn more about this function from the [iDigBio API documentation](https://github.com/iDigBio/idigbio-search-api/wiki) and [ridigbio documentation](https://cran.r-project.org/package=ridigbio/ridigbio.pdf). In this example, we want to start by searching for specimens flagged with "rev_geocode_corrected."

```{r}
# Edit the fields (e.g. `flags`) and values (e.g. "rev_geocode_corrected") in
Expand Down Expand Up @@ -134,7 +136,7 @@ map <- df_rev_geocode_lat_sign[1:10,] %>%

We can visualize this data on a map to better understand what the data quality flag is telling us. For example, in the map below you can see the effect of accidentally reversing the latitude on three example georeferenced specimen records.

```{r echo = FALSE}
```{r echo = FALSE, out.width = '100%'}
map
```

Expand Down Expand Up @@ -178,8 +180,16 @@ percentFlagged <- sum(spmByColl$n)/totalInstSpm*100

For example, we can ask how many specimen records from which collections at the Natural History Museum of Los Angeles (LACM) have been flagged as "rev_geocode_corrected" by iDigBio. *As an aside, although this graph highlights the number of specimen records with data quality issues, these represent only `r round(percentFlagged, 2)`% of the total specimen records published by LACM.*

```{r echo = FALSE}
graph_spmByColl
```{r out.width="700px", echo = FALSE}
graph_spmByColl <- graph_spmByColl +
theme_minimal_grid() +
theme(
text = element_text(size = 22),
axis.text = element_text(size = 22),
plot.title = element_text(size = 22, face = "bold")
)

knitr::include_graphics(save_plot("plot.png", graph_spmByColl, base_height = 10, base_width = 24))
```

We can also explore what *other* data quality flags these specimen records have been flagged with.
Expand All @@ -202,7 +212,7 @@ df_flagAssoc <- df_flagCoord %>%
arrange(category, desc(n))

# Visualize associated data quality flags
ggplot(df_flagAssoc, aes(x = reorder(flags, -percent), y = percent, fill = category)) +
graph_spmByColl <- ggplot(df_flagAssoc, aes(x = reorder(flags, -percent), y = percent, fill = category)) +
geom_col() +
theme(axis.title.x = element_text(face = "bold"),
axis.text.x = element_text(angle = 75, hjust = 1),
Expand All @@ -215,3 +225,15 @@ ggplot(df_flagAssoc, aes(x = reorder(flags, -percent), y = percent, fill = categ
title = "LACM records flagged for geo-coordinate issues are also flagged for...",
fill = "flag category")
```
```{r out.width="700px", echo = FALSE}
graph_spmByColl <- graph_spmByColl +
theme_minimal_grid() +
theme(
text = element_text(size = 22),
axis.text = element_text(size = 22),
axis.text.x = element_text(angle = 90, vjust = 0.5, hjust = 1),
plot.title = element_text(size = 22, face = "bold")
)

knitr::include_graphics(save_plot("plot2.png", graph_spmByColl, base_height = 10, base_width = 24))
```
32 changes: 16 additions & 16 deletions vignettes/BasicUsage.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ In this demo we will cover how to:

## Getting Started

First, you must install the ridigbio package. If you are new to R and R studio, please refer to our QUBES module to get started: Introduction to R with Biodiversity Data, [doi:10.25334/84FC-TE88](htpps://www.doi.org/10.25334/84FC-TE88) .
First, you must install the ridigbio package. If you are new to R and R studio, please refer to our QUBES module to get started: Introduction to R with Biodiversity Data, [doi:10.25334/84FC-TE88](https://www.doi.org/10.25334/84FC-TE88) .

The lastest version of our R package can be installed via CRAN.
```{r eval=FALSE, include=TRUE}
Expand Down Expand Up @@ -49,21 +49,21 @@ When fields are not specified, default columns include the following:
| Column | Description |
| ----------- | ----------- |
| uuid | Universally Unique IDentifier assigned by iDigBio |
| occurrenceid |identifier for the occurrence, http://rs.tdwg.org/dwc/terms/occurrenceID|
| catalognumber |identifier for the record within the collection, http://rs.tdwg.org/dwc/terms/catalogNumber|
| family | scientific name of the family, http://rs.tdwg.org/dwc/terms/family|
| genus | scientific name of the genus, http://rs.tdwg.org/dwc/terms/genus |
| scientificname | scientific name, http://rs.tdwg.org/dwc/terms/scientificName |
| country | country, http://rs.tdwg.org/dwc/terms/country |
| stateprovince |name of the next smaller administrative region than country, http://rs.tdwg.org/dwc/terms/stateProvince|
| geopoint.lon | equivalent to decimalLongitude, http://rs.tdwg.org/dwc/terms/decimalLongitude|
| geopoint.lat | equivalent to decimalLatitude,http://rs.tdwg.org/dwc/terms/decimalLatitude |
| occurrenceid |identifier for the occurrence, https://rs.tdwg.org/dwc/terms/occurrenceID|
| catalognumber |identifier for the record within the collection, https://rs.tdwg.org/dwc/terms/catalogNumber|
| family | scientific name of the family, https://rs.tdwg.org/dwc/terms/family|
| genus | scientific name of the genus, https://rs.tdwg.org/dwc/terms/genus |
| scientificname | scientific name, https://rs.tdwg.org/dwc/terms/scientificName |
| country | country, https://rs.tdwg.org/dwc/terms/country |
| stateprovince |name of the next smaller administrative region than country, https://rs.tdwg.org/dwc/terms/stateProvince|
| geopoint.lon | equivalent to decimalLongitude, https://rs.tdwg.org/dwc/terms/decimalLongitude|
| geopoint.lat | equivalent to decimalLatitude,https://rs.tdwg.org/dwc/terms/decimalLatitude |
| datecollected | [Modified field and could lack biological meaning](https://github.com/iDigBio/idb-backend/issues/229) |
| data.dwc:eventDate | equivalent to eventDate, https://dwc.tdwg.org/list/#dwc_eventDate |
| data.dwc:year | year of collection event, https://dwc.tdwg.org/list/#dwc_year |
| data.dwc:month | month of collection event, https://dwc.tdwg.org/list/#dwc_month |
| data.dwc:day | day of collection event | (https://dwc.tdwg.org/list/#dwc_day |
| collector | equivalent to recordedBy, http://rs.tdwg.org/dwc/terms/recordedBy |
| collector | equivalent to recordedBy, https://rs.tdwg.org/dwc/terms/recordedBy |
| recordset | indicates the iDigBio recordset the observation belongs too! |


Expand Down Expand Up @@ -121,17 +121,17 @@ When fields are not specified, default columns include the following:
| dqs | data quality score assigned by iDigBio |
| etag | tag assigned by iDigBio |
| flags | data quality flag assigned by iDigBio |
| format | media format, http://purl.org/dc/terms/format |
| format | media format, https://purl.org/dc/terms/format |
| hasSpecimen | TRUE or FALSE, indicates if there is an associated record for this media |
| licenselogourl | media license, https://ac.tdwg.org/termlist/#ac_licenseLogoURL) |
| mediatype | media object type |
| modified | date modified, http://purl.org/dc/terms/modified |
| modified | date modified, https://purl.org/dc/terms/modified |
| recordids | list of UUID for associated records |
| records | UUID for the associated record. Use this field to connect Record downloads with Media downloads |
| recordset | indicates the iDigBio recordset the observation belongs too! |
| rights | media rights, http://purl.org/dc/terms/rights |
| tag | general keywords or tags, http://rs.tdwg.org/ac/terms/tag |
| type | media type, http://purl.org/dc/terms/type |
| rights | media rights, https://purl.org/dc/terms/rights |
| tag | general keywords or tags, https://rs.tdwg.org/ac/terms/tag |
| type | media type, https://purl.org/dc/terms/type |
| uuid | Universally Unique IDentifier assigned by iDigBio |
| version | media record version assigned by iDigBio |
| webstatement | media rights, https://developer.adobe.com/xmp/docs/XMPNamespaces/xmpRights/ |
Expand Down
Loading