Study run¶
A study run reads the study's define files, builds every dataset they declare from its inputs, and hands each built dataset forward. fleet.plan_study returns the study plan without building anything; fleet.run_study yields one built dataset per step and writes no file. fleet run is the command on top of it: it prints the plan, writes each dataset and sets the exit code. A run that cannot plan or build raises StudyRunError, documented with the other exceptions. The rule for inputs is ADR 0006: every input is pinned, and only carry-through columns (declared with no derivation) are joined from the other inputs.
plan_study¶
fleet.run.plan_study
¶
Read the study's define files and return the steps of a study run.
A dataset runs after the datasets of the plan that it names as
type: dataset inputs, so ADVS reads the ADSL of the same run.
Datasets with no such link keep their file order, SDTM first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
StudyContext
|
The study context, from :func: |
required |
datasets
|
Sequence[str] | None
|
Keep only these datasets (case-insensitive). Default: every dataset in the define files. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
StudyPlan |
StudyPlan
|
The steps, in run order. |
Raises:
| Type | Description |
|---|---|
StudyRunError
|
When neither define file exists, a name in datasets is not declared in them, a planned dataset declares no inputs, or two datasets need each other. |
Examples:
List what fleet run would build::
plan = fleet.plan_study(fleet.load_study_context("study_config.yaml"))
[(s.standard, s.dataset) for s in plan.steps]
Source code in src/fleet/run.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
options: show_root_heading: true heading_level: 3
run_study¶
fleet.run.run_study
¶
Build every step of a study plan, in order, and yield each built dataset.
Writes no file and prints nothing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plan
|
StudyPlan
|
The plan from :func: |
required |
inputs
|
Mapping[str, DataFrame] | None
|
Frames the caller already holds, by dataset name. A seed is used before any file. |
None
|
strict
|
bool
|
Raise on an unknown spec algorithm (default). |
True
|
Yields:
| Name | Type | Description |
|---|---|---|
BuiltDataset |
BuiltDataset
|
One per step, as soon as it is built. |
Raises:
| Type | Description |
|---|---|
StudyRunError
|
When a seed is also a step of the plan, an input cannot be found, or a carry-through column needs a USUBJID that one side lacks or that has two different rows in the input. |
Examples:
Build ADVS from an ADSL held in memory::
plan = fleet.plan_study(ctx, datasets=["ADVS"])
advs = next(fleet.run_study(plan, inputs={"ADSL": adsl})).frame
Source code in src/fleet/run.py
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | |
options: show_root_heading: true heading_level: 3
Records¶
fleet.run.StudyPlan
dataclass
¶
The ordered steps of a study run, fixed before the first one builds.
Attributes:
| Name | Type | Description |
|---|---|---|
ctx |
StudyContext
|
The study context the steps resolve against. |
steps |
tuple[Step, ...]
|
The steps, in run order. |
declared |
Mapping[str, Standard]
|
Every dataset the define files declare, with its
standard, also those the |
Source code in src/fleet/run.py
options: show_root_heading: true heading_level: 3 filters: ["!^_"]
fleet.run.Step
dataclass
¶
One dataset of a study plan.
Attributes:
| Name | Type | Description |
|---|---|---|
define |
Path
|
The define file that declares the dataset. |
standard |
Standard
|
|
dataset |
str
|
The dataset name, upper-cased. |
inputs |
tuple[DeclaredInput, ...]
|
The declared inputs, in order. The first is the base frame; every other one is pinned under its name. |
carry_through |
tuple[str, ...]
|
The declared variables with no derivation, which the run takes from the inputs unchanged (ADR 0006). |
text_columns |
tuple[str, ...]
|
The variables of define type |
qualifiers |
tuple[str, ...]
|
The SDTM variables with |
Source code in src/fleet/run.py
options: show_root_heading: true heading_level: 3 filters: ["!^_"]
fleet.run.BuiltDataset
dataclass
¶
What a study run yields for one step.
Attributes:
| Name | Type | Description |
|---|---|---|
step |
Step
|
The step that was built. |
frame |
DataFrame
|
The built dataset, materialised. An SDTM dataset leaves out its qualifier variables, which are in supp. |
inputs |
dict[str, ResolvedInput]
|
Each input of the step, by name, with where it came from. |
supp |
DataFrame | None
|
The |
Source code in src/fleet/run.py
options: show_root_heading: true heading_level: 3 filters: ["!^_"]
fleet.run.ResolvedInput
dataclass
¶
One input of a step and where the study run took it from.
Attributes:
| Name | Type | Description |
|---|---|---|
path |
Path | None
|
The file it was read from, or |
source |
InputSource
|
Which of the sources supplied it. |
Source code in src/fleet/run.py
options: show_root_heading: true heading_level: 3 filters: ["!^_"]