From 7812bc69fa9f2f2da7ba02623ed68a4e7d629b48 Mon Sep 17 00:00:00 2001 From: agdamsbo <43278243+agdamsbo@users.noreply.github.com> Date: Mon, 30 Mar 2026 18:46:00 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20agdamsbo?= =?UTF-8?q?/FreesearchR@75f2ae07b713fb1b12c1caf0b7423c6d6e7f57bf=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 404.html | 2 +- CODE_OF_CONDUCT.html | 2 +- LICENSE.html | 2 +- QA.html | 2 +- ROADMAP.html | 2 +- SESSION.html | 304 +++++++++--------- SESSION.md | 9 +- articles/FreesearchR.html | 2 +- articles/data-types.html | 2 +- articles/index.html | 2 +- articles/missingness.html | 2 +- articles/session.html | 310 ++++++++++--------- articles/session.md | 11 +- articles/visuals.html | 2 +- authors.html | 6 +- authors.md | 4 +- index.html | 2 +- llms.txt | 5 + news/index.html | 12 +- news/index.md | 24 +- pkgdown.yml | 2 +- reference/FreesearchR_palette.html | 2 +- reference/FreesearchR_theme.html | 2 +- reference/add_class_icon.html | 2 +- reference/add_sparkline.html | 2 +- reference/align_axes.html | 2 +- reference/all_but.html | 2 +- reference/append_column.html | 2 +- reference/append_list.html | 2 +- reference/apply_labels.html | 2 +- reference/argsstring2list.html | 2 +- reference/baseline_table.html | 2 +- reference/check_app_version.html | 2 +- reference/class_icons.html | 2 +- reference/clean_common_axis.html | 2 +- reference/clean_date.html | 2 +- reference/clean_sep.html | 2 +- reference/collapse_spaces.html | 2 +- reference/colorSelectInput.html | 4 +- reference/colorSelectInput.md | 2 +- reference/columnSelectInput.html | 2 +- reference/compare_missings.html | 2 +- reference/continuous_colors.html | 2 +- reference/contrast_text.html | 2 +- reference/corr_pairs_validate.html | 2 +- reference/correlation_pairs.html | 2 +- reference/create-column.html | 2 +- reference/create_baseline.html | 5 +- reference/create_baseline.md | 3 +- reference/create_log_tics.html | 2 +- reference/create_overview_datagrid.html | 2 +- reference/cut-variable.html | 2 +- reference/cut_methods.html | 2 +- reference/cut_var.html | 2 +- reference/data-correlations.html | 2 +- reference/data-missings.html | 2 +- reference/data-plots-12.png | Bin 54607 -> 32089 bytes reference/data-plots-13.png | Bin 139748 -> 38576 bytes reference/data-plots-14.png | Bin 138803 -> 54607 bytes reference/data-plots-15.png | Bin 191305 -> 139748 bytes reference/data-plots-16.png | Bin 85712 -> 138803 bytes reference/data-plots-17.png | Bin 95922 -> 191305 bytes reference/data-plots-18.png | Bin 50850 -> 85712 bytes reference/data-plots-19.png | Bin 64623 -> 95922 bytes reference/data-plots-20.png | Bin 55943 -> 50850 bytes reference/data-plots-21.png | Bin 0 -> 64623 bytes reference/data-plots-22.png | Bin 0 -> 55943 bytes reference/data-plots.html | 62 +++- reference/data-plots.md | 40 ++- reference/data-summary.html | 2 +- reference/data_description.html | 2 +- reference/data_summary_gather.html | 2 +- reference/data_type.html | 2 +- reference/data_type_filter.html | 14 +- reference/data_type_filter.md | 12 +- reference/data_types.html | 2 +- reference/default_format_arguments.html | 2 +- reference/default_parsing.html | 20 +- reference/default_parsing.md | 18 +- reference/detect_delimiter.html | 2 +- reference/dim_change_call.html | 2 +- reference/dot-build_version_alert.html | 2 +- reference/dot-get_latest_github_version.html | 2 +- reference/dot-has_internet.html | 2 +- reference/dot-resolve_app_version.html | 2 +- reference/drop_empty_event.html | 2 +- reference/expression_string.html | 2 +- reference/extract_labels.html | 2 +- reference/factor_new_levels_labels.html | 2 +- reference/factorize.html | 2 +- reference/file_export.html | 2 +- reference/format_writer.html | 2 +- reference/generate_colors.html | 2 +- reference/get_data_packages.html | 2 +- reference/get_dimensions.html | 2 +- reference/get_fun_options.html | 2 +- reference/get_label.html | 2 +- reference/get_list_elements.html | 2 +- reference/get_plot_options.html | 2 +- reference/get_var_icon.html | 2 +- reference/getfun.html | 4 +- reference/getfun.md | 2 +- reference/gg_theme_export.html | 2 +- reference/gg_theme_shiny.html | 2 +- reference/ggeulerr.html | 2 +- reference/grepl_fix.html | 2 +- reference/if_not_missing.html | 2 +- reference/import-file-type.html | 2 +- reference/import-file.html | 2 +- reference/import-file_module.html | 2 +- reference/import-globalenv.html | 2 +- reference/index.html | 11 +- reference/index.md | 5 + reference/index_embed.html | 2 +- reference/is_any_class.html | 2 +- reference/is_consecutive.html | 2 +- reference/is_datetime.html | 2 +- reference/is_identical_to_previous.html | 2 +- reference/is_splittable.html | 2 +- reference/is_valid_redcap_url.html | 2 +- reference/is_valid_token.html | 2 +- reference/label_report.html | 2 +- reference/landing_page_ui.html | 2 +- reference/launch_FreesearchR.html | 2 +- reference/limit_data_size.html | 2 +- reference/limit_log.html | 2 +- reference/line_break.html | 2 +- reference/list_pkg_data.html | 2 +- reference/make_validation.html | 2 +- reference/make_validation_alerts.html | 2 +- reference/mcar_validate.html | 2 +- reference/merge_expression.html | 2 +- reference/merge_long.html | 2 +- reference/missing_fraction.html | 2 +- reference/missings_logic_across.html | 2 +- reference/missings_validate.html | 2 +- reference/modify_qmd.html | 2 +- reference/names2val.html | 2 +- reference/obs_filter_validate.html | 2 +- reference/overview_vars.html | 2 +- reference/pipe_string.html | 2 +- reference/plot.tbl_regression.html | 2 +- reference/plot_euler.html | 2 +- reference/plot_euler_single.html | 2 +- reference/plot_likert.html | 8 + reference/plot_sankey_single.html | 2 +- reference/possible_functions.html | 2 +- reference/possible_plots.html | 2 +- reference/read_input.html | 2 +- reference/redcap_read_shiny_module.html | 2 +- reference/regression_model.html | 2 +- reference/regression_table.html | 2 +- reference/regression_table_create.html | 2 +- reference/remove_empty_attr.html | 2 +- reference/remove_empty_cols.html | 2 +- reference/remove_nested_list.html | 2 +- reference/repeated_instruments.html | 2 +- reference/restore_labels.html | 2 +- reference/scale_fill_generate.html | 2 +- reference/selectInputIcon.html | 2 +- reference/separate_string.html | 2 +- reference/set_column_label.html | 2 +- reference/show_data.html | 2 +- reference/simple_snake.html | 2 +- reference/sort_by.html | 2 +- reference/specify_qmd_format.html | 2 +- reference/split-string.html | 2 +- reference/subset_types.html | 51 ++- reference/subset_types.md | 49 ++- reference/supported_functions.html | 2 +- reference/supported_plots.html | 2 +- reference/symmetrical_scale_x_log10.html | 2 +- reference/tbl_merge.html | 2 +- reference/type_icons.html | 2 +- reference/ui_elements.html | 2 +- reference/unique_names.html | 2 +- reference/unique_short.html | 2 +- reference/update-factor.html | 2 +- reference/update-variables.html | 2 +- reference/update_variables_datagrid.html | 2 +- reference/validate_redcap_filter.html | 162 ++++++++++ reference/validate_redcap_filter.md | 93 ++++++ reference/validation.html | 2 +- reference/validation_lib.html | 2 +- reference/vars_filter_validate.html | 2 +- reference/vectorSelectInput.html | 2 +- reference/vertical_stacked_bars.html | 2 +- reference/visual-summary.html | 2 +- reference/wide2long.html | 2 +- reference/with_labels.html | 2 +- reference/wrap_plot_list.html | 2 +- reference/write_quarto.html | 2 +- search.json | 2 +- sitemap.xml | 1 + 194 files changed, 999 insertions(+), 560 deletions(-) create mode 100644 reference/data-plots-21.png create mode 100644 reference/data-plots-22.png create mode 100644 reference/plot_likert.html create mode 100644 reference/validate_redcap_filter.html create mode 100644 reference/validate_redcap_filter.md diff --git a/404.html b/404.html index cbda3281..38d3b507 100644 --- a/404.html +++ b/404.html @@ -30,7 +30,7 @@ FreesearchR - 26.3.4 + 26.3.5 + + + + + +
+
+
+ +
+

Checks that a REDCap filter expression is syntactically correct and +consistent with the field types defined in the project data dictionary. +Plain text without field references is always rejected. Multi-clause +filters joined by AND or OR are supported.

+
+ +
+

Usage

+
validate_redcap_filter(filter, dictionary)
+
+ +
+

Arguments

+ + +
filter
+

A single character string containing the filter expression, +e.g. "[age] > 18" or "[cohabitation] = '1' AND [age] > 18".

+ + +
dictionary
+

A data frame representing the REDCap data dictionary in +API export format, as returned by e.g. REDCapCAST::get_redcap_metadata(). +Must contain at least the columns field_name and field_type. +The columns text_validation_type_or_show_slider_number and +select_choices_or_calculations are used when present for stricter +type and choice validation.

+ +
+
+

Value

+

A named list with two elements:

valid
+

Logical. TRUE if the filter passes all checks.

+ +
message
+

Character. "Filter is valid." on success, or +a newline-separated string of error messages describing every problem +found.

+ + +
+
+

Details

+

Validation rules by field type:

calc
+

Numeric fields. Value must be an unquoted number. +All comparison operators (=, !=, <, >, +<=, >=) are accepted.

+ +
text with date validation
+

Fields with validation type +date_ymd, date_dmy, datetime_*, etc. Value must be +a quoted date/datetime string in 'YYYY-MM-DD' format. All +comparison operators are accepted.

+ +
text with time validation
+

Fields with validation type +time_hh_mm_ss or time_mm_ss. Value must be a quoted time +string, e.g. '14:30:00'. All comparison operators are accepted.

+ +
radio / dropdown
+

Categorical fields. Value must be a +quoted choice code (e.g. '1') that exists in the field's choice +list. Only = and != are accepted.

+ +
text (plain)
+

Free-text fields. Value must be a quoted string. +Only = and != are accepted.

+ + +
+ +
+

Examples

+
if (FALSE) { # \dontrun{
+dict <- REDCapCAST::get_redcap_metadata(
+  uri    = "https://redcap.example.com/api/",
+  token  = Sys.getenv("REDCAP_TOKEN")
+)
+
+validate_redcap_filter("[age] > 18", dict)
+#> list(valid = TRUE, message = "Filter is valid.")
+
+validate_redcap_filter("only plain text", dict)
+#> list(valid = FALSE, message = "Filter must contain at least one field ...")
+
+validate_redcap_filter("[cohabitation] = '1' AND [age] > 18", dict)
+#> list(valid = TRUE, message = "Filter is valid.")
+} # }
+
+
+
+
+ + +
+ + + +
+ + + + + + + diff --git a/reference/validate_redcap_filter.md b/reference/validate_redcap_filter.md new file mode 100644 index 00000000..f9f9201d --- /dev/null +++ b/reference/validate_redcap_filter.md @@ -0,0 +1,93 @@ +# Validate a REDCap server-side filter string against a data dictionary + +Checks that a REDCap filter expression is syntactically correct and +consistent with the field types defined in the project data dictionary. +Plain text without field references is always rejected. Multi-clause +filters joined by `AND` or `OR` are supported. + +## Usage + +``` r +validate_redcap_filter(filter, dictionary) +``` + +## Arguments + +- filter: + + A single character string containing the filter expression, e.g. + `"[age] > 18"` or `"[cohabitation] = '1' AND [age] > 18"`. + +- dictionary: + + A data frame representing the REDCap data dictionary in API export + format, as returned by e.g. `REDCapCAST::get_redcap_metadata()`. Must + contain at least the columns `field_name` and `field_type`. The + columns `text_validation_type_or_show_slider_number` and + `select_choices_or_calculations` are used when present for stricter + type and choice validation. + +## Value + +A named list with two elements: + +- `valid`: + + Logical. `TRUE` if the filter passes all checks. + +- `message`: + + Character. `"Filter is valid."` on success, or a newline-separated + string of error messages describing every problem found. + +## Details + +Validation rules by field type: + +- `calc`: + + Numeric fields. Value must be an unquoted number. All comparison + operators (`=`, `!=`, `<`, `>`, `<=`, `>=`) are accepted. + +- `text` with date validation: + + Fields with validation type `date_ymd`, `date_dmy`, `datetime_*`, etc. + Value must be a quoted date/datetime string in `'YYYY-MM-DD'` format. + All comparison operators are accepted. + +- `text` with time validation: + + Fields with validation type `time_hh_mm_ss` or `time_mm_ss`. Value + must be a quoted time string, e.g. `'14:30:00'`. All comparison + operators are accepted. + +- `radio` / `dropdown`: + + Categorical fields. Value must be a quoted choice code (e.g. `'1'`) + that exists in the field's choice list. Only `=` and `!=` are + accepted. + +- `text` (plain): + + Free-text fields. Value must be a quoted string. Only `=` and `!=` are + accepted. + +## Examples + +``` r +if (FALSE) { # \dontrun{ +dict <- REDCapCAST::get_redcap_metadata( + uri = "https://redcap.example.com/api/", + token = Sys.getenv("REDCAP_TOKEN") +) + +validate_redcap_filter("[age] > 18", dict) +#> list(valid = TRUE, message = "Filter is valid.") + +validate_redcap_filter("only plain text", dict) +#> list(valid = FALSE, message = "Filter must contain at least one field ...") + +validate_redcap_filter("[cohabitation] = '1' AND [age] > 18", dict) +#> list(valid = TRUE, message = "Filter is valid.") +} # } +``` diff --git a/reference/validation.html b/reference/validation.html index 266899db..79d096db 100644 --- a/reference/validation.html +++ b/reference/validation.html @@ -7,7 +7,7 @@ FreesearchR - 26.3.4 + 26.3.5