The agent's x-list is a record of information that the agent possesses at
any given time. The x-list will contain the most complete information
after an interrogation has taken place (before then, the data largely
reflects the validation plan). The x-list can be constrained to a
particular validation step (by supplying the step number to the i
argument), or, we can get the information for all validation steps by leaving
i
unspecified. The x-list is indeed an R list
object that contains a
veritable cornucopia of information.
For an x-list obtained with i
specified for a validation step, the
following components are available:
time_start
: the time at which the interrogation began (POSIXct [0 or 1]
)time_end
: the time at which the interrogation ended (POSIXct [0 or 1]
)label
: the optional label given to the agent (chr [1]
)tbl_name
: the name of the table object, if available (chr [1]
)tbl_src
: the type of table used in the validation (chr [1]
)tbl_src_details
: if the table is a database table, this provides further details for the DB table (chr [1]
)tbl
: the table object itselfcol_names
: the table's column names (chr [ncol(tbl)]
)col_types
: the table's column types (chr [ncol(tbl)]
)i
: the validation step index (int [1]
)type
: the type of validation, value is validation function name (chr [1]
)columns
: the columns specified for the validation function (chr [variable length]
)values
: the values specified for the validation function (mixed types [variable length]
)briefs
: the brief for the validation step in the specifiedlang
(chr [1]
)eval_error
,eval_warning
: indicates whether the evaluation of the step function, during interrogation, resulted in an error or a warning (lgl [1]
)capture_stack
: a list of captured errors or warnings during step-function evaluation at interrogation time (list [1]
)n
: the number of test units for the validation step (num [1]
)n_passed
,n_failed
: the number of passing and failing test units for the validation step (num [1]
)f_passed
: the fraction of passing test units for the validation step,n_passed
/n
(num [1]
)f_failed
: the fraction of failing test units for the validation step,n_failed
/n
(num [1]
)warn
,stop
,notify
: a logical value indicating whether the level of failing test units caused the corresponding conditions to be entered (lgl [1]
)lang
: the two-letter language code that indicates which language should be used for all briefs, the agent report, and the reporting generated by thescan_data()
function (chr [1]
)
If i
is unspecified (i.e., not constrained to a specific validation step)
then certain length-one components in the x-list will be expanded to the
total number of validation steps (these are: i
, type
, columns
,
values
, briefs
, eval_error
, eval_warning
, capture_stack
, n
,
n_passed
, n_failed
, f_passed
, f_failed
, warn
, stop
, and
notify
). The x-list will also have additional components when i
is
NULL
, which are:
report_object
: a gt table object, which is also presented as the default print method for aptblank_agent
email_object
: a blastulaemail_message
object with a default set of componentsreport_html
: the HTML source for thereport_object
, provided as a length-one character vectorreport_html_small
: the HTML source for a narrower, more condensed version ofreport_object
, provided as a length-one character vector; The HTML has inlined styles, making it more suitable for email message bodies
Arguments
- agent
An agent object of class
ptblank_agent
.- i
The validation step number, which is assigned to each validation step in the order of invocation. If
NULL
(the default), the x-list will provide information for all validation steps. If a valid step number is provided then x-list will have information pertaining only to that step.
Examples
Create a simple data frame with a column of numerical values.
## # A tibble: 4 × 1
## a
## <dbl>
## 1 5
## 2 7
## 3 8
## 4 5
Create an action_levels()
list with fractional values for the warn
,
stop
, and notify
states.
al <-
action_levels(
warn_at = 0.2,
stop_at = 0.8,
notify_at = 0.345
)
al
## -- The `action_levels` settings
## WARN failure threshold of 0.2 of all test units.
## STOP failure threshold of 0.8 of all test units.
## NOTIFY failure threshold of 0.345 of all test units.
## ----
Create an agent (giving it the tbl
and the al
objects), supply two
validation step functions, then interrogate.
agent <-
create_agent(
tbl = tbl,
actions = al
) %>%
col_vals_gt(columns = vars(a), value = 7) %>%
col_is_numeric(columns = vars(a)) %>%
interrogate()
Get the agent x-list.
x <- get_agent_x_list(agent)
x
## -- The x-list for table `tbl`
## ---- ALL STEPS ----
## $time_start $time_end (POSIXct [1])
## $label $tbl_name $tbl_src $tbl_src_details (chr [1])
## $tbl (tbl_df tbl data.frame)
## $col_names $col_types (chr [1])
## $i $type $columns $values $label $briefs (mixed [2])
## $eval_error $eval_warning (lgl [2])
## $capture_stack (list [2])
## $n $n_passed $n_failed $f_passed $f_failed (num [2])
## $warn $stop $notify (lgl [2])
## $validation_set (tbl_df [2, 35])
## $lang (chr [1])
## $report_object (blastula_message)
## $report_html $report_html_small (chr [1])
## ----
Get the f_passed
component of the x-list x
.
x$f_passed
## [1] 0.25 1.00
See also
Other Post-interrogation:
all_passed()
,
get_data_extracts()
,
get_sundered_data()
,
write_testthat_file()