Saving and Charting Daily Vitals

I am making a health app and would like to create a screen to save vitals daily in TinyDB so it could be accessed (weight, blood pressure, etc.) I found an approach where I would get the current date from a clock and save the value in TinyDB under weight_ (insert date) (See code below). When charting this data, I try to combine the date (saved in global datelist) and the other part of the tag. However,
I have had various issues trying to get the data to cooperate with the chart. How could I rework the code of saving vitals, so I could chart it or how could I get the chart to work?


I found a spot in the AI2 Charts component Usage Guide covering usage of a TinyDB instance as a Data Source:

I haven't tried this yet, but I am guessing organizing your data by month in separate TinyDB NameSpaces of the form yyyyMM (202312) would allow you to keep a table of (day,reading) values under tags for 'weight', 'bloodPressure', etc.

Day of Month makes a nice x coordinate in a graph.

Testing if today's entry had already been added would be done by a lookup by pairs against the two column table of (day,reading) pairs for that reading category.

To add a new day's reading...

  • set the TinyDB NameSpace to the desired yyyyMM value
  • retrieve the tag/value you want to update (weight) into a variable
  • lookup in pairs against that variable to see if it has an entry for the desired day.
    • if present, complain
    • if not present
      • add row (day, reading) to the table
      • store the table back into TinyDB

Would you like to see a sample?

Thank you! An example would be great.

My experiments with direct feeds from TinyDB into the charts component were spotty at best.

I am including my failure here, for the record. This approach is new, and probably either buggy or misunderstood.


charts_TinyDB_daily.aia (4.6 KB)

I shall rework this to extract the monthly readings into a global variable, then feed the chart from that, which I know works.


This version works, loading from tables.
charts_TinyDB_daily_V1.aia (4.7 KB)

At the moment, I can't remember the trick to get a Date Picker to open at the last set date, instead of Now().

Thank you! What is the list picker for?

The list picker is for if you want to track more than just weight. Notice it's Elements from. string values in the Designer.