Generation cohort tak
Classes¶
GenerateCohortTAK(nb_patients=500, nb_days_end=365, random_state=None)
¶
Initialize the number of patients and the maximum length of follow-up.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nb_patients
|
number of patients in the cohort |
500
|
|
nb_days_end
|
maximum number of days for which deliveries can be made |
365
|
Source code in opentak/generation_cohort_tak.py
6 7 8 9 10 11 12 13 14 15 16 17 |
|
Functions¶
initialisation_dataframe(treatment_name='A', dose_mean=30, dose_std=10)
¶
Create an initial database with the correct columns and populate it with treatment_name entries.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
treatment_name
|
name of the treatment |
'A'
|
|
dose_mean
|
theoretical dosage, used as average delivery interval |
30
|
|
dose_std
|
standard deviation of the interval between doses, represents the difference found in practice between the dosage and the interval between doses. |
10
|
Source code in opentak/generation_cohort_tak.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
|
add_switch_linear(treatment_name, start_period_switch=None, end_period_switch=None, proportion_of_cohort=1)
¶
Add a switch to the treatment_name medication, with a linear distribution from start_period_switch to end_period_switch for the nbdays in which it appears.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
treatment_name
|
name of the treatment |
required | |
start_period_switch
|
smallest nbdays of switch |
None
|
|
end_period_switch
|
largest nbdays os switch |
None
|
|
proportion_of_cohort
|
proportion of the cohort affected by the switch |
1
|
Source code in opentak/generation_cohort_tak.py
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 |
|
add_switch_gaussien(treatment_name, mean=None, std=None, proportion_of_cohort=1)
¶
Add a switch to the treatment_name medication, with a Gaussian distribution for the nbdays at which it appears.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
treatment_name
|
name of the treatment |
required | |
mean
|
mean of the Gaussian distribution of switch nbdays |
None
|
|
std
|
standard deviation of the Gaussian distribution of switch nbdays |
None
|
|
proportion_of_cohort
|
proportion of the cohort affected by the switch |
1
|
Source code in opentak/generation_cohort_tak.py
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 |
|
add_drug_holidays(start_dh_min=None, start_dh_max=None, duration_dh_min=None, duration_dh_max=None, proportion_of_cohort=1)
¶
Remove deliveries in order to show drug holidays.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start_dh_min
|
int | None
|
minimum number of days from the start of the drug holiday period |
None
|
start_dh_max
|
int | None
|
maximum number of days from the start of the drug holiday period |
None
|
duration_dh_min
|
int | None
|
minimum duration of the drug holiday period |
None
|
duration_dh_max
|
int | None
|
maximum duration of the drug holiday period |
None
|
proportion_of_cohort
|
proportion of the cohort affected by the drug holidays |
1
|
Source code in opentak/generation_cohort_tak.py
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 |
|
drop_missing_deliveries(proba_suppression_delivery=0.05)
¶
Randomly deletes entries from the database.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
proba_suppression_delivery
|
proportion of deliveries to be removed from the database |
0.05
|
Source code in opentak/generation_cohort_tak.py
208 209 210 211 212 213 214 215 216 217 218 219 220 |
|
add_in_out(proba_death=0)
¶
Add a “in” to nbdays = 0 at the start of each patient and an “out” or “death” to nb_days_end+1 for each patient.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
proba_death
|
proportion of deaths in the cohort |
0
|
Source code in opentak/generation_cohort_tak.py
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 |
|