Skip to contents

Parses a YAML study specification file, converts human-readable windows (e.g., "lifetime_before_baseline", "3 years") to weeks, and validates that all required fields are present.

Usage

tteplan_read_spec(spec_path)

Arguments

spec_path

Path to the YAML specification file.

Value

A nested list representing the parsed specification, with `window_weeks` fields added to exclusion criteria and confounders.

Details

Window conversion rules:

  • `"lifetime_before_baseline"` -> `Inf`

  • `"N year"` or `"N years"` -> `N * 52`

Validation checks:

  • Required sections: study, enrollments, outcomes, follow_up

  • `study$implementation$project_prefix` must exist

  • Each exclusion criterion must have `implementation$source_variable`

  • Each outcome must have `implementation$variable`

  • Each enrollment must have `id` and `exposure$implementation$variable`

  • Computed confounders must have `implementation$source_variable`

Warns about open questions with `status: "open"`.