OCCDS Namespace¶
The df.adam.occds namespace builds occurrence datasets (ADAE, ADCM, …).
fleet.adam.OCCDSNamespace
¶
Bases: SharedADaMVerbsMixin, MultiRowMixin
Immutable pipeline builder for OCCDS (one-row-per-event) derivations.
Covers occurrence datasets: ADAE, ADCM, ADMH, ADEX, etc. Also
registered as the occds LazyFrame namespace, so
pl.scan_parquet(...).occds starts a fully lazy OCCDS pipeline.
Inherits shared verbs from SharedADaMVerbsMixin
(assign, case_when, merge, source, derivation, whereclauses, ...)
and adds OCCDS-specific verbs for event sequencing, worst-record
flagging, and treatment-emergent classification. Discover the full
set with .verbs().
Source code in src/fleet/adam/occds_namespace.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 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 | |
treatment_emergent
¶
treatment_emergent(
target="TRTEMFL",
*,
start_date,
end_date,
trtsdt,
trtedt=None,
end_window=None,
offset_days=0
)
Set target to "Y" for treatment-emergent events, as admiral derive_var_trtemfl.
The cases are taken in this order; the first that applies decides:
- trtsdt missing: null (the subject is not treated).
- end_date before trtsdt: null (the event ended before treatment).
- start_date missing:
"Y"(a missing start cannot show the event began before treatment). - start_date on or after trtsdt (+ offset_days), and, when
end_window is given, on or before trtedt + end_window days,
with a missing trtedt read as still on treatment:
"Y". - Otherwise: null.
--DTC text is read by its date portion. Pass end_date=None
when the data hold no event end date; the SAP decides the window.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
str
|
Name of the output flag column (default |
'TRTEMFL'
|
start_date
|
str
|
Event start date column ( |
required |
end_date
|
str | None
|
Event end date column ( |
required |
trtsdt
|
str
|
Treatment start date column. |
required |
trtedt
|
str | None
|
Treatment end date column; given with end_window. |
None
|
end_window
|
int | None
|
Days after trtedt in which an event still counts;
given with trtedt. |
None
|
offset_days
|
int
|
Days added to trtsdt before the start-date comparison of case 4 (a Fleet extension; admiral has none). |
0
|
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
The namespace with target appended. |
Raises:
| Type | Description |
|---|---|
DerivationError
|
When only one of trtedt and end_window is given, or end_window is negative. |
References
admiral derive_var_trtemfl (pharmaverse), Details. CDISC gives
no rule for missing dates; check the SAP.
Examples:
TEAE up to 30 days after the last dose::
adae = (
ae_raw.adam.occds
.treatment_emergent("TRTEMFL", start_date="ASTDT", end_date="AENDT",
trtsdt="TRTSDT", trtedt="TRTEDT", end_window=30)
.to_frame()
)
Source code in src/fleet/adam/occds_namespace.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 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 | |
onset_recovery
¶
Flag events that started on/after the reference date and have recovered.
Sets target to "Y" when start_date >= ref_date and
end_date is not null. --DTC text is read by its date portion
(a partial or blank start gives no flag); a number raises.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
str
|
Name of the output flag column. |
required |
start_date
|
str
|
Event start date column. |
required |
end_date
|
str
|
Event end date column. |
required |
ref_date
|
str
|
Reference date column (e.g. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
The namespace with target appended. |
Examples:
Derive recovery flag for adverse events::
adae = (
ae_raw.adam.occds
.onset_recovery("RCVRYFL", start_date="AESTDTC",
end_date="AEENDTC", ref_date="TRTSDT")
.to_frame()
)
Source code in src/fleet/adam/occds_namespace.py
options: show_root_heading: true heading_level: 2 members_order: source filters: ["!^_"]