Skip to content

Commit e15e637

Browse files
committed
Merge from main
Merge branch 'main' into sarah-dev # Conflicts: # NEWS.md # R/optional_eml_elements.R # R/required_eml_elements.R # R/tabular_data_congruence.R
2 parents 7d22090 + 12997a2 commit e15e637

69 files changed

Lines changed: 153 additions & 139 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

NEWS.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
# DPchecker 1.1.0 (under development)
22
## 2025-04-23
33
* Remove `test_public_points()` function. DataStore previously made GPS coordinates public, even when data files were restricted-access, so this function was written to alert users of that fact. DataStore now applies the same access rules to GPS coordinates and data files, so this check is no longer needed.
4-
* Remove dependency on `arcticdatautils` package.
5-
4+
65
# DPchecker 1.0.1
6+
## 2025-04-16
7+
* remove arcticdatautils as a dependency and replace functionality with equivalent functions from EMLeditor to reduce the total number of package dependencies.
8+
9+
## 2025-04-01
10+
* fix bug that caused `test_datatable_urls_doi` to produce unexpected errors when checking metadata generated from ezEML.
11+
712
## 2025-03-25
813
* fix bug that caused several functions to fail to detect certain .csv files
914

R/tabular_data_congruence.R

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,15 @@ test_datatable_urls_doi <- function (metadata = load_metadata(directory)) {
431431
cli::cli_abort(c("x" = "One or more data files lack URLs. Could not test whether URLs are properly formatted or correspond to the corect DOI. Use {.fn EMLeditor::set_data_urls} to add them."))
432432
return(invisible(metadata))
433433
}
434+
435+
#handle <url function="download> tag from ezEML:
436+
if (length(seq_along(url)) > 1) {
437+
bad_url <- bad_url + 1
438+
tbl_name <- data_tbl[[i]][["physical"]][["objectName"]]
439+
cli::cli_warn(c("!" = "Metadata URL for the data table {.var {tbl_name}} is incorrectly formatted. Use {.fn EMLeditor::set_data_urls} to update the URLs."))
440+
return(invisible(metadata))
441+
}
442+
434443
prefix <- stringr::str_sub(url, 1, stringr::str_length(url)-7)
435444
suffix <- stringr::str_sub(url, -7, -1)
436445

@@ -528,7 +537,9 @@ test_fields_match <- function(directory = here::here(), metadata = load_metadata
528537
}
529538

530539
# Get list of attributes for each table in the metadata
531-
metadata_attrs <- lapply(data_tbl, function(tbl) {EMLeditor::get_eml_simple(tbl, "attributeName")})
540+
metadata_attrs <- lapply(data_tbl,
541+
function(tbl) {EMLeditor::get_eml_simple(tbl,
542+
"attributeName")})
532543
metadata_attrs$`@context` <- NULL
533544

534545
#list all data files that are in data package
@@ -818,11 +829,12 @@ test_numeric_fields <- function(directory = here::here(), metadata = load_metada
818829
#' dir <- DPchecker_example("BICY_veg")
819830
#' test_dates_parse(dir)
820831
test_dates_parse <- function(directory = here::here(),
821-
metadata = load_metadata(directory)){
832+
metadata = load_metadata(directory)) {
822833

823834
is_eml(metadata) # Throw an error if metadata isn't an emld object
824835

825-
missing_temporal <- is.null(EMLeditor::get_eml_simple(metadata, "temporalCoverage"))
836+
missing_temporal <- is.null(EMLeditor::get_eml_simple(metadata,
837+
"temporalCoverage"))
826838

827839
# Check if temporal coverage info is complete. Throw a warning if it's missing entirely and an error if it's only partially complete.
828840
# The logic being that maybe there's a scenario where temporal coverage isn't relevant to the dataset at all, but if it has date/time info, it has to have both a start and end.
@@ -981,7 +993,8 @@ test_date_range <- function(directory = here::here(),
981993

982994
is_eml(metadata) # Throw an error if metadata isn't an emld object
983995

984-
missing_temporal <- is.null(EMLeditor::get_eml_simple(metadata, "temporalCoverage"))
996+
missing_temporal <- is.null(EMLeditor::get_eml_simple(metadata,
997+
"temporalCoverage"))
985998

986999
# Check if temporal coverage info is complete. Throw a warning if it's missing entirely and an error if it's only partially complete.
9871000
# The logic being that maybe there's a scenario where temporal coverage isn't relevant to the dataset at all, but if it has date/time info, it has to have both a start and end.
@@ -1034,8 +1047,8 @@ test_date_range <- function(directory = here::here(),
10341047
dttm_attrs$`@context` <- NULL
10351048

10361049
#### dropping skip_cols from date range check:
1037-
if(sum(!is.na(skip_cols)) > 0){
1038-
for(i in seq_along(dttm_attrs)){
1050+
if (sum(!is.na(skip_cols)) > 0) {
1051+
for (i in seq_along(dttm_attrs)) {
10391052
dttm_attrs[[i]]<-dplyr::filter(dttm_attrs[[i]],
10401053
!attributeName %in% skip_cols)
10411054
}
@@ -1200,7 +1213,8 @@ test_date_range <- function(directory = here::here(),
12001213
test_taxonomic_cov <- function(metadata = load_metadata(directory)) {
12011214
is_eml(metadata) # Throw an error if metadata isn't an emld object
12021215

1203-
missing_taxonomic <- is.null(EMLeditor::get_eml_simple(metadata, "taxonomicCoverage"))
1216+
missing_taxonomic <- is.null(EMLeditor::get_eml_simple(metadata,
1217+
"taxonomicCoverage"))
12041218

12051219
if (missing_taxonomic) {
12061220
cli::cli_warn(c("!" = "Metadata does not contain taxonomic coverage information."))
@@ -1226,8 +1240,8 @@ test_taxonomic_cov <- function(metadata = load_metadata(directory)) {
12261240
test_geographic_cov <- function(metadata = load_metadata(directory)) {
12271241
is_eml(metadata) # Throw an error if metadata isn't an emld object
12281242

1229-
missing_geographic <- is.null(EMLeditor::get_eml_simple(metadata, "geographicCoverage"))
1230-
1243+
missing_geographic <- is.null(EMLeditor::get_eml_simple(metadata,
1244+
"geographicCoverage"))
12311245
if (missing_geographic) {
12321246
cli::cli_warn(c("!" = "Metadata does not contain geographic coverage information."))
12331247
} else {
@@ -1372,7 +1386,9 @@ test_valid_fieldnames <- function(metadata = load_metadata(here::here())) {
13721386
}
13731387

13741388
# Get list of columns for each table in the metadata
1375-
metadata_attrs <- lapply(data_tbl, function(tbl) {EMLeditor::get_eml_simple(tbl, "attributeName")})
1389+
metadata_attrs <- lapply(data_tbl,
1390+
function(tbl) {EMLeditor::get_eml_simple(tbl,
1391+
"attributeName")})
13761392
metadata_attrs$`@context` <- NULL
13771393

13781394
#get names of each file to add to attributes table

docs/404.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/CONTRIBUTING.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/LICENSE-text.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/LICENSE.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/articles/DPchecker.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/articles/index.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/authors.html

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)