add stenosis measurements
This commit is contained in:
+66
-16
@@ -8,13 +8,16 @@ def report_stroke():
|
|||||||
'haemorrhage': '',
|
'haemorrhage': '',
|
||||||
'ischaemia': '',
|
'ischaemia': '',
|
||||||
'lvo': '',
|
'lvo': '',
|
||||||
'stenosis': ''
|
'ica_disease': '',
|
||||||
|
'ica_side': '',
|
||||||
|
'quantify_stenosis': '',
|
||||||
|
'left_stenosis': '',
|
||||||
|
'right_stenosis': ''
|
||||||
}
|
}
|
||||||
custom_text = {
|
custom_text = {
|
||||||
'haemorrhage': '',
|
'haemorrhage': '',
|
||||||
'ischaemia': '',
|
'ischaemia': '',
|
||||||
'lvo': '',
|
'lvo': '',
|
||||||
'stenosis': ''
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def update_result():
|
def update_result():
|
||||||
@@ -23,8 +26,21 @@ def report_stroke():
|
|||||||
f"There is evidence of intracranial haemorrhage: {answers['haemorrhage']} {custom_text['haemorrhage']}\n"
|
f"There is evidence of intracranial haemorrhage: {answers['haemorrhage']} {custom_text['haemorrhage']}\n"
|
||||||
f"There is evidence of acute ischaemia: {answers['ischaemia']} {custom_text['ischaemia']}\n"
|
f"There is evidence of acute ischaemia: {answers['ischaemia']} {custom_text['ischaemia']}\n"
|
||||||
f"There is an intracranial LVO: {answers['lvo']} {custom_text['lvo']}\n"
|
f"There is an intracranial LVO: {answers['lvo']} {custom_text['lvo']}\n"
|
||||||
f"There is significant stenosis of the internal carotid arteries: {answers['stenosis']} {custom_text['stenosis']}"
|
f"There is significant extracranial internal carotid artery disease: {answers['ica_disease']}\n"
|
||||||
)
|
)
|
||||||
|
if answers['ica_disease'] == 'YES':
|
||||||
|
formatted_text += (
|
||||||
|
f"Side of ICA disease: {answers['ica_side']}\n"
|
||||||
|
)
|
||||||
|
if answers['quantify_stenosis'] == 'YES':
|
||||||
|
formatted_text += (
|
||||||
|
f"Left ICA stenosis: {answers['left_stenosis']}\n"
|
||||||
|
f"Right ICA stenosis: {answers['right_stenosis']}\n"
|
||||||
|
)
|
||||||
|
elif answers['quantify_stenosis'] == 'NO':
|
||||||
|
formatted_text += (
|
||||||
|
"Please discuss with a Vascular Radiologist and consider contemporaneous duplex imaging if the patient is a candidate for Carotid endarterectomy.\n"
|
||||||
|
)
|
||||||
result_box.value = formatted_text
|
result_box.value = formatted_text
|
||||||
|
|
||||||
def toggle_visibility(button, input_field):
|
def toggle_visibility(button, input_field):
|
||||||
@@ -33,10 +49,14 @@ def report_stroke():
|
|||||||
|
|
||||||
def set_all_to_false():
|
def set_all_to_false():
|
||||||
answers.update({
|
answers.update({
|
||||||
'haemorrhage': 'False',
|
'haemorrhage': 'NO',
|
||||||
'ischaemia': 'False',
|
'ischaemia': 'NO',
|
||||||
'lvo': 'False',
|
'lvo': 'NO',
|
||||||
'stenosis': 'False'
|
'ica_disease': 'NO',
|
||||||
|
'ica_side': '',
|
||||||
|
'quantify_stenosis': '',
|
||||||
|
'left_stenosis': '',
|
||||||
|
'right_stenosis': ''
|
||||||
})
|
})
|
||||||
update_result()
|
update_result()
|
||||||
|
|
||||||
@@ -45,7 +65,7 @@ def report_stroke():
|
|||||||
|
|
||||||
with ui.row():
|
with ui.row():
|
||||||
ui.label('There is evidence of intracranial haemorrhage')
|
ui.label('There is evidence of intracranial haemorrhage')
|
||||||
ui.radio(['True', 'False'], on_change=lambda e: (answers.update({'haemorrhage': e.value}), update_result())).props('inline')
|
ui.radio(['YES', 'NO'], on_change=lambda e: (answers.update({'haemorrhage': e.value}), update_result())).props('inline')
|
||||||
custom_input_haemorrhage = ui.input('Custom text', on_change=lambda e: (custom_text.update({'haemorrhage': e.value}), update_result()))
|
custom_input_haemorrhage = ui.input('Custom text', on_change=lambda e: (custom_text.update({'haemorrhage': e.value}), update_result()))
|
||||||
custom_input_haemorrhage.visible = False
|
custom_input_haemorrhage.visible = False
|
||||||
toggle_button = ui.button(icon='add', on_click=lambda: toggle_visibility(toggle_button, custom_input_haemorrhage)).props('flat dense')
|
toggle_button = ui.button(icon='add', on_click=lambda: toggle_visibility(toggle_button, custom_input_haemorrhage)).props('flat dense')
|
||||||
@@ -53,7 +73,7 @@ def report_stroke():
|
|||||||
|
|
||||||
with ui.row():
|
with ui.row():
|
||||||
ui.label('There is evidence of acute ischaemia')
|
ui.label('There is evidence of acute ischaemia')
|
||||||
ui.radio(['True', 'False'], on_change=lambda e: (answers.update({'ischaemia': e.value}), update_result())).props('inline')
|
ui.radio(['YES', 'NO'], on_change=lambda e: (answers.update({'ischaemia': e.value}), update_result())).props('inline')
|
||||||
custom_input_ischaemia = ui.input('Custom text', on_change=lambda e: (custom_text.update({'ischaemia': e.value}), update_result()))
|
custom_input_ischaemia = ui.input('Custom text', on_change=lambda e: (custom_text.update({'ischaemia': e.value}), update_result()))
|
||||||
custom_input_ischaemia.visible = False
|
custom_input_ischaemia.visible = False
|
||||||
toggle_button = ui.button(icon='add', on_click=lambda: toggle_visibility(toggle_button, custom_input_ischaemia)).props('flat dense')
|
toggle_button = ui.button(icon='add', on_click=lambda: toggle_visibility(toggle_button, custom_input_ischaemia)).props('flat dense')
|
||||||
@@ -61,19 +81,49 @@ def report_stroke():
|
|||||||
|
|
||||||
with ui.row():
|
with ui.row():
|
||||||
ui.label('There is an intracranial LVO')
|
ui.label('There is an intracranial LVO')
|
||||||
ui.radio(['True', 'False'], on_change=lambda e: (answers.update({'lvo': e.value}), update_result())).props('inline')
|
ui.radio(['YES', 'NO'], on_change=lambda e: (answers.update({'lvo': e.value}), update_result())).props('inline')
|
||||||
custom_input_lvo = ui.input('Custom text', on_change=lambda e: (custom_text.update({'lvo': e.value}), update_result()))
|
custom_input_lvo = ui.input('Custom text', on_change=lambda e: (custom_text.update({'lvo': e.value}), update_result()))
|
||||||
custom_input_lvo.visible = False
|
custom_input_lvo.visible = False
|
||||||
toggle_button = ui.button(icon='add', on_click=lambda: toggle_visibility(toggle_button, custom_input_lvo)).props('flat dense')
|
toggle_button = ui.button(icon='add', on_click=lambda: toggle_visibility(toggle_button, custom_input_lvo)).props('flat dense')
|
||||||
ui.tooltip('Add custom text for this option').on(toggle_button)
|
ui.tooltip('Add custom text for this option').on(toggle_button)
|
||||||
|
|
||||||
with ui.row():
|
with ui.row():
|
||||||
ui.label('There is significant stenosis of the internal carotid arteries')
|
ui.label('There is significant extracranial internal carotid artery disease')
|
||||||
ui.radio(['True', 'False'], on_change=lambda e: (answers.update({'stenosis': e.value}), update_result())).props('inline')
|
ui.radio(['YES', 'NO'], on_change=lambda e: (answers.update({'ica_disease': e.value}), update_result(), toggle_ica_options(e.value))).props('inline')
|
||||||
custom_input_stenosis = ui.input('Custom text', on_change=lambda e: (custom_text.update({'stenosis': e.value}), update_result()))
|
|
||||||
custom_input_stenosis.visible = False
|
# Additional options for ICA disease
|
||||||
toggle_button = ui.button(icon='add', on_click=lambda: toggle_visibility(toggle_button, custom_input_stenosis)).props('flat dense')
|
def toggle_ica_options(value):
|
||||||
ui.tooltip('Add custom text for this option').on(toggle_button)
|
ica_side_row.visible = value == 'YES'
|
||||||
|
quantify_stenosis_row.visible = value == 'YES'
|
||||||
|
|
||||||
|
ica_side_row = ui.row() # Create the row
|
||||||
|
ica_side_row.visible = False # Set visibility to False
|
||||||
|
with ica_side_row:
|
||||||
|
ui.label('Please indicate the side of ICA disease')
|
||||||
|
ui.radio(['R', 'L', 'Bilateral'], on_change=lambda e: (answers.update({'ica_side': e.value}), update_result())).props('inline')
|
||||||
|
|
||||||
|
quantify_stenosis_row = ui.row() # Create the row
|
||||||
|
quantify_stenosis_row.visible = False # Set visibility to False
|
||||||
|
with quantify_stenosis_row:
|
||||||
|
ui.label('Are you happy to quantify the degree of stenosis?')
|
||||||
|
ui.radio(['YES', 'NO'], on_change=lambda e: (answers.update({'quantify_stenosis': e.value}), update_result(), toggle_stenosis_options(e.value))).props('inline')
|
||||||
|
|
||||||
|
# Additional options for quantifying stenosis
|
||||||
|
def toggle_stenosis_options(value):
|
||||||
|
left_stenosis_row.visible = value == 'YES'
|
||||||
|
right_stenosis_row.visible = value == 'YES'
|
||||||
|
|
||||||
|
left_stenosis_row = ui.row() # Create the row
|
||||||
|
left_stenosis_row.visible = False # Set visibility to False
|
||||||
|
with left_stenosis_row:
|
||||||
|
ui.label('Left ICA stenosis')
|
||||||
|
ui.radio(['Unobstructed', 'Less than 50%', '50 to 70%', '70 to 90%', 'Greater than 90%', 'Occluded'], on_change=lambda e: (answers.update({'left_stenosis': e.value}), update_result())).props('inline')
|
||||||
|
|
||||||
|
right_stenosis_row = ui.row() # Create the row
|
||||||
|
right_stenosis_row.visible = False # Set visibility to False
|
||||||
|
with right_stenosis_row:
|
||||||
|
ui.label('Right ICA stenosis')
|
||||||
|
ui.radio(['Unobstructed', 'Less than 50%', '50 to 70%', '70 to 90%', 'Greater than 90%', 'Occluded'], on_change=lambda e: (answers.update({'right_stenosis': e.value}), update_result())).props('inline')
|
||||||
|
|
||||||
# Text box to display the selected answers
|
# Text box to display the selected answers
|
||||||
result_box = ui.textarea('Selected Answers:', value='').props('rows=10 style="width: 100%;" readonly')
|
result_box = ui.textarea('Selected Answers:', value='').props('rows=10 style="width: 100%;" readonly')
|
||||||
|
|||||||
Reference in New Issue
Block a user