emvecchi commited on
Commit
be77b48
1 Parent(s): 38c83dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -42,6 +42,7 @@ COLS_TO_SAVE = ['comment_id']
42
  agreement_labels = ['strongly disagree', 'disagree', 'neither agree no disagree', 'agree', 'strongly agree']
43
  quality_labels = ['very poor', 'poor', 'acceptable', 'good', 'very good']
44
  priority_labels = ['not selected', 'not a priority', 'low priority', 'neutral', 'moderate priority', 'high priority']
 
45
  default_labels = agreement_labels
46
 
47
  function_choices = ['Broadening Discussion',
@@ -145,7 +146,7 @@ fields: List[Field] = [
145
  Field(name="image_name", type="input_col", title=""),# "**Visualization of high contributing properties:**"),
146
 
147
  Field(type="container", title="**Need for Moderation**", children=[
148
- Field(name="to_moderate", type="radio",
149
  title="Do feel this comment/discussion would benefit from moderator intervention?", mandatory=True),
150
  Field(name="actions_clear", type="select_slider",
151
  title="With what level of **priority** would you need to interact with this comment?", other_params={'labels': priority_labels},
@@ -167,7 +168,7 @@ fields: List[Field] = [
167
  ]),
168
 
169
  Field(type="container", title="**Moderator Assistance**", children=[
170
- Field(name="helpful", type="radio",
171
  title="If this comment/discussion was flagged to you, would it be helpful in your task of moderation?", mandatory=True),
172
  Field(name="mod_assistance", type="multiselect",
173
  title="If yes, please motivate the benefit it would contribute to the task. *(Multiple selection possible)*",
@@ -185,7 +186,9 @@ INPUT_FIELD_DEFAULT_VALUES = {'slider': 0,
185
  'checkbox': False,
186
  'radio': None,
187
  'select_slider': 0,
188
- 'multiselect': False}
 
 
189
  SHOW_HELP_ICON = False
190
  SHOW_VALIDATION_ERROR_MESSAGE = True
191
 
@@ -337,6 +340,13 @@ def show_field(f: Field, index: int, data_collected):
337
  format_func=lambda x: labels[x],
338
  key=key,
339
  index=value, help=f.help, horizontal=True)
 
 
 
 
 
 
 
340
  case 'text':
341
  st.text_input(f.title, key=key, value=value)
342
  case 'textarea':
 
42
  agreement_labels = ['strongly disagree', 'disagree', 'neither agree no disagree', 'agree', 'strongly agree']
43
  quality_labels = ['very poor', 'poor', 'acceptable', 'good', 'very good']
44
  priority_labels = ['not selected', 'not a priority', 'low priority', 'neutral', 'moderate priority', 'high priority']
45
+ yes_no_labels = ['yes','no','other']
46
  default_labels = agreement_labels
47
 
48
  function_choices = ['Broadening Discussion',
 
146
  Field(name="image_name", type="input_col", title=""),# "**Visualization of high contributing properties:**"),
147
 
148
  Field(type="container", title="**Need for Moderation**", children=[
149
+ Field(name="to_moderate", type="y_n_radio",
150
  title="Do feel this comment/discussion would benefit from moderator intervention?", mandatory=True),
151
  Field(name="actions_clear", type="select_slider",
152
  title="With what level of **priority** would you need to interact with this comment?", other_params={'labels': priority_labels},
 
168
  ]),
169
 
170
  Field(type="container", title="**Moderator Assistance**", children=[
171
+ Field(name="helpful", type="y_n_radio",
172
  title="If this comment/discussion was flagged to you, would it be helpful in your task of moderation?", mandatory=True),
173
  Field(name="mod_assistance", type="multiselect",
174
  title="If yes, please motivate the benefit it would contribute to the task. *(Multiple selection possible)*",
 
186
  'checkbox': False,
187
  'radio': None,
188
  'select_slider': 0,
189
+ 'multiselect': None,
190
+ 'likert_radio': None,
191
+ 'y_n_radio': None}
192
  SHOW_HELP_ICON = False
193
  SHOW_VALIDATION_ERROR_MESSAGE = True
194
 
 
340
  format_func=lambda x: labels[x],
341
  key=key,
342
  index=value, help=f.help, horizontal=True)
343
+ case 'y_n_radio':
344
+ labels = yes_no_labels if not f.other_params.get('labels') else f.other_params.get('labels')
345
+ st.radio(f.title,
346
+ options=[0, 1, 2],
347
+ format_func=lambda x: labels[x],
348
+ key=key,
349
+ index=value, help=f.help, horizontal=True)
350
  case 'text':
351
  st.text_input(f.title, key=key, value=value)
352
  case 'textarea':