Repository navigation
Expand file tree
/
Copy pathsetup.ps1
More file actions
121 lines (100 loc) · 3.82 KB
/
Copy pathsetup.ps1
File metadata and controls
121 lines (100 loc) · 3.82 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
# Smart ICU Dashboard - Quick Start Script
Write-Host "Smart ICU Dashboard - Setup Wizard" -ForegroundColor Cyan
Write-Host "======================================`n" -ForegroundColor Cyan
# Check prerequisites
Write-Host "Checking prerequisites..." -ForegroundColor Yellow
# Check Node.js
try {
$nodeVersion = node --version
Write-Host "Node.js $nodeVersion installed" -ForegroundColor Green
}
catch {
Write-Host "Node.js not found. Please install Node.js 18+ from nodejs.org" -ForegroundColor Red
exit 1
}
# Check Python
try {
$text = python --version 2>&1
Write-Host "$text installed" -ForegroundColor Green
}
catch {
Write-Host "Python not found. Please install Python 3.9+ from python.org" -ForegroundColor Red
exit 1
}
# Check MongoDB
$mongoRunning = Get-Process -Name mongod -ErrorAction SilentlyContinue
if ($mongoRunning) {
Write-Host "MongoDB is running" -ForegroundColor Green
}
if (-not $mongoRunning) {
Write-Host "MongoDB not detected. Please start MongoDB or use MongoDB Atlas" -ForegroundColor Yellow
}
Write-Host "`nSetting up project...`n" -ForegroundColor Cyan
# Setup Backend
Write-Host "Installing backend dependencies..." -ForegroundColor Yellow
if (Test-Path "backend") {
Set-Location backend
if (-not (Test-Path "node_modules")) {
npm install
}
if (-not (Test-Path ".env")) {
Write-Host "Creating backend .env file..." -ForegroundColor Yellow
if (Test-Path ".env.example") {
Copy-Item .env.example .env
Write-Host "Please update backend/.env with your MongoDB URI and JWT secret" -ForegroundColor Yellow
}
if (-not (Test-Path ".env.example")) {
Write-Host "backend/.env.example not found" -ForegroundColor Red
}
}
Set-Location ..
}
if (-not (Test-Path "backend")) {
Write-Host "backend directory not found" -ForegroundColor Red
}
# Setup Frontend
Write-Host "`nInstalling frontend dependencies..." -ForegroundColor Yellow
if (Test-Path "frontend") {
Set-Location frontend
if (-not (Test-Path "node_modules")) {
npm install
}
Set-Location ..
}
if (-not (Test-Path "frontend")) {
Write-Host "frontend directory not found" -ForegroundColor Red
}
# Setup AI Service
Write-Host "`nSetting up AI service..." -ForegroundColor Yellow
if (Test-Path "ai-service") {
Set-Location ai-service
if (-not (Test-Path "venv")) {
Write-Host "Creating Python virtual environment..." -ForegroundColor Yellow
python -m venv venv
}
Write-Host "Installing Python dependencies..." -ForegroundColor Yellow
if (Test-Path "venv\Scripts\python.exe") {
.\venv\Scripts\python.exe -m pip install -r requirements.txt
}
if (-not (Test-Path "venv\Scripts\python.exe")) {
Write-Host "venv python not found. Pip install failed." -ForegroundColor Red
}
if (-not (Test-Path ".env")) {
Write-Host "Creating AI service .env file..." -ForegroundColor Yellow
if (Test-Path ".env.example") {
Copy-Item .env.example .env
Write-Host "Please update ai-service/.env with your GEMINI_API_KEY" -ForegroundColor Yellow
}
}
Set-Location ..
}
if (-not (Test-Path "ai-service")) {
Write-Host "ai-service directory not found" -ForegroundColor Red
}
Write-Host "`nSetup complete!`n" -ForegroundColor Green
Write-Host "Next steps:" -ForegroundColor Cyan
Write-Host "1. Update backend/.env with MongoDB URI and JWT secret" -ForegroundColor White
Write-Host "2. Update ai-service/.env with GEMINI_API_KEY" -ForegroundColor White
Write-Host "3. Run: cd backend; npm run seed (to create sample data)" -ForegroundColor White
Write-Host "4. Start all services using the start script`n" -ForegroundColor White
Write-Host "For detailed instructions, see README.md" -ForegroundColor Cyan