emvecchi commited on
Commit
cde6187
1 Parent(s): b0f4dd5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -45
app.py CHANGED
@@ -34,7 +34,7 @@ COLS_TO_SAVE = ['comment_id']
34
 
35
  agreement_labels = ['strongly disagree', 'disagree', 'neither agree no disagree', 'agree', 'strongly agree']
36
  quality_labels = ['very poor', 'poor', 'acceptable', 'good', 'very good']
37
- priority_labels = ['not a priority', 'low priority', 'neutral', 'moderate priority', 'high priority']
38
  default_labels = agreement_labels
39
 
40
  function_choices = ['Broadening Discussion',
@@ -84,8 +84,7 @@ intro_fields: List[Field] = [
84
  Field(name="intro_experience", type="text", title="What do you feel contributes to a good experience for the users/discussion?"),
85
  Field(name="intro_valuable_comment", type="text", title="What makes a comment or contribution valuable?"),
86
  Field(name="intro_bad_comment", type="text", title="What makes a comment or contribution of poor quality, unconstructive or detrimental to the discussion?"),
87
-
88
- ]
89
  ]
90
 
91
  fields: List[Field] = [
@@ -227,8 +226,8 @@ def show_field(f: Field, index: int, data_collected):
227
  case 'select_slider':
228
  labels = default_labels if not f.other_params.get('labels') else f.other_params.get('labels')
229
  st.session_state.data_inputs[f.name] = st.select_slider(f.title,
230
- options=[0, 25, 50, 75, 100],
231
- format_func=lambda x: labels[x // 25],
232
  key=key,
233
  value=value, help=f.help)
234
  case 'multiselect':
@@ -337,46 +336,6 @@ else:
337
  st.write(f"Thank you for taking part in this study! Code to finish the study: {study_code}")
338
 
339
 
340
- #if st.session_state.current_index == -1:
341
- # user_id_from_url = get_user_id_from_url()
342
- # if user_id_from_url:
343
- # st.session_state.user_id = user_id_from_url
344
- # navigate(1)
345
- # else:
346
- # st.session_state.user_id = st.text_input('Please enter your user ID to proceed', value=user_id_from_url)
347
- # if st.button("Next"):
348
- # navigate(1)
349
- #
350
- #elif st.session_state.current_index < len(st.session_state.data):
351
- # st.write(f"username is {st.session_state.user_id}")
352
- #
353
- # # Creating the form
354
- # with st.form("feedback_form"):
355
- # index = st.session_state.current_index
356
- # data_collected = read_saved_data()
357
- # st.session_state.default_values = {}
358
- # st.session_state.data_inputs = {}
359
- #
360
- # for field in fields:
361
- # if field.name not in st.session_state.data.columns:
362
- # # Field doesn't exist in input dataframe, add it with a default value
363
- # st.session_state.data_inputs[field.name] = None
364
- # show_field(field, index)
365
- #
366
- # submitted = st.form_submit_button("Submit")
367
- # if submitted:
368
- # with st.spinner(text="saving"):
369
- # save_data({
370
- # 'user_id': st.session_state.user_id,
371
- # 'index': st.session_state.current_index,
372
- # **st.session_state.data.iloc[index][COLS_TO_SAVE].to_dict(),
373
- # **st.session_state.data_inputs
374
- # })
375
- # st.success("Feedback submitted successfully!")
376
- # navigate(1)
377
- #else:
378
- # st.write("Finished all data points!")
379
-
380
  # Navigation buttons
381
  if st.session_state.current_index > 0:
382
  if st.button("Previous"):
 
34
 
35
  agreement_labels = ['strongly disagree', 'disagree', 'neither agree no disagree', 'agree', 'strongly agree']
36
  quality_labels = ['very poor', 'poor', 'acceptable', 'good', 'very good']
37
+ priority_labels = ['not selected', 'not a priority', 'low priority', 'neutral', 'moderate priority', 'high priority']
38
  default_labels = agreement_labels
39
 
40
  function_choices = ['Broadening Discussion',
 
84
  Field(name="intro_experience", type="text", title="What do you feel contributes to a good experience for the users/discussion?"),
85
  Field(name="intro_valuable_comment", type="text", title="What makes a comment or contribution valuable?"),
86
  Field(name="intro_bad_comment", type="text", title="What makes a comment or contribution of poor quality, unconstructive or detrimental to the discussion?"),
87
+ ]),
 
88
  ]
89
 
90
  fields: List[Field] = [
 
226
  case 'select_slider':
227
  labels = default_labels if not f.other_params.get('labels') else f.other_params.get('labels')
228
  st.session_state.data_inputs[f.name] = st.select_slider(f.title,
229
+ options=[0, 20, 40, 60, 80, 100],
230
+ format_func=lambda x: labels[x // 20],
231
  key=key,
232
  value=value, help=f.help)
233
  case 'multiselect':
 
336
  st.write(f"Thank you for taking part in this study! Code to finish the study: {study_code}")
337
 
338
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
339
  # Navigation buttons
340
  if st.session_state.current_index > 0:
341
  if st.button("Previous"):