-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcombined_progress_api.py
More file actions
209 lines (205 loc) · 7.45 KB
/
Copy pathcombined_progress_api.py
File metadata and controls
209 lines (205 loc) · 7.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
import os
from openai import OpenAI
from datetime import date, datetime, timedelta
from flask import Blueprint, request, jsonify
from firebase_admin import firestore
# Import helpers from progress_api if needed
from progress_api import get_user_sessions, get_total_time, get_daily_motivational_quote
combined_progress_bp = Blueprint('combined_progress', __name__)
@combined_progress_bp.route('/progress/combined', methods=['GET'])
def get_combined_progress():
user_id = request.args.get('user_id')
if not user_id:
return jsonify({'error': 'user_id is required'}), 400
# Static data for prototype users
if user_id == "DxchnGkk5hf52qP0fOjHmTAp1oX2" :
# Engaged user with consistent usage
return jsonify({
"progress": {
"wellness_streak": 14,
"wellness_streak_text": "14 days of showing up for yourself",
"milestone_message": "Two weeks of consistency!",
"next_milestone": 21,
"next_milestone_message": "Keep going! Next milestone at 21 days"
},
"healing_journey": {
"times_showed_up": 22,
"time_for_yourself": "46h",
"day_streak": 14,
"mood_checkins": 28
},
"milestones": [
{
"title": "You Took the First Step",
"description": "Started your first therapy session",
"achieved": True,
"progress": 1,
"target": 1
},
{
"title": "You're Showing Up Regularly",
"description": "Completed 5 therapy sessions",
"achieved": True,
"progress": 5,
"target": 5
},
{
"title": "Committed to Growth",
"description": "Completed 10 therapy sessions",
"achieved": True,
"progress": 10,
"target": 10
},
{
"title": "Checking In With Yourself",
"description": "Logged your mood for 7 days",
"achieved": True,
"progress": 7,
"target": 7
},
{
"title": "Consistency Champion",
"description": "Maintained a 14-day wellness streak",
"achieved": True,
"progress": 14,
"target": 14
},
{
"title": "Wellness Warrior",
"description": "Completed 25 therapy sessions",
"achieved": False,
"progress": 22,
"target": 25
},
{
"quote": "Every small step is progress. Celebrate your journey!"
}
]
})
elif user_id == "eVpZUJWiQAUx97RizTgTnJqwD6O2":
# Moderate user with weekday-focused usage
return jsonify({
"progress": {
"wellness_streak": 5,
"wellness_streak_text": "5 days of showing up for yourself",
"milestone_message": "Keep going!",
"next_milestone": 7,
"next_milestone_message": "Keep going! Next milestone at 7 days"
},
"healing_journey": {
"times_showed_up": 15,
"time_for_yourself": "32h",
"day_streak": 5,
"mood_checkins": 20
},
"milestones": [
{
"title": "You Took the First Step",
"description": "Started your first therapy session",
"achieved": True,
"progress": 1,
"target": 1
},
{
"title": "You're Showing Up Regularly",
"description": "Completed 5 therapy sessions",
"achieved": True,
"progress": 5,
"target": 5
},
{
"title": "Committed to Growth",
"description": "Completed 10 therapy sessions",
"achieved": True,
"progress": 10,
"target": 10
},
{
"title": "Checking In With Yourself",
"description": "Logged your mood for 7 days",
"achieved": True,
"progress": 7,
"target": 7
},
{
"title": "Consistency Champion",
"description": "Maintained a 14-day wellness streak",
"achieved": False,
"progress": 5,
"target": 14
},
{
"title": "Wellness Warrior",
"description": "Completed 25 therapy sessions",
"achieved": False,
"progress": 15,
"target": 25
},
{
"quote": "Progress is progress, no matter how small."
}
]
})
# Default response for other users
return jsonify({
"progress": {
"wellness_streak": 0,
"wellness_streak_text": "0 days of showing up for yourself",
"milestone_message": "Start your journey today!",
"next_milestone": 7,
"next_milestone_message": "Keep going! Next milestone at 7 days"
},
"healing_journey": {
"times_showed_up": 0,
"time_for_yourself": "0h",
"day_streak": 0,
"mood_checkins": 0
},
"milestones": [
{
"title": "You Took the First Step",
"description": "Started your first therapy session",
"achieved": False,
"progress": 0,
"target": 1
},
{
"title": "You're Showing Up Regularly",
"description": "Completed 5 therapy sessions",
"achieved": False,
"progress": 0,
"target": 5
},
{
"title": "Committed to Growth",
"description": "Completed 10 therapy sessions",
"achieved": False,
"progress": 0,
"target": 10
},
{
"title": "Checking In With Yourself",
"description": "Logged your mood for 7 days",
"achieved": False,
"progress": 0,
"target": 7
},
{
"title": "Consistency Champion",
"description": "Maintained a 30-day wellness streak",
"achieved": False,
"progress": 0,
"target": 30
},
{
"title": "Wellness Warrior",
"description": "Completed 25 therapy sessions",
"achieved": False,
"progress": 0,
"target": 25,
},
{
"quote": "Your mental health journey starts with a single step."
}
]
})