Skip to content

Commit

Permalink
convert references from elm to paperbark
Browse files Browse the repository at this point in the history
Also add `corella` and `paperbark` to Remotes in DESCRIPTION
  • Loading branch information
mjwestgate committed Dec 5, 2024
1 parent 1edf7d1 commit a92bd6d
Show file tree
Hide file tree
Showing 15 changed files with 36 additions and 37 deletions.
5 changes: 4 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ Imports:
corella,
curl,
dplyr,
elm,
glue,
httr2,
jsonlite,
paperbark,
potions,
purrr,
readr,
Expand All @@ -45,6 +45,9 @@ Suggests:
rmarkdown,
testthat (>= 3.0.0),
xml2
Remotes:
AtlasOfLivingAustralia/corella
AtlasOfLivingAustralia/paperbark
License: MPL-2.0
URL: https://galaxias.ala.org.au
BugReports: https://github.com/AtlasOfLivingAustralia/galaxias/issues
Expand Down
9 changes: 4 additions & 5 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ importFrom(dplyr,mutate)
importFrom(dplyr,pull)
importFrom(dplyr,select)
importFrom(dplyr,slice_head)
importFrom(elm,add_eml_header)
importFrom(elm,check_eml)
importFrom(elm,read_md)
importFrom(elm,use_metadata)
importFrom(elm,write_eml)
importFrom(glue,glue)
importFrom(glue,glue_collapse)
importFrom(httr2,req_body_multipart)
Expand All @@ -43,6 +38,10 @@ importFrom(httr2,request)
importFrom(httr2,resp_body_json)
importFrom(jsonlite,toJSON)
importFrom(jsonlite,unbox)
importFrom(paperbark,check_eml)
importFrom(paperbark,read_md)
importFrom(paperbark,use_metadata)
importFrom(paperbark,write_eml)
importFrom(potions,brew)
importFrom(potions,pour)
importFrom(purrr,map)
Expand Down
6 changes: 3 additions & 3 deletions R/build_archive.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#' altered to use Darwin Core terms as column headers. See the `corella`
#' package for details.
#' * A metadata statement, stored in xml using the filename `eml.xml`. The
#' function `use_metadata()` from the `elm` package is a good starting point
#' here, followed by `build_metadata()` to save it in xml.
#' function `use_metadata()` from the `paperbark` package is a good starting
#' point here, followed by `build_metadata()` to save it in xml.
#' * A 'schema' document, also stored in xml, called `meta.xml`. This is
#' usually constructed using `build_schema()`.
#'
Expand Down Expand Up @@ -135,7 +135,7 @@ find_data <- function(directory,

if(!file.exists(glue("{directory}/eml.xml"))){
bullets <- c("No metadata statement ({.file eml.xml}) is present in the specified directory.",
i = "See `elm::use_metadata()` for an example metadata statement.",
i = "See `paperbark::use_metadata()` for an example metadata statement.",
i = "Use `build_metadata()` to convert to {.file eml.xml}.")
cli_abort(bullets,
call = call)
Expand Down
14 changes: 5 additions & 9 deletions R/build_metadata.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@
#' specified using the `directory` argument.
#'
#' This function is a fairly shallow wrapper on top of functionality build
#' in the `elm` package, particularly `read_md()` and `write_eml()`. You can
#' in the `paperbark` package, particularly `read_md()` and `write_eml()`. You can
#' use that package to gain greater control, or to debug problems, should you
#' wish.
#' @param path Path to a metadata statement stored in markdown format (.md).
#' @param file A file where the result should be saved. Defaults to
#' `data/eml.xml`.
#' @returns Does not return an object to the workspace; called for the side
#' effect of building a file named `meta.xml` in the `data` directory.
#' @importFrom elm add_eml_header
#' @importFrom elm read_md
#' @importFrom elm write_eml
#' @importFrom paperbark read_md
#' @importFrom paperbark write_eml
#' @export
build_metadata <- function(x = "data",
file = "./data/eml.xml"){
Expand All @@ -26,13 +25,10 @@ build_metadata <- function(x = "data",
# import file, ensure EML metadata is added, convert to XML
progress_update("Reading file...")
metadata_file <- read_md(x)

progress_update("Building xml components...")
built_file <- add_eml_header(metadata_file)


progress_update("Writing file...")
write_eml(built_file, file = file)

cli::cli_alert_success("Metadata successfully built. Saved as {.file /data/eml.xml}.")
cli::cli_progress_done()
}
}
4 changes: 2 additions & 2 deletions R/build_schema.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#' @param file (string) A file name for the resulting schema document.
#' @returns Does not return an object to the workspace; called for the side
#' effect of building a file named `meta.xml` in the specified directory.
#' @importFrom elm write_eml
#' @importFrom paperbark write_eml
#' @importFrom glue glue
#' @importFrom rlang abort
#' @export
Expand Down Expand Up @@ -231,4 +231,4 @@ add_front_matter <- function(df){
)
)
bind_rows(front_row, df)
}
}
4 changes: 2 additions & 2 deletions R/check_archive.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' Check an archive against Darwin Core standards
#'
#' This is a wrapper to two other packages; schema and EML files (i.e. xml) are
#' checked with the `elm` package; csv files are checked with the `corella`
#' checked with the `paperbark` package; csv files are checked with the `corella`
#' package.
#' @param x (string) A directory containing the files to be published, or
#' optionally a `.zip` file built from the same (i.e. with `build_archive()`).
Expand All @@ -27,7 +27,7 @@ check_archive <- function(x = "data"){

#' Internal function to check all files
#' @importFrom corella check_occurrences
#' @importFrom elm check_eml
#' @importFrom paperbark check_eml
#' @importFrom purrr map
#' @importFrom readr read_csv
#' @noRd
Expand Down
2 changes: 1 addition & 1 deletion R/galaxias-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#' * [build_archive()] Convert a directory to a Darwin Core Archive
#'
#' **Validate an archive**
#' * [check_archive()] Check your archive using the `elm` and `corella` packages
#' * [check_archive()] Check your archive using the `paperbark` and `corella` packages
#' * [galaxias_config()] Store credentials for your API call
#' * [validate_archive()] Check your archive using the GBIF 'validator' API
#' * [print_validation()] Methods for displaying API responses
Expand Down
4 changes: 2 additions & 2 deletions R/galaxias_project.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' side-effect of building a new project or package.
#' @name galaxias_project
#' @order 1
#' @importFrom elm use_metadata
#' @importFrom paperbark use_metadata
#' @importFrom usethis create_project
#' @importFrom usethis use_directory
#' @export
Expand All @@ -33,4 +33,4 @@ galaxias_package <- function(path, ...){
create_package(path, ...)
use_directory("data_raw")
use_directory("data")
}
}
4 changes: 2 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ library(galaxias)
`galaxias` is part of a group of packages that help users publish data using
the Darwin Core standard. The other packages are:

- [`corella`](https://github.com/AtlasOfLivingAustralia/corella) for converting tibbles to the required column names
- [`elm`](https://github.com/AtlasOfLivingAustralia/elm) for converting markdown files to `xml`.
- [`corella`](https://corella.ala.org.au) for converting tibbles to the required column names
- [`paperbark`](https://paperbark.ala.org.au) for converting markdown files to `xml`.


## Citing galaxias
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ library(galaxias)
`galaxias` is part of a group of packages that help users publish data
using the Darwin Core standard. The other packages are:

- [`corella`](https://github.com/AtlasOfLivingAustralia/corella) for
converting tibbles to the required column names
- [`elm`](https://github.com/AtlasOfLivingAustralia/elm) for converting
markdown files to `xml`.
- [`corella`](https://corella.ala.org.au) for converting tibbles to the
required column names
- [`paperbark`](https://paperbark.ala.org.au) for converting markdown
files to `xml`.

## Citing galaxias

Expand Down
4 changes: 2 additions & 2 deletions man/build_archive.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/build_metadata.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/check_archive.Rd

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

3 changes: 2 additions & 1 deletion man/galaxias-package.Rd

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

2 changes: 1 addition & 1 deletion vignettes/quick_start_guide.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ in the data folder and remove your `data-raw` folder.

Darwin Core Archives use `xml` files to store two metadata files; one that
describes your data and ownership, and a second that stores its' structure.
We recommend using the `elm` package to manipulate these files.
We recommend using the `paperbark` package to manipulate these files.

`build_schema()` example

Expand Down

0 comments on commit a92bd6d

Please sign in to comment.