emvecchi commited on
Commit
29f2786
·
verified ·
1 Parent(s): 6701bea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -15
app.py CHANGED
@@ -119,6 +119,9 @@ Please indicate, in the box below, that you are at least 18 years old, have read
119
 
120
  fields0: List[Field] = [
121
  Field(name="patient", type="input_col", title=" "),
 
 
 
122
  Field(type="expander", title="**Session Transcription:** *(expand)*", children=[
123
  Field(name="dialogue_name", type="input_col", title=""),
124
  ]),
@@ -139,7 +142,7 @@ fields0: List[Field] = [
139
  title="Select rupture markers noted in the session, include line numbers where rupture is found.", mandatory=False),
140
  ]),
141
  ]
142
- fields1: List[Field] = [
143
  Field(type="container", title="#### True-To-Patient-Prompt Features", children=[
144
  Field(type="expander", title="**Patient Role Description:** *(expand)*", children=[
145
  Field(name="role_name", type="input_col", title=""),
@@ -585,20 +588,17 @@ def show_field(f: Field, index: int, data_collected):
585
  else None
586
  )
587
 
588
- if f.name == 'image_name' and value:
589
- display_image(os.path.join(input_repo_path, 'images', value))
 
 
 
590
 
591
  elif f.name == 'dialogue_name' and value:
592
- render_dialogue(
593
- os.path.join(input_repo_path, 'dialogues', value),
594
- width_chars=115, height_px=520, show_border=False
595
- )
596
-
597
  elif f.name == 'role_name' and value:
598
  render_markdown_simple(os.path.join(input_repo_path, 'role_descriptions', value), height_px=520)
599
- #,
600
- #width_chars=115, height_px=520, show_border=False
601
- #)
602
 
603
  elif f.name == 'patient' and value:
604
  st.markdown(f"#### Patient:  {value}")
@@ -609,12 +609,19 @@ def show_field(f: Field, index: int, data_collected):
609
  st.write(value)
610
 
611
  case 'markdown':
612
- path = f.other_params.get("path") if f.other_params else None
613
- if path:
614
- content = load_text(os.path.join(input_repo_path, path))
 
 
615
  st.markdown(content, unsafe_allow_html=True)
616
  else:
617
- st.markdown(f.title)
 
 
 
 
 
618
 
619
  case 'expander':
620
  with (st.expander(f.title) if f.type == 'expander' else st.container(border=True)):
 
119
 
120
  fields0: List[Field] = [
121
  Field(name="patient", type="input_col", title=" "),
122
+ Field(type="markdown", title="", mandatory=False, other_params={"use_dialogue_name": True}),
123
+ ]
124
+ fields1: List[Field] = [
125
  Field(type="expander", title="**Session Transcription:** *(expand)*", children=[
126
  Field(name="dialogue_name", type="input_col", title=""),
127
  ]),
 
142
  title="Select rupture markers noted in the session, include line numbers where rupture is found.", mandatory=False),
143
  ]),
144
  ]
145
+ fields2: List[Field] = [
146
  Field(type="container", title="#### True-To-Patient-Prompt Features", children=[
147
  Field(type="expander", title="**Patient Role Description:** *(expand)*", children=[
148
  Field(name="role_name", type="input_col", title=""),
 
588
  else None
589
  )
590
 
591
+ #elif f.name == 'dialogue_name' and value:
592
+ # render_dialogue(
593
+ # os.path.join(input_repo_path, 'dialogues', value),
594
+ # width_chars=115, height_px=520, show_border=False
595
+ # )
596
 
597
  elif f.name == 'dialogue_name' and value:
598
+ render_markdown_simple(os.path.join(input_repo_path, 'dialogues', value), height_px=720)
599
+
 
 
 
600
  elif f.name == 'role_name' and value:
601
  render_markdown_simple(os.path.join(input_repo_path, 'role_descriptions', value), height_px=520)
 
 
 
602
 
603
  elif f.name == 'patient' and value:
604
  st.markdown(f"#### Patient:  {value}")
 
609
  st.write(value)
610
 
611
  case 'markdown':
612
+ if f.other_params and f.other_params.get("use_dialogue_name"):
613
+ row = st.session_state.data.iloc[index]
614
+ dialogue_name = row["dialogue_name"]
615
+ md_path = os.path.join(input_repo_path, "dialogues", dialogue_name)
616
+ content = load_text(md_path)
617
  st.markdown(content, unsafe_allow_html=True)
618
  else:
619
+ path = f.other_params.get("path") if f.other_params else None
620
+ if path:
621
+ content = load_text(os.path.join(input_repo_path, path))
622
+ st.markdown(content, unsafe_allow_html=True)
623
+ else:
624
+ st.markdown(f.title)
625
 
626
  case 'expander':
627
  with (st.expander(f.title) if f.type == 'expander' else st.container(border=True)):