File size: 1,552 Bytes
1f68b7c
682caaf
 
 
 
1f68b7c
 
 
 
682caaf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76201c6
682caaf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
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