From 4a070ee4389aa25e9b3968af517ec395842d7555 Mon Sep 17 00:00:00 2001 From: Rob Baker Date: Tue, 20 Aug 2024 16:28:11 -0600 Subject: [PATCH 01/11] fix directory to .xml metadata for unit tests --- tests/testthat/test-editEMLfunctions.R | 12 ++---------- tests/testthat/test-getEMLfunctions.R | 8 ++------ 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/tests/testthat/test-editEMLfunctions.R b/tests/testthat/test-editEMLfunctions.R index c38951b..f89f003 100644 --- a/tests/testthat/test-editEMLfunctions.R +++ b/tests/testthat/test-editEMLfunctions.R @@ -1,17 +1,9 @@ -# load directories for accessing testing data/metadata. Note that this directory structure is necessary to pass Rstudio Build Checks but will not work for local test development and test testing. -good_dir <- here::here("good") -bad_dir <- here::here("bad") - -#to test/debug the tests, use the following directory structure: -#good_dir <- here::here("tests", "testthat", "good") - -#load metadata to to test functions with. Note that this directory structure is necessary to pass Rstudio Build Checks but will not work for local test development and test testing. -BICY_EMLed_meta <- EML::read_eml(here::here(good_dir, +#load metadata to to test functions with. +BICY_EMLed_meta <- EML::read_eml(testthat::test_path("good", "BICY", "BICY_EMLeditor_metadata.xml"), from="xml") - # a couple of house-keeping functions for mockr interactivity: return_val_2 <- function() {2} return_val_1 <- function() {1} diff --git a/tests/testthat/test-getEMLfunctions.R b/tests/testthat/test-getEMLfunctions.R index 0b5fc64..3e964e3 100644 --- a/tests/testthat/test-getEMLfunctions.R +++ b/tests/testthat/test-getEMLfunctions.R @@ -1,9 +1,5 @@ -# load directories for accessing testing data/metadata. Note that this directory structure is necessary to pass Rstudio Build Checks but will not work for local test development and test testing. -good_dir <- here::here("good") -bad_dir <- here::here("bad") - -#load metadata to to test functions with. Note that this directory structure is necessary to pass Rstudio Build Checks but will not work for local test development and test testing. -BICY_EMLed_meta <- EML::read_eml(here::here(good_dir, +#load metadata to to test functions with. +BICY_EMLed_meta <- EML::read_eml(testthat::test_path("good", "BICY", "BICY_EMLeditor_metadata.xml"), from="xml") From b37074ef3bc706d281e172606e4a5100ce589c72 Mon Sep 17 00:00:00 2001 From: Rob Baker Date: Tue, 20 Aug 2024 16:28:33 -0600 Subject: [PATCH 02/11] Update readme documentation --- README.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fe5c780..706423f 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,8 @@ The goal of EMLeditor is to edit EML-formatted xml files. Specifically, EMLeditor provides many functions that will be useful to the U.S. National Park Service when generating metadata for statistical data packages uploaded to DataStore. NPS affiliation is assumed as default. -However, some of the functions for viewing and editing metadata may be -useful to people outside the NPS. +However, the functions for viewing and editing metadata may be useful to +people outside the NPS. ## Installation and updates @@ -47,15 +47,20 @@ accompanying documentation includes information on: package functions 2) Adding in NPS specific and DataStore specific EML elements using the R/EMLeditor package functions -3) Checking the EML document to make sure it is schema-valid and passes - all the necessary tests for uploading to DataStore -4) Generating a draft data package reference on DataStore and +3) Generating a draft data package reference on DataStore and incorporating DOIs into the metadata +4) Checking the EML document to make sure it is schema-valid and passes + all the necessary tests for uploading to DataStore (using the + `run_congruence_checks()` function from the + [DPchecker](https://nationalparkservice.github.io/DPchecker/) + package) 5) Uploading a completed data package to DataStore Please *DO NOT ACTIVATE* the DataStore reference: prior to activation, data packages need to be reviewed via a yet-to-be-created process. +## Accessing the EML creation script + To access the EML creation script from within EMLeditor, install (or update) the EMLeditor package and restart R. From within Rstudio, select the “File” drop-down menu and choose “New File” (the first option). From @@ -63,6 +68,8 @@ within the “New File” menu, select “Rmarkdown…”. In the pop-up menu, select “From Template on the left hand side. Then choose the template,”Editable_EML_Creation_Workflow {EMLeditor}” then click “OK”. +## Additional considerations + If you use EMLeditor functions to alter your metadata (e.g. “set” class functions) they will also silently add the National Park Service as a publisher (including location, [ROR id](https://ror.org/), etc) to your From c659081cc13c90672ebdc4ccbd7d05f76924a420 Mon Sep 17 00:00:00 2001 From: Rob Baker Date: Tue, 20 Aug 2024 16:29:00 -0600 Subject: [PATCH 03/11] Add github workflow for build checks --- .github/workflows/R-CMD-check.yaml | 52 ++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/R-CMD-check.yaml diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml new file mode 100644 index 0000000..d46a617 --- /dev/null +++ b/.github/workflows/R-CMD-check.yaml @@ -0,0 +1,52 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +name: R-CMD-check.yaml + +permissions: read-all + +jobs: + R-CMD-check: + runs-on: ${{ matrix.config.os }} + + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + + strategy: + 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'} + - {os: ubuntu-latest, r: 'oldrel-1'} + + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes + + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck + needs: check + + - uses: r-lib/actions/check-r-package@v2 + with: + upload-snapshots: true + build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' From 66c2d526169dad638b8dcde8fc8e9b3213503f57 Mon Sep 17 00:00:00 2001 From: Rob Baker Date: Tue, 20 Aug 2024 16:29:35 -0600 Subject: [PATCH 04/11] add helper function to mask testthat::test_path until bug fix is merged into testhat --- tests/testthat/helper.R | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/testthat/helper.R diff --git a/tests/testthat/helper.R b/tests/testthat/helper.R new file mode 100644 index 0000000..ab4769e --- /dev/null +++ b/tests/testthat/helper.R @@ -0,0 +1,10 @@ +test_path <- function(...) { + # testthat::test_path() returns incorrect value + # when in the context of devtools::test_coverage_active_file() + path <- file.path(...) + if (file.exists(path)) { + path + } else { + file.path("tests/testthat/", path) + } +} From 37661198d2c610c6f297b0cbc417109f646abcc1 Mon Sep 17 00:00:00 2001 From: Rob Baker Date: Tue, 20 Aug 2024 16:52:01 -0600 Subject: [PATCH 05/11] fix url conflict between _pkgdown.yml and DESCRIPTION --- _pkgdown.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_pkgdown.yml b/_pkgdown.yml index fa97b15..6522c43 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -1,4 +1,4 @@ -url: https://nationalparkservice.github.io/EMLeditor/ +url: https://github.com/nationalparkservice/EMLeditor template: bootstrap: 5 From b11c8de1d49dd063bc6ac41bbec989ce64d3c4d8 Mon Sep 17 00:00:00 2001 From: Rob Baker Date: Tue, 20 Aug 2024 16:52:23 -0600 Subject: [PATCH 06/11] add alt-text to figures --- vignettes/a02_EML_creation_script.Rmd | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vignettes/a02_EML_creation_script.Rmd b/vignettes/a02_EML_creation_script.Rmd index d1c2f06..76b3174 100644 --- a/vignettes/a02_EML_creation_script.Rmd +++ b/vignettes/a02_EML_creation_script.Rmd @@ -19,12 +19,18 @@ knitr::opts_chunk$set( This page mirrors the editable EML Creation template that is included with the EMLeditor package (and has been installed if you installed either EMLeditor on its own or as part of the NPSdataverse). To access an editable version of this script, open R studio and select the "File" drop-down menu. Choose "New File" and select "R markdown" from the submenu. In the pop-up box, select "From Template" and then highlight "Editable_EML_Creation_Workflow {Emleditor}" (likely the first item in the list). Click "OK" to open the template. ```{r echo=FALSE, out.width='45%', fig.align="center"} +#| fig.alt: > +#| a graphic showing the first steps used to access the template EML creation +#| script included with the EMLeditor package. knitr::include_graphics("../man/figures/open_rmd.png") ``` ```{r echo=FALSE, out.width='45%', fig.show='hold', fig.align='center'} +#| fig.alt: > +#| a graphic showing the final steps used to access the template EML creation +#| script included with the EMLeditor package. knitr::include_graphics("../man/figures/EMLtemplate.png") ``` From 3ec7e2a7414c57af6a94a00456d4881431ab830d Mon Sep 17 00:00:00 2001 From: Rob Baker Date: Tue, 20 Aug 2024 16:52:43 -0600 Subject: [PATCH 07/11] update with newest changes --- NEWS.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS.md b/NEWS.md index d9cd954..c1a6844 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,8 @@ # EMLeditor v0.1.6 (in progress) +## 2024-08-20 + * add helper.R file with a test_path function to facilitate unit tests + * update unit test code to run both interactively and during build checks + * add yaml file to conduct github actions: build test ## 2024-07-10 * add in the new function `set_project()` and attempt to update existing function, `set_protocol()`. * update license from MIT to CC0. From f97cd39328c15b2e67f13c23a89d5fef251b3c19 Mon Sep 17 00:00:00 2001 From: Rob Baker Date: Tue, 20 Aug 2024 16:53:06 -0600 Subject: [PATCH 08/11] auto update via pkgdown --- docs/404.html | 71 +- docs/LICENSE-text.html | 62 +- docs/LICENSE.html | 62 +- docs/articles/a01_prereqs.html | 73 +- docs/articles/a02_EML_creation_script.html | 77 +- docs/articles/a03_Template_edits.html | 75 +- docs/articles/a04_Editing_fixing_eml.html | 75 +- docs/articles/a05_advanced_functionality.html | 73 +- docs/articles/index.html | 60 +- docs/authors.html | 71 +- docs/deps/bootstrap-5.3.1/bootstrap.min.css | 2 +- .../bootstrap-toc-1.0.1/bootstrap-toc.min.js | 5 + .../deps/clipboard.js-2.0.11/clipboard.min.js | 7 + docs/deps/data-deps.txt | 9 + docs/deps/font-awesome-6.4.2/css/all.css | 7968 +++++++++++++++++ docs/deps/font-awesome-6.4.2/css/all.min.css | 9 + docs/deps/font-awesome-6.4.2/css/v4-shims.css | 2194 +++++ .../font-awesome-6.4.2/css/v4-shims.min.css | 6 + .../webfonts/fa-brands-400.ttf | Bin 0 -> 189684 bytes .../webfonts/fa-brands-400.woff2 | Bin 0 -> 109808 bytes .../webfonts/fa-regular-400.ttf | Bin 0 -> 63348 bytes .../webfonts/fa-regular-400.woff2 | Bin 0 -> 24488 bytes .../webfonts/fa-solid-900.ttf | Bin 0 -> 394668 bytes .../webfonts/fa-solid-900.woff2 | Bin 0 -> 150020 bytes .../webfonts/fa-v4compatibility.ttf | Bin 0 -> 10172 bytes .../webfonts/fa-v4compatibility.woff2 | Bin 0 -> 4568 bytes docs/deps/headroom-0.11.0/headroom.min.js | 7 + .../headroom-0.11.0/jQuery.headroom.min.js | 7 + .../search-1.0.0/autocomplete.jquery.min.js | 7 + docs/deps/search-1.0.0/fuse.min.js | 9 + docs/deps/search-1.0.0/mark.min.js | 7 + docs/index.html | 80 +- docs/katex-auto.js | 14 + docs/lightswitch.js | 85 + docs/news/index.html | 69 +- docs/pkgdown.js | 2 - docs/pkgdown.yml | 5 +- docs/reference/EMLeditor-package.html | 62 +- docs/reference/EMLeditor.html | 8 + docs/reference/check_eml.html | 74 +- docs/reference/dot-get_unit_polygon.html | 74 +- docs/reference/dot-get_user_input.html | 70 +- docs/reference/dot-get_user_input3.html | 70 +- docs/reference/dot-set_for_by_nps.html | 74 +- docs/reference/dot-set_npspublisher.html | 74 +- docs/reference/dot-set_version.html | 74 +- docs/reference/get_abstract.html | 74 +- docs/reference/get_additional_info.html | 74 +- docs/reference/get_author_list.html | 74 +- docs/reference/get_begin_date.html | 74 +- docs/reference/get_citation.html | 74 +- docs/reference/get_content_units.html | 74 +- docs/reference/get_cui.html | 78 +- docs/reference/get_cui_code.html | 74 +- docs/reference/get_cui_marking.html | 74 +- docs/reference/get_doi.html | 74 +- docs/reference/get_drr_doi.html | 74 +- docs/reference/get_drr_title.html | 74 +- docs/reference/get_ds_id.html | 74 +- docs/reference/get_end_date.html | 74 +- docs/reference/get_file_info.html | 74 +- docs/reference/get_lit.html | 74 +- docs/reference/get_methods.html | 74 +- docs/reference/get_producing_units.html | 74 +- docs/reference/get_publisher.html | 74 +- docs/reference/get_title.html | 74 +- docs/reference/index.html | 344 +- docs/reference/remove_datastore_files.html | 78 +- docs/reference/set_abstract.html | 80 +- docs/reference/set_additional_info.html | 80 +- docs/reference/set_content_units.html | 80 +- docs/reference/set_creator_orcids.html | 80 +- docs/reference/set_creator_order.html | 80 +- docs/reference/set_creator_orgs.html | 84 +- docs/reference/set_cui.html | 84 +- docs/reference/set_cui_code.html | 80 +- docs/reference/set_cui_marking.html | 84 +- docs/reference/set_data_urls.html | 80 +- docs/reference/set_datastore_doi.html | 80 +- docs/reference/set_doi.html | 84 +- docs/reference/set_drr.html | 84 +- docs/reference/set_int_rights.html | 80 +- docs/reference/set_language.html | 80 +- docs/reference/set_lit.html | 84 +- docs/reference/set_methods.html | 80 +- docs/reference/set_missing_data.html | 86 +- docs/reference/set_new_creator.html | 88 +- docs/reference/set_producing_units.html | 80 +- docs/reference/set_project.html | 82 +- docs/reference/set_protocol.html | 86 +- docs/reference/set_publisher.html | 98 +- docs/reference/set_title.html | 80 +- docs/reference/upload_data_package.html | 78 +- docs/reference/write_readme.html | 76 +- docs/search.json | 2 +- docs/sitemap.xml | 276 +- 96 files changed, 12704 insertions(+), 3389 deletions(-) create mode 100644 docs/deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js create mode 100644 docs/deps/clipboard.js-2.0.11/clipboard.min.js create mode 100644 docs/deps/font-awesome-6.4.2/css/all.css create mode 100644 docs/deps/font-awesome-6.4.2/css/all.min.css create mode 100644 docs/deps/font-awesome-6.4.2/css/v4-shims.css create mode 100644 docs/deps/font-awesome-6.4.2/css/v4-shims.min.css create mode 100644 docs/deps/font-awesome-6.4.2/webfonts/fa-brands-400.ttf create mode 100644 docs/deps/font-awesome-6.4.2/webfonts/fa-brands-400.woff2 create mode 100644 docs/deps/font-awesome-6.4.2/webfonts/fa-regular-400.ttf create mode 100644 docs/deps/font-awesome-6.4.2/webfonts/fa-regular-400.woff2 create mode 100644 docs/deps/font-awesome-6.4.2/webfonts/fa-solid-900.ttf create mode 100644 docs/deps/font-awesome-6.4.2/webfonts/fa-solid-900.woff2 create mode 100644 docs/deps/font-awesome-6.4.2/webfonts/fa-v4compatibility.ttf create mode 100644 docs/deps/font-awesome-6.4.2/webfonts/fa-v4compatibility.woff2 create mode 100644 docs/deps/headroom-0.11.0/headroom.min.js create mode 100644 docs/deps/headroom-0.11.0/jQuery.headroom.min.js create mode 100644 docs/deps/search-1.0.0/autocomplete.jquery.min.js create mode 100644 docs/deps/search-1.0.0/fuse.min.js create mode 100644 docs/deps/search-1.0.0/mark.min.js create mode 100644 docs/katex-auto.js create mode 100644 docs/lightswitch.js create mode 100644 docs/reference/EMLeditor.html diff --git a/docs/404.html b/docs/404.html index 71bccbf..367fd1e 100644 --- a/docs/404.html +++ b/docs/404.html @@ -8,69 +8,56 @@ Page not found (404) • EMLeditor - - - - + + + Skip to contents - -