Why do we map the firestore daily log to a python object? The alternative would be just to write to the dicts directly.

  1. As a philosophy, since we’re using a python runtime in Cloud Functions, we may as well speak the language directly. So we have an interface between the database dicts and native python objects and then do all processing in pure python and only convert back and forth at download and upload time. The downside is that there are more pieces of the code to update with each new feature.
  2. Richer value and type checking and better error handling
  3. Potential for future local analytics
  4. Flexibility for replacing chat bot engines (eg to ChatGPT from Dialogflow) by abstracting away processing and keeping a single translation layer

Class Design

DailyLog

- date: str
- activities: map(name, Activity)
- activity_notes: str
- pains: map(name, Pain)
- pain_notes: str

Activity

- name: str
- sets: list(Set)

Pain

- name: str
- levl: int

Intent

- type
- raw_entity
- log_input
- date
- user

Intent Parsing Layer

LogActivity

Untitled

This layer must pivot the incoming data from DialogFlow request into sets because the input is split into separate arrays for reps/durations/weights.

Some important characteristics of the input request are: