Wellness Wheel Chart - where do I store my data?

Hello everyone, I am trying to make a questionnaire that asks the user 36 questions. The user will answer with a Slider- the degree to which each question is true. There are six categories of questions: “Physical, Financial, Intellectual, Emotional, Social, Spiritual.” At the end of the questionnaire, I am hoping to show the user a “wellness wheel” that is a radar chart that shows the users scores plotted in the six areas. Right now my program has a local database that contains all of the questions. When the user clicks “next” the next Question in the database is shown. I have a slider in place- but I am at a loss as to where I should be tracking the score within the six separate categories. At first I was trying to “write” the score back to the local Database- but that didn’t work. Then I tried to write the score out to a google sheet with a third party API. I couldn’t get that going either. I really don’t know if I should be storing the data in a list, or a variable or what. I need each individual score totaled for the six categories in order to plot the chart properly. I don’t even know if the chart is a possibility- I’m just trying to take this one step at a time. Any recommendations for data storage would be greatly welcomed. Thanks so much.

2 Likes

This is all definitely possible. @jared knows a lot about graphs and a few other people do, too.

As for storing the values from your sliders, it’s really dependent on how you intend to use them later. If you only need device-level access to the data (that is, you’re not needing a cloud-based spreadsheet that you can access from anywhere), then a local database is a good idea.

You say it didn’t work to write the score back to the local database. Post a screenshot of the blocks you used and someone can help you troubleshoot your code. This is a really common use for Thunkable so I’m confident we’ll be able to help you!

3 Likes

Tatiang,
Thanks so much for the guidance! Unfortunately erased all of my failed attempts to push the slider value to the server- but the picture above shows my attempt at sending the data to a list named “physicalScore.” I’m thinking that if I make six different lists, it might be easier to sum up the data in the end to make the chart.

1 Like

Lists are usually a lot more work to manage than a database which is essentially a spreadsheet. You can create a database in Thunkable with the columns you need and then just add rows or update cells as necessary.

I assume you want something like this?

Name Physical Financial Intellectual Emotional Social Spiritual
Ted 4 1 1 5 6 5
Beth 6 5 6 3 5 2
3 Likes

Tatiang,
Thank you, yes. Actually the database could be a bit more simple, I think. I don’t even need to permanently track scores. I just need the score kept for the duration of the game, in order to produce the chart at the end. After the user exits the app, all of the data can be reset. So really I just need the score in the six categories. I’m going to go back and try with the database. Thanks so much for your help.

1 Like

For sure is, when you’re ready let’s build a thunkable chart on the forum and show others how it works!

2 Likes

You’re welcome! If you get stuck, just give us a few more details about your data set. For example, I’m not clear on whether each category such as Financial has one score or multiple scores that you are summing/averaging. And if only one person is using the app on a single device then the storage should be pretty simple and a local database or list (as stored variable) should suffice.

1 Like

jared!! OMG Thank you- even if only for your reassurance. Right now I’m working on the DB element. I finally got the slider value writing to a Realtime Firebase database at 1am last night. Once I figure that out, I will certainly accept any guidance you can give. I’m pasting the link to my Google sheets version. You can see the code I’ve written to calculate the values, and the Wheel populates at the bottom of the sheet. I believe it’s called a Radar chart. It’s supposed to demonstrate the need for balance in all areas of one’s life. Ironically, it is making me literally insane. I really appreciate your help. :slight_smile:

Google sheets version Wellness Wheel

Tatiang,
I just could not write to the local DB- which is so odd, because all of my questions are stored in there, and I have no trouble access those. I went through a YouTube video and set up a Firebase Realtime Database. At about 1am last night I wrote the first glorious bit of data to the database. Right now I only have one cell of data, so that’s my next step- figuring out how to get the value of each answer. To try to better explain my dataset, I am pasting a URL to my Google Sheets version of the same project below. There are six categories ( Physical, Financial, Intellectual, Emotional, Social, Spiritual) each having six questions each. There are 36 questions total to be answered by a slider with a possible value of 1-6. So the first bit of data I need would be 36 numerical values taken from the value of a slider. To get my chart data, I will need to SUM each category. So in the end, I will only have 6 numbers that are the sum of each category. That’s what I will need to chart. In my google sheets version you can see all of my code to the right of the questionnaire. Thanks for any advice you can give. It is greatly appreciated.

When you’re working with blocks that generate a green error block, it’s important to check that value in your code. For example, you can set a label’s value to the green error block to see what happens when you try to save data to the Realtime DB.

Also, I can’t see any of your code from that link. It’s just blank. You can share a link to your project if you like.

paste this in your browser’s url:

https://quickchart.io/chart?width=500&height=300&c={type:'radar',
data:{labels:['Physical','Financial','Intellectual','Emotional','Social','Spiritual'],
datasets:[
{label:'Bob',data:[4.8,3.6,2.5,1.8,4.2,5],fill:false,borderColor:'%234e79a7'}
]},options:{scale:{ticks:{min:0}}}}

that’s how easy it is to make a radar chart. as you can see you only have to come up with the list of category names, the label (eg.‘Bob’) and the list data points (eg. [4.8,3.6,2.5,1.8,4.2,5]) and you have enough to build a radar chart.
so you need to have the following data structures:

  • a list of category scores, 6 items, corresponding to the number of categories.
  • another list (aka score list) of 36 items which will start initially with all zeroes then you update them as each question is answered - ie. the score of question 7 will update the 7th entry in the score list.
  • another list (aka itemcat_list), parallel to the score list, which contains the category codes corresponding to the question, eg. [1,1,1,1,1,1,2,2,2,2,2,2,etc] - the value will be used at the computation of the score. for example, the response to the 7th question will be added into the 2nd score total.

your questions can reside in the local storage table with these columns: sequence (1…36), category code (1=spiritual, 2=social, etc), question (the actual question).
at the start, while you initialize the score_list with zeroes, you can build the itemcat_list from the category code column in the table.
as each question is answered, store the response in the score list. upon completion of the quiz, gather the responses and sum the score to the correct bucket according to the category code. finally, compute the average score per category. the resulting list , along with a corresponding label, goes to the chart url mentioned at the beginning.

good luck!

2 Likes