Models and AsyncStorage Keys - uoftblueprint/the-period-purse-ios GitHub Wiki

AsyncStorage Keys

A list of all keys stored in AsyncStorage that can be retrieved:

// Average Period Length of the User, may be NULL
averagePeriodLength: float
// Average Period Length of the User, may be NULL
averageCycleLength: float

// From Onboarding
initialPeriodStart: Date
// From Onboarding 
initialPeriodLength: int

// User's tracking Preferences
trackFlow: bool 
trackMood: bool
trackSleep: bool
trackCramps: bool
trackExercise: bool 


Models

Logging Symptoms

The symptoms of each day are stored in the following JSON format:

class Symptoms: 
{
    "Flow”:  FLOW_LEVEL,
    “Mood”: MOOD_LEVEL,
    "Sleep": float, 
    "Cramps": CRAMP_LEVEL, 
    "Exercise: {EXERCISE_TYPE: float, EXERCISE_TYPE: float },
    "Notes": string
}

Calendar

Calendar related values can be retrieved using the year and month. For a specific day of a year, retrieve the indexed value in the array for info from that day.

class CalendarData: 
Year: {
    Month: [
        DayInfo
    ]
}

Calendar Example

The (index + 1) of the array refers to the Month or Day of the month. For example, January 1st 2022 is the 0th index of the 0th index in key "2022" in AsyncStorage

“2022”: [
    // 0th index of the 2022 array is 1st month i.e. January has size 31
    [
         { // 0th index of the January array is the 1st day i.e. Jan 1st 
             “Flow”:  “LIGHT”,
             “Mood”: “HAPPY”,
             "Sleep": "7.5", 
             "Cramps": "MEDIUM", 
             "Exercise: {"BIKING": "0.5", "RUNNING": "1" },
             "Notes": "Happy new year! My resolution is to log symptoms every day."
         }, 
         {
             “Flow”:  "NONE",
             “Mood”: “SAD”,
         }, 
         null, 
         ..., 
    ], 

    // 1st index of the 2022 array is 2nd month i.e. February has size 28 or 29
    [...], 
    // 2nd index of the 2022 array is 3rd month i.e. March has size 31 
    [...], 
    ...
]

Enums

enum FLOW_LEVEL {
    NONE, 
    LIGHT, 
    MEDIUM, 
    HEAVY, 
    SPOTTING
}
enum MOOD_LEVEL {
    HAPPY, 
    NEUTRAL, 
    SAD, 
    LOL, 
    IDK, 
    GREAT, 
    SICK, 
    ANGRY, 
    LOVED 
}

image

enum CRAMP_LEVEL {
    NEUTRAL, 
    BAD, 
    TERRIBLE, 
    GOOD, 
    NONE
}
enum EXERCISE_TYPE {
    CARDIO, 
    YOGA, 
    STRENGTH, 
    BALL_SPORT, 
    MARTIAL_ARTS, 
    WATER_SPORT, 
    CYCLE_SPORT, 
    RACKET_SPORT, 
    WINTER_SPORT 
}