synthesize_ids() builds a small "messy column" for a source: a mix of
well-formed ids, repairable ids (a wrong-case or unpadded form that suggests a
valid one), hard-invalid ids, and missing cells. Every value is labeled by
running the checker, so the labels are always correct and match what the Python
synthesize() produces for the same source. It works in pattern mode (the
shape) for any source and in cache mode (the snapshot) for a source that ships
one. It is useful for exercising a validation pipeline (feed the column to
report_id(), repair_id(), or an adapter) without hand-writing test data. The
generation is deterministic and offline.
Usage
synthesize_ids(
source_db,
how = "pattern",
version = NULL,
n_valid = 2,
n_repairable = 1,
n_invalid = 1,
missing = 1,
seed = 0
)Arguments
- source_db
Source key, for example
"mondo". Seesources().- how
Checking mode to label against:
"pattern"(the shape, any source) or"cache"(the snapshot; the source must ship one).- version
In cache mode, the snapshot version. Defaults to
"sample".- n_valid
How many well-formed or in-snapshot ids to include. A source with no numeric part yields just the example.
- n_repairable
How many repairable ids (a wrong-case or unpadded form that suggests a valid id, or in cache mode a retired id that maps to a successor).
ec,hgvs, andhgnchave no pattern-mode repairable form, so they yield none there.- n_invalid
How many hard-invalid ids (neither valid nor suggestible).
- missing
How many missing cells (
NA).- seed
Shifts the numeric variants, for a different but still deterministic column (pattern mode).
Value
A tibble with the columns input, category
("valid", "repairable", "invalid", or "missing"), and the valid,
normalized, and suggestion the checker returned for that input. Categories
a source cannot produce are simply absent.
Examples
synthesize_ids("mondo")
#> # A tibble: 5 × 5
#> input category valid normalized suggestion
#> <chr> <chr> <lgl> <chr> <chr>
#> 1 MONDO:0005148 valid TRUE MONDO:0005148 NA
#> 2 mondo:0005148 repairable FALSE NA MONDO:0005148
#> 3 MONDO:0005148! invalid FALSE NA NA
#> 4 NA missing NA NA NA
#> 5 MONDO:0005149 valid TRUE MONDO:0005149 NA