Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recycle brief if validation expands into multiple steps #564

Merged
merged 31 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
281c2bb
resolve_briefs() draft
yjunechoe Aug 19, 2024
6f9c4cf
try implementing on col and col-x-seg type of validations
yjunechoe Aug 19, 2024
b91cb72
add tests
yjunechoe Aug 19, 2024
27bf33f
use magrittr pipe
yjunechoe Aug 19, 2024
6571553
resolve_briefs() wraps generate_autobriefs()
yjunechoe Sep 8, 2024
cc7596c
minimally working copy paste
yjunechoe Sep 9, 2024
9649b86
improve error messages
yjunechoe Sep 9, 2024
228cb3a
set default vaue of columns to length-1 for autobriefs
yjunechoe Sep 9, 2024
34f4708
Merge branch 'main' into brief-recycle
yjunechoe Sep 23, 2024
e4cd67e
Merge branch 'main' into brief-recycle
yjunechoe Nov 7, 2024
3f55805
tests refactoring
yjunechoe Nov 7, 2024
f611dde
reduce code dup
yjunechoe Nov 7, 2024
300aebf
brief-recycle
yjunechoe Nov 27, 2024
5173e00
special handling of col_vals_expr
yjunechoe Nov 27, 2024
e5c2744
augment special case tests
yjunechoe Nov 27, 2024
8ccc198
index through brief vector under for loop
yjunechoe Nov 27, 2024
f2251fd
merge main
yjunechoe Nov 28, 2024
b0d0214
reapply fix for quosure list deprecation
yjunechoe Nov 28, 2024
f94a695
reapply trimming trailing whitespace
yjunechoe Nov 28, 2024
26e90fe
refactor iteration logic, move out shared code between resolving labe…
yjunechoe Nov 29, 2024
d1bb28a
try out new iteration logic
yjunechoe Nov 29, 2024
297d0f0
set up for batch testing
yjunechoe Nov 29, 2024
83e7761
standardize function name to singular
yjunechoe Dec 2, 2024
c872541
Merge branch 'main' into brief-recycle
yjunechoe Dec 3, 2024
de76186
rework batch test function
yjunechoe Jan 17, 2025
525a913
round off test for every validation function
yjunechoe Jan 17, 2025
6f34fb3
indexing into 1-dimension
yjunechoe Jan 17, 2025
35e3932
indexing into 2-dimension
yjunechoe Jan 17, 2025
12aec27
Merge branch 'main' into brief-recycle
yjunechoe Jan 17, 2025
1174dfc
test briefs involving NAs
yjunechoe Jan 21, 2025
be1b1ee
test setup cleanup
yjunechoe Jan 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions R/col_count_match.R
Original file line number Diff line number Diff line change
Expand Up @@ -300,15 +300,11 @@ col_count_match <- function(

agent <- x

if (is.null(brief)) {

brief <-
create_autobrief(
agent = agent,
assertion_type = "col_count_match",
values = count
)
}
brief <- resolve_brief(
brief = brief, agent = agent,
preconditions = preconditions, values = count,
assertion_type = "col_count_match"
)

# Normalize any provided `step_id` value(s)
step_id <- normalize_step_id(step_id, columns = "column", agent)
Expand Down
12 changes: 7 additions & 5 deletions R/col_exists.R
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,12 @@ col_exists <- function(

agent <- x

if (is.null(brief)) {
brief <-
generate_autobriefs(agent, columns, preconditions, values, "col_exists")
}
brief <- resolve_brief(
brief = brief, agent = agent,
columns = columns,
preconditions = preconditions, values = value,
assertion_type = "col_exists"
)

# Normalize any provided `step_id` value(s)
step_id <- normalize_step_id(step_id, columns, agent)
Expand Down Expand Up @@ -309,7 +311,7 @@ col_exists <- function(
actions = covert_actions(actions, agent),
step_id = step_id[i],
label = label[[i]],
brief = brief[i],
brief = brief[[i]],
active = active
)
}
Expand Down
14 changes: 7 additions & 7 deletions R/col_is_character.R
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,12 @@ col_is_character <- function(

agent <- x

if (is.null(brief)) {
brief <-
generate_autobriefs(
agent, columns, preconditions, values, "col_is_character"
)
}
brief <- resolve_brief(
brief = brief, agent = agent,
columns = columns,
preconditions = preconditions, values = value,
assertion_type = "col_is_character"
)

# Normalize any provided `step_id` value(s)
step_id <- normalize_step_id(step_id, columns, agent)
Expand Down Expand Up @@ -302,7 +302,7 @@ col_is_character <- function(
actions = covert_actions(actions, agent),
step_id = step_id[i],
label = label[[i]],
brief = brief[i],
brief = brief[[i]],
active = active
)
}
Expand Down
14 changes: 7 additions & 7 deletions R/col_is_date.R
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,12 @@ col_is_date <- function(

agent <- x

if (is.null(brief)) {
brief <-
generate_autobriefs(
agent, columns, preconditions, values, "col_is_date"
)
}
brief <- resolve_brief(
brief = brief, agent = agent,
columns = columns,
preconditions = preconditions, values = value,
assertion_type = "col_is_date"
)

# Normalize any provided `step_id` value(s)
step_id <- normalize_step_id(step_id, columns, agent)
Expand Down Expand Up @@ -294,7 +294,7 @@ col_is_date <- function(
actions = covert_actions(actions, agent),
step_id = step_id[i],
label = label[[i]],
brief = brief[i],
brief = brief[[i]],
active = active
)
}
Expand Down
14 changes: 7 additions & 7 deletions R/col_is_factor.R
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,12 @@ col_is_factor <- function(

agent <- x

if (is.null(brief)) {
brief <-
generate_autobriefs(
agent, columns, preconditions, values, "col_is_factor"
)
}
brief <- resolve_brief(
brief = brief, agent = agent,
columns = columns,
preconditions = preconditions, values = value,
assertion_type = "col_is_factor"
)

# Normalize any provided `step_id` value(s)
step_id <- normalize_step_id(step_id, columns, agent)
Expand Down Expand Up @@ -300,7 +300,7 @@ col_is_factor <- function(
actions = covert_actions(actions, agent),
step_id = step_id[i],
label = label[[i]],
brief = brief[i],
brief = brief[[i]],
active = active
)
}
Expand Down
14 changes: 7 additions & 7 deletions R/col_is_integer.R
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,12 @@ col_is_integer <- function(

agent <- x

if (is.null(brief)) {
brief <-
generate_autobriefs(
agent, columns, preconditions, values, "col_is_integer"
)
}
brief <- resolve_brief(
brief = brief, agent = agent,
columns = columns,
preconditions = preconditions, values = value,
assertion_type = "col_is_integer"
)

# Normalize any provided `step_id` value(s)
step_id <- normalize_step_id(step_id, columns, agent)
Expand Down Expand Up @@ -298,7 +298,7 @@ col_is_integer <- function(
actions = covert_actions(actions, agent),
step_id = step_id[i],
label = label[[i]],
brief = brief[i],
brief = brief[[i]],
active = active
)
}
Expand Down
14 changes: 7 additions & 7 deletions R/col_is_logical.R
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,12 @@ col_is_logical <- function(

agent <- x

if (is.null(brief)) {
brief <-
generate_autobriefs(
agent, columns, preconditions, values, "col_is_logical"
)
}
brief <- resolve_brief(
brief = brief, agent = agent,
columns = columns,
preconditions = preconditions, values = value,
assertion_type = "col_is_logical"
)

# Normalize any provided `step_id` value(s)
step_id <- normalize_step_id(step_id, columns, agent)
Expand Down Expand Up @@ -295,7 +295,7 @@ col_is_logical <- function(
actions = covert_actions(actions, agent),
step_id = step_id[i],
label = label[[i]],
brief = brief[i],
brief = brief[[i]],
active = active
)
}
Expand Down
14 changes: 7 additions & 7 deletions R/col_is_numeric.R
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,12 @@ col_is_numeric <- function(

agent <- x

if (is.null(brief)) {
brief <-
generate_autobriefs(
agent, columns, preconditions, values, "col_is_numeric"
)
}
brief <- resolve_brief(
brief = brief, agent = agent,
columns = columns,
preconditions = preconditions, values = value,
assertion_type = "col_is_numeric"
)

# Normalize any provided `step_id` value(s)
step_id <- normalize_step_id(step_id, columns, agent)
Expand Down Expand Up @@ -295,7 +295,7 @@ col_is_numeric <- function(
actions = covert_actions(actions, agent),
step_id = step_id[i],
label = label[[i]],
brief = brief[i],
brief = brief[[i]],
active = active
)
}
Expand Down
14 changes: 7 additions & 7 deletions R/col_is_posix.R
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,12 @@ col_is_posix <- function(

agent <- x

if (is.null(brief)) {
brief <-
generate_autobriefs(
agent, columns, preconditions, values, "col_is_posix"
)
}
brief <- resolve_brief(
brief = brief, agent = agent,
columns = columns,
preconditions = preconditions, values = value,
assertion_type = "col_is_posix"
)

# Normalize any provided `step_id` value(s)
step_id <- normalize_step_id(step_id, columns, agent)
Expand Down Expand Up @@ -295,7 +295,7 @@ col_is_posix <- function(
actions = covert_actions(actions, agent),
step_id = step_id[i],
label = label[[i]],
brief = brief[i],
brief = brief[[i]],
active = active
)
}
Expand Down
12 changes: 4 additions & 8 deletions R/col_schema_match.R
Original file line number Diff line number Diff line change
Expand Up @@ -356,14 +356,10 @@ col_schema_match <- function(

agent <- x

if (is.null(brief)) {

brief <-
create_autobrief(
agent = agent,
assertion_type = "col_schema_match"
)
}
brief <- resolve_brief(
brief = brief, agent = agent,
assertion_type = "col_schema_match"
)

# Normalize any provided `step_id` value(s)
step_id <- normalize_step_id(step_id, columns = "column", agent)
Expand Down
19 changes: 7 additions & 12 deletions R/col_vals_between.R
Original file line number Diff line number Diff line change
Expand Up @@ -433,17 +433,12 @@ col_vals_between <- function(
left <- as.list(left)
right <- as.list(right)

if (is.null(brief)) {

brief <-
generate_autobriefs(
agent = agent,
columns = columns,
preconditions = preconditions,
values = c(left, right),
assertion_type = "col_vals_between"
)
}
brief <- resolve_brief(
brief = brief, agent = agent,
columns = columns, segments_list = segments_list,
preconditions = preconditions, values = c(left, right),
assertion_type = "col_vals_between"
)

# Normalize any provided `step_id` value(s)
step_id <- normalize_step_id(step_id, columns, agent)
Expand Down Expand Up @@ -480,7 +475,7 @@ col_vals_between <- function(
actions = covert_actions(actions, agent),
step_id = step_id[i],
label = label[[i, j]],
brief = brief[i],
brief = brief[[i, j]],
active = active
)
}
Expand Down
19 changes: 7 additions & 12 deletions R/col_vals_decreasing.R
Original file line number Diff line number Diff line change
Expand Up @@ -413,17 +413,12 @@ col_vals_decreasing <- function(

agent <- x

if (is.null(brief)) {

brief <-
generate_autobriefs(
agent = agent,
columns = columns,
preconditions = preconditions,
values = increasing_tol,
assertion_type = "col_vals_decreasing"
)
}
brief <- resolve_brief(
brief = brief, agent = agent,
columns = columns, segments_list = segments_list,
preconditions = preconditions, values = increasing_tol,
assertion_type = "col_vals_decreasing"
)

# Normalize any provided `step_id` value(s)
step_id <- normalize_step_id(step_id, columns, agent)
Expand Down Expand Up @@ -460,7 +455,7 @@ col_vals_decreasing <- function(
actions = covert_actions(actions, agent),
step_id = step_id[i],
label = label[[i, j]],
brief = brief[i],
brief = brief[[i, j]],
active = active
)
}
Expand Down
19 changes: 7 additions & 12 deletions R/col_vals_equal.R
Original file line number Diff line number Diff line change
Expand Up @@ -365,17 +365,12 @@ col_vals_equal <- function(

agent <- x

if (is.null(brief)) {

brief <-
generate_autobriefs(
agent = agent,
columns = columns,
preconditions = preconditions,
values = value,
assertion_type = "col_vals_equal"
)
}
brief <- resolve_brief(
brief = brief, agent = agent,
columns = columns, segments_list = segments_list,
preconditions = preconditions, values = value,
assertion_type = "col_vals_equal"
)

# Normalize any provided `step_id` value(s)
step_id <- normalize_step_id(step_id, columns, agent)
Expand Down Expand Up @@ -412,7 +407,7 @@ col_vals_equal <- function(
actions = covert_actions(actions, agent),
step_id = step_id[i],
label = label[[i, j]],
brief = brief[i],
brief = brief[[i, j]],
active = active
)
}
Expand Down
16 changes: 7 additions & 9 deletions R/col_vals_expr.R
Original file line number Diff line number Diff line change
Expand Up @@ -367,14 +367,12 @@ col_vals_expr <- function(

agent <- x

if (is.null(brief)) {

brief <-
create_autobrief(
agent = agent,
assertion_type = "col_vals_expr"
)
}
brief <- resolve_brief(
brief = brief, agent = agent,
segments_list = segments_list,
preconditions = preconditions,
assertion_type = "col_vals_expr"
)

# Normalize any provided `step_id` value(s)
step_id <- normalize_step_id(step_id, columns = "column", agent)
Expand Down Expand Up @@ -409,7 +407,7 @@ col_vals_expr <- function(
actions = covert_actions(actions, agent),
step_id = step_id,
label = label[[i]],
brief = brief,
brief = brief[[i]],
active = active
)
}
Expand Down
Loading
Loading