Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -119,13 +119,13 @@ Please indicate, in the box below, that you are at least 18 years old, have read
|
|
| 119 |
'''
|
| 120 |
|
| 121 |
fields: List[Field] = [
|
| 122 |
-
Field(name="patient", type="input_col", title="
|
| 123 |
Field(type="expander", title="**Session Transcription:** *(expand)*", children=[
|
| 124 |
Field(name="dialogue_name", type="input_col", title=""),
|
| 125 |
]),
|
| 126 |
|
| 127 |
Field(type="container", title="#### Session-/Patient-Specific Properties", children=[
|
| 128 |
-
Field(name="
|
| 129 |
title="Explicit mention of clinical diagnosis?", other_params={'labels': mentioned_y_n}, mandatory=True),
|
| 130 |
Field(name="priority_level", type="likert_radio",
|
| 131 |
title="Level of priority", other_params={'labels': priority_labels}, mandatory=True),
|
|
@@ -137,16 +137,14 @@ fields: List[Field] = [
|
|
| 137 |
]),
|
| 138 |
Field(name="rupture_marker", type="rupture_markers",
|
| 139 |
title="Select rupture markers noted in the session, include line numbers where rupture is found.", mandatory=False),
|
| 140 |
-
# Field(name="rupture_marker", type="multiselect",
|
| 141 |
-
# title="What type of rupture markers are found? *(Select only one)*",
|
| 142 |
-
# other_params={'choices': rupture_choices}, mandatory=True, following_mandatory_values=['Other (please specify)']),
|
| 143 |
-
# Field(name="rupture_marker", type="text", title="What lines demonstrate the rupture markers you notice?", mandatory=False),
|
| 144 |
-
# Field(name="rupture_marker_other", type="text", title="*If Other, please specify:*", mandatory=False),
|
| 145 |
]),
|
| 146 |
|
| 147 |
Field(type="container", title="#### True-To-Patient-Prompt Features", children=[
|
| 148 |
-
Field(
|
| 149 |
-
|
|
|
|
|
|
|
|
|
|
| 150 |
following_mandatory_values=[1]),
|
| 151 |
]),
|
| 152 |
|
|
@@ -644,9 +642,6 @@ def navigate(index_change):
|
|
| 644 |
#
|
| 645 |
|
| 646 |
def show_field(f: Field, index: int, data_collected):
|
| 647 |
-
"""Render a Field tree. Pure rendering (no form submit logic here)."""
|
| 648 |
-
|
| 649 |
-
# ---------- Non-input / structural types ----------
|
| 650 |
if f.type not in INPUT_FIELD_DEFAULT_VALUES.keys():
|
| 651 |
match f.type:
|
| 652 |
case 'input_col':
|
|
@@ -657,7 +652,6 @@ def show_field(f: Field, index: int, data_collected):
|
|
| 657 |
else None
|
| 658 |
)
|
| 659 |
|
| 660 |
-
# Render by name
|
| 661 |
if f.name == 'image_name' and value:
|
| 662 |
display_image(os.path.join(input_repo_path, 'images', value))
|
| 663 |
|
|
@@ -667,8 +661,14 @@ def show_field(f: Field, index: int, data_collected):
|
|
| 667 |
width_chars=115, height_px=520, show_border=False
|
| 668 |
)
|
| 669 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 670 |
elif f.name == 'patient' and value:
|
| 671 |
-
st.markdown(f"
|
| 672 |
|
| 673 |
elif value not in (None, np.nan, ""):
|
| 674 |
# generic fallback
|
|
|
|
| 119 |
'''
|
| 120 |
|
| 121 |
fields: List[Field] = [
|
| 122 |
+
Field(name="patient", type="input_col", title=""),
|
| 123 |
Field(type="expander", title="**Session Transcription:** *(expand)*", children=[
|
| 124 |
Field(name="dialogue_name", type="input_col", title=""),
|
| 125 |
]),
|
| 126 |
|
| 127 |
Field(type="container", title="#### Session-/Patient-Specific Properties", children=[
|
| 128 |
+
Field(name="diagnosis_mention", type="likert_radio",
|
| 129 |
title="Explicit mention of clinical diagnosis?", other_params={'labels': mentioned_y_n}, mandatory=True),
|
| 130 |
Field(name="priority_level", type="likert_radio",
|
| 131 |
title="Level of priority", other_params={'labels': priority_labels}, mandatory=True),
|
|
|
|
| 137 |
]),
|
| 138 |
Field(name="rupture_marker", type="rupture_markers",
|
| 139 |
title="Select rupture markers noted in the session, include line numbers where rupture is found.", mandatory=False),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
]),
|
| 141 |
|
| 142 |
Field(type="container", title="#### True-To-Patient-Prompt Features", children=[
|
| 143 |
+
Field(type="expander", title="**Patient Role Description:** *(expand)*", children=[
|
| 144 |
+
Field(name="role_name", type="input_col", title=""),
|
| 145 |
+
]),
|
| 146 |
+
Field(name="true_to_roll", type="y_n_radio",
|
| 147 |
+
title="Did the patient remain true to the provided patient description?", mandatory=True,
|
| 148 |
following_mandatory_values=[1]),
|
| 149 |
]),
|
| 150 |
|
|
|
|
| 642 |
#
|
| 643 |
|
| 644 |
def show_field(f: Field, index: int, data_collected):
|
|
|
|
|
|
|
|
|
|
| 645 |
if f.type not in INPUT_FIELD_DEFAULT_VALUES.keys():
|
| 646 |
match f.type:
|
| 647 |
case 'input_col':
|
|
|
|
| 652 |
else None
|
| 653 |
)
|
| 654 |
|
|
|
|
| 655 |
if f.name == 'image_name' and value:
|
| 656 |
display_image(os.path.join(input_repo_path, 'images', value))
|
| 657 |
|
|
|
|
| 661 |
width_chars=115, height_px=520, show_border=False
|
| 662 |
)
|
| 663 |
|
| 664 |
+
elif f.name == 'role_name' and value:
|
| 665 |
+
render_dialogue(
|
| 666 |
+
os.path.join(input_repo_path, 'role_descriptions', value),
|
| 667 |
+
width_chars=115, height_px=520, show_border=False
|
| 668 |
+
)
|
| 669 |
+
|
| 670 |
elif f.name == 'patient' and value:
|
| 671 |
+
st.markdown(f"### Patient: {value}")
|
| 672 |
|
| 673 |
elif value not in (None, np.nan, ""):
|
| 674 |
# generic fallback
|