File size: 4,562 Bytes
4a8b134
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
@echo off
REM ========================================================================
REM Drug Repurposing AI System - Production Startup (Windows)
REM ========================================================================
REM This script installs all dependencies and starts the API server

setlocal enabledelayedexpansion

cls
echo.
echo ========================================================================
echo  ^^ DRUG REPURPOSING AI SYSTEM ^^
echo  ^^ Production API Startup ^^
echo ========================================================================
echo.

REM Check Python installation
python --version >nul 2>&1
if %errorlevel% neq 0 (
    echo ERROR: Python is not installed or not in PATH
    echo Please install Python 3.10+ from https://www.python.org/
    pause
    exit /b 1
)

REM Step 1: Create/Activate virtual environment
echo [1/4] Setting up virtual environment...
if not exist "venv" (
    echo Creating new virtual environment...
    python -m venv venv
    if !errorlevel! neq 0 (
        echo ERROR: Failed to create virtual environment
        pause
        exit /b 1
    )
) else (
    echo Virtual environment already exists
)

call venv\Scripts\activate.bat
if !errorlevel! neq 0 (
    echo ERROR: Failed to activate virtual environment
    pause
    exit /b 1
)
echo βœ… Virtual environment activated
echo.

REM Step 2: Upgrade pip
echo [2/4] Upgrading pip and setuptools...
python -m pip install --upgrade pip setuptools wheel -q
echo βœ… pip upgraded
echo.

REM Step 3: Install base dependencies
echo [3/4] Installing dependencies from requirements.txt...
pip install -r requirements.txt -q
if !errorlevel! neq 0 (
    echo WARNING: Some dependencies failed to install
    echo This may be normal if you're missing optional packages
)
echo.

REM Step 4: Install special packages (optional but important)
echo [3.5/4] Installing specialized packages...
echo Installing DeepPurpose from GitHub...
pip install git+https://github.com/kexinhuang12345/DeepPurpose.git -q 2>nul
if !errorlevel! neq 0 (
    echo WARNING: DeepPurpose installation failed
    echo The API will still run but use local mock predictions
    echo To use real AI predictions, install manually:
    echo   pip install git+https://github.com/kexinhuang12345/DeepPurpose.git
)

echo Installing TDC (Therapeutic Data Commons)...
pip install git+https://github.com/Alantic/TDC.git -q 2>nul
if !errorlevel! neq 0 (
    echo NOTE: TDC installation failed
    echo The API will use local fallback drug library (40+ FDA-approved drugs)
)
echo.

REM Step 5: Display startup info and start server
echo ========================================================================
echo βœ… [4/4] SETUP COMPLETE - STARTING API SERVER
echo ========================================================================
echo.
echo 🌐 API DOCUMENTATION & ENDPOINTS:
echo   β€’ Interactive Swagger Docs:  http://localhost:8000/docs
echo   β€’ Alternative ReDoc Docs:    http://localhost:8000/redoc
echo   β€’ OpenAPI Schema:            http://localhost:8000/openapi.json
echo.
echo πŸ“Š MONITORING ENDPOINTS:
echo   β€’ Health Check:              http://localhost:8000/health
echo   β€’ Model Status:              http://localhost:8000/api/v1/model-status
echo.
echo 🧬 MAIN SCREENING ENDPOINT (POST):
echo   β€’ Virtual Screening:         http://localhost:8000/api/v1/screen
echo     Request body:
echo     {
echo       "disease_name": "Type 2 Diabetes",
echo       "min_score": 0.5,
echo       "top_n_targets": 10,
echo       "known_drugs": ["Metformin"]
echo     }
echo.
echo πŸ“‹ ADDITIONAL ENDPOINTS (POST):
echo   β€’ Get Disease Targets:       http://localhost:8000/api/v1/disease-targets
echo   β€’ Get Protein Sequences:     http://localhost:8000/api/v1/protein-sequences
echo   β€’ Get Drug Library:          http://localhost:8000/api/v1/drug-library
echo.
echo ⏹️  Press CTRL+C to stop the server
echo ========================================================================
echo.

REM Start the API server
python -m uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload

pause

echo ========================================================================
echo.

python -m uvicorn app.main:app --host 0.0.0.0 --port 8000 --log-level info

if %errorlevel% neq 0 (
    echo.
    echo ❌ API failed to start
    echo.
    echo Troubleshooting:
    echo   β€’ Check dependencies: pip install -r requirements.txt
    echo   β€’ Check DeepPurpose: python -c "import deepPurpose"
    echo   β€’ Check app exists: dir app\main.py
    echo.
    pause
)

endlocal