Skip to content

Commit e6be0d9

Browse files
authored
Merge pull request DOI-NPS#170 from nationalparkservice/sarah-dev
Remove unnecessary function and dependency
2 parents 6ab8153 + ba6c94f commit e6be0d9

15 files changed

Lines changed: 1287 additions & 1075 deletions

DESCRIPTION

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
Package: DPchecker
22
Title: Checks Data Packages for Congruence
3-
Version: 1.0.1
3+
Version: 1.1.0
44
Authors@R: c(
55
person("Rob", "Baker", email = "robert_baker@nps.gov", role = c("cre", "aut"), comment = c(ORCID = "0000-0001-7591-5035")),
66
person(c("Sarah", "E."), "Wright", email = "sarah_wright@nps.gov", role = "aut"),
77
person("Issac", "Quevedo", role = "ctb"),
88
person("Amelia", "Sherman", role = "ctb"))
99
Description: Allows the user (and reviewer) to check a data package and test whether it meets the congruence standards set forth by NPS for upload to DataStore as a datapackage.
1010
License: MIT + file LICENSE
11+
BugReports: https://github.com/nationalparkservice/DPchecker/issues
1112
Encoding: UTF-8
1213
Roxygen: list(markdown = TRUE)
1314
RoxygenNote: 7.3.2
@@ -16,8 +17,7 @@ Suggests:
1617
here,
1718
rstudioapi,
1819
testthat (>= 3.0.0),
19-
knitr,
20-
EMLeditor
20+
knitr
2121
Config/testthat/edition: 3
2222
Imports:
2323
EML,
@@ -33,8 +33,9 @@ Imports:
3333
httr,
3434
jsonlite,
3535
QCkit,
36+
EMLeditor,
3637
lifecycle
3738
Remotes:
3839
https://github.com/nationalparkservice/QCkit,
3940
https://github.com/nationalparkservice/EMLeditor
40-
URL: https://nationalparkservice.github.io/DPchecker/
41+
URL: https://github.com/nationalparkservice/DPchecker, https://nationalparkservice.github.io/DPchecker/

NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ export(test_pii_data_emails)
4343
export(test_pii_meta_emails)
4444
export(test_project)
4545
export(test_pub_date)
46-
export(test_public_points)
4746
export(test_publisher)
4847
export(test_publisher_city)
4948
export(test_publisher_state)

NEWS.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# DPchecker 1.0.1 (under development)
1+
# DPchecker 1.1.0 (under development)
2+
## 2025-04-23
3+
* 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+
5+
# DPchecker 1.0.1
26
## 2025-04-24
37
* add function `test_datatable_url_attributes` to test for the appropriate attribute in the xml designation in metadata for urls.
48
* Added unit tests for `test_datatable_url_attributes`, `test_datatable_urls_doi`, and `test_datatable_urls`

R/optional_data_checks.R

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,51 +13,52 @@
1313
#' test_pii_data_emails()
1414
#' }
1515
test_pii_data_emails <- function(directory = here::here()) {
16-
17-
#get the full file names and paths for all files in directory
16+
# get the full file names and paths for all files in directory
1817
files <- list.files(directory, full.names = TRUE)
1918

20-
emails_list <- NULL #list of lists containing offending emails.
21-
#populate emails_list with pii emails:
22-
for(file in files){
23-
data_emails <- NULL #holds emails
24-
email_files <- NULL #holds names of files that contain emails
19+
emails_list <- NULL # list of lists containing offending emails.
20+
# populate emails_list with pii emails:
21+
for (file in files) {
22+
data_emails <- NULL # holds emails
23+
email_files <- NULL # holds names of files that contain emails
2524
personal_emails <- NULL # holds offending emails
26-
if(grepl(".csv", file, ignore.case = TRUE)) {
27-
#read data line by line, concatenate lines (emails split across a lines)
25+
if (grepl(".csv", file, ignore.case = TRUE)) {
26+
# read data line by line, concatenate lines (emails split across a lines)
2827
data_lines <- paste(readLines(file), collapse = " ")
29-
#for each csv file, extract all emails and add them to file_emails
28+
# for each csv file, extract all emails and add them to file_emails
3029
data_emails <- suppressWarnings(
31-
regmatches(data_lines,gregexpr("([_+a-z0-9-]+(\\.[_+a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,14}))", data_lines)))
30+
regmatches(data_lines, gregexpr("([_+a-z0-9-]+(\\.[_+a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,14}))", data_lines))
31+
)
3232
data_emails <- unlist(data_emails, recursive = FALSE)
3333

34-
#if a file contains emails, check for offending emails:
35-
if(length(seq_along(data_emails)) > 0){
36-
for(i in seq_along(data_emails)){
37-
#filter out .govs
38-
if(!stringr::str_detect(data_emails[i], ".gov")){
34+
# if a file contains emails, check for offending emails:
35+
if (length(seq_along(data_emails)) > 0) {
36+
for (i in seq_along(data_emails)) {
37+
# filter out .govs
38+
if (!stringr::str_detect(data_emails[i], ".gov")) {
3939
personal_emails <- append(personal_emails, data_emails[i])
4040
}
4141
}
4242
}
43-
if(!is.null(personal_emails)){
43+
if (!is.null(personal_emails)) {
4444
pii_emails <- list(personal_emails)
4545
names(pii_emails) <- basename(file)
46-
emails_list<-append(emails_list, pii_emails)
46+
emails_list <- append(emails_list, pii_emails)
4747
}
4848
}
4949
}
50-
#if there are offending emails, fail with warning:
51-
if(!is.null(emails_list)){
50+
# if there are offending emails, fail with warning:
51+
if (!is.null(emails_list)) {
5252
msg <- paste0("--> {.file ", names(emails_list), "}: ", unlist(emails_list))
5353
names(msg) <- rep(" ", length(msg))
5454
err <- paste0("The following data files contain emails with potential PII:")
5555

5656
cli::cli_warn(c("!" = err, msg))
57-
#if no pii emails (non .gov), pass test:
57+
# if no pii emails (non .gov), pass test:
5858
} else {
5959
cli::cli_inform(
60-
c("v" = "Data files do not appear to contain any personal emails."))
60+
c("v" = "Data files do not appear to contain any personal emails.")
61+
)
6162
}
62-
#return(invisible(metadata))
63+
# return(invisible(metadata))
6364
}

0 commit comments

Comments
 (0)