Skip to content

Commit

Permalink
Merge pull request #128 from RobLBaker/main
Browse files Browse the repository at this point in the history
Update to version 0.1.5
  • Loading branch information
RobLBaker authored Apr 2, 2024
2 parents 1484057 + 5c319aa commit 45f31da
Show file tree
Hide file tree
Showing 117 changed files with 3,836 additions and 17,393 deletions.
21 changes: 11 additions & 10 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: EMLeditor
Title: View and Edit EML Metadata
Version: 0.1.4
Version: 0.1.5
Authors@R: c(
person(given="Robert", family="Baker", email="[email protected]",
role = c("aut", "cre"),
Expand All @@ -19,7 +19,7 @@ License: MIT + file LICENSE
BugReports: https://github.com/nationalparkservice/EMLeditor/issues
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Remotes:
NCEAS/arcticdatautils,
nationalparkservice/DPchecker
Expand All @@ -29,26 +29,27 @@ Imports:
sf,
utils,
EML,
arcticdatautils,
magrittr,
stringr,
gdata,
stargazer,
lubridate,
ISOcodes,
crayon,
dplyr,
stats,
lifecycle,
here,
DPchecker (>= 0.1.0),
purrr,
jsonlite,
tibble,
cli,
cli,
XML,
curl
Suggests:
curl,
mockr,
rlang,
ISOcodes,
gdata
Suggests:
arcticdatautils,
stargazer,
knitr,
rmarkdown,
testthat (>= 3.0.0)
Expand Down
11 changes: 10 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Generated by roxygen2: do not edit by hand

export(.get_user_input3)
export(check_eml)
export(get_abstract)
export(get_additional_info)
Expand All @@ -8,14 +9,18 @@ export(get_begin_date)
export(get_citation)
export(get_content_units)
export(get_cui)
export(get_cui_code)
export(get_cui_marking)
export(get_doi)
export(get_drr_doi)
export(get_drr_title)
export(get_ds_id)
export(get_end_date)
export(get_file_info)
export(get_lit)
export(get_methods)
export(get_producing_units)
export(get_publisher)
export(get_title)
export(remove_datastore_files)
export(set_abstract)
Expand All @@ -25,6 +30,8 @@ export(set_creator_orcids)
export(set_creator_order)
export(set_creator_orgs)
export(set_cui)
export(set_cui_code)
export(set_cui_marking)
export(set_data_urls)
export(set_datastore_doi)
export(set_doi)
Expand All @@ -33,12 +40,14 @@ export(set_int_rights)
export(set_language)
export(set_lit)
export(set_methods)
export(set_missing_data)
export(set_producing_units)
export(set_protocol)
export(set_publisher)
export(set_title)
export(upload_data_package)
export(write_readme)
importFrom(lifecycle,deprecated)
importFrom(magrittr,"%>%")
importFrom(mockr,local_mock)
importFrom(rlang,local_options)
importFrom(stats,complete.cases)
30 changes: 29 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
# EMLeditor v0.1.5 "Little Bighorn"

## 2024-04-01
* Fix bug in `set_creator_orcids()`: no longer adds https://orcid.org/NA for creators without an orcid.
* Added checks in `set_creator_orcids()` such that users must specify NA (not "NA") and to check that the length of the orcid list supplied matches the length of the authors in metadata (excluding organizational authors).
* Updated `set_creator_orcids()` documentation to specify that the function can also be used to remove orcids from authors.
* Updated the EML creation script to reference `set_cui_code()` as opposed to the (now deprecated) `set_cui()`.

## 2024-04-01
* Fix bug in `set_cui_code()` that was detecting both CUI code and CUI marking.
* Fix bug in `set_cui_marking()`.
* Fix bug in `set_creator_order()`.

## 2024-03-12
* make `write_readme()` a non-exported function.

## 2024-02-29
* Add function `get_cui_code()`. Deprecate function `get_cui()`.
* Add function `get_cui_marking()`.

## 2024-02-22
* Added function `set_missing_data()` which allows users to add missing data codes and missing data code definitions to metadata.
* Added utility functions `.get_user_input()` and `.get_user_input3()`. Refactored all set_ class functions to use these sub-functions rather than readlines() to get user input.

## 2024-02-13
* Deprecated `set_cui()` in favor of `set_cui_dissem()`, which does the exact same thing as `set_cui()` but the function name has been updated to distinguish the action of the function from the newly added `set_cui_code()` function.
* Updated the publisher contact email in `set_npspublisher()` from [email protected] to [email protected] to reflect DataStore changes in the contact email address.

# EMLeditor v0.1.4 "Mackinac Island"

## 2024-01-18
Expand Down Expand Up @@ -135,7 +163,7 @@ Added a new function, `set_datastore_doi()` that will initiate a draft reference

## February 09, 2023

# Summary
### Summary

Bug fixes, update `set_cui()` codes, flesh out `set_int_rights`. Update documentation.

Expand Down
3 changes: 3 additions & 0 deletions R/UntitledR.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@
# agol_token)
# data_w_covariates <- rbind(data_w_covariates, temporary) } return(data_w_covariates) }
#}



1 change: 0 additions & 1 deletion R/check_eml.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ check_eml <- function(path = here::here()) {
#' @param outfile is the name of the file you want to write, typically *.txt.
#'
#' @return a character string in readable format (saved to the given outfile)
#' @export
#'
#' @examples
#' \dontrun{
Expand Down
19 changes: 9 additions & 10 deletions R/datastore_interactions.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#' Initiates a draft reference and inserts the reserved DOI into metadata
#'
#' @description `set_datastore_doi()` differs from `set_doi()` in that this function generates a draft reference on DataStore and uses that draft reference to auto-populate the DOI within metadata whereas the later requires manually initiating a draft reference in DataStore and providing the reference ID to insert the DOI into metadata.
#' @description `set_datastore_doi()` differs from `set_doi()` in that this function generates a draft reference on DataStore and uses that draft reference to auto-populate the DOI within metadata whereas the latter requires manually initiating a draft reference in DataStore and providing the reference ID to insert the DOI into metadata.
#'
#' @details To prevent generating too many (unused) draft references, `set_datastore_doi()` checks your metadata contents prior to initiating a draft reference on DataStore. If you already have a DOI specified, it will ask if you really want to over-write the DOI **and** initiate a new draft reference. Setting force = TRUE will over-ride this aspect of the function, so use with care. the `set_datastore_doi()` function requires that your metadata already contain a data package title and if it is missing will prompt you to insert it and quit. Setting force = TRUE will not override this check. If R cannot successfully initiate a draft reference on DataStore, the function will remind you to log on to the VPN. If the problem persists, email [irma@nps.gov](mailto:irma@nps.gov).
#' @details To prevent generating too many (unused) draft references, `set_datastore_doi()` checks your metadata contents prior to initiating a draft reference on DataStore. If you already have a DOI specified, it will ask if you really want to over-write the DOI **and** initiate a new draft reference. Setting force = TRUE will over-ride this aspect of the function, so use with care. the `set_datastore_doi()` function requires that your metadata already contain a data package title and if it is missing will prompt you to insert it and quit. Setting force = TRUE will not override this check. If R cannot successfully initiate a draft reference on DataStore, the function will remind you to log on to the VPN. If the problem persists, email [NRSS_DataStore@nps.gov ](mailto:NRSS_DataStore@nps.gov ).
#'
#' @details This function generates a draft reference on DataStore. If you run with force = FALSE (default), the function will report the draft reference URL and the draft title for the draft reference. Make sure you upload your data and metadata to the correct draft reference! Your draft reference title should read: "DRAFT: <your data package title>". This will be updated to your data package title when you upload your metadata.
#'
Expand All @@ -28,16 +28,16 @@
#' }
set_datastore_doi <- function(eml_object, force = FALSE, NPS = TRUE, dev = FALSE){
# check for existing DOI:
doc <- utils::capture.output(get_doi(eml_object))
doc <- utils::capture.output(EMLeditor::get_doi(eml_object))
#get data package title from metadata:
data_package_title <- EMLeditor::get_title(eml_object)
if(force == FALSE){
# if there is NOT an existing DOI in metadata:
if(length(seq_along(doc)) > 1 ){
cat("Your metadata does not have a previously specified DOI.\n", sep = "")
cat("Your metadata does not have a previously specified DOI.\n",
sep = "")
cat("Are you sure you want to create a new draft reference on DataStore and insert the corresponding DOI into your metadata?\n")
message("1: Yes")
var1 <- readline(prompt = "2: No \n")
var1 <- .get_user_input() #1 = yes, 2 = no
if (var1 == 2){
cat("Function terminated. You have not created a new draft reference on DataStore and a DOI has not been added to your metadata.")
return()
Expand Down Expand Up @@ -81,8 +81,7 @@ set_datastore_doi <- function(eml_object, force = FALSE, NPS = TRUE, dev = FALSE
}
#Ask if they really want a new DOI & new draft reference?
cat("Are you sure you want to create a new draft reference on DataStore and insert the corresponding DOI into your metadata?\n")
message("1: Yes")
var1 <- readline(prompt = "2: No\n")
var1 <- .get_user_input() # 1 = yes, 2 = no
# if chooses not to add a new doi/generate a new draft reference:
if (var1 == 2){
cat("Function terminated. You have not created a new draft reference on DataStore and your original DOI has been retained.")
Expand Down Expand Up @@ -255,7 +254,7 @@ upload_data_package <- function(directory = here::here(),
return()
}
cat("Are you sure you want to upload your data package files to this reference?\n")
var1 <- readline(prompt = "1: Yes\n2: No\n")
var1 <- .get_user_input() # 1 = yes, 2 = no
if (var1 == 2) {
cat("Function terminated. You have not uploaded any files to DataStore.")
}
Expand Down Expand Up @@ -524,7 +523,7 @@ remove_datastore_files <- function(data_store_reference,
Reference?"
x <- strwrap(x, width = 10000, simplify = TRUE)
cat(x)
var1 <- readline(prompt = "1: Yes\n2: No\n")
var1 <- .get_user_input() # 1 = yes, 2 = no
if (var1 == 2) {
cat("You have not removed any files from the Reference.")
return(invisible())
Expand Down
Loading

0 comments on commit 45f31da

Please sign in to comment.