
Protect chiral designations from downstream stripping
Source:R/cleaning_pipeline.R
protect_chiral_designations.RdReplaces chiral markers - (+), (-), (R), (S), (R,S), (dl), etc. - with numbered placeholders (###CHIRAL_n###) and sets a WARNING flag. Must run BEFORE strip_terminal_enclosures() (Step 6a).
Examples
df <- tibble::tibble(chemical_name = c("(+)-catechin", "acetone"))
protect_chiral_designations(df, c("chemical_name"))
#> $cleaned_data
#> # A tibble: 2 × 2
#> chemical_name cleaning_flag
#> <chr> <chr>
#> 1 ###CHIRAL_PLUS###-catechin WARNING: chiral designation
#> 2 acetone NA
#>
#> $audit_trail
#> # A tibble: 1 × 6
#> row_id field step original_value new_value reason
#> <int> <chr> <chr> <chr> <chr> <chr>
#> 1 1 chemical_name protect_chiral_designati… (+)-catechin ###CHIRA… Chira…
#>