Spaces:
Sleeping
Sleeping
Yara Kyrychenko commited on
Commit ·
f81587e
1
Parent(s): 9c3cfcb
fix submission
Browse files
app.py
CHANGED
|
@@ -196,36 +196,20 @@ def submit():
|
|
| 196 |
|
| 197 |
st.text_area('Any feedback?',key="feedback")
|
| 198 |
if st.button('Submit', key=None, help=None, use_container_width=True, disabled=st.session_state.user_id=="" or st.session_state.score==50 or st.session_state.personalization_score==50):
|
| 199 |
-
submission_date = datetime.now() #.strftime("%Y-%m-%d %H:%M:%S")
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
"residence":st.session_state.residence,
|
| 214 |
-
#"zipcode":st.session_state.zipcode,
|
| 215 |
-
"property":st.session_state.property,
|
| 216 |
-
# "income":st.session_state.income,
|
| 217 |
-
"politics":st.session_state.politics,
|
| 218 |
-
"climate_actions":st.session_state.climate_actions,
|
| 219 |
-
"impact_open":st.session_state.impact_open,
|
| 220 |
-
"recycling":st.session_state.recycling,
|
| 221 |
-
"ev":st.session_state.ev,
|
| 222 |
-
"fossil":st.session_state.fossil,
|
| 223 |
-
"aerosol":st.session_state.aerosol,
|
| 224 |
-
"diet":st.session_state.diet,
|
| 225 |
-
"inserted":st.session_state.inserted,
|
| 226 |
-
"start_time":st.session_state.start_time,
|
| 227 |
-
"convo_start_time":st.session_state.convo_start_time,
|
| 228 |
-
"submission_time":submission_date,}
|
| 229 |
|
| 230 |
from pymongo.mongo_client import MongoClient
|
| 231 |
from pymongo.server_api import ServerApi
|
|
|
|
| 196 |
|
| 197 |
st.text_area('Any feedback?',key="feedback")
|
| 198 |
if st.button('Submit', key=None, help=None, use_container_width=True, disabled=st.session_state.user_id=="" or st.session_state.score==50 or st.session_state.personalization_score==50):
|
| 199 |
+
#submission_date = datetime.now() #.strftime("%Y-%m-%d %H:%M:%S")
|
| 200 |
+
|
| 201 |
+
keys = [
|
| 202 |
+
"user_id", "messages", "score", "personalization_score", "knowledge_score", "model",
|
| 203 |
+
"feedback",
|
| 204 |
+
"age", "gender", "education", "residence", "property", "politics",
|
| 205 |
+
"climate_actions", "impact_open",
|
| 206 |
+
"recycling", "ev", "fossil", "aerosol", "diet",
|
| 207 |
+
"inserted", "start_time", "convo_start_time"
|
| 208 |
+
]
|
| 209 |
+
|
| 210 |
+
user_data = {key: st.session_state[key] for key in keys}
|
| 211 |
+
user_data["condition"] = f"p{st.query_params['p']}"
|
| 212 |
+
user_data["submission_time"] = datetime.now()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 213 |
|
| 214 |
from pymongo.mongo_client import MongoClient
|
| 215 |
from pymongo.server_api import ServerApi
|