ADaM Namespace¶
The df.adam namespace builds ADaM BDS datasets (ADVS, ADLB, …).
fleet.adam.AdamNamespace
¶
Bases: SharedADaMVerbsMixin
Immutable pipeline builder for ADaM derivations.
Each verb appends to a lazy expression list; to_frame() materialises
everything in one with_columns call (unless the verb requires a join/filter).
Accepts both pl.DataFrame and pl.LazyFrame inputs, so scanned
sources stay lazy end-to-end.
Inherits shared verbs from SharedADaMVerbsMixin (assign,
case_when, merge, source, derivation, whereclauses,
...). Discover the full set with df.adam.verbs().
Source code in src/fleet/adam/namespace.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 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 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 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 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 | |
adsl
property
¶
ADSL (one-row-per-subject) derivations: treatment dates, duration, population flags.
occds
property
¶
OCCDS (one-row-per-event) derivations: sequencing, worst flag, treatment-emergent.
ophtha
property
¶
Ophthalmology derivations (admiralophtha-inspired): ETDRS/LogMAR, study eye.
metabolic
property
¶
Metabolic derivations (admiralmetabolic-inspired): waist ratios, body fat.
pk
property
¶
PK (pharmacokinetics) derivations: BLQ flags, actual/nominal time, dose normalisation.
baseline
¶
Derive BASE as the AVAL where the baseline flag equals "Y".
Uses a window function so all records in the same group receive the
same baseline value. A group with more than one flagged
record has an ambiguous baseline: with strict=True (default)
this raises a DerivationError naming the offending groups
(admiral semantics); strict=False keeps the legacy behaviour
(silently taking the maximum flagged value) but emits a
UserWarning.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
str
|
Name of the output column (e.g. |
required |
aval
|
str
|
Analysis value column (default |
'AVAL'
|
baseline_flag
|
str
|
Flag column indicating the baseline record. |
'ABLFL'
|
by
|
list[str] | None
|
Partition columns (default |
None
|
strict
|
bool
|
Raise when a group has multiple baseline-flagged
records (default |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
AdamNamespace |
AdamNamespace
|
The namespace with target appended. |
Raises:
| Type | Description |
|---|---|
DerivationError
|
When |
Examples:
Propagate baseline AVAL to all records::
advs = (
vs_raw.adam
.baseline("BASE", aval="AVAL", baseline_flag="ABLFL",
by=["USUBJID", "PARAMCD"])
.to_frame()
)
Source code in src/fleet/adam/namespace.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 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 | |
chg
¶
Compute change from baseline: CHG = AVAL - BASE.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
str
|
Name of the output column (e.g. |
required |
aval
|
str
|
Analysis value column. |
'AVAL'
|
base
|
str
|
Baseline value column. |
'BASE'
|
Returns:
| Name | Type | Description |
|---|---|---|
AdamNamespace |
AdamNamespace
|
The namespace with target appended. |
Examples:
Derive CHG from AVAL and BASE::
advs = (
vs_raw.adam
.chg("CHG", aval="AVAL", base="BASE")
.to_frame()
)
Source code in src/fleet/adam/namespace.py
pchg
¶
Compute percent change from baseline.
PCHG = (AVAL - BASE) / BASE * 100. Returns null when BASE is
null or zero.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
str
|
Name of the output column (e.g. |
required |
aval
|
str
|
Analysis value column. |
'AVAL'
|
base
|
str
|
Baseline value column. |
'BASE'
|
Returns:
| Name | Type | Description |
|---|---|---|
AdamNamespace |
AdamNamespace
|
The namespace with target appended. |
Examples:
Derive PCHG from AVAL and BASE::
advs = (
vs_raw.adam
.pchg("PCHG", aval="AVAL", base="BASE")
.to_frame()
)
Source code in src/fleet/adam/namespace.py
bmi
¶
Derive Body Mass Index: weight_kg / (height_cm / 100) ** 2.
The value keeps full precision. A height of 0 gives null, as SAS gives a missing value for a division by zero.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
str
|
Name of the output column. |
required |
weight
|
str
|
Column containing weight in kg. |
required |
height
|
str
|
Column containing height in cm. |
required |
round_digits
|
int | None
|
Decimal places, rounded as SAS |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
AdamNamespace |
AdamNamespace
|
The namespace with target appended. |
References
admiral compute_bmi (pharmaverse): full precision, NA for height 0.
ADR-0025: a derived value is rounded only when the call says so.
Examples:
Compute BMI from weight and height::
advs = (
vs_raw.adam
.bmi("BMI", weight="WEIGHT", height="HEIGHT")
.to_frame()
)
Source code in src/fleet/adam/namespace.py
nrind
¶
Categorise value relative to normal range: LOW / NORMAL / HIGH.
The value and the limits are compared at signif_dig significant digits, so float noise (1.3 x 88.4 = 114.92000000000002) does not move a value at the limit out of the range. A null or NaN value gives null.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
str
|
Name of the output column (e.g. |
required |
value
|
str
|
Column containing the numeric result. |
required |
low
|
str
|
Column containing the lower limit of normal. |
required |
high
|
str
|
Column containing the upper limit of normal. |
required |
signif_dig
|
int
|
Significant digits for the comparison (default 15). |
15
|
Returns:
| Name | Type | Description |
|---|---|---|
AdamNamespace |
AdamNamespace
|
The namespace with target appended. |
References
admiral derive_var_anrind (pharmaverse): signif(x, 15) on AVAL,
ANRLO and ANRHI before the comparison.
Examples:
Derive normal range indicator for lab results::
adlb = (
lb_raw.adam
.nrind("NRIND", value="LBSTRESN",
low="LBSTNRLO", high="LBSTNRHI")
.to_frame()
)
Source code in src/fleet/adam/namespace.py
on_treatment
¶
Set target to "Y" when adt is within [trtsdt, trtedt].
When open_ended is True (default) and trtedt is null, the
interval is treated as ongoing (adt >= trtsdt suffices).
--DTC text is read by its date portion (a partial or blank
value gives null); a number raises. When adt and trtsdt are
both pl.Datetime, the start comparison keeps the time, so a
pre-dose record on the first dose day is not on treatment; the end
comparison is at date level.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
str
|
Name of the output column (default |
'ONTRTFL'
|
adt
|
str
|
Analysis date column. |
required |
trtsdt
|
str
|
Treatment start date column. |
required |
trtedt
|
str
|
Treatment end date column. |
required |
open_ended
|
bool
|
Treat null trtedt as open-ended (default |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
AdamNamespace |
AdamNamespace
|
The namespace with target appended. |
References
admiral derive_var_ontrtfl (start compared with time when
both are date-times); ADR-0011 and ADR-0022.
Examples:
Derive on-treatment flag::
advs = (
vs_raw.adam
.on_treatment("ONTRTFL", adt="ADT",
trtsdt="TRTSDT", trtedt="TRTEDT")
.to_frame()
)
Source code in src/fleet/adam/namespace.py
shift
¶
Derive a categorical shift label: "<baseline><sep><post>".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
str
|
Name of the output column (e.g. |
required |
baseline_cat
|
str
|
Column with baseline category (e.g. |
required |
post_cat
|
str
|
Column with post-baseline category (e.g. |
required |
sep
|
str
|
Separator string (default |
' to '
|
Returns:
| Name | Type | Description |
|---|---|---|
AdamNamespace |
AdamNamespace
|
The namespace with target appended. |
Examples:
Create a shift variable from baseline and post normal range::
adlb = (
lb_raw.adam
.shift("SHIFT1", baseline_cat="BNRIND",
post_cat="NRIND")
.to_frame()
)
Source code in src/fleet/adam/namespace.py
bsa
¶
Derive Body Surface Area in m², at full precision.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
str
|
Name of the output column. |
required |
weight
|
str
|
Column containing weight in kg. |
required |
height
|
str
|
Column containing height in cm. |
required |
method
|
str
|
Formula to use — |
'Mosteller'
|
round_digits
|
int | None
|
Decimal places, rounded as SAS |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
AdamNamespace |
AdamNamespace
|
The namespace with target appended. |
References
admiral compute_bsa (pharmaverse): full precision.
ADR-0025: a derived value is rounded only when the call says so.
Examples:
Compute BSA using the Mosteller formula::
advs = (
vs_raw.adam
.bsa("BSA", weight="WEIGHT", height="HEIGHT")
.to_frame()
)
Source code in src/fleet/adam/namespace.py
map
¶
Derive Mean Arterial Pressure: DBP + (SBP - DBP) / 3, at full precision.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
str
|
Name of the output column (default |
'MAP'
|
systolic
|
str
|
Systolic blood pressure column. |
'SYSBP'
|
diastolic
|
str
|
Diastolic blood pressure column. |
'DIABP'
|
round_digits
|
int | None
|
Decimal places, rounded as SAS |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
AdamNamespace |
AdamNamespace
|
The namespace with target appended. |
References
admiral compute_map (pharmaverse): full precision.
ADR-0025: a derived value is rounded only when the call says so.
Examples:
Compute MAP from blood pressure columns::
advs = (
vs_raw.adam
.map("MAP", systolic="SYSBP", diastolic="DIABP")
.to_frame()
)
Source code in src/fleet/adam/namespace.py
qtc
¶
Derive corrected QT interval, as admiral compute_qtc, at full precision.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
str
|
Name of the output column (default |
'QTC'
|
qt
|
str
|
QT interval column, in ms. |
'QT'
|
rr
|
str
|
RR interval column, in rr_unit. |
'RR'
|
method
|
str
|
Correction formula — |
'Fridericia'
|
rr_unit
|
str
|
Unit of rr: |
'ms'
|
round_digits
|
int | None
|
Decimal places, rounded as SAS |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
AdamNamespace |
AdamNamespace
|
The namespace with target appended. |
Raises:
| Type | Description |
|---|---|
DerivationError
|
When rr_unit is unknown, or a value cannot be in its unit: an RR under 10 in ms, an RR of 10 or more in seconds, or a QT under 10 ms. |
References
admiral compute_qtc (pharmaverse): RR in ms, QT in ms, full precision.
ADR-0025: a derived value is rounded only when the call says so.
Examples:
Derive QTcF from QT and RR, both in ms::
adeg = (
eg_raw.adam
.qtc("QTCF", qt="QT", rr="RR", method="Fridericia")
.to_frame()
)
Source code in src/fleet/adam/namespace.py
derive_summary_records
¶
Compute a summary statistic per group and append the results as new records.
set_values_to: column → value mapping applied to every new record
(e.g. {"PARAMCD": "AVGBP", "DTYPE": "AVERAGE"}).
stat: "mean" (default), "sum", "min", "max", "median",
"count". A group with only null values gives null for every stat
except "count", which gives 0, as SAS SUM() and PROC MEANS.
where: filter on the source records of the summary. The rows of the
dataset are all kept. A second call in one chain reads the rows that
the first call added: give where=pl.col("DTYPE").is_null() to
summarise only collected records. When where is None and the source
holds a non-null DTYPE, the verb warns.
Materialises the current pipeline before concatenation.
Examples:
Compute mean AVAL per subject and parameter::
advs = (
vs_raw.adam
.derive_summary_records(
by=["USUBJID", "PARAMCD"],
analysis_var="AVAL",
set_values_to={"DTYPE": "AVERAGE"},
stat="mean",
)
.to_frame()
)
Source code in src/fleet/adam/namespace.py
630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 | |
derive_locf_records
¶
derive_locf_records(
*,
dataset_ref,
by,
order_by,
analysis_var="AVAL",
imputation="add",
keep_vars=None
)
Add LOCF records for missed visits and for a null analysis_var.
For each by group, every row of dataset_ref (the expected visits)
that has no record with a non-null analysis_var gets a value carried
forward from the previous record, sorted by by and order_by. Each
imputed record has DTYPE "LOCF"; an existing DTYPE on the other
records is kept. A group with no earlier value keeps a null value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset_ref
|
DataFrame
|
Expected observations, for example AVISIT and AVISITN, or PARAMCD, AVISIT and AVISITN. Add USUBJID for a per-subject list. Each of its columns must be in the dataset. |
required |
by
|
list[str]
|
Group columns, for example |
required |
order_by
|
str | list[str]
|
Sort column(s) within a group. The first one must be in dataset_ref, so that a new record has a sort value. |
required |
analysis_var
|
str
|
Column to carry forward (default |
'AVAL'
|
imputation
|
Literal['add', 'update', 'update_add']
|
|
'add'
|
keep_vars
|
list[str] | None
|
Other columns to carry forward, for example PARAMN. A new record has values only in by, dataset_ref, analysis_var, keep_vars and DTYPE; other columns are null. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
AdamNamespace |
AdamNamespace
|
The namespace with the LOCF records; call
|
Raises:
| Type | Description |
|---|---|
DerivationError
|
On an unknown imputation, a missing column, a first order_by column that is not in dataset_ref, or a null order_by value on a record to sort. |
Examples:
Add WEEK 24 by LOCF for each subject and parameter::
visits = pl.DataFrame(
{"AVISIT": ["BASELINE", "WEEK 8", "WEEK 16", "WEEK 24"],
"AVISITN": [0, 8, 16, 24]}
)
adqs = (
qs_raw.adam
.derive_locf_records(
dataset_ref=visits,
by=["STUDYID", "USUBJID", "PARAMCD"],
order_by=["AVISITN"],
keep_vars=["PARAM"],
)
.to_frame()
)
References
ADaMIG v1.3 section 4.4 (BDS): DTYPE must be populated on a record
whose AVAL is imputed; "LOCF" is in CDISC CT codelist DTYPE (C81224).
admiral derive_locf_records (pharmaverse) defines the three
imputation modes. ADR-0029.
Source code in src/fleet/adam/namespace.py
725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 | |
derive_param
¶
derive_param(
*,
by=None,
set_values_to,
parameter_filter,
analysis_value,
from_dataset=None,
where=None
)
Derive a new parameter (e.g. BMI) from existing records and append the computed rows to the dataset.
parameter_filter: {alias: PARAMCD} pairs identifying the source
records to pivot on (e.g. {"WEIGHT": "WEIGHT", "HEIGHT": "HEIGHT"}).
Each key is a local alias; the value is the PARAMCD it matches.
Every source parameter must be unique per by group — duplicates
raise instead of silently multiplying the derived rows.
analysis_value: a Polars expression (or YAML-friendly string)
referencing the aliases to compute the new AVAL
(e.g. pl.col("WEIGHT") / (pl.col("HEIGHT")/100)**2).
set_values_to: constant columns on the new rows — including the
parameter-level identifiers PARAM, PARAMN, PARCATy /
PARCATyN, and DTYPE (e.g. {"PARAMCD": "BMI",
"PARAM": "Body Mass Index", "PARAMN": 3, "PARCAT1": "ANTHRO"}).
Columns that don't exist yet are added to the dataset. The new
PARAMCD must not already exist in the dataset: appending under
an existing code would break the PARAMCD ↔ PARAM/PARAMN one-to-one
mapping that ADaM conformance checks enforce.
from_dataset: optional BDS-shaped frame (PARAMCD + AVAL)
to pivot the source parameters from — derive into this dataset
from another one (e.g. compute a param in ADVS from ADLB rows).
Defaults to the current pipeline frame.
where: optional filter applied to the source records before the
pivot (e.g. restrict to ANL01FL == "Y" or baseline rows) —
the current dataset's rows are never dropped.
A new AVAL that is infinite or NaN (for example a division by zero) becomes null, with a warning that gives the count, as SAS gives a missing value.
Materialises the pipeline before appending.
Examples:
Derive BMI as a new PARAMCD from WEIGHT and HEIGHT::
advs = (
vs_raw.adam
.derive_param(
by=["USUBJID", "ADT"],
set_values_to={"PARAMCD": "BMI",
"PARAM": "Body Mass Index"},
parameter_filter={"WEIGHT": "WEIGHT",
"HEIGHT": "HEIGHT"},
analysis_value=(
pl.col("WEIGHT") / (pl.col("HEIGHT") / 100) ** 2
),
)
.to_frame()
)
Add a parameter computed from ANOTHER dataset's records::
advs = (
advs.adam
.derive_param(
by=["USUBJID", "AVISIT"],
set_values_to={"PARAMCD": "BSCRCL",
"PARAM": "Creatinine Clearance"},
parameter_filter={"CREAT": "CREAT"},
analysis_value='pl.col("CREAT") * 1.1',
from_dataset=adlb,
where='pl.col("ANL01FL") == "Y"',
)
.to_frame()
)
Source code in src/fleet/adam/namespace.py
847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 | |
atoxgr
¶
atoxgr(
target,
*,
system="ctcae_v5",
direction,
term_var,
unit_var,
signif_dig=15,
indicators=None
)
Derive a toxicity grade, as admiral derive_var_atoxgr_dir.
Materialises the pipeline and grades every row whose term has
criteria in direction. The bundled criteria are generated from the
admiral metadata (scripts/regen_grading_criteria.R), so each term
follows the admiral case_when: for example, a null BNRIND
counts as not abnormal and the ULN criteria apply, and CTCAE v5 INR
takes the worse of the absolute and the baseline cut-offs (admiral
COMMENT: worst case, assume on anticoagulation). The term and the
unit match without case. A row with another unit, a null unit, no
criteria or a population no criteria cover gets a null grade. Every
row stays, in its order.
The ctcae_*, daids systems hold SI cut-offs (hemoglobin in
g/L); the *_uscv systems hold US conventional units (g/dL). A
row whose unit is not a unit of the criteria gets null, with a
warning that gives the count.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
str
|
Name of the output grade column (e.g. |
required |
system
|
str
|
Grading system name (e.g. |
'ctcae_v5'
|
direction
|
Literal['L', 'H']
|
|
required |
term_var
|
str
|
Column holding the lab-test / term name. |
required |
unit_var
|
str
|
Column holding the unit of measure (e.g. |
required |
signif_dig
|
int
|
Significant digits for comparison (default 15, as
admiral |
15
|
indicators
|
dict[str, list[str]] | None
|
Values of the indicator params of the criteria
(default |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
AdamNamespace |
AdamNamespace
|
A fresh namespace wrapping the graded frame. |
Raises:
| Type | Description |
|---|---|
DerivationError
|
When direction is not |
References
admiral derive_var_atoxgr_dir and the metadata tables
atoxgr_criteria_ctcv4/5/6 and atoxgr_criteria_daids
(SI and USCV), admiral 1.4.1, where get_unit_expr is required;
NCI CTCAE v4.03, v5.0, v6.0; DAIDS grading table v2.1. ADR-0028.
Examples:
Grade low-direction anemia using CTCAE v5::
adlb = (
lb_raw.adam
.atoxgr("ATOXGRL", system="ctcae_v5",
direction="L", term_var="PARAMCD",
unit_var="AVALU")
.to_frame()
)
Source code in src/fleet/adam/namespace.py
1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 | |
combine_grades
¶
combine_grades(
target="ATOXGR",
*,
low_var="ATOXGRL",
high_var="ATOXGRH",
low_desc_var="ATOXDSCL",
high_desc_var="ATOXDSCH"
)
Combine low and high toxicity grades into a signed grade, as admiral.
Low grades are prefixed with "-"; high grades are kept as-is.
Both null → null. "0" only when each side is "0" or its
description is null (no criteria in that direction). Low "0"
with a null high grade and a present high description gives null:
the high grade is unknown (for example ANRHI is missing).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
str
|
Name of the output column (default |
'ATOXGR'
|
low_var
|
str
|
Low-direction grade column (default |
'ATOXGRL'
|
high_var
|
str
|
High-direction grade column (default |
'ATOXGRH'
|
low_desc_var
|
str
|
Low-grade term description column (default
|
'ATOXDSCL'
|
high_desc_var
|
str
|
High-grade term description column (default
|
'ATOXDSCH'
|
Returns:
| Name | Type | Description |
|---|---|---|
AdamNamespace |
AdamNamespace
|
The namespace with target appended. |
Raises:
| Type | Description |
|---|---|
DerivationError
|
When a grade or description column is missing. |
References
admiral derive_var_atoxgr (admiral 1.4.1): lowgrade == "0" |
is.na(lowdesc) and the same for high give "0". ADR-0028.
Examples:
Combine low/high grades into ATOXGR::
adlb = (
lb_raw.adam
.atoxgr("ATOXGRL", system="ctcae_v5", direction="L",
term_var="ATOXDSCL", unit_var="AVALU")
.atoxgr("ATOXGRH", system="ctcae_v5", direction="H",
term_var="ATOXDSCH", unit_var="AVALU")
.combine_grades("ATOXGR")
.to_frame()
)
Source code in src/fleet/adam/namespace.py
1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 | |
transform
¶
Apply an arbitrary (pl.DataFrame) -> pl.DataFrame function.
The pending expression pipeline is materialised before the function is called, so the function always receives a fully committed frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
str | Callable[[DataFrame], DataFrame]
|
Either a callable directly, or the registered name of a
transform (see :func: |
required |
label
|
str | None
|
Optional cosmetic label for documentation/lineage; has no effect on the output. |
None
|
Raises:
| Type | Description |
|---|---|
KeyError
|
If fn is a string that has not been registered. |
TypeError
|
If fn is neither a callable nor a string, or if the
function does not return a |
Returns:
| Name | Type | Description |
|---|---|---|
AdamNamespace |
AdamNamespace
|
A fresh namespace wrapping the transformed frame. |
Examples:
Register and apply a custom age-group transform::
from fleet.adam.transforms import register_transform
@register_transform("add_agegr1")
def add_agegr1(df):
return df.with_columns(
pl.when(pl.col("AGE") < 65).then(pl.lit("<65"))
.otherwise(pl.lit(">=65")).alias("AGEGR1")
)
adsl = (
dm_raw.adam
.assign("STUDYID", value="S01")
.transform("add_agegr1")
.to_frame()
)
Source code in src/fleet/adam/namespace.py
1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 | |
options: show_root_heading: true heading_level: 2 members_order: source inherited_members: true filters: ["!^_"]
Shared verbs (all ADaM namespaces)¶
These verbs are available on every ADaM namespace (df.adam, df.adam.adsl, df.adam.occds, …).
fleet.adam.SharedADaMVerbsMixin
¶
Bases: SharedVerbsMixin, PinMixin, FlagCriterionMixin
Base mixin providing the shared verbs and chaining infrastructure.
Inherits algorithmic and infrastructure verbs from SharedVerbsMixin
(derivation, duration, study_day, seq, validate, select, inspect,
explain, to_frame, to_dataset_json, write_parquet, _chain,
_materialise_then).
Concrete namespace classes inherit from this mixin. The _chain
and _materialise_then helpers use copy.copy(self) so the
returned instance stays the correct sub-type for continued chaining.
Required instance attribute
~~~~~~~~~~~~~~~~~~~~~~~~~~~
_lazy: pl.LazyFrame — set by __init__.
Source code in src/fleet/adam/_mixins.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 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 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 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 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 | |
join_adsl
¶
Pull columns from pinned ADSL into this pipeline.
Performs a left join on the pinned join key, keeps only the
requested columns, and records carry_forward lineage for
each column.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*cols
|
str
|
Column names to carry forward from ADSL
(e.g. |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
The namespace with ADSL columns attached; call
|
Raises:
| Type | Description |
|---|---|
LookupError
|
If ADSL is not pinned. |
DerivationError
|
If a column is not in ADSL (with a did-you-mean suggestion), is already in the pipeline, or ADSL has two different rows for one subject. |
References
ADR-0032 (docs/adr/0032-merge-reads-as-sas-merge-and-stops-on-a-clash.md). ADaMIG 1.3: ADSL holds one record per subject.
Examples:
Carry TRTSDT and SAFFL from ADSL into an ADAE pipeline::
adae = (
ae_df.adam.occds("ADAE")
.pin("ADSL", adsl_df)
.source("USUBJID")
.join_adsl("TRTSDT", "TRTEDT", "SAFFL")
.to_frame()
)
Source code in src/fleet/adam/_mixins.py
source
¶
Carry one or more source columns into the ADaM dataset.
With a single name and from_col=, copies from_col to the
target (legacy 1:1 form — prefer assign(target, source=...)).
With multiple names, each column is carried through as-is::
.source("STUDYID", "USUBJID", "AETERM")
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*targets
|
str
|
Output ADaM variable name(s). Without from_col each is an identity copy of the same-named input column. |
()
|
from_col
|
str | None
|
Name of the input column to copy from (single target only). Defaults to the target name. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
The namespace with the target(s) appended; call
|
Raises:
| Type | Description |
|---|---|
DerivationError
|
When no target is given, or from_col is combined with more than one target. |
Examples:
Carry the key variables through in one call::
adae = (
ae_df.adam
.source("STUDYID", "USUBJID", "AEDECOD")
.to_frame()
)
Source code in src/fleet/adam/_mixins.py
recode
¶
Map values in source to recoded values in target.
Unmapped values fall back to default. The output type follows
the map values and a literal default, ignoring None: integers
give an integer column, integers with floats a float column (ADaM
*N variables such as ASEVN and AVISITN are Num), and text gives
text. A map that mixes kinds raises, so a typing slip cannot give a
text *N variable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
str
|
Name of the output ADaM variable. |
required |
source
|
str
|
Name of the input column containing coded values. |
required |
recode_map
|
dict[Any, Any]
|
|
required |
default
|
Any
|
Value for entries not present in recode_map. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
The namespace with target appended; call |
Raises:
| Type | Description |
|---|---|
DerivationError
|
When the map values and default mix kinds. |
Examples:
Recode numeric sex to character::
adsl = (
dm_df.adam.adsl
.recode("SEX", source="SEXN",
recode_map={1: "M", 2: "F"})
.to_frame()
)
Code severity to a number::
adae = (
ae_df.adam.occds
.recode("ASEVN", source="ASEV",
recode_map={"MILD": 1, "MODERATE": 2, "SEVERE": 3})
.to_frame()
)
Source code in src/fleet/adam/_mixins.py
pick
¶
Derive targets from one event per group, chosen across the events.
Each event in the list defines a candidate source, a filter condition, and values to set when that event is selected. Within each event's matching records, the event's order and mode (or the top-level ones) select one record. Then one event wins:
- with a top-level order, every event's record competes on that
order and mode, as admiral
derive_vars_extreme_eventdoes:order=["LSTALVDT"], mode="last"gives the latest date over all sources. A tie goes to the first listed event. - with no top-level order, the first listed event with a matching record wins (a priority cascade, as the admiral DTHCAUS template).
This is Fleet's answer to multi-source derivations such as last-date-known-alive (LSTALVDT) or death cause (DTHCAUS).
Event dict keys:
"when"(required): Boolean expression (str | pl.Expr) filtering which records qualify."set"(required):dict[str, str | pl.Expr | Any]mapping each target name to a column reference, expression, or literal. Column references use bare names ("DTHDT"); literals must be wrapped inpl.lit()."source"(optional): Externalpl.DataFrameto scan for this event. When omitted, the current pipeline frame is used."mode"(optional): Override the top-level mode for this event only ("first"|"last")."order"(optional): Override the top-level order for this event only."label"(optional): Documentation-only description.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
targets
|
str | list[str]
|
Target column name(s) to derive. |
required |
events
|
list[dict[str, Any]]
|
List of event dicts. List position breaks ties and, with no top-level order, decides the winner. |
required |
by
|
list[str] | None
|
Grouping columns (default |
None
|
order
|
str | list[str] | None
|
Sort column(s). Within an event they select the record;
at top level they also select the event (see above). An
event with more than one matching record in a group needs
an order (its own or the top-level one). A missing order
value loses in both modes. Records that tie on the order
keep their input order, so |
None
|
mode
|
str
|
|
'first'
|
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
A fresh namespace with targets added; call
|
Raises:
| Type | Description |
|---|---|
DerivationError
|
If events is empty, a required key is
missing, an event contains an unknown key (with a
did-you-mean suggestion), or an event with no order has
more than one matching record in a group. Also catchable
as |
References
admiral derive_vars_extreme_event (order is required)
and SAS FIRST./LAST. after PROC SORT EQUALS; ADR-0024.
Examples:
Derive last date known alive from death, AE, and treatment::
adsl = (
dm.adam.adsl
.source("USUBJID")
.pick(
["LSTALVDT", "DTHFL"],
events=[
{"when": pl.col("DTHDT").is_not_null(),
"set": {"LSTALVDT": "DTHDT", "DTHFL": pl.lit("Y")},
"source": adsl_df, "label": "Death date"},
{"when": pl.col("AEENDTC").is_not_null(),
"set": {"LSTALVDT": "AEENDTC", "DTHFL": pl.lit("N")},
"source": ae, "mode": "last", "order": ["AEENDTC"]},
{"when": pl.col("TRTEDT").is_not_null(),
"set": {"LSTALVDT": "TRTEDT", "DTHFL": pl.lit("N")},
"source": adsl_df},
],
by=["USUBJID"],
order=["LSTALVDT"],
mode="last",
)
.to_frame()
)
Simple single-target with string conditions (YAML-friendly)::
adsl = (
dm.adam.adsl
.pick(
"DTHCAUS",
events=[
{"when": 'pl.col("AEOUT") == "FATAL"',
"set": {"DTHCAUS": "AEDECOD"},
"source": ae, "order": ["AESTDTC", "AESEQ"]},
{"when": 'pl.col("DSDECOD") == "DEATH"',
"set": {"DTHCAUS": "DSTERM"},
"source": ds, "order": ["DSSTDTC", "DSSEQ"]},
],
by=["USUBJID"],
)
.to_frame()
)
Source code in src/fleet/adam/_mixins.py
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 | |
whereclauses
¶
Filter records by a where expression.
Materialises the pipeline before applying the filter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
where
|
str | Expr
|
A Polars expression (or string) that evaluates to a boolean mask. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
A fresh namespace wrapping the filtered frame. |
Examples:
Subset to on-treatment records only::
advs = (
vs_df.adam
.whereclauses(where='pl.col("ONTRTFL") == "Y"')
.to_frame()
)
Source code in src/fleet/adam/_mixins.py
merge_adsl
¶
Left-join ADSL columns onto the current dataset.
Materialises the pipeline, left-joins adsl (optionally restricted to
keep plus the by key columns), and returns a fresh namespace.
Each by key must name one ADSL row, and a non-key column may be
on one side only: give keep, or add a shared column such as
STUDYID to by, as admiral derive_vars_merged asks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adsl
|
DataFrame
|
The ADSL |
required |
by
|
list[str] | None
|
Key column(s) for the join (default |
None
|
keep
|
list[str] | None
|
Subset of ADSL columns to bring in (excluding by
keys, which are always included). When |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
A fresh namespace wrapping the joined frame. |
Raises:
| Type | Description |
|---|---|
DerivationError
|
When a keep column is not in adsl, a non-key column is on both sides, or adsl has two different rows for one key. |
References
ADR-0032 (docs/adr/0032-merge-reads-as-sas-merge-and-stops-on-a-clash.md). ADaMIG 1.3: ADSL holds one record per subject.
Examples:
Merge treatment date columns from ADSL::
advs = (
vs_df.adam
.merge_adsl(adsl_df, keep=["TRTSDT", "TRTEDT", "TRT01P"])
.to_frame()
)
Source code in src/fleet/adam/_mixins.py
first_date
¶
Derive target as the earliest date in date_col from from_dataset.
Materialises the current pipeline, aggregates from_dataset to
subject level, then left-joins. Useful for ASTDTM, TRTSDT, etc.
--DTC text is compared as dates: *DT gives a date, *DTM
a date-time, *DTC the text of the earliest record. A partial
or unreadable value is left out with a warning, unless impute
states the SAP rule (admiral derive_vars_dt).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
str
|
Name of the output date column. |
required |
from_dataset
|
DataFrame
|
Source |
required |
date_col
|
str
|
Date column to take the minimum of. |
required |
where
|
str | Expr | None
|
Optional filter applied to from_dataset before aggregation. |
None
|
by
|
list[str] | None
|
Join key columns (default |
None
|
impute
|
str | None
|
Impute a partial |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
The namespace with target appended. |
Examples:
Derive earliest serious AE start date::
adsl = (
dm_raw.adam.adsl
.first_date("AESTDTM", from_dataset=ae_sdtm,
date_col="AESTDTC",
where='pl.col("AESER") == "Y"')
.to_frame()
)
Source code in src/fleet/adam/_mixins.py
last_date
¶
Derive target as the latest date in date_col from from_dataset.
Useful for AENDTM, TRTEDT, DTHDT, etc. Reads --DTC text as
:meth:first_date does.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
str
|
Name of the output date column. |
required |
from_dataset
|
DataFrame
|
Source |
required |
date_col
|
str
|
Date column to take the maximum of. |
required |
where
|
str | Expr | None
|
Optional filter applied to from_dataset before aggregation. |
None
|
by
|
list[str] | None
|
Join key columns (default |
None
|
impute
|
str | None
|
Impute a partial |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
The namespace with target appended. |
Examples:
Derive latest treatment end date::
adsl = (
dm_raw.adam.adsl
.last_date("TRTEDT", from_dataset=ex_sdtm,
date_col="EXENDTC")
.to_frame()
)
Source code in src/fleet/adam/_mixins.py
count_events
¶
Derive target as the count of matching records in from_dataset.
Returns 0 for subjects with no matching records (never null). The count is Int64, so a later subtraction can go below zero.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
str
|
Name of the output count column. |
required |
from_dataset
|
DataFrame
|
Source |
required |
where
|
str | Expr | None
|
Optional filter applied before counting. |
None
|
by
|
list[str] | None
|
Join key columns (default |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
The namespace with target appended. |
Examples:
Count total AE records per subject::
adsl = (
dm_raw.adam.adsl
.count_events("NUMAE", from_dataset=ae_sdtm)
.to_frame()
)
Source code in src/fleet/adam/_mixins.py
date
¶
date(
target,
*,
source=None,
value=None,
output=None,
time=None,
impute="first",
impute_time=None,
highest=None,
flag=True,
min_date=None,
max_date=None
)
Parse, convert, impute, and flag a date or datetime column.
Dispatches behavior based on the CDISC suffix of target (DT, DTM)
or an explicit output override. Supports both column references
(source=) and literal values (value=).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
str
|
Name of the output column. |
required |
source
|
str | None
|
Column name to read values from. Mutually exclusive with value. |
None
|
value
|
str | None
|
Literal date value to broadcast. Mutually exclusive with source. |
None
|
output
|
str | None
|
Explicit output type override: |
None
|
time
|
str | None
|
Time column name or |
None
|
impute
|
str
|
Imputation strategy for missing date components:
|
'first'
|
impute_time
|
str | None
|
Override for time-part imputation, separate from impute. Only relevant for DTM targets. |
None
|
highest
|
str | None
|
Maximum imputation ceiling ( |
None
|
flag
|
bool | str
|
|
True
|
min_date
|
str | None
|
Lower bound for an imputed date (column name or date literal). Applies only when the bound is inside the possible range of the partial value; a complete date never changes. Date (*DT) targets only. |
None
|
max_date
|
str | None
|
Upper bound for an imputed date, with the same rule. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
The namespace with target (and optionally flag columns)
appended; call |
Examples:
Derive ADT from a DTC source with default imputation::
advs = (
vs_df.adam
.date("ADT", source="VSDTC")
.to_frame()
)
Non-standard target with explicit output and flag::
df = (
raw.adam
.date("XYZ", source="raw_date", output="dt",
flag="XYZDTF")
.to_frame()
)
Broadcast a literal date::
adsl = (
dm.adam.adsl
.date("RFSTDT", value="2024-01-15", output="dt",
flag=False)
.to_frame()
)
Source code in src/fleet/adam/_mixins.py
1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 | |
options: show_root_heading: false heading_level: 3 members_order: source filters: ["!^_"]
Flag Criterion Mixin¶
fleet.adam.FlagCriterionMixin
¶
Mixin providing flag(), its wrappers, and criterion().
Both SDTM (df.sdtm) and all ADaM namespaces inherit from this
mixin. The methods rely on _chain(), _with_lazy() and
_materialise_then() which every concrete namespace class must
provide.
Source code in src/fleet/core/_flag_mixin.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 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 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 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 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 | |
flag
¶
flag(
target,
*,
criteria,
by=None,
order_by=None,
value_col=None,
where=None,
from_dataset=None,
on=None,
source_filter=None,
condition=None,
inclusive=True,
flag_no_ref_groups=True,
flag_all=False,
flag_value="Y",
false_value=None
)
Set target to flag_value for records matching criteria.
Supports row-level boolean expressions and built-in shortcuts:
"first"/"last"— rank-based edge detection within groups."max"/"min"— value-based extreme within groups."exists"— set-membership from external dataset(s)."before"/"after"— relative to a landmark condition."exists_after"/"exists_before"— temporal/self-join flag.
Parameters that are irrelevant to the selected criteria mode
raise :class:~fleet.core.exceptions.VerbUsageError instead of
being silently ignored. The flag_first / flag_last /
flag_extreme / flag_exists / flag_relative wrappers
expose each mode with only its own parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
str
|
Name of the output flag column. |
required |
criteria
|
str | Expr
|
A Polars expression, or one of |
required |
by
|
list[str] | None
|
Partition columns (default |
None
|
order_by
|
str | list[str] | None
|
Sort column(s) required for |
None
|
value_col
|
str | None
|
Value column required for |
None
|
where
|
str | Expr | None
|
Optional pre-filter — only matching rows are candidates; rows that fail it take no part, even on a tie. |
None
|
from_dataset
|
DataFrame | list[DataFrame] | None
|
External dataset(s) for |
None
|
on
|
list[str] | None
|
Join key columns for |
None
|
source_filter
|
Expr | None
|
Filter applied to from_dataset before key extraction or join. |
None
|
condition
|
Expr | None
|
Boolean expression identifying landmark rows for
|
None
|
inclusive
|
bool
|
Whether the landmark row itself is included in the
flag (for |
True
|
flag_no_ref_groups
|
bool
|
If |
True
|
flag_all
|
bool
|
If |
False
|
flag_value
|
str
|
Value to assign when condition is met (default
|
'Y'
|
false_value
|
str | None
|
Value to assign when condition is not met.
Default |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
The namespace with target appended; call
|
Raises:
| Type | Description |
|---|---|
VerbUsageError
|
When a parameter irrelevant to the selected criteria mode is passed. |
DerivationError
|
When a mode-required parameter is missing, or a bare-identifier criteria matches neither a keyword nor a column. |
References
admiral derive_var_extreme_flag (pharmaverse): the order of
"first"/"last", a missing value last in each key (ADR-0020).
Examples:
First observation per group::
advs = (
vs_raw.adam
.flag("ABLFL", criteria="first", order_by="AVISITN",
by=["USUBJID", "PARAMCD"])
.to_frame()
)
Existence flag from external dataset::
adsl = (
dm.adam.adsl
.flag("VSEVALFL", criteria="exists",
from_dataset=advs, on=["USUBJID"],
source_filter=pl.col("AVISIT") == "BASELINE")
.to_frame()
)
Relative flag — before first PD::
result = (
response.adam
.flag("ANL02FL", criteria="before",
condition=pl.col("AVALC") == "PD",
order_by="AVISITN", by=["USUBJID"],
inclusive=True)
.to_frame()
)
Population flag from the treatment start date (a population
flag is never blank, so non-members get "N")::
adsl = (
adsl.adam.adsl
.flag("SAFFL", criteria=pl.col("TRTSDT").is_not_null(),
false_value="N")
.to_frame()
)
Source code in src/fleet/core/_flag_mixin.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 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 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 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 | |
flag_first
¶
flag_first(
target,
*,
order_by,
by=None,
where=None,
flag_all=False,
flag_value="Y",
false_value=None
)
Flag the first record per group (flag(criteria="first")).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
str
|
Name of the output flag column. |
required |
order_by
|
str | list[str]
|
Sort column(s) defining "first" within each group. A tie goes to the first input record. A missing value sorts last, as admiral: it is first only when every candidate misses it. |
required |
by
|
list[str] | None
|
Partition columns (default |
None
|
where
|
str | Expr | None
|
Optional pre-filter — only matching rows are candidates. |
None
|
flag_all
|
bool
|
Flag every tied extreme record instead of one. |
False
|
flag_value
|
str
|
Value assigned to flagged records (default |
'Y'
|
false_value
|
str | None
|
Value assigned otherwise (default null). |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
The namespace with target appended; call
|
Examples:
Baseline flag on the first visit per subject/parameter::
advs = (
vs_raw.adam
.flag_first("ABLFL", order_by="AVISITN",
by=["USUBJID", "PARAMCD"])
.to_frame()
)
Source code in src/fleet/core/_flag_mixin.py
flag_last
¶
flag_last(
target,
*,
order_by,
by=None,
where=None,
flag_all=False,
flag_value="Y",
false_value=None
)
Flag the last record per group (flag(criteria="last")).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
str
|
Name of the output flag column. |
required |
order_by
|
str | list[str]
|
Sort column(s) defining "last" within each group. A tie goes to the last input record. A missing value sorts last, as admiral, so a record with a missing key is last. |
required |
by
|
list[str] | None
|
Partition columns (default |
None
|
where
|
str | Expr | None
|
Optional pre-filter — only matching rows are candidates. |
None
|
flag_all
|
bool
|
Flag every tied extreme record instead of one. |
False
|
flag_value
|
str
|
Value assigned to flagged records (default |
'Y'
|
false_value
|
str | None
|
Value assigned otherwise (default null). |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
The namespace with target appended; call
|
Examples:
Last analysis-eligible record per subject/parameter::
advs = (
vs_raw.adam
.flag_last("ANL01FL", order_by="ADT",
by=["USUBJID", "PARAMCD"])
.to_frame()
)
Source code in src/fleet/core/_flag_mixin.py
flag_extreme
¶
flag_extreme(
target,
*,
value_col,
mode="max",
by=None,
where=None,
flag_value="Y",
false_value=None
)
Flag the extreme-valued record(s) per group (criteria="max"/"min").
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
str
|
Name of the output flag column. |
required |
value_col
|
str
|
Column whose extreme value is flagged. |
required |
mode
|
Literal['max', 'min']
|
|
'max'
|
by
|
list[str] | None
|
Partition columns (default |
None
|
where
|
str | Expr | None
|
Optional pre-filter — only matching rows are candidates. |
None
|
flag_value
|
str
|
Value assigned to flagged records (default |
'Y'
|
false_value
|
str | None
|
Value assigned otherwise (default null). |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
The namespace with target appended; call
|
Examples:
Worst-severity record per subject and term::
adae = (
ae_df.adam.occds
.flag_extreme("ANL01FL", value_col="AESEVN",
by=["USUBJID", "AETERM"])
.to_frame()
)
Source code in src/fleet/core/_flag_mixin.py
flag_exists
¶
Flag records with a match in external dataset(s) (criteria="exists").
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
str
|
Name of the output flag column. |
required |
from_dataset
|
DataFrame | list[DataFrame]
|
External dataset(s) to look up keys in. |
required |
on
|
list[str]
|
Join key columns. |
required |
source_filter
|
Expr | None
|
Filter applied to from_dataset before key extraction. |
None
|
flag_value
|
str
|
Value assigned when a match exists (default |
'Y'
|
false_value
|
str | None
|
Value assigned otherwise (default null). |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
The namespace with target appended; call
|
Examples:
Subjects with a baseline vital-signs record::
adsl = (
dm.adam.adsl
.flag_exists("VSEVALFL", from_dataset=advs,
on=["USUBJID"],
source_filter=pl.col("AVISIT") == "BASELINE")
.to_frame()
)
Source code in src/fleet/core/_flag_mixin.py
flag_relative
¶
flag_relative(
target,
*,
when,
condition,
order_by,
by=None,
inclusive=True,
flag_no_ref_groups=True,
flag_value="Y",
false_value=None
)
Flag records before/after a landmark (criteria="before"/"after").
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
str
|
Name of the output flag column. |
required |
when
|
Literal['before', 'after']
|
|
required |
condition
|
Expr
|
Boolean expression identifying landmark rows. |
required |
order_by
|
str | list[str]
|
Sort column(s) defining record order within groups. |
required |
by
|
list[str] | None
|
Partition columns (default |
None
|
inclusive
|
bool
|
Whether the landmark row itself is flagged. |
True
|
flag_no_ref_groups
|
bool
|
If |
True
|
flag_value
|
str
|
Value assigned to flagged records (default |
'Y'
|
false_value
|
str | None
|
Value assigned otherwise (default null). |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
The namespace with target appended; call
|
Examples:
Analysis flag for records up to first disease progression::
adrs = (
rs_df.adam
.flag_relative("ANL02FL", when="before",
condition=pl.col("AVALC") == "PD",
order_by="AVISITN", by=["USUBJID"])
.to_frame()
)
Source code in src/fleet/core/_flag_mixin.py
criterion
¶
Derive criterion flag triple: CRITy, CRITyFL, CRITyFN.
Produces three columns following CDISC ADaM conventions:
{prefix}{number}— the criterion description (constant string).{prefix}{number}FL—"Y"if condition is met,"N"if not.{prefix}{number}FN—1if met,0if not.
When the condition is null (for example AVAL is missing), FL and FN are
null, as admiral derive_vars_crit_flag(). For a SAP rule "missing is
not met", pass condition=(...).fill_null(False).
References
admiral derive_vars_crit_flag(values_yn = TRUE,
create_numeric_flag = TRUE); ADR-0033.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number
|
int
|
Criterion number (e.g. 1 → CRIT1, CRIT1FL, CRIT1FN). |
required |
condition
|
Expr
|
Boolean Polars expression defining the criterion. |
required |
description
|
str | None
|
Human-readable description stored in CRITy column.
If |
None
|
prefix
|
str
|
Column name prefix (default |
'CRIT'
|
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
The namespace with three new columns appended; call
|
Examples:
Flag records where AVAL >= 10::
adlb = (
lb_df.adam
.criterion(1, condition=pl.col("AVAL") >= 10,
description="AVAL >= 10")
.to_frame()
)
Source code in src/fleet/core/_flag_mixin.py
options: show_root_heading: false heading_level: 3 members_order: source filters: ["!^_"]