File size: 9,044 Bytes
0bd4ab4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
#!/usr/bin/env python3
"""
Quick Start Guide - Step-by-step instructions
"""

QUICK_START = """
╔══════════════════════════════════════════════════════════════════════════════╗
β•‘                   AI Scientific Co-Investigator - QUICK START                β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

πŸš€ OPTION 1: Docker Compose (Recommended - 5 minutes)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

1. Prerequisites:
   βœ“ Install Docker: https://www.docker.com/products/docker-desktop
   βœ“ Install Docker Compose (included with Docker Desktop)

2. Setup:
   $ cp .env.example .env
   $ # Edit .env - add your API keys
   
3. Start services:
   $ chmod +x deploy.sh
   $ ./deploy.sh up
   
   βœ“ API: http://localhost:8000
   βœ“ Docs: http://localhost:8000/docs
   βœ“ Qdrant: http://localhost:6333
   βœ“ PostgreSQL: localhost:5432

4. Verify health:
   $ curl http://localhost:8000/health/ready
   β†’ Should return: {"ready": true, ...}

5. Stop:
   $ ./deploy.sh down


πŸ› οΈ OPTION 2: Local Python Development
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

1. Prerequisites:
   βœ“ Python 3.10+
   βœ“ PostgreSQL 13+
   βœ“ Redis
   βœ“ Qdrant

2. Setup environment:
   $ python -m venv .venv
   $ source .venv/bin/activate  # or .venv\\Scripts\\activate on Windows
   
3. Install dependencies:
   $ pip install -r requirements.txt
   
4. Configure:
   $ cp .env.example .env
   $ # Edit .env with your local DB credentials
   
5. Start services (in separate terminals):
   Terminal 1 - PostgreSQL:
   $ psql -U user -d scoinvestigator
   
   Terminal 2 - Redis:
   $ redis-server
   
   Terminal 3 - Qdrant:
   $ docker run -p 6333:6333 qdrant/qdrant
   
   Terminal 4 - API:
   $ uvicorn app.main:app --reload
   β†’ http://localhost:8000


πŸ“š COMMON OPERATIONS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Health Check:
  $ curl http://localhost:8000/health/ready
  
View API Docs:
  β†’ Open browser: http://localhost:8000/docs

View Logs:
  $ ./deploy.sh logs
  
Run Tests:
  $ ./deploy.sh test
  
Database: psql connection
  $ psql -U user -d scoinvestigator -h localhost
  
Stop Everything:
  $ ./deploy.sh down


πŸš€ FIRST API CALL
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Run an analysis:
  
  $ curl -X POST http://localhost:8000/api/v1/analysis/run \\
    -H "Content-Type: application/json" \\
    -d '{
      "documents": ["Document text here..."],
      "analysis_type": "comprehensive"
    }'
  
View results:
  
  $ curl http://localhost:8000/api/v1/analysis/{analysis_id}/results


πŸ“Š DATABASE SETUP
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Create database (first time):
  
  $ psql -U postgres
  postgres=# CREATE DATABASE scoinvestigator;
  postgres=# CREATE USER user WITH PASSWORD 'onion123';
  postgres=# GRANT ALL PRIVILEGES ON DATABASE scoinvestigator TO user;
  
Tables are created automatically by SQLAlchemy on first run.


πŸ” TROUBLESHOOTING
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Problem: Import errors
Solution: pip install --upgrade -r requirements.txt

Problem: Database connection failed
Solution: Check DATABASE_URL in .env
        Check PostgreSQL is running
        psql -U user -d scoinvestigator
        
Problem: Qdrant not responding
Solution: docker run -p 6333:6333 qdrant/qdrant
        curl http://localhost:6333/health
        
Problem: Ports already in use
Solution: Check what's using the port:
        lsof -i :8000  # for API
        lsof -i :5432  # for DB
        Kill the process: kill -9 <PID>
        Or change ports in docker-compose.yml


πŸ“– STRUCTURE OVERVIEW
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

/app
  /api          β†’ API routes
  /db           β†’ Database models & sessions
  /services     β†’ Business logic
  /reasoning    β†’ AI orchestration (LangGraph)
  /rag          β†’ Document processing
  /modules      β†’ Analysis modules
  /core         β†’ Configuration & utilities
  main.py       β†’ FastAPI app


🎯 NEXT STEPS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

1. Verify all services running:
   $ curl http://localhost:8000/health/ready
   
2. Try the API with sample data:
   β†’ Visit http://localhost:8000/docs
   β†’ Try POST /api/v1/analysis/run
   
3. Check logs for errors:
   $ ./deploy.sh logs
   
4. Monitor resources:
   $ docker stats
   
5. Setup frontend (separate project):
   β†’ See FRONTEND_SCAFFOLD.md


πŸ“ž NEED HELP?
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

1. Read the docs:
   - README.md (project overview)
   - DEPLOYMENT.md (deployment guide)
   - STACK_ANALYSIS.md (tech stack details)
   - FRONTEND_SCAFFOLD.md (frontend setup)
   
2. Check logs:
   - Docker: docker-compose logs
   - API: ./deploy.sh logs
   - Database: psql logs
   
3. API Docs:
   - Swagger: http://localhost:8000/docs
   - ReDoc: http://localhost:8000/redoc
   
4. Health checks:
   - All services: http://localhost:8000/health/ready
   - API only: http://localhost:8000/health/


πŸ‘¨β€πŸ’» DEVELOPMENT WORKFLOW
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Edit code β†’ Changes auto-reload (with --reload flag)
Run tests β†’ ./deploy.sh test
View logs β†’ ./deploy.sh logs
Debug   β†’ Add print statements β†’ Check logs


🎊 YOU'RE ALL SET!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Next: Start making requests to the API!

Happy coding! πŸš€
"""

if __name__ == "__main__":
    print(QUICK_START)
    
    # Additional interactive help
    import sys
    
    print(\"\\n\" + \"=\"*80)
    print(\"INTERACTIVE QUICK START\")
    print(\"=\"*80)
    
    choice = input(\"\\nHow do you want to run the app?\\n1. Docker Compose (recommended)\\n2. Local Python\\n> \").strip()
    
    if choice == '1':
        print(\"\\n\" + \"=\"*80)
        print(\"DOCKER COMPOSE SETUP\")
        print(\"=\"*80)
        print(\"\\nSteps:\")
        print(\"1. cp .env.example .env\")
        print(\"2. Edit .env with your API keys\")
        print(\"3. chmod +x deploy.sh\")
        print(\"4. ./deploy.sh up\")
        print(\"\\nThen visit: http://localhost:8000/docs\")
        
    elif choice == '2':
        print(\"\\n\" + \"=\"*80)
        print(\"LOCAL PYTHON SETUP\")
        print(\"=\"*80)
        print(\"\\nSteps:\")
        print(\"1. python -m venv .venv\")
        print(\"2. source .venv/bin/activate\")
        print(\"3. pip install -r requirements.txt\")
        print(\"4. Start PostgreSQL, Redis, Qdrant\")
        print(\"5. uvicorn app.main:app --reload\")
        print(\"\\nThen visit: http://localhost:8000/docs\")
    
    print(\"\\n\" + \"=\"*80)
    print(\"Questions? Check: README.md | DEPLOYMENT.md | STACK_ANALYSIS.md\")
    print(\"=\"*80 + \"\\n\")