Normalisation dictionary for participant metadata
Source:R/participants.R
sdt_participant_dictionary.RdThe TDSC participant register stores four covariates as German free text.
This function holds the maps that fold that text onto controlled
vocabularies as data, so extending the package for a spelling it has
not seen is one argument rather than a code change: whatever you pass is
utils::modifyList()-merged, recursively, onto the shipped default.
Usage
sdt_participant_dictionary(
funktion = NULL,
titel = NULL,
fachbereich = NULL,
anrede = NULL
)Arguments
- funktion, titel, fachbereich, anrede
Optional named lists merged onto the corresponding shipped slot. Each slot has a
map(normalised key to level), and, depending on the covariate,patterns,levels,scoreandgroup. Adding one spelling means passingfunktion = list(map = list("leitender oberarzt" = "consultant")).
Value
An S3 object of class sdt_participant_dictionary: a list of four
slots, with print() and format() methods.
Details
The four vocabularies are:
funktion— an ordered seniority ladder,resident < specialist < consultant < chief(Assistenzarzt, Facharzt, Oberarzt, Chefarzt), scored 1–4.other("Andere") is a real answer that sits off the ladder and scoresNA;not_stated("Nichts angegeben") is a declared non-answer and is treated as missing, not as a sixth grade.titel— the academic laddernone < doctorate < habilitation < professor, scored 0–3. Matching is exact on a punctuation- and case-insensitive key first, then falls back topatterns, where every rung is tested and the highest match wins. An empty title box is filled withnonewhenblank_is_noneisTRUE— and every filled row is flagged, seesdt_read_participants().fachbereich— a controlled specialty list plus a surgical / non-surgicalgroup. Multi-specialty free text ("Chirurgie, Unfallchirurgie") is collapsed by the stated rule the primary specialty is the one mentioned first: the pattern whose match starts earliest in the string wins.anrede— salutation to sex. This is a proxy: it records how a person was addressed on a registration form, not a gender identity.
See also
sdt_read_participants(), which applies it.
Examples
d <- sdt_participant_dictionary()
d
#> <sdt_participant_dictionary>
#> funktion 6 spellings -> resident < specialist < consultant < chief
#> titel 22 spellings + 3 patterns -> none < doctorate < habilitation < professor
#> fachbereich 14 spellings -> 11 specialties (6 surgical)
#> anrede female / male (a salutation proxy, not gender identity)
d$funktion$score
#> resident specialist consultant chief
#> 1 2 3 4
# One new spelling, no package patch.
d2 <- sdt_participant_dictionary(
funktion = list(map = list("leitender oberarzt" = "consultant"))
)
d2$funktion$map[["leitender oberarzt"]]
#> [1] "consultant"