-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.js
More file actions
executable file
·183 lines (153 loc) · 8.18 KB
/
Copy pathsetup.js
File metadata and controls
executable file
·183 lines (153 loc) · 8.18 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
#!/usr/bin/env node
const readline = require('readline');
const chalk = require('chalk');
let rl = null;
function getRl() {
if (!rl) rl = readline.createInterface({ input: process.stdin, output: process.stdout });
return rl;
}
function question(query) {
const r = getRl();
return new Promise(resolve => r.question(query, resolve));
}
async function setup() {
console.clear();
console.log(chalk.cyan.bold('\n🏥 Welcome to StepSyncAI Health & Wellness Apps!\n'));
console.log(chalk.gray('═'.repeat(60)));
console.log(chalk.white('\nThis interactive setup will help you get started with:\n'));
console.log(chalk.green(' • 🧠 Mental Health Tracker') + ' - Mood, symptoms, triggers');
console.log(chalk.green(' • 💊 Medication Tracker') + ' - Pill reminders & adherence');
console.log(chalk.green(' • 😴 Sleep Tracker') + ' - Quality & duration monitoring');
console.log(chalk.green(' • 🏃 Exercise Tracker') + ' - Physical activity logging');
console.log(chalk.green(' • 📊 Daily Dashboard') + ' - Unified wellness overview');
console.log(chalk.green(' • ☁️ AWS For Kids') + ' - Cloud practitioner exam prep');
console.log(chalk.gray('\n' + '═'.repeat(60) + '\n'));
// Check if user wants to continue
const proceed = await question(chalk.yellow('Ready to get started? (yes/no): '));
if (proceed.toLowerCase() !== 'yes' && proceed.toLowerCase() !== 'y') {
console.log(chalk.gray('\nNo problem! Run this script anytime with: npm run setup\n'));
if (rl) rl.close();
return;
}
console.log(chalk.cyan('\n\n📋 Quick Setup Guide\n'));
console.log(chalk.gray('─'.repeat(60)));
// Step 1: Mental Health Profile
console.log(chalk.bold('\n1️⃣ Mental Health Tracker\n'));
const setupMental = await question(chalk.white(' Set up your mental health profile? (yes/no): '));
if (setupMental.toLowerCase() === 'yes' || setupMental.toLowerCase() === 'y') {
console.log(chalk.gray('\n Example command:'));
console.log(chalk.white(' node mental-health-tracker.js profile-setup "2024-01-01" "Recovery journey"'));
console.log(chalk.gray('\n This creates your profile with accident date and description.'));
console.log(chalk.yellow('\n ✏️ Try it: npm run mental profile-setup "YYYY-MM-DD" "Your description"'));
}
// Step 2: Medication Tracker
console.log(chalk.bold('\n2️⃣ Medication Tracker\n'));
const setupMeds = await question(chalk.white(' Add your medications? (yes/no): '));
if (setupMeds.toLowerCase() === 'yes' || setupMeds.toLowerCase() === 'y') {
console.log(chalk.gray('\n Example command:'));
console.log(chalk.white(' node medication-tracker.js add "Aspirin" "100mg" "Once daily" "08:00"'));
console.log(chalk.gray('\n This adds a medication with dosage, frequency, and reminder time.'));
console.log(chalk.yellow('\n ✏️ Try it: npm run med add "MedName" "Dosage" "Frequency" "Time"'));
}
// Step 3: Sample Data
console.log(chalk.bold('\n3️⃣ Sample Data\n'));
const createSamples = await question(chalk.white(' Generate sample wellness data to explore features? (yes/no): '));
if (createSamples.toLowerCase() === 'yes' || createSamples.toLowerCase() === 'y') {
console.log(chalk.cyan('\n Generating sample data...'));
try {
const MentalHealthTracker = require('./mental-health-tracker');
const SleepTracker = require('./sleep-tracker');
const ExerciseTracker = require('./exercise-tracker');
// Create sample mood logs
const mental = new MentalHealthTracker('test-mental-health-data.json');
const today = new Date();
for (let i = 0; i < 7; i++) {
const date = new Date(today);
date.setDate(date.getDate() - i);
const timestamp = date.toISOString();
const rating = Math.floor(Math.random() * 4) + 6; // 6-9
mental.data.moodLogs.push({
rating,
note: `Sample mood entry ${i + 1}`,
timestamp
});
}
mental.saveData();
// Create sample sleep entries
const sleep = new SleepTracker('test-sleep.json');
for (let i = 0; i < 7; i++) {
const date = new Date(today);
date.setDate(date.getDate() - i);
sleep.data.sleepEntries.push({
id: i + 1,
date: date.toISOString().split('T')[0],
bedtime: '22:30',
wakeTime: '06:30',
duration: 7.5 + (Math.random() - 0.5),
quality: Math.floor(Math.random() * 3) + 7,
notes: `Sample sleep entry ${i + 1}`,
timestamp: date.toISOString()
});
}
sleep.saveData();
// Create sample exercise logs
const exercise = new ExerciseTracker('test-exercise.json');
for (let i = 0; i < 5; i++) {
const date = new Date(today);
date.setDate(date.getDate() - i);
exercise.data.exercises.push({
id: i + 1,
date: date.toISOString().split('T')[0],
type: ['Running', 'Cycling', 'Yoga', 'Swimming'][Math.floor(Math.random() * 4)],
duration: Math.floor(Math.random() * 30) + 20,
intensity: ['low', 'moderate', 'high'][Math.floor(Math.random() * 3)],
notes: `Sample exercise ${i + 1}`,
timestamp: date.toISOString()
});
}
exercise.saveData();
console.log(chalk.green(' ✅ Sample data created!'));
console.log(chalk.gray('\n Test files created:'));
console.log(chalk.white(' • test-mental-health-data.json'));
console.log(chalk.white(' • test-sleep.json'));
console.log(chalk.white(' • test-exercise.json'));
} catch (error) {
console.log(chalk.red(` ❌ Error creating sample data: ${error.message}`));
}
}
// Step 4: Quick Command Reference
console.log(chalk.bold('\n4️⃣ Quick Command Reference\n'));
console.log(chalk.gray(' Here are the most useful commands:\n'));
console.log(chalk.cyan(' Mental Health:'));
console.log(chalk.white(' npm run mental log-mood 8 "Feeling good"'));
console.log(chalk.white(' npm run mental daily'));
console.log(chalk.cyan('\n Sleep Tracking:'));
console.log(chalk.white(' node sleep-tracker.js log 22:30 06:30 8'));
console.log(chalk.white(' node sleep-tracker.js stats'));
console.log(chalk.cyan('\n Exercise:'));
console.log(chalk.white(' node exercise-tracker.js log "Running" 30 moderate'));
console.log(chalk.white(' node exercise-tracker.js today'));
console.log(chalk.cyan('\n Daily Dashboard:'));
console.log(chalk.white(' node daily-dashboard.js daily'));
console.log(chalk.white(' node daily-dashboard.js correlations'));
console.log(chalk.white(' node daily-dashboard.js export-pdf'));
// Step 5: Documentation
console.log(chalk.bold('\n5️⃣ Documentation & Help\n'));
console.log(chalk.gray(' For detailed help on any tracker, run:\n'));
console.log(chalk.white(' node <tracker>.js help'));
console.log(chalk.gray('\n Check the README for complete documentation:\n'));
console.log(chalk.white(' cat README.md | less'));
// Final message
console.log(chalk.gray('\n' + '═'.repeat(60)));
console.log(chalk.green.bold('\n✅ Setup Complete!\n'));
console.log(chalk.white('You\'re all set to start tracking your wellness journey.'));
console.log(chalk.yellow('\n💡 Pro tip: Run commands daily to build meaningful insights!\n'));
console.log(chalk.gray('═'.repeat(60) + '\n'));
if (rl) rl.close();
}
// Run setup
setup().catch(err => {
console.error(chalk.red('\n❌ Setup error:', err.message));
if (rl) rl.close();
process.exit(1);
});