# Sessions Context This document describes the Session schema and how it serves as the unified storage model for both **Activities** and **Intentions**. ## Types of Sessions For historical and compatibility reasons, activities and intentions are both stored in the same `sessions` schema. They are different representations of the same underlying session data, with different contents in their `info` JSON field. **Key Distinction:** | Session Type | Distinction | Description | | --- | --- | --- | | Activity | No subjective-inputs | Represents specific actions or tasks performed by the user (e.g., running, yoga, cooking) | | Intention | Has subjective-inputs | Represents wellness goals and subjective feelings with user-reported measurements (e.g., calm, focus) | The shared session structure: ```json { "id": , "startDatetime": , "endDatetime": , "created": , "lastUpdated": , "type": , "info": , "userId": } ``` | Field | Type | Description | | --- | --- | --- | | `id` | UUID | Unique identifier for the session | | `startDatetime` | Timestamp | When the session started | | `endDatetime` | Timestamp|null | When the session ended (null for ongoing sessions) | | `created` | Timestamp | When the record was created | | `lastUpdated` | Timestamp | When the record was last modified | | `type` | Integer | Activity type (1-122) for Activities, 0 for Intentions | | `info` | JSON String | Contains activity/intention stringified JSON data | | `userId` | UUID | The user who owns this session (excluded from API responses) | ## Activities Activities represent specific actions or tasks performed by the user. They are sessions with **empty `subjectiveInputs` arrays** and **type values 1-122**. ### Activity `info` Schema The `info` field for activities contains a JSON string with the following structure: ```json { "name": , "origin": , } ``` | Field | Type | Description | | --- | --- | --- | | `name` | String | Custom name for the activity | | `origin` | Number | ActivityOrigin enum value (how activity was created) | ### Example Activity `info` ```json { "name": "Early afternoon cycle", "origin": 1 } ``` ### ActivityType The `type` field for activities ranges from 0-122, representing specific actions: | Value | Activity Type | Value | Activity Type | Value | Activity Type | Value | Activity Type | | --- | --- | --- | --- | --- | --- | --- | --- | | 0 | UNDEFINED | 31 | WEIGHTLIFTING | 62 | CROSS_COUNTRY | 93 | GAMING | | 1 | BREATHWORK | 32 | MARATHON | 63 | TRAMPOLINE | 94 | GARDENING | | 2 | ICE_BATH | 33 | TRIATHLON | 64 | SKIING | 95 | HAIRCUT | | 3 | CYCLING | 34 | JUMP_ROPE | 65 | SNOWBOARDING | 96 | MASSAGE | | 4 | DANCING | 35 | CIRCUIT_TRAINING | 66 | ICE_SKATING | 97 | MEETING | | 5 | EVENT | 36 | GYMNASTICS | 67 | HOCKEY | 98 | PANIC_ATTACK | | 6 | HIKING | 37 | STRETCH | 68 | SKATEBOARDING | 99 | PRAYER | | 7 | MEDITATION | 38 | BASKETBALL | 69 | ROCK_CLIMBING | 100 | PRESENTATION | | 8 | LISTENING_TO_MUSIC | 39 | CRICKET | 70 | PARAGLIDING | 101 | READING | | 9 | PAINT | 40 | VOLLEYBALL | 71 | SKYDIVING | 102 | WATCHING_TV | | 10 | PARTY | 41 | FOOTBALL | 72 | GOLF | 103 | SHOPPING | | 11 | WRITING | 42 | BASEBALL | 73 | ARCHERY | 104 | STUDYING | | 12 | PHOTOGRAPHY | 43 | DODGEBALL | 74 | BOWLING | 105 | THERAPY | | 13 | RELAXING | 44 | HANDBALL | 75 | BILLIARDS | 106 | WORKING | | 14 | RUN | 45 | TENNIS | 76 | DARTS | 107 | BATH | | 15 | SAUNA | 46 | RACQUETBALL | 77 | HIIT | 108 | PLAYING | | 16 | SEX | 47 | SQUASH | 78 | HORSEBACK_RIDING | 109 | BREASTFEEDING | | 17 | SINGING | 48 | BADMINTON | 79 | POLO | 110 | KNITTING | | 18 | SOCIALISING | 49 | TABLE_TENNIS | 80 | MOUNTAIN_CLIMBING | 111 | POTTERY | | 19 | SWIMMING | 50 | PADEL | 81 | SCUBA_DIVING | 112 | CONCERT | | 20 | WALKING | 51 | DIVING | 82 | DRIVE | 113 | PLAYING_MUSIC | | 21 | WORKOUT | 52 | KAYAKING | 83 | DD | 114 | NAIL_PAINTING | | 22 | YOGA | 53 | ROWING | 84 | MOTORBIKE | 115 | DOG_WALKING | | 23 | SITTING | 54 | CANOEING | 85 | CHESS | 116 | TRAVELLING | | 24 | ROLLER_SKATING | 55 | SAILING | 86 | PHYSIOTHERAPY | 117 | BOARD_GAME | | 25 | SNORKEL | 56 | SURFING | 87 | CLASS_LECTURE | | | | 26 | AEROBICS | 57 | WINDSURFING | 88 | COMMUTING | | | | 27 | PILATES | 58 | KITESURFING | 89 | COOKING | | | | 28 | TAI_CHI | 59 | WAKEBOARDING | 90 | CRAFTING | | | | 29 | BODYBUILDING | 60 | WATER_SKIING | 91 | HOUSEWORK | | | | 30 | CROSSFIT | 61 | MARTIAL_ARTS | 92 | FISHING | | | ### ActivityOrigin The `origin` field tracks how the activity was created: | Origin Type | Description | | --- | --- | | USER_GENERATED | User manually created the activity in the app | | AUTO_GENERATED | System automatically created the activity | | STARTED_OUTSIDE_APP | Activity started on device, not in app | | STOPPED_OUTSIDE_APP | Activity stopped on device, not in app | | STARTED_AND_STOPPED_OUTSIDE_APP | Both start and stop occurred outside the app | | LOGGED_FROM_TIMELINE | User logged the activity retroactively from timeline | ## Intentions `info` Schema Intentions represent wellness goals and subjective feelings. They are sessions with **non-empty `subjectiveInputs` arrays** and **type 0 (UNDEFINED)**. The `info` field for intentions contains a JSON string with the following structure: ```json { "name": , "subjectiveInputs": [ { "datetime": , "type": , "value": , "tag": , "note": } ], "origin": , "toolData": , "intentionInfoData": } ``` | Field | Type | Description | | --- | --- | --- | | `name` | String|null | Name/description of the intention (can be null) | | `subjectiveInputs` | Array | User-reported measurements (required, non-empty for true intentions) | | `origin` | Number | Optional ActivityOrigin enum value | | `toolData` | String | Optional metadata (often empty string) | | `intentionInfoData` | Base64String | Base64-encoded JSON with intention configuration details (see below) | ### IntentionInfoData Structure The `intentionInfoData` field is a base64-encoded JSON string with the following structure when decoded: ```json { "intention": , "intentionMethod": , "intentionDetails": { "writingPrompts": , "options": { "soundscape": , "breathingPattern": { "inhale": , "exhale": }, "selectedDuration": } } } ``` | Field | Type | Description | | --- | --- | --- | | `intention` | Number | IntentionTag enum value (0=CALM, 1=FOCUS, 2=ENERGY, 3=POSITIVITY) | | `intentionMethod` | Number | Method/technique used for the intention | | `intentionDetails` | Object | Detailed configuration including prompts, soundscape, breathing pattern, and duration | ### Example Intention `info` with SubjectiveInputs ```json { "name": "Walk", "subjectiveInputs": [ { "datetime": "2025-11-09T17:51:03Z", "type": 2, "value": 3, "tag": 0, "note": null }, { "datetime": "2025-11-09T17:51:03Z", "type": 2, "value": 5, "tag": 0, "note": null } ], "origin": 0, "toolData": "", "intentionInfoData": "" } ``` ### Example Intention `info` with IntentionInfoData ```json { "name": "1:2 Breathing", "subjectiveInputs": [], "origin": 0, "toolData": "", "intentionInfoData": "eyJpbnRlbnRpb24iOjAsImludGVudGlvbk1ldGhvZCI6MiwiaW50ZW50aW9uRGV0YWlscyI6eyJ3cml0aW5nUHJvbXB0cyI6W10sIm9wdGlvbnMiOnsic291bmRzY2FwZSI6eyJub25lIjp7fX0sImJyZWF0aGluZ1BhdHRlcm4iOnsiaW5oYWxlIjozLCJleGhhbGUiOjZ9LCJzZWxlY3RlZER1cmF0aW9uIjoxMjB9fX0=" } ``` When `intentionInfoData` is decoded: ```json { "intention": 0, "intentionMethod": 2, "intentionDetails": { "writingPrompts": [], "options": { "soundscape": { "none": {} }, "breathingPattern": { "inhale": 3, "exhale": 6 }, "selectedDuration": 120 } } } ``` ### IntentionTag The four core wellness goals users can set intentions for: | Value | Tag | Description | | --- | --- | --- | | 0 | CALM | Seeking calmness/relaxation | | 1 | FOCUS | Improving concentration/attention | | 2 | ENERGY | Boosting energy levels | | 3 | POSITIVITY | Enhancing mood/positivity | ### SubjectiveInput User-reported measurements that distinguish intentions from activities. | Field | Type | Description | | --- | --- | --- | | `datetime` | String (ISO 8601) | When the input was recorded | | `type` | Number | SubjectiveInputType enum value | | `value` | Number | Numeric rating/measurement | | `tag` | Number | IntentionTag enum value | | `note` | String|null | Optional note or comment (can be null) | ### SubjectiveInputType | Value | Type | Description | | --- | --- | --- | | 0 | UNDEFINED | Undefined input type | | 1 | MOOD | Mood rating | | 2 | FEELING | Emotional feeling | | 3 | CHECK_IN_CONTEXT_CATEGORY | Check-in context categorization | | 4 | DAY | Day rating/assessment | | 5 | SLEEP | Sleep quality rating | | 6 | RELATED_FEELING | Related emotional state | ## Summary: Activities vs Intentions | Feature | Activity | Intention | | --- | --- | --- | | **Purpose** | Track specific actions/tasks | Track wellness goals and feelings | | **Type field** | 1-122 (specific activities) | 0 (UNDEFINED) | | **SubjectiveInputs** | Empty array `[]` | Populated with measurements | | **Has Origin** | ✅ Yes | ❌ No | | **Has Tags** | ❌ No | ✅ Yes (CALM, FOCUS, ENERGY, POSITIVITY) | | **Example** | "30 min YOGA session" | "Morning CALM intention - feeling peaceful (7/10)" | | **Represents** | What you did | How you felt/want to feel |