--- title: CPS API emoji: 📈 colorFrom: pink colorTo: purple sdk: docker pinned: false --- # CPS-API - Clinical Patient System API A FastAPI-based backend for clinical patient management with AI integration (TxAgent). ## Features - Patient management - Authentication & authorization - AI-powered clinical assistance (TxAgent) - Voice transcription and synthesis - PDF generation - FHIR integration - Appointment scheduling ## Local Development ```bash # Install dependencies pip install -r requirements.txt # Run the server python -m uvicorn app:app --reload --host 0.0.0.0 --port 7860 ``` ## Deployment to Hugging Face Spaces This API is configured for deployment on Hugging Face Spaces. ### Environment Variables Set these in your Hugging Face Space settings: ```bash # MongoDB connection MONGODB_URL=your_mongodb_connection_string # JWT settings SECRET_KEY=your_secret_key ALGORITHM=HS256 ACCESS_TOKEN_EXPIRE_MINUTES=30 # TxAgent configuration TXAGENT_MODE=cloud TXAGENT_CLOUD_URL=https://rocketfarmstudios-txagent-api.hf.space TXAGENT_LOCAL_ENABLED=false # CORS settings ALLOWED_ORIGINS=https://your-frontend-domain.com ``` ### API Endpoints - **Health Check**: `GET /` - **Documentation**: `GET /docs` - **Authentication**: `/auth/*` - **Patients**: `/patients/*` - **Appointments**: `/appointments/*` - **TxAgent AI**: `/txagent/*` ## Architecture - **Backend**: FastAPI + MongoDB - **AI Integration**: TxAgent with fallback (local/cloud) - **Authentication**: JWT tokens - **Documentation**: Auto-generated OpenAPI/Swagger