Data Structure & File Naming
File Naming Convention
Format: {course_code}{workbook_number}_response.json
All journal workbooks use workbook number 1.
| Example Filename | Course |
|---|---|
C14ENB1_response.json |
Confidence, English |
H23ENB1_response.json |
Smoking cessation, English |
S66ENB1_response.json |
Weight loss, English |
P11ENM1_response.json |
Productivity, English, Male voice |
Storage Location: Internal Storage/AppData/JSONs/User_Workbook_Responses/
Each HTML workbook must hardcode the filename:
const FILE_NAME = "C14ENB1_response.json";
JSON Response Structure
Every workbook response has this top-level structure:
| Field | Type | Description |
|---|---|---|
workbook_id |
String | Unique identifier for the workbook type |
created_at |
ISO8601 | First save timestamp (preserved across updates) |
updated_at |
ISO8601 | Most recent save timestamp |
ai_prompt |
String | Context for AI analysis of journal data |
data |
Object | Workbook-specific response data |
ai_prompt Field
Each workbook includes an ai_prompt field that provides context for AI analysis. Customize based on the workbook type:
ai_prompt: "This contains the user's anxiety journal responses. Analyze emotional patterns, identify triggers and effective coping strategies, and provide personalized recommendations."
Supported Input Types
The collectWorkbookData() function handles all these input types:
| Input Type | Collection Method |
|---|---|
| Text input | document.getElementById('field-id').value |
| Textarea | document.getElementById('textarea-id').value |
| Radio button | document.querySelector('input[name="group"]:checked')?.value |
| Checkboxes | Array.from(document.querySelectorAll('input[name="group"]:checked')).map(cb => cb.value) |
| Select dropdown | document.getElementById('select-id').value |
| Number | parseInt(document.getElementById('number-id').value) |
| Date | document.getElementById('date-id').value |
| Range slider | document.getElementById('slider-id').value |
| Calendar days | Array.from(document.querySelectorAll('.calendar-day.checked')).map(day => day.dataset.date) |
| Contenteditable | document.getElementById('editable-id').innerText |
Example: Anxiety Daily Journal
Full JSON response example:
{
"workbook_id": "anxiety_daily_journal",
"created_at": "2024-11-14T09:30:00.000Z",
"updated_at": "2024-11-14T15:45:23.000Z",
"ai_prompt": "Analyze emotional patterns, identify triggers and coping strategies...",
"data": {
"daily_entries": [
{
"date": "2024-11-14",
"mood_rating": "7",
"anxiety_level": 4,
"triggers": ["work_stress", "social_situations"],
"other_triggers": "Traffic jam on the way to work",
"physical_symptoms": ["racing_heart", "sweating", "muscle_tension"],
"mental_symptoms": ["worry", "overthinking"],
"coping_strategies": ["deep_breathing", "grounding_5_4_3_2_1"],
"effectiveness_rating": 8,
"thoughts_feelings": "Felt anxious about the presentation...",
"positive_moments": "Received compliment from my boss...",
"gratitude": ["Supportive colleagues", "Beautiful weather"],
"tomorrow_goal": "Practice presentation once more"
}
],
"completed_days": ["2024-11-01", "2024-11-02", "2024-11-14"],
"progress_tracking": {
"total_entries": 4,
"streak_days": 1,
"average_mood": "6.8",
"average_anxiety": "4.2"
}
}
}