
Validate Specimens Main Function
validate_specimens.Rd
The validate_specimens
function serves as a main driver for validating specimens
data, both for Micronix and Cryovial specimens. The process involves several key steps:
Usage
validate_specimens(
user_data,
sample_type,
user_action,
file_type,
database = Sys.getenv("SDB_PATH")
)
Arguments
- user_data
Character string. The path to the user-provided CSV file to be validated.
- sample_type
Character string. The type of sample being validated. Expected values are "micronix" or "cryovial".
- user_action
Character string. The action being performed by the user, e.g. "upload".
- database
Character string. The database connection or specification for validation. Default is the system environment variable "SDB_PATH".
Value
A data frame. The validated and potentially modified user data if validation passes. If validation does not pass, an error will be raised.
Details
Formatting the provided user CSV based on the sample type and action with
format_user_csv
.Validation based on the sample type using either
validate_micronix
orvalidate_cryovial
.If the user action is "upload", dates in the data will be further validated using
validate_dates_with_tokens
.Any errors during the validation steps are accumulated and, if present, will trigger an error message, stopping the process.
If unknown date tokens are found during validation, these are handled using the
handle_unknown_date_tokens
function.
At the end of the validation process, the user data will be either ready for upload to the database or returned to the user with errors.
See also
format_user_csv
, validate_micronix
,
validate_cryovial
, validate_dates_with_tokens
,
handle_unknown_date_tokens