SebastianBravo commited on
Commit
d1ac89f
1 Parent(s): f8a4a5a

Corrected diagnosis

Browse files
Files changed (1) hide show
  1. app.py +102 -75
app.py CHANGED
@@ -173,7 +173,7 @@ def get_diagnosis(brain_img, input_name, input_age, input_phone_num, input_emer_
173
 
174
  # Probabilidad de tener MCI
175
  print(prob)
176
- diagnosis = f"The patient has a probability of {(100*prob):.2f}% of having MCI"
177
 
178
  save_file(input_name, input_age, input_phone_num, input_emer_name, input_emer_phone_num,
179
  input_sex, input_MMSE, input_GDSCALE, input_CDR, input_FAQ, input_NPI_Q, input_Diastolic_blood_pressure,
@@ -191,94 +191,121 @@ def clear():
191
  '''--------------------------------- Interfaz ---------------------------------'''
192
 
193
  with gr.Blocks(theme=gr.themes.Base()) as demo:
 
194
  with gr.Row():
195
  # gr.HTML(r"""<center><img src='https://user-images.githubusercontent.com/66338785/233529518-33e8bcdb-146f-49e8-94c4-27d6529ce4f7.png' width="30%" height="30%"></center>""")
196
- gr.HTML(r"""<center><img src='https://user-images.githubusercontent.com/66338785/233531457-f368e04b-5099-42a8-906d-6f1250ea0f1e.png' width="40%" height="40%"></center>""")
197
- # gr.Markdown("""
198
- # # SIMCI
199
- # Interfaz de SIMCI
200
- # """)
201
 
202
  # Inputs
203
  with gr.Row():
204
  with gr.Column(variant="panel", scale=1):
205
- gr.Markdown('<h2 style="text-align: center; color:#235784;">Patient Information</h2>')
206
- with gr.Tab("Personal data"):
207
- # Objeto para subir archivo nifti
208
- input_name = gr.Textbox(placeholder='Enter the patient name', label='Patient name')
209
- input_age = gr.Number(label='Age')
210
- input_phone_num = gr.Number(label='Phone number')
211
- input_emer_name = gr.Textbox(placeholder='Enter the emergency contact name', label='Emergency contact name')
212
- input_emer_phone_num = gr.Number(label='Emergency contact name phone number')
213
- input_sex = gr.Dropdown(["Male", "Female"], label="Sex")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
214
 
215
- with gr.Tab("Clinical data"):
216
- input_MMSE = gr.Slider(minimum=0,
217
- maximum=30,
218
- value=0,
219
- step=1,
220
- label="MMSE total score")
221
 
222
- input_GDSCALE = gr.Slider(minimum=0,
223
- maximum=12,
224
- value=0,
225
- step=1,
226
- label="GDSCALE total score")
227
 
228
- input_CDR = gr.Slider(minimum=0,
229
- maximum=3,
230
- value=0,
231
- step=0.5,
232
- label="Global CDR")
233
 
234
- input_FAQ = gr.Slider(minimum=0,
235
- maximum=30,
236
- value=0,
237
- step=1,
238
- label="FAQ total score")
239
 
240
- input_NPI_Q = gr.Slider(minimum=0,
241
- maximum=30,
242
- value=0,
243
- step=1,
244
- label="NPI-Q total score")
245
-
246
 
247
- with gr.Tab("Vital Signs"):
248
- input_Diastolic_blood_pressure = gr.Number(label='Diastolic Blood Pressure(mm Hg)')
249
- input_Systolic_blood_pressure = gr.Number(label='Systolic Blood Pressure(mm Hg)')
250
- input_Body_heigth = gr.Number(label='Body heigth (cm)')
251
- input_Body_weight = gr.Number(label='Body weigth (kg)')
252
- input_Heart_rate = gr.Number(label='Heart rate (bpm)')
253
- input_Respiratory_rate = gr.Number(label='Respiratory rate (bpm)')
254
- input_Body_temperature = gr.Number(label='Body temperature (掳C)')
255
- input_Pluse_oximetry = gr.Number(label='Pluse oximetry (%)')
256
 
257
- with gr.Tab("Medications"):
258
- input_medications = gr.Textbox(label='Medications', lines=5)
259
- input_allergies = gr.Textbox(label='Allergies', lines=5)
260
 
261
- with gr.Box():
262
- gr.Markdown('<h4 style="color:#235784;">Upload MRI</h4>')
263
- input_file = gr.File(file_count="single", label="MRI File (.nii)", file_types=[".nii"], show_label=False)
264
-
265
- with gr.Row():
266
- # Bot贸n para cargar imagen
267
- load_img_button = gr.Button(value="Load")
268
 
269
- # Bot贸n para borrar
270
- clear_button = gr.Button(value="Clear")
271
-
272
- # Bot贸n para procesar imagen
273
- process_button = gr.Button(value="Process MRI", visible=False, variant="primary")
274
-
275
- # Bot贸n para obtener diagnostico
276
- diagnostic_button = gr.Button(value="Get diagnosis", visible=False, variant="primary")
277
-
278
- with gr.Box(visible=False) as download_box:
279
- gr.Markdown('<h4 style="color:#235784;"> Download diagnosis report</h4>')
280
- # Descarga de archivo
281
- output_file = gr.File(file_count="single", show_label=False, interactive=False, visible=True)
 
282
 
283
  # Outputs
284
  with gr.Column(variant="panel", scale=1):
@@ -317,7 +344,7 @@ with gr.Blocks(theme=gr.themes.Base()) as demo:
317
  # Texto del diagnostico
318
  diagnosis_text = gr.Textbox(label="Diagnosis",interactive=False, placeholder="The diagnosis will show here...")
319
 
320
- # componentes =
321
 
322
  # Variables
323
  original_input_sitk = gr.State()
 
173
 
174
  # Probabilidad de tener MCI
175
  print(prob)
176
+ diagnosis = f"The patient has a probability of {(100*prob):.2f}% of having MCI with a sensitivity of 92.00% and a specificity of 92.75%"
177
 
178
  save_file(input_name, input_age, input_phone_num, input_emer_name, input_emer_phone_num,
179
  input_sex, input_MMSE, input_GDSCALE, input_CDR, input_FAQ, input_NPI_Q, input_Diastolic_blood_pressure,
 
191
  '''--------------------------------- Interfaz ---------------------------------'''
192
 
193
  with gr.Blocks(theme=gr.themes.Base()) as demo:
194
+
195
  with gr.Row():
196
  # gr.HTML(r"""<center><img src='https://user-images.githubusercontent.com/66338785/233529518-33e8bcdb-146f-49e8-94c4-27d6529ce4f7.png' width="30%" height="30%"></center>""")
197
+ gr.HTML(r"""
198
+ <center><img src='https://user-images.githubusercontent.com/66338785/233531457-f368e04b-5099-42a8-906d-6f1250ea0f1e.png' width="40%" height="40%"></center>
199
+ """)
 
 
200
 
201
  # Inputs
202
  with gr.Row():
203
  with gr.Column(variant="panel", scale=1):
204
+ with gr.Tab("Patient Information"):
205
+ gr.Markdown('<h2 style="text-align: center; color:#235784;">Patient Information</h2>')
206
+ with gr.Tab("Personal data"):
207
+ # Objeto para subir archivo nifti
208
+ input_name = gr.Textbox(placeholder='Enter the patient name', label='Patient name')
209
+ input_age = gr.Number(label='Age', value=None)
210
+ input_phone_num = gr.Number(label='Phone number')
211
+ input_emer_name = gr.Textbox(placeholder='Enter the emergency contact name', label='Emergency contact name')
212
+ input_emer_phone_num = gr.Number(label='Emergency contact name phone number', value=None)
213
+ input_sex = gr.Dropdown(["Male", "Female"], label="Sex")
214
+
215
+ with gr.Tab("Clinical data"):
216
+ input_MMSE = gr.Slider(minimum=0,
217
+ maximum=30,
218
+ value=0,
219
+ step=1,
220
+ label="MMSE total score")
221
+
222
+ input_GDSCALE = gr.Slider(minimum=0,
223
+ maximum=12,
224
+ value=0,
225
+ step=1,
226
+ label="GDSCALE total score")
227
+
228
+ input_CDR = gr.Slider(minimum=0,
229
+ maximum=3,
230
+ value=0,
231
+ step=0.5,
232
+ label="Global CDR")
233
+
234
+ input_FAQ = gr.Slider(minimum=0,
235
+ maximum=30,
236
+ value=0,
237
+ step=1,
238
+ label="FAQ total score")
239
+
240
+ input_NPI_Q = gr.Slider(minimum=0,
241
+ maximum=30,
242
+ value=0,
243
+ step=1,
244
+ label="NPI-Q total score")
245
+
246
+
247
+ with gr.Tab("Vital Signs"):
248
+ input_Diastolic_blood_pressure = gr.Number(label='Diastolic Blood Pressure(mm Hg)')
249
+ input_Systolic_blood_pressure = gr.Number(label='Systolic Blood Pressure(mm Hg)')
250
+ input_Body_heigth = gr.Number(label='Body heigth (cm)')
251
+ input_Body_weight = gr.Number(label='Body weigth (kg)')
252
+ input_Heart_rate = gr.Number(label='Heart rate (bpm)')
253
+ input_Respiratory_rate = gr.Number(label='Respiratory rate (bpm)')
254
+ input_Body_temperature = gr.Number(label='Body temperature (掳C)')
255
+ input_Pluse_oximetry = gr.Number(label='Pluse oximetry (%)')
256
+
257
+ with gr.Tab("Medications"):
258
+ input_medications = gr.Textbox(label='Medications', lines=5)
259
+ input_allergies = gr.Textbox(label='Allergies', lines=5)
260
+
261
+ with gr.Box():
262
+ gr.Markdown('<h4 style="color:#235784;">Upload MRI</h4>')
263
+ input_file = gr.File(file_count="single", label="MRI File (.nii)", file_types=[".nii"], show_label=False)
264
 
265
+ with gr.Row():
266
+ # Bot贸n para cargar imagen
267
+ load_img_button = gr.Button(value="Load")
268
+
269
+ # Bot贸n para borrar
270
+ clear_button = gr.Button(value="Clear")
271
 
272
+ # Bot贸n para procesar imagen
273
+ process_button = gr.Button(value="Process MRI", visible=False, variant="primary")
 
 
 
274
 
275
+ # Bot贸n para obtener diagnostico
276
+ diagnostic_button = gr.Button(value="Get diagnosis", visible=False, variant="primary")
 
 
 
277
 
278
+ with gr.Box(visible=False) as download_box:
279
+ gr.Markdown('<h4 style="color:#235784;"> Download diagnosis report</h4>')
280
+ # Descarga de archivo
281
+ output_file = gr.File(file_count="single", show_label=False, interactive=False, visible=True)
 
282
 
283
+ with gr.Tab("About"):
284
+ gr.Markdown('''
285
+ # SIMCI
286
+ Alzheimer is a degenerative and irreversible neurological disorder that affects cognitive abilities and daily activities. It is divided into three stages: preclinical, mild cognitive impairment (MCI), and dementia. MCI represents a transition to dementia, characterized by a greater-than-expected decline in cognitive function without interference in daily activities. It is estimated that approximately 20% of individuals with MCI progress to dementia, but diagnostic errors are common in this early stage due to ambiguous cognitive changes, including those observed in neuroimaging.
 
 
287
 
288
+ SIMCI is a system for detecting mild cognitive impairment that employs a multimodal approach and a stratification process to address this issue. The system utilizes demographic characteristics and clinical test results to provide medical interpretability and assist specialists in decision-making. The database includes magnetic resonance imaging (MRI) brain scans, clinical examination results, and demographic information. SIMCI achieves an F1-score of 0.9233, a sensitivity of 0.9200, and a specificity of 0.9275.
 
 
 
 
 
 
 
 
289
 
290
+ <center><img src='https://github.com/SebastianBravo/Battery_monitoring_system/assets/66338785/64cd8821-8249-4020-a00d-a6ae5a7a7e53' width="80%" height="80%"></center>
 
 
291
 
292
+ ## Repository
293
+ https://github.com/SebastianBravo/SIMCI
 
 
 
 
 
294
 
295
+ ## Authors
296
+
297
+ - Daniel Stiven Zambrano Acosta <span>B.Sc</span>
298
+ - Juan Sebasti谩n Bravo Santacruz <span>B.Sc</span>
299
+ - Wilson Javier Arenas L贸pez <span>M.Sc</span>
300
+ - Pablo Alexander Reyes Gavilan PhD
301
+ - Miguel Alfonso Altuve PhD
302
+
303
+
304
+ ## Acknowledgement
305
+
306
+ - Data collection and sharing for this project was funded by the Alzheimer's Disease Neuroimaging Initiative (ADNI) (National Institutes of Health Grant U01 AG024904) and DOD ADNI (Department of Defense award number W81XWH-12-2-0012). ADNI is funded by the National Institute on Aging, the National Institute of Biomedical Imaging and Bioengineering, and through generous contributions from the following: AbbVie, Alzheimer鈥檚 Association; Alzheimer鈥檚 Drug Discovery Foundation; Araclon Biotech; BioClinica, Inc.; Biogen; Bristol-Myers Squibb Company; CereSpir, Inc.; Cogstate; Eisai Inc.; Elan Pharmaceuticals, Inc.; Eli Lilly and Company; EuroImmun; F. Hoffmann-La Roche Ltd and its affiliated company Genentech, Inc.; Fujirebio; GE Healthcare; IXICO Ltd.; Janssen Alzheimer Immunotherapy Research & Development, LLC.; Johnson & Johnson Pharmaceutical Research & Development LLC.; Lumosity; Lundbeck; Merck & Co., Inc.; Meso Scale Diagnostics, LLC.; NeuroRx Research; Neurotrack Technologies; Novartis Pharmaceuticals Corporation; Pfizer Inc.; Piramal Imaging; Servier; Takeda Pharmaceutical Company; and Transition Therapeutics. The Canadian Institutes of Health Research is providing funds to support ADNI clinical sites in Canada. Private sector contributions are facilitated by the Foundation for the National Institutes of Health (www.fnih.org). The grantee organization is the Northern California Institute for Research and Education, and the study is coordinated by the Alzheimer鈥檚 Therapeutic Research Institute at the University of Southern California. ADNI data are disseminated by the Laboratory for Neuro Imaging at the University of Southern California.
307
+ - We thank [MedicalNet](https://github.com/Tencent/MedicalNet) and [segmentation_models_3D](https://github.com/ZFTurbo/segmentation_models_3D) which we build SIMCI.
308
+ ''')
309
 
310
  # Outputs
311
  with gr.Column(variant="panel", scale=1):
 
344
  # Texto del diagnostico
345
  diagnosis_text = gr.Textbox(label="Diagnosis",interactive=False, placeholder="The diagnosis will show here...")
346
 
347
+
348
 
349
  # Variables
350
  original_input_sitk = gr.State()