Need help using a dynamic data source

Hi - I’m quite new to Bubble so apologies if this is straightforward and I’ve missed something…

I am building an app which asks users to submit a score, and upon submission also calculates and saves their performance as a percentile against all other users who have submitted.

The users are separated into groups (for example under 25’s, 25-40 year olds etc), and compared against their peer groups performance.

So when a score is submitted, I need to be able to:

  1. take the users date of birth, and from it calculate their group (dob already saved in the ‘User’ data type)
  2. fetch the groups mean and standard deviation scores for the test in question, to calculate the Z-score (need to perform a lookup against some static data source here)
  3. look up the Z-score value in a z-score table and find the percentile value (again need to perform a lookup against a static data source)

Not sure where to go with this one so any help would be much appreciated. :smiley:

You just need to build a few workflows that do what you need them to do, have you tried building one? Make the score submit workflow first, then once that is working, copy it, 1 for each age group. for example the >25 years, on the workflow put an ‘only if current date - users DOB formatted in days >= 9125 days’

I would hold the SD and Z scores in a table on the database for reference.

Thanks nfish, really helpful.

How would you go about storing Z-scores and their respective probability values? There are perhaps 800 key value pairs to store… :confounded:

After calculating the Z-score using the various workflows as described above, I’d then need to take the score and lookup the respective probability value and save that in the workflow too

Yes that sounds good, break down the problem in to small steps and try and get one step at a time working with some dummy data, It will all start to fall together. Create your input and display pages with repeating groups. You can get CSV import on the hobby plan.

Thanks, still not sure how to store the Z-values? Any ideas on that?

Also how to lookup a value based on a key-value pair?

I’m not sure, what do they look like, how are they formatted etc?

Each Z-score would have an associated percentile value:

Z-score. Percentile.
0.1 50%
0.2 55%
0.3 58%
etc

Based on the calculated Z-score, I need to lookup the percentile value and save it…

Any ideas?

so just create a ‘z-score’ data type, with ‘score’ and ‘percent’ fields, then you can look them up. The and all of the records. You can import them from a CSV if you have bubble paid for plan ($29/month)

Thanks!