Why do we map the firestore daily log to a python object? The alternative would be just to write to the dicts directly.
- 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.
- Richer value and type checking and better error handling
- Potential for future local analytics
- 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

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: