| Title: | Data Wizard for a Minimal Wildlife Disease Data Standard |
|---|---|
| Description: | Facilitates compliance with and use of the Wildlife Disease Data Standard stored on Zenodo <https://doi.org/10.5281/zenodo.15020049>. It allows users to restructure and validate datasets. |
| Authors: | Collin Schwantes [aut, cre] (ORCID: <https://orcid.org/0000-0002-9882-941X>) |
| Maintainer: | Collin Schwantes <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.2.5 |
| Built: | 2026-06-03 09:05:01 UTC |
| Source: | https://github.com/viralemergence/wddsWizard |
This is download_deposit_version wrapped in a purr::pmap call.
batch_download_deposit_versions(df = list_deposit_versions(), dir_path)batch_download_deposit_versions(df = list_deposit_versions(), dir_path)
df |
Data frame. Has the same structure as the output of |
dir_path |
Character. Path to folder where files should be downloaded. |
List of download locations.
Other WDDS deposit:
download_deposit_version(),
list_deposit_versions(),
sanitize_version(),
set_wdds_version(),
wdds_data_templates(),
wdds_example_data(),
wdds_json()
## Not run: # download all versions batch_download_deposit_versions(dir_path = "data") ## End(Not run)## Not run: # download all versions batch_download_deposit_versions(dir_path = "data") ## End(Not run)
A bat coronavirus dataset that conforms to the wildlife disease data standard. See data standard for field descriptions
becker_disease_databecker_disease_data
An object of class tbl_df (inherits from tbl, data.frame) with 2 rows and 21 columns.
https://pharos.viralemergence.org/projects/?prj=prjRPayEvMecN
Other Data:
becker_project_metadata,
disease_data_required_fields,
minimal_disease_data,
minimal_project_metadata,
project_metadata_required_fields,
schema_required_fields,
spdx_licenses,
wdds_to_dcmi_map,
wdds_to_pharos_map
The project metadata for a bat coronavirus dataset that conforms to the wildlife disease data standard. See data standard for field descriptions.
becker_project_metadatabecker_project_metadata
An object of class list of length 11.
https://www.ebi.ac.uk/pride/archive/projects/PXD031075
Other Data:
becker_disease_data,
disease_data_required_fields,
minimal_disease_data,
minimal_project_metadata,
project_metadata_required_fields,
schema_required_fields,
spdx_licenses,
wdds_to_dcmi_map,
wdds_to_pharos_map
Clean Field Names
clean_field_names(x)clean_field_names(x)
x |
Data frame or other named object |
object with names in snakecase::to_lower_camel_case format
Other JSON Prep:
get_entity(),
prep_affiliation(),
prep_array(),
prep_array_objects(),
prep_atomic(),
prep_creators(),
prep_data(),
prep_descriptions(),
prep_for_json(),
prep_from_metadata_template(),
prep_fundingReferences(),
prep_identifier(),
prep_language(),
prep_methodology(),
prep_methods(),
prep_nameIdentifiers(),
prep_object(),
prep_publicationYear(),
prep_relatedIdentifiers(),
prep_rights(),
prep_subjects(),
prep_titles()
df <- data.frame("Sample ID" = 1:10, "Name" = "Fred", "Host Identification" = "Pinus strobus") clean_field_names(df)df <- data.frame("Sample ID" = 1:10, "Name" = "Fred", "Host Identification" = "Pinus strobus") clean_field_names(df)
Create Docs Section for a schema object
create_object_docs(x, idx, required_fields, schema_dir)create_object_docs(x, idx, required_fields, schema_dir)
x |
List. Schema property or definition |
idx |
Name from schema property |
required_fields |
Character. Vector of required fields |
schema_dir |
Character. directory where the schema is stored |
Character formatted markdown text
Other Schema Docs:
create_schema_docs(),
get_ref(),
get_required_fields(),
increase_docs_depth(),
paste_reduce(),
paste_reduce_ul()
Produces nested markdown that documents a schema. This is a recursive set of function
create_schema_docs(schema_path = the$current_schema_path, sep = "\n")create_schema_docs(schema_path = the$current_schema_path, sep = "\n")
schema_path |
Character. Path to a json-schema. Default is the current schema path
set in the package environment |
sep |
Character. separator to be used by |
character vector of markdown text
Other Schema Docs:
create_object_docs(),
get_ref(),
get_required_fields(),
increase_docs_depth(),
paste_reduce(),
paste_reduce_ul()
## Not run: create_schema_docs() ## End(Not run)## Not run: create_schema_docs() ## End(Not run)
See data standard JSON file for field descriptions.
datacite_schemadatacite_schema
An object of class list of length 9.
Other Schema:
disease_data_schema,
project_metadata_schema,
schema_obj,
schema_properties,
schema_terms,
wdds_schema
See data standard JSON file for field descriptions.
disease_data_required_fieldsdisease_data_required_fields
An object of class character of length 9.
Other Data:
becker_disease_data,
becker_project_metadata,
minimal_disease_data,
minimal_project_metadata,
project_metadata_required_fields,
schema_required_fields,
spdx_licenses,
wdds_to_dcmi_map,
wdds_to_pharos_map
See data standard JSON file for field descriptions.
disease_data_schemadisease_data_schema
An object of class list of length 7.
Other Schema:
datacite_schema,
project_metadata_schema,
schema_obj,
schema_properties,
schema_terms,
wdds_schema
Downloads and extracts some version of the deposit. This function is specific to the structure of the wdds repo.
download_deposit_version(zenodo_id, version, latest_version, dir_path)download_deposit_version(zenodo_id, version, latest_version, dir_path)
zenodo_id |
String. ID for a Zenodo deposit. Should correspond to the version of a deposit. |
version |
String. Version number/id for the deposit (e.g. v.1.1.1). |
latest_version |
Logical. Indicates that the work is designated as the latest version. |
dir_path |
String. Path to directory where the files should be downloaded e.g. "inst/extdata/wdds_archive" note no trailing slash on the path. |
String. Path to downloaded version.
Other WDDS deposit:
batch_download_deposit_versions(),
list_deposit_versions(),
sanitize_version(),
set_wdds_version(),
wdds_data_templates(),
wdds_example_data(),
wdds_json()
# list all deposit versions list_deposit_versions() # download the deposit ## Not run: download_deposit_version("15270582", "v.1.0.3", TRUE, "data") ## End(Not run)# list all deposit versions list_deposit_versions() # download the deposit ## Not run: download_deposit_version("15270582", "v.1.0.3", TRUE, "data") ## End(Not run)
Checks if file exists in a directory, downloads the file if its not found. Sleeps for a given amount of time to respect rate limits on openalex servers.
download_oa_item(entity, oa_id, dir_temp = tempdir(), sleep_time = 1)download_oa_item(entity, oa_id, dir_temp = tempdir(), sleep_time = 1)
entity |
Character. What kind of openalex item is it? |
oa_id |
Character. ID from openalex |
dir_temp |
Character. path to directory where jons is stored. |
sleep_time |
Numeric. Seconds of sleep. |
Character. File path to json file
Other Project Metadata:
expand_tidy_dfs(),
extract_metadata_from_doi(),
extract_metadata_oa(),
generate_metadata_csv(),
generate_repeat_dfs(),
make_simple_df()
Creates a JSON-like structure in the csv that can be processed using established workflows in this package.
expand_tidy_dfs(tidy_df, group_prefix)expand_tidy_dfs(tidy_df, group_prefix)
tidy_df |
data frame. Each row corresponds to a complete entry. |
group_prefix |
character. A repeatable metadata property in the project metadata section of WDDS. See https://viralemergence.github.io/wddsWizard/articles/schema_overview.html#project_metadata |
Data frame. The data frame contains the fields Group, Variable, and Value.
Other Project Metadata:
download_oa_item(),
extract_metadata_from_doi(),
extract_metadata_oa(),
generate_metadata_csv(),
generate_repeat_dfs(),
make_simple_df()
# a nice tidy dataset creators_tidy <- data.frame("Name" = paste(letters[1:10],LETTERS[1:10]), "Given Name" = letters[1:10], "Family Name" = LETTERS[1:10], "Name Identifier" = sample(1:100,10,FALSE), "Affiliation" = letters[11:20], "Affiliation Identifier" = 11:20, check.names =FALSE) # an expanded dataset that matches the template format. creators_tidy |> expand_tidy_dfs(group_prefix = "Creators")# a nice tidy dataset creators_tidy <- data.frame("Name" = paste(letters[1:10],LETTERS[1:10]), "Given Name" = letters[1:10], "Family Name" = LETTERS[1:10], "Name Identifier" = sample(1:100,10,FALSE), "Affiliation" = letters[11:20], "Affiliation Identifier" = 11:20, check.names =FALSE) # an expanded dataset that matches the template format. creators_tidy |> expand_tidy_dfs(group_prefix = "Creators")
Some works are explicitly connected to a publication and the metadata for that publication are fairly complete. Instead of re-writing the metadata, it would be better to extract it and transform it.
extract_metadata_from_doi(doi, file_path, write_output = TRUE)extract_metadata_from_doi(doi, file_path, write_output = TRUE)
doi |
String. DOI for a published work |
file_path |
String. Where should the output be written? |
write_output |
Logical. Should the output be written to a file? |
data frame. A data frame structured in the same way as the metadata template csv.
Other Project Metadata:
download_oa_item(),
expand_tidy_dfs(),
extract_metadata_oa(),
generate_metadata_csv(),
generate_repeat_dfs(),
make_simple_df()
doi <-"doi.org/10.1038/s41597-025-05332-x" extract_metadata_from_doi(doi = doi,write_output=FALSE)doi <-"doi.org/10.1038/s41597-025-05332-x" extract_metadata_from_doi(doi = doi,write_output=FALSE)
Uses the DOI for a work to extract metadata from OpenAlex - https://openalex.org/. The OpenAlex data model does not included some fields that are part of the wdds project metadata related identifiers.
extract_metadata_oa(doi)extract_metadata_oa(doi)
doi |
Character. A digital object identifier for a published work. |
Carefully review and edit the metadata produced.
We recommend writing the metadata to a csv, editing the csv, then processing it as demonstrated in the project metadata tutorial.
data frame. A data frame structured in the same way as the metadata template CSV.
Other Project Metadata:
download_oa_item(),
expand_tidy_dfs(),
extract_metadata_from_doi(),
generate_metadata_csv(),
generate_repeat_dfs(),
make_simple_df()
doi <- "doi.org/10.1038/s41597-025-05332-x" extract_metadata_oa(doi = doi)doi <- "doi.org/10.1038/s41597-025-05332-x" extract_metadata_oa(doi = doi)
This function allows you to generate a minimal metadata template for your project. You provide certain values and it generates a csv based on those values. Any parameter that starts with num takes an integer and creates repeat entries in the metadata csv. All other values take a string or logical input and will prepopulate that section of the metadata csv.
generate_metadata_csv( file_path, event_based, archival, num_creators, num_titles, identifier, identifier_type, num_subjects, publication_year, rights, language, num_descriptions, num_fundingReferences, num_related_identifiers, write_output = TRUE )generate_metadata_csv( file_path, event_based, archival, num_creators, num_titles, identifier, identifier_type, num_subjects, publication_year, rights, language, num_descriptions, num_fundingReferences, num_related_identifiers, write_output = TRUE )
file_path |
String. Where should the CSV file be saved? |
event_based |
Logical. Whether or not research was conducted in response to a known or suspected infectious disease outbreak, observed animal morbidity or mortality, etc. |
archival |
Logical. Whether samples were from an archival source (e.g., museum collections, biobanks). |
num_creators |
Integer. Number of creators for a work. |
num_titles |
Integer. Number of titles for a work. |
identifier |
String. A unique string that identifies a resource. Should be a DOI |
identifier_type |
String. Should be DOI |
num_subjects |
Integer. Number of subjects. Subject, keyword, classification code, or key phrase describing the resource |
publication_year |
String. Year when work was published |
rights |
String. Use one of the rights identifiers found here https://spdx.org/licenses/ |
language |
String. The primary language of the resource. |
num_descriptions |
Integer. Number of descriptions to add to the csv. All additional information that does not fit in any of the other categories. May be used for technical information or detailed information associated with a scientific instrument |
num_fundingReferences |
Integer. Number of funders to add to the csv. Name and other identifying information of a funding provider |
num_related_identifiers |
Integer. Number of other works you would like to link to. |
write_output |
Logical. Should the file be written? |
data.frame
Other Project Metadata:
download_oa_item(),
expand_tidy_dfs(),
extract_metadata_from_doi(),
extract_metadata_oa(),
generate_repeat_dfs(),
make_simple_df()
generate_metadata_csv(file_path = "test.csv", event_based = TRUE, archival = FALSE, num_creators = 10, num_titles = 1, identifier = "https://doi.org/10.1080/example.doi", identifier_type = "doi", num_subjects = 5, publication_year = "2025", rights = "cc-by", language = "en", num_descriptions = 1, num_fundingReferences = 4, num_related_identifiers= 5, write_output = FALSE) # change to TRUE to write the csvgenerate_metadata_csv(file_path = "test.csv", event_based = TRUE, archival = FALSE, num_creators = 10, num_titles = 1, identifier = "https://doi.org/10.1080/example.doi", identifier_type = "doi", num_subjects = 5, publication_year = "2025", rights = "cc-by", language = "en", num_descriptions = 1, num_fundingReferences = 4, num_related_identifiers= 5, write_output = FALSE) # change to TRUE to write the csv
generate_repeat_dfs
generate_repeat_dfs(num_groups, group_prefix, group_variables)generate_repeat_dfs(num_groups, group_prefix, group_variables)
num_groups |
Numeric. Number of groups |
group_prefix |
Character. A group name |
group_variables |
Character. A comma separated scalar string of variables. |
data frame. Structured appropriately for the metadata csv.
Other Project Metadata:
download_oa_item(),
expand_tidy_dfs(),
extract_metadata_from_doi(),
extract_metadata_oa(),
generate_metadata_csv(),
make_simple_df()
related_ids_df <- generate_repeat_dfs(num_groups = 5, group_prefix = "Related Identifiers", group_variables = "Related Identifier,Related Identifier Type,Relation Type")related_ids_df <- generate_repeat_dfs(num_groups = 5, group_prefix = "Related Identifiers", group_variables = "Related Identifier,Related Identifier Type,Relation Type")
The get_entity function creates standard entities that will be easier to transform json.
get_entity(x)get_entity(x)
x |
data frame. A "long" form data frame with the fields Group, entity_id, Value, and variable. |
Pivots data from long to wide and formats column names.
data frame in "wide" form
Other JSON Prep:
clean_field_names(),
prep_affiliation(),
prep_array(),
prep_array_objects(),
prep_atomic(),
prep_creators(),
prep_data(),
prep_descriptions(),
prep_for_json(),
prep_from_metadata_template(),
prep_fundingReferences(),
prep_identifier(),
prep_language(),
prep_methodology(),
prep_methods(),
prep_nameIdentifiers(),
prep_object(),
prep_publicationYear(),
prep_relatedIdentifiers(),
prep_rights(),
prep_subjects(),
prep_titles()
df <- data.frame(Group = 1, entity_id = 1, Value = 1:3, Variable = letters[1:3]) get_entity(df)df <- data.frame(Group = 1, entity_id = 1, Value = 1:3, Variable = letters[1:3]) get_entity(df)
Parses $ref calls in a schema. Can retrieve internal ('"$ref":"#/definitions/someDef") or external references ('"$ref":"schemas/datacite/datacite.json"').
get_ref(x, schema_dir)get_ref(x, schema_dir)
x |
List. Must have property "$ref" |
schema_dir |
Character. Directory for the current schema. |
For external references, it can handle both pointers and references to entire schemas.
This function navigates between parent and child schemas by manipulating
variables in the package environment the.
List or Character. Character is only returned if an entire schema is referenced.
Other Schema Docs:
create_object_docs(),
create_schema_docs(),
get_required_fields(),
increase_docs_depth(),
paste_reduce(),
paste_reduce_ul()
Gets the required fields for an object or schema
get_required_fields(schema_list)get_required_fields(schema_list)
schema_list |
List from jsonlite::read_json |
character vector of required fields
Other Schema Docs:
create_object_docs(),
create_schema_docs(),
get_ref(),
increase_docs_depth(),
paste_reduce(),
paste_reduce_ul()
schema_list <- jsonlite::read_json(wdds_json("latest", "schemas/disease_data.json")) get_required_fields(schema_list)schema_list <- jsonlite::read_json(wdds_json("latest", "schemas/disease_data.json")) get_required_fields(schema_list)
Pads the left side of any list items with an extra 4 spaces
increase_docs_depth(string)increase_docs_depth(string)
string |
Character. item to be parsed |
character
Other Schema Docs:
create_object_docs(),
create_schema_docs(),
get_ref(),
get_required_fields(),
paste_reduce(),
paste_reduce_ul()
This function list all the versions of a deposit associated with a parent id. The parent id is used to identify a set of works that are different versions of the same work. The parent id is provided from the Zenodo API. If you download a JSON representation of the deposit (export to json), there will be an attribute in that json called parent that looks like "https://zenodo.org/api/records/15020049". The 8 digit string at the end of the url is the parent id.
list_deposit_versions(parent_id = "15020049")list_deposit_versions(parent_id = "15020049")
parent_id |
String. Identifier for a Zenodo deposit with multiple versions. Default is the parent id for the wdds zenodo deposit. |
Data frame. The data frame contains the Zenodo id for each version of the deposit, as well as the version name, and logical field called latest that indicates if this is the latest version.
Other WDDS deposit:
batch_download_deposit_versions(),
download_deposit_version(),
sanitize_version(),
set_wdds_version(),
wdds_data_templates(),
wdds_example_data(),
wdds_json()
list_deposit_versions()list_deposit_versions()
Displays file paths for Wildlife Disease Data Standard templates
list_wdds_templates(template_file = NULL)list_wdds_templates(template_file = NULL)
template_file |
character. file name for a template. Default is |
If path is null, displays all files in the templates folder.
file paths or, if path = NULL, a list of file names
Other Templates:
use_wdds_template()
A convenience function for making non-repeating items
make_simple_df(property, value)make_simple_df(property, value)
property |
string. Metadata group and variable name |
value |
A value for that property. |
data frame. A data frame that conforms to non-repeatable structure in template.
Other Project Metadata:
download_oa_item(),
expand_tidy_dfs(),
extract_metadata_from_doi(),
extract_metadata_oa(),
generate_metadata_csv(),
generate_repeat_dfs()
language_df <- make_simple_df(property = "language", value = "fr")language_df <- make_simple_df(property = "language", value = "fr")
This is a minimal disease data example. It is a data frame with the minimal items required for disease data.
minimal_disease_dataminimal_disease_data
An object of class data.frame with 3 rows and 15 columns.
Other Data:
becker_disease_data,
becker_project_metadata,
disease_data_required_fields,
minimal_project_metadata,
project_metadata_required_fields,
schema_required_fields,
spdx_licenses,
wdds_to_dcmi_map,
wdds_to_pharos_map
This is a minimal project metadata example. It is a list with the minimal items required for project metadata.
minimal_project_metadataminimal_project_metadata
An object of class list of length 7.
Other Data:
becker_disease_data,
becker_project_metadata,
disease_data_required_fields,
minimal_disease_data,
project_metadata_required_fields,
schema_required_fields,
spdx_licenses,
wdds_to_dcmi_map,
wdds_to_pharos_map
Converts all columns to character then converts all NA's to blanks.
na_to_blank(df)na_to_blank(df)
df |
data frame. A data frame where NAs should be coverted to blanks. Cannot be a tibble with nested columns. |
data frame. All columns will be character and all NA's will be replaced with "".
Other Standards Mapping:
translate_to_dcmi(),
wdds_to_dcmi(),
wdds_to_pharos()
data.frame(a = 1:10, b = c(1:9,NA)) |> na_to_blank()data.frame(a = 1:10, b = c(1:9,NA)) |> na_to_blank()
A paste function that can be used with purrr::reduce to build up nested
documentation items
paste_reduce(x, y, sep = "\n")paste_reduce(x, y, sep = "\n")
x |
Character |
y |
Character |
sep |
Character. Default is a line break |
Character
Other Schema Docs:
create_object_docs(),
create_schema_docs(),
get_ref(),
get_required_fields(),
increase_docs_depth(),
paste_reduce_ul()
text_a <- "hello" text_b <- "world" paste_reduce(text_a, text_b)text_a <- "hello" text_b <- "world" paste_reduce(text_a, text_b)
A paste function that can be used with purrr::reduce to build up nested
documentation items
paste_reduce_ul(x, y, sep = "\n - ")paste_reduce_ul(x, y, sep = "\n - ")
x |
Character |
y |
Character |
sep |
Character. Default is a line break followed by a dash |
Character
Other Schema Docs:
create_object_docs(),
create_schema_docs(),
get_ref(),
get_required_fields(),
increase_docs_depth(),
paste_reduce()
text_a <- "hello" text_b <- "world" paste_reduce_ul(text_a, text_b)text_a <- "hello" text_b <- "world" paste_reduce_ul(text_a, text_b)
There are affiliations associated with a creator.
prep_affiliation(x)prep_affiliation(x)
x |
Data frame from prep_creators |
Affiliation in datacite is an array of objects with properties name, affiliationIdentifier, affiliationIdentifierScheme, and schemeURI. This function takes the affiliation fields and restructures as a list within the dataframe.
Affiliation fields to be converted to a list: "affiliation", #' "affiliationIdentifier", "affiliationIdentifierScheme" , "schemeUri"
Data frame with affiliation fields in a list column called affiliation
Other JSON Prep:
clean_field_names(),
get_entity(),
prep_array(),
prep_array_objects(),
prep_atomic(),
prep_creators(),
prep_data(),
prep_descriptions(),
prep_for_json(),
prep_from_metadata_template(),
prep_fundingReferences(),
prep_identifier(),
prep_language(),
prep_methodology(),
prep_methods(),
prep_nameIdentifiers(),
prep_object(),
prep_publicationYear(),
prep_relatedIdentifiers(),
prep_rights(),
prep_subjects(),
prep_titles()
creator_df <- wddsWizard::becker_project_metadata$creators[[1]] creator_df_aff_prepped <- prep_affiliation(creator_df)creator_df <- wddsWizard::becker_project_metadata$creators[[1]] creator_df_aff_prepped <- prep_affiliation(creator_df)
Prep array
prep_array(x)prep_array(x)
x |
a list object. |
unnamed vector
Other JSON Prep:
clean_field_names(),
get_entity(),
prep_affiliation(),
prep_array_objects(),
prep_atomic(),
prep_creators(),
prep_data(),
prep_descriptions(),
prep_for_json(),
prep_from_metadata_template(),
prep_fundingReferences(),
prep_identifier(),
prep_language(),
prep_methodology(),
prep_methods(),
prep_nameIdentifiers(),
prep_object(),
prep_publicationYear(),
prep_relatedIdentifiers(),
prep_rights(),
prep_subjects(),
prep_titles()
# this form can arise because of the csv template nested_list <- list(list("formats" = list("formats" = "csv", "formats" = "fasta"))) prep_array(nested_list)# this form can arise because of the csv template nested_list <- list(list("formats" = list("formats" = "csv", "formats" = "fasta"))) prep_array(nested_list)
wraps a data frame in a list and or unboxes list items that are 1 row dataframes. This will result in an array of objects being created.
prep_array_objects(x, unbox = TRUE)prep_array_objects(x, unbox = TRUE)
x |
list of data frames or a data frame |
unbox |
logical. Should the things be unboxed? |
list of single row unboxed data frames
Other JSON Prep:
clean_field_names(),
get_entity(),
prep_affiliation(),
prep_array(),
prep_atomic(),
prep_creators(),
prep_data(),
prep_descriptions(),
prep_for_json(),
prep_from_metadata_template(),
prep_fundingReferences(),
prep_identifier(),
prep_language(),
prep_methodology(),
prep_methods(),
prep_nameIdentifiers(),
prep_object(),
prep_publicationYear(),
prep_relatedIdentifiers(),
prep_rights(),
prep_subjects(),
prep_titles()
# note that you cannot unbox data frames with more than 1 row x <- list( tibble::tibble(age = 1, group = letters[1]), tibble::tibble(age = 2, group = letters[2]) ) # running jsonlite::toJSON on an unmodified object results in # extra square brackets - an array of arrays of objects jsonlite::toJSON(x, pretty = TRUE) # with the prepped data we get an array of objects x_prepped <- prep_array_objects(x) x_prepped |> jsonlite::toJSON(pretty = TRUE)# note that you cannot unbox data frames with more than 1 row x <- list( tibble::tibble(age = 1, group = letters[1]), tibble::tibble(age = 2, group = letters[2]) ) # running jsonlite::toJSON on an unmodified object results in # extra square brackets - an array of arrays of objects jsonlite::toJSON(x, pretty = TRUE) # with the prepped data we get an array of objects x_prepped <- prep_array_objects(x) x_prepped |> jsonlite::toJSON(pretty = TRUE)
This is a thin wrapper for jsonlite::unbox. It stops jsonlite from
representing single character, numeric, logical, etc. items as arrays.
prep_atomic(x, unbox = TRUE)prep_atomic(x, unbox = TRUE)
x |
vector or single row data frame |
unbox |
Logical. Should the value be unboxed? See |
This is useful when a property or definition is of type string, number, logical and of length 1.
an unboxed dataframe with 1 row
Other JSON Prep:
clean_field_names(),
get_entity(),
prep_affiliation(),
prep_array(),
prep_array_objects(),
prep_creators(),
prep_data(),
prep_descriptions(),
prep_for_json(),
prep_from_metadata_template(),
prep_fundingReferences(),
prep_identifier(),
prep_language(),
prep_methodology(),
prep_methods(),
prep_nameIdentifiers(),
prep_object(),
prep_publicationYear(),
prep_relatedIdentifiers(),
prep_rights(),
prep_subjects(),
prep_titles()
x <- 1 # values in x are stored in an array x |> jsonlite::toJSON() # output is [1] # values in x are NOT stored in an array (no square brackets) prep_atomic(x) |> jsonlite::toJSON() # output is 1x <- 1 # values in x are stored in an array x |> jsonlite::toJSON() # output is [1] # values in x are NOT stored in an array (no square brackets) prep_atomic(x) |> jsonlite::toJSON() # output is 1
The creator object can be complex so we prepare components of the final object (e.g. affiliation, nameIdentifiers) then run prep_array_objects
prep_creators(x)prep_creators(x)
x |
data frame or named list. |
List of unboxed data frames
Other JSON Prep:
clean_field_names(),
get_entity(),
prep_affiliation(),
prep_array(),
prep_array_objects(),
prep_atomic(),
prep_data(),
prep_descriptions(),
prep_for_json(),
prep_from_metadata_template(),
prep_fundingReferences(),
prep_identifier(),
prep_language(),
prep_methodology(),
prep_methods(),
prep_nameIdentifiers(),
prep_object(),
prep_publicationYear(),
prep_relatedIdentifiers(),
prep_rights(),
prep_subjects(),
prep_titles()
wddsWizard::becker_project_metadata$creators |> prep_creators()wddsWizard::becker_project_metadata$creators |> prep_creators()
Prepares an object of arrays.
prep_data(x)prep_data(x)
x |
named vector, list, or data frame |
Note that unboxing will only work on items where you have 1:1 key value pair. So if you have a dataframe with multiple rows or a list with multiple values at a given position, it won't work.
List of formatted objects
Other JSON Prep:
clean_field_names(),
get_entity(),
prep_affiliation(),
prep_array(),
prep_array_objects(),
prep_atomic(),
prep_creators(),
prep_descriptions(),
prep_for_json(),
prep_from_metadata_template(),
prep_fundingReferences(),
prep_identifier(),
prep_language(),
prep_methodology(),
prep_methods(),
prep_nameIdentifiers(),
prep_object(),
prep_publicationYear(),
prep_relatedIdentifiers(),
prep_rights(),
prep_subjects(),
prep_titles()
cars_small <- datasets::cars[1:10, ] # creates an array of objects where each # row is an object cars_small |> jsonlite::toJSON(pretty = TRUE) # creates an object with 2 arrays prep_object(cars_small) |> jsonlite::toJSON(pretty = TRUE) # this makes no difference x <- list("hello" = 1:10, "world" = "Earth") prep_object(x) |> jsonlite::toJSON(pretty = TRUE)cars_small <- datasets::cars[1:10, ] # creates an array of objects where each # row is an object cars_small |> jsonlite::toJSON(pretty = TRUE) # creates an object with 2 arrays prep_object(cars_small) |> jsonlite::toJSON(pretty = TRUE) # this makes no difference x <- list("hello" = 1:10, "world" = "Earth") prep_object(x) |> jsonlite::toJSON(pretty = TRUE)
Wrapper for prep_array_objects.
prep_descriptions(x)prep_descriptions(x)
x |
Data frame/Tibble containing description items |
List with x marked as unbox (do not make an array)
Other JSON Prep:
clean_field_names(),
get_entity(),
prep_affiliation(),
prep_array(),
prep_array_objects(),
prep_atomic(),
prep_creators(),
prep_data(),
prep_for_json(),
prep_from_metadata_template(),
prep_fundingReferences(),
prep_identifier(),
prep_language(),
prep_methodology(),
prep_methods(),
prep_nameIdentifiers(),
prep_object(),
prep_publicationYear(),
prep_relatedIdentifiers(),
prep_rights(),
prep_subjects(),
prep_titles()
x <- wddsWizard::becker_project_metadata$descriptions prep_descriptions(x) |> jsonlite::toJSON()x <- wddsWizard::becker_project_metadata$descriptions prep_descriptions(x) |> jsonlite::toJSON()
Usespurrr::modify_at to apply a set of methods at specific locations in a
list.
prep_for_json(x, prep_methods_list = prep_methods())prep_for_json(x, prep_methods_list = prep_methods())
x |
list. Named list of data frames, lists, or vectors. For methods to be applied, the names of the list items should match the names in the methods list |
prep_methods_list |
list. Named list of methods where each items is a
function to applied to corresponding items in x. Default is full list of methods
from |
Named list where methods have been applied.
Other JSON Prep:
clean_field_names(),
get_entity(),
prep_affiliation(),
prep_array(),
prep_array_objects(),
prep_atomic(),
prep_creators(),
prep_data(),
prep_descriptions(),
prep_from_metadata_template(),
prep_fundingReferences(),
prep_identifier(),
prep_language(),
prep_methodology(),
prep_methods(),
prep_nameIdentifiers(),
prep_object(),
prep_publicationYear(),
prep_relatedIdentifiers(),
prep_rights(),
prep_subjects(),
prep_titles()
wddsWizard::becker_project_metadata |> prep_for_json() a <- list("hello_world" = 1:10) methods_list <- list( "hello_world" = function(x) { x * 2 }, "unused_method" = function(x) { x / 2 } ) prep_for_json(a, methods_list)wddsWizard::becker_project_metadata |> prep_for_json() a <- list("hello_world" = 1:10) methods_list <- list( "hello_world" = function(x) { x * 2 }, "unused_method" = function(x) { x / 2 } ) prep_for_json(a, methods_list)
A convenience function for those who used the metadata template to create their project metadata data.
prep_from_metadata_template( project_metadata, prep_methods_list = prep_methods(), schema_properties = wddsWizard::schema_properties, json_prep = TRUE )prep_from_metadata_template( project_metadata, prep_methods_list = prep_methods(), schema_properties = wddsWizard::schema_properties, json_prep = TRUE )
project_metadata |
Data frame. Should correspond to the structure of the project_metadata_template.csv |
prep_methods_list |
list. Named list of methods where each items is a function to applied to corresponding items in x.Default is |
schema_properties |
Data frame. A data frame of schema properties and their types. |
json_prep |
Logical. Should the metadata be prepped for JSON? |
Does some light data formatting to make conversion to json easier.
Named list ready to be converted to json
Other JSON Prep:
clean_field_names(),
get_entity(),
prep_affiliation(),
prep_array(),
prep_array_objects(),
prep_atomic(),
prep_creators(),
prep_data(),
prep_descriptions(),
prep_for_json(),
prep_fundingReferences(),
prep_identifier(),
prep_language(),
prep_methodology(),
prep_methods(),
prep_nameIdentifiers(),
prep_object(),
prep_publicationYear(),
prep_relatedIdentifiers(),
prep_rights(),
prep_subjects(),
prep_titles()
## Not run: # create wddsWizard::use_template("project_metadata_template.csv", folder = "data", file_name = "my_project_metadata.csv" ) project_metadata <- read.csv("data/my_project_metadata.csv") prepped_project_metadata <- wddsWizard::prep_from_metadata_template(project_metadata) project_metadat_json <- jsonlite::toJSON(prepped_project_metadata, pretty = TRUE) ## End(Not run)## Not run: # create wddsWizard::use_template("project_metadata_template.csv", folder = "data", file_name = "my_project_metadata.csv" ) project_metadata <- read.csv("data/my_project_metadata.csv") prepped_project_metadata <- wddsWizard::prep_from_metadata_template(project_metadata) project_metadat_json <- jsonlite::toJSON(prepped_project_metadata, pretty = TRUE) ## End(Not run)
creates an array of objects
prep_fundingReferences(x)prep_fundingReferences(x)
x |
list of tibbles/data frames or a tibble/data frame |
list of single row unboxed data frames
Other JSON Prep:
clean_field_names(),
get_entity(),
prep_affiliation(),
prep_array(),
prep_array_objects(),
prep_atomic(),
prep_creators(),
prep_data(),
prep_descriptions(),
prep_for_json(),
prep_from_metadata_template(),
prep_identifier(),
prep_language(),
prep_methodology(),
prep_methods(),
prep_nameIdentifiers(),
prep_object(),
prep_publicationYear(),
prep_relatedIdentifiers(),
prep_rights(),
prep_subjects(),
prep_titles()
wddsWizard::becker_project_metadata$fundingReferences |> prep_fundingReferences()wddsWizard::becker_project_metadata$fundingReferences |> prep_fundingReferences()
Prepare identifier for a scholarly work. Wrapper for prep_array_objects
prep_identifier(x)prep_identifier(x)
x |
data frame with identifier properties |
List with x marked as do not unbox
Other JSON Prep:
clean_field_names(),
get_entity(),
prep_affiliation(),
prep_array(),
prep_array_objects(),
prep_atomic(),
prep_creators(),
prep_data(),
prep_descriptions(),
prep_for_json(),
prep_from_metadata_template(),
prep_fundingReferences(),
prep_language(),
prep_methodology(),
prep_methods(),
prep_nameIdentifiers(),
prep_object(),
prep_publicationYear(),
prep_relatedIdentifiers(),
prep_rights(),
prep_subjects(),
prep_titles()
wddsWizard::becker_project_metadata$identifier |> prep_identifier()wddsWizard::becker_project_metadata$identifier |> prep_identifier()
Prepare the language property - this should describe the language of the scholarly work.
prep_language(x)prep_language(x)
x |
named list, vector, or data.frame of with 1:1 name:value pairs |
an unboxed dataframe with 1 row
Other JSON Prep:
clean_field_names(),
get_entity(),
prep_affiliation(),
prep_array(),
prep_array_objects(),
prep_atomic(),
prep_creators(),
prep_data(),
prep_descriptions(),
prep_for_json(),
prep_from_metadata_template(),
prep_fundingReferences(),
prep_identifier(),
prep_methodology(),
prep_methods(),
prep_nameIdentifiers(),
prep_object(),
prep_publicationYear(),
prep_relatedIdentifiers(),
prep_rights(),
prep_subjects(),
prep_titles()
a <- data.frame("language" = "en") prep_language(a)a <- data.frame("language" = "en") prep_language(a)
Prep methodology for conversion to json
prep_methodology(x)prep_methodology(x)
x |
List. methodology component of a list |
properly formatted list
Other JSON Prep:
clean_field_names(),
get_entity(),
prep_affiliation(),
prep_array(),
prep_array_objects(),
prep_atomic(),
prep_creators(),
prep_data(),
prep_descriptions(),
prep_for_json(),
prep_from_metadata_template(),
prep_fundingReferences(),
prep_identifier(),
prep_language(),
prep_methods(),
prep_nameIdentifiers(),
prep_object(),
prep_publicationYear(),
prep_relatedIdentifiers(),
prep_rights(),
prep_subjects(),
prep_titles()
## Not run: prepped_list <- project_metadata_list_entities prepped_list$methodology <- prep_methodology(project_metadata_list_entities$methodology) OR prepped_list <- purrr::modify_at(project_metadata_list_entities, "methodology", prep_methodology) ## End(Not run)## Not run: prepped_list <- project_metadata_list_entities prepped_list$methodology <- prep_methodology(project_metadata_list_entities$methodology) OR prepped_list <- purrr::modify_at(project_metadata_list_entities, "methodology", prep_methodology) ## End(Not run)
Collection of methods for preparing data conveniently named to make preparing easier
prep_methods()prep_methods()
list of methods
Other JSON Prep:
clean_field_names(),
get_entity(),
prep_affiliation(),
prep_array(),
prep_array_objects(),
prep_atomic(),
prep_creators(),
prep_data(),
prep_descriptions(),
prep_for_json(),
prep_from_metadata_template(),
prep_fundingReferences(),
prep_identifier(),
prep_language(),
prep_methodology(),
prep_nameIdentifiers(),
prep_object(),
prep_publicationYear(),
prep_relatedIdentifiers(),
prep_rights(),
prep_subjects(),
prep_titles()
prep_methods()prep_methods()
These are Persistent identifiers associated with a creator.
prep_nameIdentifiers(x)prep_nameIdentifiers(x)
x |
Data frame from "creators" |
Name identifiers in datacite is an array of objects
with properties "nameIdentifier", "nameIdentifierScheme" ,
and "schemeUri". This function takes the name identifiers fields and restructures
as a list within the data frame.
data frame with a nameIdentifiers column as list
Other JSON Prep:
clean_field_names(),
get_entity(),
prep_affiliation(),
prep_array(),
prep_array_objects(),
prep_atomic(),
prep_creators(),
prep_data(),
prep_descriptions(),
prep_for_json(),
prep_from_metadata_template(),
prep_fundingReferences(),
prep_identifier(),
prep_language(),
prep_methodology(),
prep_methods(),
prep_object(),
prep_publicationYear(),
prep_relatedIdentifiers(),
prep_rights(),
prep_subjects(),
prep_titles()
creator_df <- wddsWizard::becker_project_metadata$creators[[1]] creator_df_nameID_prepped <- prep_nameIdentifiers(creator_df)creator_df <- wddsWizard::becker_project_metadata$creators[[1]] creator_df_nameID_prepped <- prep_nameIdentifiers(creator_df)
Converts a named vector, list, or data frame to a list, and optionally unboxes it, so that its recorded as an object.
prep_object(x, unbox = FALSE)prep_object(x, unbox = FALSE)
x |
named vector, list, or data frame |
unbox |
logical Should items be unboxed (not arrays)? Default is FALSE meaning items will remain as arrays when converted to json. |
Note that unboxing will only work on items where you have 1:1 key value pair. So if you have a dataframe with multiple rows or a list with multiple values at a given position, it won't work.
List of formatted objects
Other JSON Prep:
clean_field_names(),
get_entity(),
prep_affiliation(),
prep_array(),
prep_array_objects(),
prep_atomic(),
prep_creators(),
prep_data(),
prep_descriptions(),
prep_for_json(),
prep_from_metadata_template(),
prep_fundingReferences(),
prep_identifier(),
prep_language(),
prep_methodology(),
prep_methods(),
prep_nameIdentifiers(),
prep_publicationYear(),
prep_relatedIdentifiers(),
prep_rights(),
prep_subjects(),
prep_titles()
cars_small <- datasets::cars[1:10, ] # creates an array of objects where each # row is an object cars_small |> jsonlite::toJSON(pretty = TRUE) # creates an object with 2 arrays prep_object(cars_small) |> jsonlite::toJSON(pretty = TRUE) # this makes no difference x <- list("hello" = 1:10, "world" = "Earth") prep_object(x) |> jsonlite::toJSON(pretty = TRUE)cars_small <- datasets::cars[1:10, ] # creates an array of objects where each # row is an object cars_small |> jsonlite::toJSON(pretty = TRUE) # creates an object with 2 arrays prep_object(cars_small) |> jsonlite::toJSON(pretty = TRUE) # this makes no difference x <- list("hello" = 1:10, "world" = "Earth") prep_object(x) |> jsonlite::toJSON(pretty = TRUE)
wrapper for prep atomic
prep_publicationYear(x)prep_publicationYear(x)
x |
Named vector, data frame, or list |
an unboxed dataframe with 1 row
Other JSON Prep:
clean_field_names(),
get_entity(),
prep_affiliation(),
prep_array(),
prep_array_objects(),
prep_atomic(),
prep_creators(),
prep_data(),
prep_descriptions(),
prep_for_json(),
prep_from_metadata_template(),
prep_fundingReferences(),
prep_identifier(),
prep_language(),
prep_methodology(),
prep_methods(),
prep_nameIdentifiers(),
prep_object(),
prep_relatedIdentifiers(),
prep_rights(),
prep_subjects(),
prep_titles()
pub_year <- data.frame("publicationYear" = "2025") prep_language(pub_year)pub_year <- data.frame("publicationYear" = "2025") prep_language(pub_year)
Prepares an array of objects
prep_rights(x)prep_rights(x)
x |
named list, vector, or data.frame of with 1:1 name:value pairs |
list of unboxed data frames
Other JSON Prep:
clean_field_names(),
get_entity(),
prep_affiliation(),
prep_array(),
prep_array_objects(),
prep_atomic(),
prep_creators(),
prep_data(),
prep_descriptions(),
prep_for_json(),
prep_from_metadata_template(),
prep_fundingReferences(),
prep_identifier(),
prep_language(),
prep_methodology(),
prep_methods(),
prep_nameIdentifiers(),
prep_object(),
prep_publicationYear(),
prep_relatedIdentifiers(),
prep_subjects(),
prep_titles()
wddsWizard::becker_project_metadata$rights |> prep_rights()wddsWizard::becker_project_metadata$rights |> prep_rights()
Subjects or keywords describing a work. Prepares an array of objects.
prep_subjects(x)prep_subjects(x)
x |
named list, vector, or data.frame of with 1:1 name:value pairs |
list of unboxed data frames
Other JSON Prep:
clean_field_names(),
get_entity(),
prep_affiliation(),
prep_array(),
prep_array_objects(),
prep_atomic(),
prep_creators(),
prep_data(),
prep_descriptions(),
prep_for_json(),
prep_from_metadata_template(),
prep_fundingReferences(),
prep_identifier(),
prep_language(),
prep_methodology(),
prep_methods(),
prep_nameIdentifiers(),
prep_object(),
prep_publicationYear(),
prep_relatedIdentifiers(),
prep_rights(),
prep_titles()
wddsWizard::becker_project_metadata$subjects |> prep_subjects()wddsWizard::becker_project_metadata$subjects |> prep_subjects()
Prepares an array of objects
prep_titles(x)prep_titles(x)
x |
list of data frames or a data frame |
list of single row unboxed data frames
Other JSON Prep:
clean_field_names(),
get_entity(),
prep_affiliation(),
prep_array(),
prep_array_objects(),
prep_atomic(),
prep_creators(),
prep_data(),
prep_descriptions(),
prep_for_json(),
prep_from_metadata_template(),
prep_fundingReferences(),
prep_identifier(),
prep_language(),
prep_methodology(),
prep_methods(),
prep_nameIdentifiers(),
prep_object(),
prep_publicationYear(),
prep_relatedIdentifiers(),
prep_rights(),
prep_subjects()
wddsWizard::becker_project_metadata$titles |> prep_titles()wddsWizard::becker_project_metadata$titles |> prep_titles()
See data standard JSON file for field descriptions.
project_metadata_required_fieldsproject_metadata_required_fields
An object of class character of length 7.
Other Data:
becker_disease_data,
becker_project_metadata,
disease_data_required_fields,
minimal_disease_data,
minimal_project_metadata,
schema_required_fields,
spdx_licenses,
wdds_to_dcmi_map,
wdds_to_pharos_map
See data standard JSON file for field descriptions.
project_metadata_schemaproject_metadata_schema
An object of class list of length 6.
Other Schema:
datacite_schema,
disease_data_schema,
schema_obj,
schema_properties,
schema_terms,
wdds_schema
This function replaces periods with under scores. The different versions of the data standard are stored in folders with their respective names; however, having periods in folder names can cause problems on certain operating systems and makes it more difficult to parse file extensions.
sanitize_version(version)sanitize_version(version)
version |
Character. Version identifier. |
Character. Version identifier with no periods.
Other WDDS deposit:
batch_download_deposit_versions(),
download_deposit_version(),
list_deposit_versions(),
set_wdds_version(),
wdds_data_templates(),
wdds_example_data(),
wdds_json()
sanitize_version("v.1.1.0")sanitize_version("v.1.1.0")
A class for getting schema properties.
List of of data frames. Create a list from a schema object
Creates a data.frame with the fields name and type
data frame with type and name Get schema references
Parses $ref calls in a schema. Can retrieve internal ('"$ref":"#/definitions/someDef") or external references ('"$ref":"schemas/datacite/datacite.json"').
For external references, it can handle both pointers and references to entire schemas.
This function navigates between parent and child schemas by manipulating
variables in the package environment the.
data frame with name or type. Process Array Items
Processes array items so they can be added to a data frame.
data frames with name and type for array items that are objects or character strings atomic (string, null, Boolean, etc) array items.
schema_path(character(1))
path to the schema file.
schema_list_out(list())
List of data frames with schema properties.
wdds_version(character(1))
version of wdds used
current_schema_path(character(1))
current schema file path
current_schema_dir(character(1))
current schema directory path
current_sub_schema_dir(character(1))
current sub schema directory path
parent_schema_path(character(1))
parent schema file path
parent_schema_dir(character(1))
parent schema directory
array_items(c())
array items
array_items_skip(logical(1))
array items to skip
array_items_parent(logical(1))
parent array items
new()
Creates a new instance of this R6 class.
schema_obj$new(schema_path, wdds_version = "latest")
schema_pathCharacter. File path for the schema (character(1))
wdds_versionCharacter. Version of wdds used (character(1))
create_schema_list()
Create an expanded schema object
Produces a list of data frame with name and type for the schema. This is a recursive set of function and may be expanded to get other properties.
schema_obj$create_schema_list(schema_path = self$current_schema_path)
schema_pathCharacter. Path to a json-schema. Default is the current schema path from the package environment,
create_object_list()
schema_obj$create_object_list(x, idx, schema_dir)
xList. Schema property or definition
idxName from schema property
schema_dirCharacter. directory where the schema is stored
get_ref_list()
schema_obj$get_ref_list(x, schema_dir)
xList. Must have property "$ref"
schema_dirCharacter. Directory for the current schema.
process_array_items()
schema_obj$process_array_items(array_items, out)
array_itemslist. List of array items for processing.
outdata frame. Data frame with name and type.
clone()
The objects of this class are cloneable with this method.
schema_obj$clone(deep = FALSE)
deepWhether to make a deep clone.
Other Schema:
datacite_schema,
disease_data_schema,
project_metadata_schema,
schema_properties,
schema_terms,
wdds_schema
A data frame of schema names and types.
schema_propertiesschema_properties
An object of class data.frame with 78 rows and 4 columns.
Other Schema:
datacite_schema,
disease_data_schema,
project_metadata_schema,
schema_obj,
schema_terms,
wdds_schema
See data standard JSON file for field descriptions. This is a vector of the required fields for the entire schema.
schema_required_fieldsschema_required_fields
An object of class character of length 2.
Other Data:
becker_disease_data,
becker_project_metadata,
disease_data_required_fields,
minimal_disease_data,
minimal_project_metadata,
project_metadata_required_fields,
spdx_licenses,
wdds_to_dcmi_map,
wdds_to_pharos_map
Markdown of schema terms
schema_termsschema_terms
An object of class character of length 1.
Other Schema:
datacite_schema,
disease_data_schema,
project_metadata_schema,
schema_obj,
schema_properties,
wdds_schema
Used to keep the package and data standard in alignment.
set_wdds_version(version = "latest")set_wdds_version(version = "latest")
version |
Character. identifier for a version e.g. "v.1.0.2" or "latest". Default is "latest". |
Character. Current schema version.
Other WDDS deposit:
batch_download_deposit_versions(),
download_deposit_version(),
list_deposit_versions(),
sanitize_version(),
wdds_data_templates(),
wdds_example_data(),
wdds_json()
A table with SPDX license metadata. Use spdx_licenses$licenseId when uploading data to Zenodo.
spdx_licensesspdx_licenses
An object of class data.frame with 706 rows and 9 columns.
https://github.com/spdx/license-list-data/blob/main/json/licenses.json
Other Data:
becker_disease_data,
becker_project_metadata,
disease_data_required_fields,
minimal_disease_data,
minimal_project_metadata,
project_metadata_required_fields,
schema_required_fields,
wdds_to_dcmi_map,
wdds_to_pharos_map
translate to dcmi
translate_to_dcmi(item, translation_map)translate_to_dcmi(item, translation_map)
item |
List. Item to be translated. |
translation_map |
List. Instructions for translating the item |
List. Item that has been translated to DCMI
Other Standards Mapping:
na_to_blank(),
wdds_to_dcmi(),
wdds_to_pharos()
This function allows you to easily copy and open a template from the package.
use_wdds_template( template_file = NULL, folder = fs::path_wd(), file_name = NULL, open = rlang::is_interactive(), overwrite = FALSE )use_wdds_template( template_file = NULL, folder = fs::path_wd(), file_name = NULL, open = rlang::is_interactive(), overwrite = FALSE )
template_file |
character. File name for a template. Defaults to |
folder |
character. Where should the template be copied to? Default is the current working directory. |
file_name |
character. What should the copied file be called? Default is to use whatever value is supplied to template_file. |
open |
logical. Should the file be opened? Defaults to TRUE if interactive. |
overwrite |
logical. Should a file with the same name in the destination folder be overwritten? Default is FALSE to avoid accidentally overwriting data. |
Character. If no template_file value is provided, lists all template files in the package. If a file is created, it returns the file path for that new file.
Other Templates:
list_wdds_templates()
# return available templates use_wdds_template() ## Not run: # makes a copy of the disease data template in the current working directory use_wdds_template("disease_data_template.csv") ## End(Not run)# return available templates use_wdds_template() ## Not run: # makes a copy of the disease data template in the current working directory use_wdds_template("disease_data_template.csv") ## End(Not run)
Since schema versions may change during the life cycle of project, it is important that users have access to all schema versions via this package. This function allows you to quickly retrieve whichever version of the data templates you may need.
wdds_data_templates(version = NULL, file = NULL)wdds_data_templates(version = NULL, file = NULL)
version |
Character. Version of the wdds deposit. Leave as NULL to see all versions. |
file |
Character. Specific file from the wdds deposit. Leave as NULL to see all files in a version. |
This function does three things.
Shows all versions of the schema in the package if version is NULL
Provides paths to all example data files associated with a version of the schema if version is not NULL and file is NULL
Provides a specific file path in a specific version of the example data if both version and file are specified.
Character. Either version identifiers or file paths.
Other WDDS deposit:
batch_download_deposit_versions(),
download_deposit_version(),
list_deposit_versions(),
sanitize_version(),
set_wdds_version(),
wdds_example_data(),
wdds_json()
# see which versions are in the package wdds_data_templates() # see files associated with a version wdds_data_templates(version = "latest") # get the file path for a specific file wdds_data_templates(version = "v_1_0_2", file = "disease_data_template.csv")# see which versions are in the package wdds_data_templates() # see files associated with a version wdds_data_templates(version = "latest") # get the file path for a specific file wdds_data_templates(version = "v_1_0_2", file = "disease_data_template.csv")
Since schema versions may change during the life cycle of project, it is important that users have access to all schema versions via this package. This function allows you to quickly retrieve whichever version of the example data you may need.
wdds_example_data(version = NULL, file = NULL)wdds_example_data(version = NULL, file = NULL)
version |
Character or NULL. Version of the wdds deposit. Leave as NULL to see all versions. Default is NULL to return a character vector of versions. |
file |
Character or NULL. Specific file from the wdds deposit. Leave as NULL to see all files in a version. Default is NULL to return all files associated with a given version. |
This function does three things.
Shows all versions of the schema in the package if version is NULL.
Provides paths to all example data files associated with a version of the schema if version is provided and file is NULL.
Provides a specific file path in a specific version of the example data if both file and version are provided.
Character. Either version identifiers or file paths.
Other WDDS deposit:
batch_download_deposit_versions(),
download_deposit_version(),
list_deposit_versions(),
sanitize_version(),
set_wdds_version(),
wdds_data_templates(),
wdds_json()
# see which versions are in the package wdds_example_data() # see files associated with a version wdds_example_data(version = "latest") # get the file path for a specific file wdds_example_data(version = "v_1_0_2", file = "Becker_demo_dataset.xlsx")# see which versions are in the package wdds_example_data() # see files associated with a version wdds_example_data(version = "latest") # get the file path for a specific file wdds_example_data(version = "v_1_0_2", file = "Becker_demo_dataset.xlsx")
Since schema versions may change during the life cycle of project, it is important that users have access to all schema versions via this package. This function allows you to quickly retrieve whichever schema version you may need.
wdds_json(version = NULL, file = NULL)wdds_json(version = NULL, file = NULL)
version |
Character or NULL. Version of the wdds deposit. Leave as NULL to see all versions. Default is NULL to return character vector of versions. |
file |
Character or NULL. Specific file from the wdds deposit. Leave as NULL to see all files in a version. Default is NULL to return character vector of relative file paths. |
This function does three things:
Shows all versions of the schema in the package if both version and file are NULL.
Provides relative paths to all schema files associated with a version of the schema if only version is provided.
Provides a specific file path in a specific version of the schema if version and file path are provided.
Character. Either version identifiers, relative file paths within a version, or a specific file path.
Other WDDS deposit:
batch_download_deposit_versions(),
download_deposit_version(),
list_deposit_versions(),
sanitize_version(),
set_wdds_version(),
wdds_data_templates(),
wdds_example_data()
# see which versions are in the package wdds_json() # see files associated with a version wdds_json(version = "latest") # get the file path for a specific file wdds_json(version = "v_1_0_2", file = "schemas/disease_data.json")# see which versions are in the package wdds_json() # see files associated with a version wdds_json(version = "latest") # get the file path for a specific file wdds_json(version = "v_1_0_2", file = "schemas/disease_data.json")
See data standard JSON file for field descriptions.
wdds_schemawdds_schema
An object of class list of length 6.
Other Schema:
datacite_schema,
disease_data_schema,
project_metadata_schema,
schema_obj,
schema_properties,
schema_terms
Converts WDDS project metadata to Zenodo flavored DCMI metadata.
wdds_to_dcmi( metadata_to_translate, translation_map = wddsWizard::wdds_to_dcmi_map )wdds_to_dcmi( metadata_to_translate, translation_map = wddsWizard::wdds_to_dcmi_map )
metadata_to_translate |
List. Metadata that conforms to the WDDS data standard but is not prepped for JSON. See |
translation_map |
List. A list that describes how to translate from WDDS to DCMI. |
List. Translated metadata with appropriate names.
Other Standards Mapping:
na_to_blank(),
translate_to_dcmi(),
wdds_to_pharos()
project_metadata <- wdds_example_data(version = "latest", file = "example_project_metadata.csv")|> read.csv() test_pmd <- project_metadata |> prep_from_metadata_template(json_prep = FALSE) test_pmd$rights$rights <- "CC0-1.0" dcmi_metadata <- wdds_to_dcmi(metadata_to_translate = test_pmd, translation_map = wddsWizard::wdds_to_dcmi_map)project_metadata <- wdds_example_data(version = "latest", file = "example_project_metadata.csv")|> read.csv() test_pmd <- project_metadata |> prep_from_metadata_template(json_prep = FALSE) test_pmd$rights$rights <- "CC0-1.0" dcmi_metadata <- wdds_to_dcmi(metadata_to_translate = test_pmd, translation_map = wddsWizard::wdds_to_dcmi_map)
A list that maps variables between WDDS and the DCMI data standards.
wdds_to_dcmi_mapwdds_to_dcmi_map
An object of class list of length 2.
https://github.com/ropenscilabs/deposits/blob/main/inst/extdata/dc/schema.json
Other Data:
becker_disease_data,
becker_project_metadata,
disease_data_required_fields,
minimal_disease_data,
minimal_project_metadata,
project_metadata_required_fields,
schema_required_fields,
spdx_licenses,
wdds_to_pharos_map
As of 11 September 2025, WDDS and the PHAROS data model are not fully aligned.
This function converts data that conforms to WDDS into the PHAROS data model.
See wdds_to_pharos_map for the data model crosswalk.
wdds_to_pharos(wdds_disease_data)wdds_to_pharos(wdds_disease_data)
wdds_disease_data |
Data frame. A Disease Data set that conforms to the wdds data standard. |
Data frame. A tabular data set that conforms to the PHAROS data model.
Other Standards Mapping:
na_to_blank(),
translate_to_dcmi(),
wdds_to_dcmi()
wdds_to_pharos(wdds_disease_data = wddsWizard::minimal_disease_data) # data must be written to CSV then uploaded to PHAROSwdds_to_pharos(wdds_disease_data = wddsWizard::minimal_disease_data) # data must be written to CSV then uploaded to PHAROS
A table that maps variables between WDDS and the PHAROS data standard (11 September 2025). Will be deprecated once PHARSO and wdds are aligned.
wdds_to_pharos_mapwdds_to_pharos_map
An object of class spec_tbl_df (inherits from tbl_df, tbl, data.frame) with 45 rows and 2 columns.
https://pharos.viralemergence.org/
Other Data:
becker_disease_data,
becker_project_metadata,
disease_data_required_fields,
minimal_disease_data,
minimal_project_metadata,
project_metadata_required_fields,
schema_required_fields,
spdx_licenses,
wdds_to_dcmi_map