Spaces:
Sleeping
Sleeping
File size: 4,145 Bytes
64eded8 |
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 |
#!/usr/bin/env python3
"""
MedeX Setup Script
Professional setup for MedeX Medical AI System
"""
import sys
import subprocess
from pathlib import Path
def check_python_version():
"""Check if Python version is compatible"""
if sys.version_info < (3, 8):
print("❌ Error: MedeX requiere Python 3.8 o superior")
print(f" Versión actual: {sys.version}")
print(" Por favor actualice Python antes de continuar")
return False
print(f"✅ Python {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro} - Compatible")
return True
def install_dependencies():
"""Install required dependencies"""
print("\n📦 Instalando dependencias de MedeX...")
try:
subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
print("✅ Dependencias instaladas correctamente")
return True
except subprocess.CalledProcessError as e:
print(f"❌ Error instalando dependencias: {e}")
print(" Intente ejecutar manualmente: pip install -r requirements.txt")
return False
def setup_directories():
"""Create necessary directories"""
print("\n📁 Configurando estructura de directorios...")
directories = [
"data/medical_conditions",
"data/medications",
"data/protocols",
"logs",
"cache"
]
for directory in directories:
Path(directory).mkdir(parents=True, exist_ok=True)
print(f" ✅ {directory}")
print("✅ Estructura de directorios configurada")
def test_system():
"""Test basic system functionality"""
print("\n🧪 Probando funcionalidad básica...")
try:
# Test imports
from core.ai_engine import MedeXAIEngine
print(" ✅ Motor de IA médica")
# Test AI engine initialization
engine = MedeXAIEngine()
print(" ✅ Inicialización del motor")
# Test knowledge base
results = engine.knowledge_engine.search_medical_knowledge("diabetes")
if results:
print(" ✅ Base de conocimientos médicos")
print("✅ Sistema funcionando correctamente")
return True
except Exception as e:
print(f"❌ Error en prueba del sistema: {e}")
return False
def display_completion_message():
"""Display setup completion message"""
print("\n" + "="*60)
print("🏥 MedeX - CONFIGURACIÓN COMPLETADA")
print("="*60)
print("\n🎉 MedeX Medical AI System está listo para usar!")
print("\n🚀 PARA COMENZAR:")
print(" python3 medex_chat.py")
print("\n📖 DOCUMENTACIÓN:")
print(" docs/user_guide.md - Guía completa de usuario")
print("\n🔧 CONFIGURACIÓN OPCIONAL:")
print(" export KIMI_API_KEY='your-key' - Para integración Kimi")
print("\n💡 EJEMPLOS DE USO:")
print(" 👨⚕️'Paciente 65 años, dolor torácico'")
print(" 👤 'Me duele el pecho'")
print(" 💊 'Dosis de aspirina'")
print("\n⚠️ IMPORTANTE:")
print(" 🔬 Solo para uso educativo y de apoyo")
print(" 👨⚕️ No reemplaza evaluación médica profesional")
print(" 🚨 En emergencias: llame al 911")
print("\n🏥 ¡Bienvenido a MedeX!")
print("="*60)
def main():
"""Main setup function"""
print("🏥 MedeX Medical AI System - Setup")
print("="*50)
# Check Python version
if not check_python_version():
sys.exit(1)
# Install dependencies
if not install_dependencies():
print("\n⚠️ Continuando sin algunas dependencias...")
print(" Puede instalarlas manualmente después")
# Setup directories
setup_directories()
# Test system
if test_system():
display_completion_message()
else:
print("\n⚠️ Setup completado con advertencias")
print(" El sistema puede funcionar parcialmente")
print(" Revise los errores arriba para resolverlos")
if __name__ == "__main__":
main() |