Watts-Lab / commonsense-platform

Commonsense platform
https://commonsense.seas.upenn.edu
1 stars 0 forks source link

The answers page on dashboard should 1) show statement commonsensicality, 2) let me change my mind #128

Open markwhiting opened 2 months ago

markwhiting commented 2 months ago

I think it might be neat to show people how they agree or disagree with others, and where their common sense is wrong.

Further, I think it would be good to let someone say something like "I changed my mind" but that seems like a very low priority options that perhaps we should ignore for now.

acao22 commented 1 week ago

Hi, for some reason the nodemailer still doesn't work for me -- I have my email and password in the .env file and I have created an email with the NodeMailer link, but the email just doesn't send. Not sure what the issue is but I've tried troubleshooting for a while so for now I think I'll just manually access the Dashboard by temporarily adding it to the Navbar or trying something else. If you have any ideas for nodemailer please let me know and thank you!

acao22 commented 1 week ago

nevermind, got it to work! typed my email wrong...

acao22 commented 1 week ago
Screenshot 2024-06-21 at 3 39 13 AM

I implemented a toggle for the I_agree variable and others_agree variable -- when the top right button "Edit your answers" is clicked, users can update their answers by moving the toggle and the backend updates as well. Then when clicking done the toggles go away and the answers are all saved. I also added a bit of transition animation for the button and made it the same color as the navbar to go with the theme. Let me know any suggestions/feedback and I can open a PR soon!

Also, for reference the branch I am working on is 128-change-answers

acao22 commented 1 week ago

As for showing people how they agree or disagree with others, and where their common sense is wrong, is there a specific table/column in the backend that I can reference? I see the commonsensicality value in Scores.ts but that is for a user as a whole, not a specific question, so not sure where to find the total similar/different answers for a question unless I should do that myself -- thanks!

amirrr commented 1 week ago

As for showing people how they agree or disagree with others, and where their common sense is wrong, is there a specific table/column in the backend that I can reference? I see the commonsensicality value in Scores.ts but that is for a user as a whole, not a specific question, so not sure where to find the total similar/different answers for a question unless I should do that myself -- thanks!

Good job on the dashboard. For commonsensicality comparison, you have to calculate the commonsensicality per statement based on the statement_number of each answer from user and then return that for that user. My suggestion is create a new endpoint api on the answer/results route that takes a list of statement_ids and returns a list commonsensicality score for that statement. Here is the formula for the commonsensicality score for each statement:

image
acao22 commented 1 week ago

Okay thank you so much! I made a new endpoint on results/commonsensicality that calculates commonsensicality for each question and I displayed it in a new column on the Answers tab of dashboard. If maybe you could take a look at my math on the API endpoint that would be great -- I tried to follow the equation above as closely as possible but not sure if I missed anything. Thanks!

markwhiting commented 1 week ago

Exciting to see this coming together! I am not totally sure if we want commonsensicality or something like "you answered the same as 60% of people" or something like that.

The main Idea we might want to help uncover is that what you think might be different from what others think on a particular issue.

However, I'm absolutely open to ideas here. So let me know what you all think.

acao22 commented 1 week ago

Ah, I think that might make more sense -- normal users might not know what the commensensicality score means so it might not be that informative to them. I can implement the "you answered the same as 60% of people" option too

Also would that make people more inclined to edit their answer after they've seen the stats of others? Just a quick thought but if it's fine for that to happen then no worries

markwhiting commented 1 week ago

Yes. On the back end we should store this as a change, as opposed to their only answer. I think if we just store it as another row in the table of responses, i.e., as a second response on an item they already responded to, then it should be ok — we can think about how to work with that data in analysis, and of course the change should be time stamped.

acao22 commented 1 week ago
image

Okay, I made another endpoint under results/agreementPercentage that calculates how much you answered the same as other people. It's now displayed on the Dashboard screen as a new column -- I just averaged the agreementPercentage for both I_agreeand others_agree and displayed it as one percentage, unless we want to put individual agreement percentages for I_agree and others_agree. Also I commented out the commensensicality column for now

One thing to note is that this agreement percentage only displays the percentage that you agreed with others for your original answer, it doesn't update when you change your answer -- should I fix that? I left it alone for now because I need to also change it so that the backend stores the edit as a change, right now it is just overwriting the current answer. I might need to think about how to do that more in depth as I'm less familiar than backend but maybe we can talk about it at the wrap-up meeting today -- thanks!

markwhiting commented 1 week ago

Cool, let's do a minor adjustment to that. Let's compare the rater's second column to everyone else's first column. So if I said "I think most other people don't agree" but actually 60% of people agree with it, it should effectively indicate that what you think others think is correct only 40% of the time for that statement. Does that make sense?

And actually can we throw in another small tweak. Can you adjust the first column heading to be "I agree", and the to "I think most others agree"

markwhiting commented 1 week ago

Just to try to clarify the percentage column — it's tricky and something that we went around and around on when developing the commonsensicality score: I think we should show the % of people for whom my perception of what others think is accurate.

So if my answer to "I think most others agree" is "yes" and of others, 65% answered "yes" then I would get a 65%. However, If I had answered "no" and 65% of others answered "yes" then my score would be 35%.

Does that sound ok?

markwhiting commented 1 week ago

Perhaps the headline for it is something like "People who think what you think most people think"

acao22 commented 5 days ago
Screenshot 2024-06-25 at 3 26 06 PM

Adjusted the first and second columns names, and also fixed the column percentages -- I pushed to the branch 128-change-answers

For the backend, could you walk me through how I would add a new row/rows for changed answers and a timestamp? I'm a little unfamiliar with the backend. Thanks!

acao22 commented 3 days ago
Screenshot 2024-06-27 at 11 27 49 PM

Added the new row for each changed answer and its timestamp (the commented out code is the previous version, I replaced it withanswer.createso that it inserts a new row with the current timestamp whenever an answer is changed.

There is still one bug -- the percentage column displayed on the Dashboard doesn't actively update when an answer is changed, but I will look into it and try to fix it. Once that is resolved, I believe this issue should be completed and I can do a PR. Thanks!

amirrr commented 3 days ago
Screenshot 2024-06-27 at 11 27 49 PM

Added the new row for each changed answer and its timestamp (the commented out code is the previous version, I replaced it withanswer.createso that it inserts a new row with the current timestamp whenever an answer is changed.

There is still one bug -- the percentage column displayed on the Dashboard doesn't actively update when an answer is changed, but I will look into it and try to fix it. Once that is resolved, I believe this issue should be completed and I can do a PR. Thanks!

Looks good. For updates you have to look into useState hook. whenever there is a change, it will trigger a function, which in your case can be a new call to the backend