Infers the ADaM dataset class from the variables present in a dataset or spec. Uses variable signatures rather than dataset name conventions so it works across companies that name their ADaM datasets differently.
Classes returned:
- ADSL
Subject-level: one row per subject, no PARAMCD/AVAL.
- BDS
Basic Data Structure: PARAMCD + AVAL present. Includes lab, vitals, ECG, exposure, and similar parameter-based datasets.
- TTE
Time-to-event: BDS signature plus CNSR (censoring indicator).
- OCCDS
Occurrence Data Structure: occurrence-based without a numeric AVAL parameter spine; e.g. AE, CM, MH, CE.
- unknown
Insufficient variables to determine class.
Details
Signature rules (evaluated in order):
TTE: PARAMCD + AVAL + CNSR all present.
BDS: PARAMCD + AVAL present (without CNSR).
ADSL: USUBJID present, no PARAMCD, no AVAL, no occurrence-flag pattern.
OCCDS: USUBJID present + either (a) a term variable (*TERM, *DECOD, *DOSE) or (b) at least two occurrence flag variables matching
*FLbut no PARAMCD.unknown: none of the above.
See also
Other specification:
apply_spec(),
coerce_types(),
decode_var(),
detect_adam_classes(),
drop_unspec_vars(),
herald_spec(),
herald_spec_from_fixture(),
order_cols(),
read_spec(),
read_spec_define(),
retained_variable_convention(),
scaffold_vars(),
sort_keys(),
spec_codelist(),
spec_datasets(),
spec_study(),
spec_vars(),
variable_codelist(),
variable_is_required(),
write_define_html(),
write_define_xml(),
write_spec()
Examples
detect_adam_class(c("STUDYID", "USUBJID", "AGE", "SEX", "RACE")) # "ADSL"
#> [1] "ADSL"
detect_adam_class(c("USUBJID", "PARAMCD", "PARAM", "AVAL", "BASE")) # "BDS"
#> [1] "BDS"
detect_adam_class(c("USUBJID", "PARAMCD", "PARAM", "AVALC", "DTYPE")) # "BDS"
#> [1] "BDS"
detect_adam_class(c("USUBJID", "PARAMCD", "AVAL", "CNSR", "STARTDT")) # "TTE"
#> [1] "TTE"
detect_adam_class(c("USUBJID", "AETERM", "AEDECOD", "AESTDTC")) # "OCCDS"
#> [1] "OCCDS"
