meta-edc 1.0.7__py3-none-any.whl → 1.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- meta_ae/action_items.py +10 -2
- meta_ae/baker_recipes.py +1 -2
- meta_ae/tests/tests/test_actions.py +1 -2
- meta_analytics/README.rst +1 -2
- meta_analytics/notebooks/anu.ipynb +95 -0
- meta_analytics/notebooks/appointment_planning.ipynb +329 -0
- meta_analytics/notebooks/arvs.ipynb +103 -0
- meta_analytics/notebooks/cleaning/consent_v1_ext.ipynb +227 -0
- meta_analytics/notebooks/cleaning/offschedule_eos.ipynb +353 -0
- meta_analytics/notebooks/dsmc/renal_dysfunction.ipynb +435 -0
- meta_analytics/notebooks/endpoints/meta_endpoints_by_date.ipynb +664 -0
- meta_analytics/notebooks/followup_examination.ipynb +141 -0
- meta_analytics/notebooks/hba1c.ipynb +136 -0
- meta_analytics/notebooks/hiv_regimens.ipynb +122 -118
- meta_analytics/notebooks/incidence.ipynb +232 -0
- meta_analytics/notebooks/liver.ipynb +389 -0
- meta_analytics/notebooks/magreth.ipynb +645 -0
- meta_analytics/notebooks/monitoring_report.ipynb +721 -448
- meta_analytics/notebooks/pharmacy.ipynb +405 -306
- meta_analytics/notebooks/pharmacy_stock_202410.ipynb +306 -0
- meta_analytics/notebooks/steering.ipynb +61 -0
- meta_analytics/notebooks/undiagnosed/meta3_screening_consort_chart.ipynb +1176 -0
- meta_analytics/notebooks/undiagnosed/meta3_screening_undiagnosed.ipynb +519 -0
- meta_analytics/notebooks/undiagnosed/meta_screening_table2.ipynb +964 -0
- meta_analytics/notebooks/undiagnosed/screen_undiagnosed_or.ipynb +296 -0
- meta_analytics/notebooks/undiagnosed/screening.ipynb +273 -0
- meta_analytics/notebooks/undiagnosed/screening2.ipynb +958 -0
- meta_analytics/notebooks/undiagnosed/screening_undiagnosed_20241002.ipynb +958 -0
- meta_analytics/notebooks/ven.ipynb +191 -0
- meta_analytics/notebooks/vitals.ipynb +263 -0
- meta_edc/settings/debug.py +3 -2
- meta_edc/urls.py +1 -0
- {meta_edc-1.0.7.dist-info → meta_edc-1.1.1.dist-info}/METADATA +3 -3
- {meta_edc-1.0.7.dist-info → meta_edc-1.1.1.dist-info}/RECORD +62 -35
- {meta_edc-1.0.7.dist-info → meta_edc-1.1.1.dist-info}/WHEEL +1 -1
- meta_labs/reportables.py +14 -11
- meta_labs/tests/test_reportables.py +33 -12
- meta_pharmacy/notebooks/pharmacy.ipynb +41 -0
- meta_prn/admin/offschedule_pregnancy_admin.py +3 -3
- meta_prn/admin/onschedule_dm_referral_admin.py +5 -5
- meta_prn/form_validators/end_of_study.py +2 -2
- meta_prn/migrations/0063_historicaloffstudymedication_singleton_field_and_more.py +37 -0
- meta_prn/migrations/0064_auto_20250602_2143.py +18 -0
- meta_prn/models/end_of_study.py +2 -0
- meta_prn/models/off_study_medication.py +2 -0
- meta_reports/admin/last_imp_refill_admin.py +3 -2
- meta_screening/eligibility/eligibility_part_three/base_eligibility_part_three.py +59 -47
- meta_screening/form_validators/screening_part_three.py +6 -1
- meta_screening/tests/meta_test_case_mixin.py +3 -0
- meta_screening/tests/tests/test_forms.py +9 -2
- meta_screening/tests/tests/test_screening_part_three.py +11 -14
- meta_subject/action_items.py +2 -3
- meta_subject/choices.py +2 -1
- meta_subject/form_validators/delivery_form_validator.py +1 -0
- meta_subject/forms/blood_results/blood_results_rft_form.py +60 -3
- meta_subject/forms/delivery_form.py +2 -0
- meta_subject/migrations/0223_bloodresultsfbc_errors_bloodresultsgludummy_errors_and_more.py +83 -0
- meta_subject/migrations/0224_bloodresultsfbc_abnormal_summary_and_more.py +153 -0
- meta_subject/tests/tests/test_egfr.py +5 -5
- meta_analytics/dataframes/enrolled/__init__.py +0 -0
- {meta_edc-1.0.7.dist-info → meta_edc-1.1.1.dist-info}/licenses/AUTHORS.rst +0 -0
- {meta_edc-1.0.7.dist-info → meta_edc-1.1.1.dist-info}/licenses/LICENSE +0 -0
- {meta_edc-1.0.7.dist-info → meta_edc-1.1.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,296 @@
|
|
1
|
+
{
|
2
|
+
"cells": [
|
3
|
+
{
|
4
|
+
"cell_type": "code",
|
5
|
+
"execution_count": null,
|
6
|
+
"id": "0",
|
7
|
+
"metadata": {},
|
8
|
+
"outputs": [],
|
9
|
+
"source": [
|
10
|
+
"%%capture\n",
|
11
|
+
"# output is suppressed but normally would spew out all the edc loading messages\n",
|
12
|
+
"\n",
|
13
|
+
"import os\n",
|
14
|
+
"from pathlib import Path\n",
|
15
|
+
"from datetime import datetime\n",
|
16
|
+
"import pandas as pd\n",
|
17
|
+
"import numpy as np\n",
|
18
|
+
"import math\n",
|
19
|
+
"# import matplotlxib.pyplot as plt\n",
|
20
|
+
"# import seaborn as sns\n",
|
21
|
+
"import scipy.stats as stats\n",
|
22
|
+
"\n",
|
23
|
+
"from dj_notebook import activate\n",
|
24
|
+
"\n",
|
25
|
+
"env_file = os.environ[\"META_ENV\"]\n",
|
26
|
+
"documents_folder = os.environ[\"META_DOCUMENTS_FOLDER\"]\n",
|
27
|
+
"report_folder = Path(documents_folder)\n",
|
28
|
+
"\n",
|
29
|
+
"plus = activate(dotenv_file=env_file)\n"
|
30
|
+
]
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"cell_type": "code",
|
34
|
+
"execution_count": null,
|
35
|
+
"id": "1",
|
36
|
+
"metadata": {},
|
37
|
+
"outputs": [],
|
38
|
+
"source": [
|
39
|
+
"import itertools\n",
|
40
|
+
"from meta_analytics.dataframes import GlucoseEndpointsByDate, get_eos_df, get_screening_df\n",
|
41
|
+
"from meta_analytics.dataframes.screening import get_glucose_tested_only_df\n"
|
42
|
+
]
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"cell_type": "code",
|
46
|
+
"execution_count": null,
|
47
|
+
"id": "2",
|
48
|
+
"metadata": {},
|
49
|
+
"outputs": [],
|
50
|
+
"source": [
|
51
|
+
"df_glu2 = get_glucose_tested_only_df()\n",
|
52
|
+
"cond_fasting2 = (df_glu2.fasting == \"Yes\") & (df_glu2.fasting_fbg_hrs >= 8.0)\n",
|
53
|
+
"cond_f2 = (df_glu2[\"gender\"] == \"F\")\n",
|
54
|
+
"cond_m2 = (df_glu2[\"gender\"] == \"M\")\n"
|
55
|
+
]
|
56
|
+
},
|
57
|
+
{
|
58
|
+
"cell_type": "code",
|
59
|
+
"execution_count": null,
|
60
|
+
"id": "3",
|
61
|
+
"metadata": {},
|
62
|
+
"outputs": [],
|
63
|
+
"source": [
|
64
|
+
"# df_glu[cond_f & cond_fasting & (df_glu.ogtt.notna()) & ((df_glu.fbg>=7.0) | (df_glu.ogtt>=11.1))].count()\n",
|
65
|
+
"\n",
|
66
|
+
"# when ogtt not done \n",
|
67
|
+
"# df_glu[cond_f & cond_fasting & (df_glu.ogtt.isna())].fbg.describe()\n",
|
68
|
+
"\n",
|
69
|
+
"# we never have ogtt w/o fbg\n",
|
70
|
+
"# df_glu[cond_f & cond_fasting & (df_glu.fbg.isna())].ogtt.describe()\n",
|
71
|
+
"\n",
|
72
|
+
"# df_glu = df_glu.reset_index(drop=False)\n",
|
73
|
+
"def dx(row):\n",
|
74
|
+
" # print((row.fbg>=7.0) & (row.ogtt>=11.1))\n",
|
75
|
+
" # print(row.fbg, row.ogtt)\n",
|
76
|
+
" if (row.fbg>=7.0) & (row.fbg<10.0) & (row.ogtt>=11.1):\n",
|
77
|
+
" ret = \"fbg_ogtt\"\n",
|
78
|
+
" elif (row.fbg>=7.0) & (row.fbg<10.0) & (row.ogtt<11.1):\n",
|
79
|
+
" ret = \"fbg_only\"\n",
|
80
|
+
" elif (row.fbg<7.0) & (row.ogtt>=11.1):\n",
|
81
|
+
" ret = \"ogtt_only\"\n",
|
82
|
+
" elif (row.fbg<7.0) & (row.ogtt<11.1):\n",
|
83
|
+
" ret = \"neither\"\n",
|
84
|
+
" else:\n",
|
85
|
+
" ret = None\n",
|
86
|
+
" # print(row.fbg, row.ogtt)\n",
|
87
|
+
" return ret\n",
|
88
|
+
" \n",
|
89
|
+
"df_glu2[\"glucose\"] = \"\" \n",
|
90
|
+
"df_glu2[\"glucose\"] = df_glu2[cond_fasting2].apply(lambda r: dx(r), axis=1)\n",
|
91
|
+
"# df_glu[cond_fasting & cond_f]\n"
|
92
|
+
]
|
93
|
+
},
|
94
|
+
{
|
95
|
+
"cell_type": "code",
|
96
|
+
"execution_count": null,
|
97
|
+
"id": "4",
|
98
|
+
"metadata": {},
|
99
|
+
"outputs": [],
|
100
|
+
"source": [
|
101
|
+
"df_glu2[\"glucose\"].value_counts()\n"
|
102
|
+
]
|
103
|
+
},
|
104
|
+
{
|
105
|
+
"cell_type": "code",
|
106
|
+
"execution_count": null,
|
107
|
+
"id": "5",
|
108
|
+
"metadata": {},
|
109
|
+
"outputs": [],
|
110
|
+
"source": [
|
111
|
+
"df_glu2[cond_fasting2 & cond_f2][\"glucose\"].value_counts()\n"
|
112
|
+
]
|
113
|
+
},
|
114
|
+
{
|
115
|
+
"cell_type": "code",
|
116
|
+
"execution_count": null,
|
117
|
+
"id": "6",
|
118
|
+
"metadata": {},
|
119
|
+
"outputs": [],
|
120
|
+
"source": [
|
121
|
+
"df_glu2[cond_fasting2 & cond_m2][\"glucose\"].value_counts()"
|
122
|
+
]
|
123
|
+
},
|
124
|
+
{
|
125
|
+
"cell_type": "code",
|
126
|
+
"execution_count": null,
|
127
|
+
"id": "7",
|
128
|
+
"metadata": {},
|
129
|
+
"outputs": [],
|
130
|
+
"source": [
|
131
|
+
"from sklearn.metrics import cohen_kappa_score"
|
132
|
+
]
|
133
|
+
},
|
134
|
+
{
|
135
|
+
"cell_type": "code",
|
136
|
+
"execution_count": null,
|
137
|
+
"id": "8",
|
138
|
+
"metadata": {},
|
139
|
+
"outputs": [],
|
140
|
+
"source": [
|
141
|
+
"df_glu2[cond_fasting2 & cond_m2 & (df_glu2.fbg>=7.0) & (df_glu2.fbg<10.0) ].glucose.value_counts()\n",
|
142
|
+
"# y2 = df_glu2[cond_fasting2 & cond_f2 & (df_glu2.fbg<7.0)].glucose"
|
143
|
+
]
|
144
|
+
},
|
145
|
+
{
|
146
|
+
"cell_type": "code",
|
147
|
+
"execution_count": null,
|
148
|
+
"id": "9",
|
149
|
+
"metadata": {},
|
150
|
+
"outputs": [],
|
151
|
+
"source": [
|
152
|
+
"# cohen_kappa_score(y1, y2)"
|
153
|
+
]
|
154
|
+
},
|
155
|
+
{
|
156
|
+
"cell_type": "code",
|
157
|
+
"execution_count": null,
|
158
|
+
"id": "10",
|
159
|
+
"metadata": {},
|
160
|
+
"outputs": [],
|
161
|
+
"source": [
|
162
|
+
"cond_fasting = (df_glu2.fasting == \"Yes\") & (df_glu2.fasting_fbg_hrs >= 8.0)\n",
|
163
|
+
"\n",
|
164
|
+
"df_glu2[\"fbg_threshold\"] = (df_glu2[cond_fasting].fbg >= 7.0) & (df_glu2[cond_fasting].fbg < 10.0)\n",
|
165
|
+
"df_glu2[\"ogtt_threshold\"] = df_glu2[cond_fasting].ogtt >= 11.1\n"
|
166
|
+
]
|
167
|
+
},
|
168
|
+
{
|
169
|
+
"cell_type": "code",
|
170
|
+
"execution_count": null,
|
171
|
+
"id": "11",
|
172
|
+
"metadata": {},
|
173
|
+
"outputs": [],
|
174
|
+
"source": [
|
175
|
+
"df_glu2[\"fbg_threshold\"].value_counts()"
|
176
|
+
]
|
177
|
+
},
|
178
|
+
{
|
179
|
+
"cell_type": "code",
|
180
|
+
"execution_count": null,
|
181
|
+
"id": "12",
|
182
|
+
"metadata": {},
|
183
|
+
"outputs": [],
|
184
|
+
"source": [
|
185
|
+
"df_glu2[\"ogtt_threshold\"].value_counts()"
|
186
|
+
]
|
187
|
+
},
|
188
|
+
{
|
189
|
+
"cell_type": "code",
|
190
|
+
"execution_count": null,
|
191
|
+
"id": "13",
|
192
|
+
"metadata": {},
|
193
|
+
"outputs": [],
|
194
|
+
"source": [
|
195
|
+
"# female\n",
|
196
|
+
"df_glu2[cond_f2][[\"fbg_threshold\", \"ogtt_threshold\"]].value_counts()"
|
197
|
+
]
|
198
|
+
},
|
199
|
+
{
|
200
|
+
"cell_type": "code",
|
201
|
+
"execution_count": null,
|
202
|
+
"id": "14",
|
203
|
+
"metadata": {},
|
204
|
+
"outputs": [],
|
205
|
+
"source": [
|
206
|
+
"# male\n",
|
207
|
+
"df_glu2[cond_m2][[\"fbg_threshold\", \"ogtt_threshold\"]].value_counts()"
|
208
|
+
]
|
209
|
+
},
|
210
|
+
{
|
211
|
+
"cell_type": "code",
|
212
|
+
"execution_count": null,
|
213
|
+
"id": "15",
|
214
|
+
"metadata": {},
|
215
|
+
"outputs": [],
|
216
|
+
"source": [
|
217
|
+
"from scipy.stats.contingency import odds_ratio\n",
|
218
|
+
"\n",
|
219
|
+
"# female\n",
|
220
|
+
"res = odds_ratio([[76, 414], [72,3639]])\n",
|
221
|
+
"res.statistic"
|
222
|
+
]
|
223
|
+
},
|
224
|
+
{
|
225
|
+
"cell_type": "code",
|
226
|
+
"execution_count": null,
|
227
|
+
"id": "16",
|
228
|
+
"metadata": {},
|
229
|
+
"outputs": [],
|
230
|
+
"source": [
|
231
|
+
"res.confidence_interval(confidence_level=0.95)"
|
232
|
+
]
|
233
|
+
},
|
234
|
+
{
|
235
|
+
"cell_type": "code",
|
236
|
+
"execution_count": null,
|
237
|
+
"id": "17",
|
238
|
+
"metadata": {},
|
239
|
+
"outputs": [],
|
240
|
+
"source": [
|
241
|
+
"# male\n",
|
242
|
+
"res = odds_ratio([[28, 141], [48,1197]])\n",
|
243
|
+
"res.statistic"
|
244
|
+
]
|
245
|
+
},
|
246
|
+
{
|
247
|
+
"cell_type": "code",
|
248
|
+
"execution_count": null,
|
249
|
+
"id": "18",
|
250
|
+
"metadata": {},
|
251
|
+
"outputs": [],
|
252
|
+
"source": [
|
253
|
+
"res.confidence_interval(confidence_level=0.95)"
|
254
|
+
]
|
255
|
+
},
|
256
|
+
{
|
257
|
+
"cell_type": "code",
|
258
|
+
"execution_count": null,
|
259
|
+
"id": "19",
|
260
|
+
"metadata": {},
|
261
|
+
"outputs": [],
|
262
|
+
"source": [
|
263
|
+
"df_glu2[cond_fasting].count()"
|
264
|
+
]
|
265
|
+
},
|
266
|
+
{
|
267
|
+
"cell_type": "code",
|
268
|
+
"execution_count": null,
|
269
|
+
"id": "20",
|
270
|
+
"metadata": {},
|
271
|
+
"outputs": [],
|
272
|
+
"source": []
|
273
|
+
}
|
274
|
+
],
|
275
|
+
"metadata": {
|
276
|
+
"kernelspec": {
|
277
|
+
"display_name": "Python 3 (ipykernel)",
|
278
|
+
"language": "python",
|
279
|
+
"name": "python3"
|
280
|
+
},
|
281
|
+
"language_info": {
|
282
|
+
"codemirror_mode": {
|
283
|
+
"name": "ipython",
|
284
|
+
"version": 3
|
285
|
+
},
|
286
|
+
"file_extension": ".py",
|
287
|
+
"mimetype": "text/x-python",
|
288
|
+
"name": "python",
|
289
|
+
"nbconvert_exporter": "python",
|
290
|
+
"pygments_lexer": "ipython3",
|
291
|
+
"version": "3.12.4"
|
292
|
+
}
|
293
|
+
},
|
294
|
+
"nbformat": 4,
|
295
|
+
"nbformat_minor": 5
|
296
|
+
}
|
@@ -0,0 +1,273 @@
|
|
1
|
+
{
|
2
|
+
"cells": [
|
3
|
+
{
|
4
|
+
"cell_type": "code",
|
5
|
+
"execution_count": null,
|
6
|
+
"id": "0",
|
7
|
+
"metadata": {},
|
8
|
+
"outputs": [],
|
9
|
+
"source": [
|
10
|
+
"%%capture\n",
|
11
|
+
"import os\n",
|
12
|
+
"from pathlib import Path\n",
|
13
|
+
"import pandas as pd\n",
|
14
|
+
"from dj_notebook import activate\n",
|
15
|
+
"import numpy as np\n",
|
16
|
+
"from django_pandas.io import read_frame\n",
|
17
|
+
"\n",
|
18
|
+
"env_file = os.environ[\"META_ENV\"]\n",
|
19
|
+
"reports_folder = Path(os.environ[\"META_REPORTS_FOLDER\"])\n",
|
20
|
+
"analysis_folder = Path(os.environ[\"META_ANALYSIS_FOLDER\"])\n",
|
21
|
+
"pharmacy_folder = Path(os.environ[\"META_PHARMACY_FOLDER\"])\n",
|
22
|
+
"plus = activate(dotenv_file=env_file)"
|
23
|
+
]
|
24
|
+
},
|
25
|
+
{
|
26
|
+
"cell_type": "code",
|
27
|
+
"execution_count": null,
|
28
|
+
"id": "1",
|
29
|
+
"metadata": {},
|
30
|
+
"outputs": [],
|
31
|
+
"source": [
|
32
|
+
"from meta_analytics.dataframes.screening import get_screening_df\n",
|
33
|
+
"from django.contrib.sites.models import Site"
|
34
|
+
]
|
35
|
+
},
|
36
|
+
{
|
37
|
+
"cell_type": "code",
|
38
|
+
"execution_count": null,
|
39
|
+
"id": "2",
|
40
|
+
"metadata": {},
|
41
|
+
"outputs": [],
|
42
|
+
"source": [
|
43
|
+
"df = get_screening_df()\n",
|
44
|
+
"sites = {obj.domain: obj.id for obj in Site.objects.all()}\n",
|
45
|
+
"df[\"site\"] = df[\"site\"].map(sites)\n",
|
46
|
+
"df = df.rename(columns={\"report_datetime\": \"screening_datetime\"})\n"
|
47
|
+
]
|
48
|
+
},
|
49
|
+
{
|
50
|
+
"cell_type": "code",
|
51
|
+
"execution_count": null,
|
52
|
+
"id": "3",
|
53
|
+
"metadata": {},
|
54
|
+
"outputs": [],
|
55
|
+
"source": [
|
56
|
+
"df.to_csv(analysis_folder, index=False, sep=\"|\")"
|
57
|
+
]
|
58
|
+
},
|
59
|
+
{
|
60
|
+
"cell_type": "code",
|
61
|
+
"execution_count": null,
|
62
|
+
"id": "4",
|
63
|
+
"metadata": {},
|
64
|
+
"outputs": [],
|
65
|
+
"source": [
|
66
|
+
"df = pd.read_csv(analysis_folder, sep=\"|\")"
|
67
|
+
]
|
68
|
+
},
|
69
|
+
{
|
70
|
+
"cell_type": "code",
|
71
|
+
"execution_count": null,
|
72
|
+
"id": "5",
|
73
|
+
"metadata": {},
|
74
|
+
"outputs": [],
|
75
|
+
"source": [
|
76
|
+
"df"
|
77
|
+
]
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"cell_type": "code",
|
81
|
+
"execution_count": null,
|
82
|
+
"id": "6",
|
83
|
+
"metadata": {},
|
84
|
+
"outputs": [],
|
85
|
+
"source": [
|
86
|
+
"columns = [\"screening_identifier\", \"site\", \"screening_datetime\", \"fbg_datetime\", \"fbg_value\", \"ogtt_value\", \"repeat_glucose_performed\", \"fbg2_value\", \"ogtt2_value\", \"fbg2_datetime\", \"ogtt2_datetime\", \"consented\"]"
|
87
|
+
]
|
88
|
+
},
|
89
|
+
{
|
90
|
+
"cell_type": "code",
|
91
|
+
"execution_count": null,
|
92
|
+
"id": "7",
|
93
|
+
"metadata": {},
|
94
|
+
"outputs": [],
|
95
|
+
"source": [
|
96
|
+
"\n",
|
97
|
+
"df[(df[\"fbg_value\"].notna()) & (df[\"ogtt_value\"].isna()) & (df[\"unsuitable_agreed\"]!=\"Yes\")][columns].count()"
|
98
|
+
]
|
99
|
+
},
|
100
|
+
{
|
101
|
+
"cell_type": "code",
|
102
|
+
"execution_count": null,
|
103
|
+
"id": "8",
|
104
|
+
"metadata": {},
|
105
|
+
"outputs": [],
|
106
|
+
"source": [
|
107
|
+
"columns = [\"screening_identifier\", \"site\", \"screening_datetime\", \"fbg_datetime\", \"fbg_value\", \"ogtt_value\", \"repeat_glucose_performed\", \"fbg2_value\", \"ogtt2_value\", \"fbg2_datetime\", \"ogtt2_datetime\", \"consented\"]"
|
108
|
+
]
|
109
|
+
},
|
110
|
+
{
|
111
|
+
"cell_type": "code",
|
112
|
+
"execution_count": null,
|
113
|
+
"id": "9",
|
114
|
+
"metadata": {},
|
115
|
+
"outputs": [],
|
116
|
+
"source": [
|
117
|
+
"df[(df[\"fbg_value\"].notna()) & (df[\"ogtt_value\"].isna()) & (df[\"repeat_glucose_performed\"]==\"Yes\")][columns]"
|
118
|
+
]
|
119
|
+
},
|
120
|
+
{
|
121
|
+
"cell_type": "code",
|
122
|
+
"execution_count": null,
|
123
|
+
"id": "10",
|
124
|
+
"metadata": {},
|
125
|
+
"outputs": [],
|
126
|
+
"source": [
|
127
|
+
"from edc_constants.constants import YES, NO\n",
|
128
|
+
"df = get_screening_df()\n",
|
129
|
+
"\n"
|
130
|
+
]
|
131
|
+
},
|
132
|
+
{
|
133
|
+
"cell_type": "code",
|
134
|
+
"execution_count": null,
|
135
|
+
"id": "11",
|
136
|
+
"metadata": {},
|
137
|
+
"outputs": [],
|
138
|
+
"source": [
|
139
|
+
"df.groupby(by=[\"eligible_part_one\", \"eligible_part_two\"], dropna=True).size()"
|
140
|
+
]
|
141
|
+
},
|
142
|
+
{
|
143
|
+
"cell_type": "code",
|
144
|
+
"execution_count": null,
|
145
|
+
"id": "12",
|
146
|
+
"metadata": {},
|
147
|
+
"outputs": [],
|
148
|
+
"source": [
|
149
|
+
"erik = list(df[(df.eligible_part_one==YES) & (df.eligible_part_two==YES) & (df.hiv_pos==YES)].screening_identifier)\n"
|
150
|
+
]
|
151
|
+
},
|
152
|
+
{
|
153
|
+
"cell_type": "code",
|
154
|
+
"execution_count": null,
|
155
|
+
"id": "13",
|
156
|
+
"metadata": {},
|
157
|
+
"outputs": [],
|
158
|
+
"source": [
|
159
|
+
"df_peiyun = pd.read_csv(Path(\"~/Documents/ucl/protocols/intecomm/analysis/primary\") / \"peiyun.csv\")\n",
|
160
|
+
"peiyun = list(df_peiyun.screening_identifier)"
|
161
|
+
]
|
162
|
+
},
|
163
|
+
{
|
164
|
+
"cell_type": "code",
|
165
|
+
"execution_count": null,
|
166
|
+
"id": "14",
|
167
|
+
"metadata": {},
|
168
|
+
"outputs": [],
|
169
|
+
"source": [
|
170
|
+
"[x for x in erik if x not in peiyun]"
|
171
|
+
]
|
172
|
+
},
|
173
|
+
{
|
174
|
+
"cell_type": "code",
|
175
|
+
"execution_count": null,
|
176
|
+
"id": "15",
|
177
|
+
"metadata": {},
|
178
|
+
"outputs": [],
|
179
|
+
"source": [
|
180
|
+
"df[df.screening_identifier == \"SR9E8B4D\"][[\"site\", 'eligible_part_one', 'eligible_part_two', \"hiv_pos\"]]"
|
181
|
+
]
|
182
|
+
},
|
183
|
+
{
|
184
|
+
"cell_type": "code",
|
185
|
+
"execution_count": null,
|
186
|
+
"id": "16",
|
187
|
+
"metadata": {},
|
188
|
+
"outputs": [],
|
189
|
+
"source": [
|
190
|
+
"[x for x in peiyun if x not in erik]"
|
191
|
+
]
|
192
|
+
},
|
193
|
+
{
|
194
|
+
"cell_type": "code",
|
195
|
+
"execution_count": null,
|
196
|
+
"id": "17",
|
197
|
+
"metadata": {},
|
198
|
+
"outputs": [],
|
199
|
+
"source": [
|
200
|
+
"df.groupby(by=[\"eligible_part_one\", \"eligible_part_two\", \"agree_to_p3\"], dropna=True).size()\n"
|
201
|
+
]
|
202
|
+
},
|
203
|
+
{
|
204
|
+
"cell_type": "code",
|
205
|
+
"execution_count": null,
|
206
|
+
"id": "18",
|
207
|
+
"metadata": {},
|
208
|
+
"outputs": [],
|
209
|
+
"source": [
|
210
|
+
"df[~(df.subject_identifier.isna()) & (df.agree_to_p3==NO)][[\"subject_identifier\", \"eligible_part_one\", \"eligible_part_two\", \"agree_to_p3\", \"screening_identifier\"]]"
|
211
|
+
]
|
212
|
+
},
|
213
|
+
{
|
214
|
+
"cell_type": "code",
|
215
|
+
"execution_count": null,
|
216
|
+
"id": "19",
|
217
|
+
"metadata": {},
|
218
|
+
"outputs": [],
|
219
|
+
"source": [
|
220
|
+
"df[~(df.subject_identifier.str.startswith(\"105-\")) & (df.eligible_part_one==YES) & (df.eligible_part_two==YES)][[\"subject_identifier\", \"eligible_part_one\", \"eligible_part_two\", \"agree_to_p3\", \"screening_identifier\"]]\n"
|
221
|
+
]
|
222
|
+
},
|
223
|
+
{
|
224
|
+
"cell_type": "code",
|
225
|
+
"execution_count": null,
|
226
|
+
"id": "20",
|
227
|
+
"metadata": {},
|
228
|
+
"outputs": [],
|
229
|
+
"source": [
|
230
|
+
"df[(df.subject_identifier.str.startswith(\"105-\"))][[\"subject_identifier\", \"eligible_part_one\", \"eligible_part_two\", \"agree_to_p3\", \"screening_identifier\"]]\n"
|
231
|
+
]
|
232
|
+
},
|
233
|
+
{
|
234
|
+
"cell_type": "code",
|
235
|
+
"execution_count": null,
|
236
|
+
"id": "21",
|
237
|
+
"metadata": {},
|
238
|
+
"outputs": [],
|
239
|
+
"source": [
|
240
|
+
"df[df.agree_to_p3==NO][[\"screening_identifier\", \"subject_identifier\", \"eligible_part_one\", \"eligible_part_two\", \"eligible_part_three\"]]\n"
|
241
|
+
]
|
242
|
+
},
|
243
|
+
{
|
244
|
+
"cell_type": "code",
|
245
|
+
"execution_count": null,
|
246
|
+
"id": "22",
|
247
|
+
"metadata": {},
|
248
|
+
"outputs": [],
|
249
|
+
"source": []
|
250
|
+
}
|
251
|
+
],
|
252
|
+
"metadata": {
|
253
|
+
"kernelspec": {
|
254
|
+
"display_name": "Python 3 (ipykernel)",
|
255
|
+
"language": "python",
|
256
|
+
"name": "python3"
|
257
|
+
},
|
258
|
+
"language_info": {
|
259
|
+
"codemirror_mode": {
|
260
|
+
"name": "ipython",
|
261
|
+
"version": 3
|
262
|
+
},
|
263
|
+
"file_extension": ".py",
|
264
|
+
"mimetype": "text/x-python",
|
265
|
+
"name": "python",
|
266
|
+
"nbconvert_exporter": "python",
|
267
|
+
"pygments_lexer": "ipython3",
|
268
|
+
"version": "3.12.4"
|
269
|
+
}
|
270
|
+
},
|
271
|
+
"nbformat": 4,
|
272
|
+
"nbformat_minor": 5
|
273
|
+
}
|