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- SmartHealDB
|
| 10 |
+
datasets:
|
| 11 |
+
- SmartHealDB
|
| 12 |
+
license: mit
|
| 13 |
+
title: smarthealapp
|
| 14 |
sdk: docker
|
| 15 |
+
emoji: 📊
|
| 16 |
+
colorFrom: yellow
|
| 17 |
+
colorTo: red
|
| 18 |
+
---
|
| 19 |
+
# SmartHeal FastAPI Application
|
| 20 |
+
|
| 21 |
+
This is a FastAPI conversion of the original Flask SmartHeal application, maintaining all the same endpoints and functionality.
|
| 22 |
+
|
| 23 |
+
## Setup Instructions
|
| 24 |
+
|
| 25 |
+
1. **Install Dependencies**
|
| 26 |
+
```bash
|
| 27 |
+
pip install -r requirements.txt
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
2. **Environment Configuration**
|
| 31 |
+
- Copy `.env.example` to `.env`
|
| 32 |
+
- Fill in your database and Twilio credentials in the `.env` file
|
| 33 |
+
|
| 34 |
+
3. **Run the Application**
|
| 35 |
+
```bash
|
| 36 |
+
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
## API Endpoints
|
| 40 |
+
|
| 41 |
+
The application maintains all the original endpoints from the Flask version:
|
| 42 |
+
|
| 43 |
+
### Organization Endpoints
|
| 44 |
+
- `POST /send_email` - Send license key via email
|
| 45 |
+
- `POST /verify_license_key` - Verify license key
|
| 46 |
+
- `POST /create_pin` - Create PIN for organization
|
| 47 |
+
- `POST /fetch_data` - Fetch organization data
|
| 48 |
+
- `POST /save_additional_data` - Save department and location
|
| 49 |
+
- `POST /verify_pin` - Verify PIN
|
| 50 |
+
- `POST /send_otp` - Send OTP
|
| 51 |
+
- `POST /change_pin_org` - Change organization PIN
|
| 52 |
+
- `POST /forgot_pin_org` - Reset organization PIN
|
| 53 |
+
- `GET /organisation_details` - Get organization details
|
| 54 |
+
- `POST /store_org_image` - Store organization image
|
| 55 |
+
- `GET /get_org_image` - Get organization image
|
| 56 |
+
- `POST /update_org_profile` - Update organization profile
|
| 57 |
+
- `POST /org/forgot/pin/otp` - Send OTP for PIN reset
|
| 58 |
+
|
| 59 |
+
### Medical User Endpoints
|
| 60 |
+
- `POST /med_send_email` - Send license key for medical users
|
| 61 |
+
- `POST /med_verify_license_key` - Verify medical user license key
|
| 62 |
+
- `POST /med_create_pin` - Create PIN for medical user
|
| 63 |
+
- `POST /med_fetch_data` - Fetch medical user data
|
| 64 |
+
- `POST /save_med_data` - Save medical user data
|
| 65 |
+
- `POST /med_verify_pin` - Verify medical user PIN
|
| 66 |
+
- `POST /med_send_otp` - Send OTP for medical user
|
| 67 |
+
- `POST /change_pin_med` - Change medical user PIN
|
| 68 |
+
- `POST /forgot_pin_med` - Reset medical user PIN
|
| 69 |
+
- `GET /med_details` - Get medical user details
|
| 70 |
+
- `POST /store_med_image` - Store medical user image
|
| 71 |
+
- `GET /get_med_image` - Get medical user image
|
| 72 |
+
- `POST /update_med_profile` - Update medical user profile
|
| 73 |
+
- `POST /med/forgot/pin/otp` - Send OTP for PIN reset
|
| 74 |
+
|
| 75 |
+
### Patient Management Endpoints
|
| 76 |
+
- `POST /add_patient` - Add new patient
|
| 77 |
+
- `POST /add_patient_v2` - Add new patient (v2)
|
| 78 |
+
- `GET /get_all_patient_details` - Get all patient details
|
| 79 |
+
- `GET /search_patient` - Search for patient
|
| 80 |
+
- `GET /patient_details` - Get specific patient details
|
| 81 |
+
- `POST /update_patient_details` - Update patient details
|
| 82 |
+
- `POST /store_image` - Store patient image
|
| 83 |
+
- `GET /get_image` - Get patient image
|
| 84 |
+
- `POST /save_notes` - Save patient notes
|
| 85 |
+
- `POST /save_notes_v2` - Save patient notes (v2)
|
| 86 |
+
- `POST /sort_patients` - Sort patients by criteria
|
| 87 |
+
|
| 88 |
+
### Wound Management Endpoints
|
| 89 |
+
- `POST /add_wound_details` - Add wound details
|
| 90 |
+
- `POST /add_wound_details_v2` - Add wound details with image (v2)
|
| 91 |
+
- `POST /add_wound_details_v3` - Add wound details with multiple images (v3)
|
| 92 |
+
- `POST /store_wound_image` - Store wound image
|
| 93 |
+
- `GET /get_wound_image` - Get wound image
|
| 94 |
+
- `GET /wound_progress_timeline` - Get wound progress timeline
|
| 95 |
+
|
| 96 |
+
### Appointment Management Endpoints
|
| 97 |
+
- `POST /update_scheduled_date` - Update appointment date
|
| 98 |
+
- `POST /update_scheduled_date_v2` - Update appointment date (v2)
|
| 99 |
+
- `GET /total_appointments_till_date` - Get total appointments till date
|
| 100 |
+
- `GET /total_appointments_till_month` - Get total appointments till month
|
| 101 |
+
- `POST /total_appointments` - Get total appointments in date range
|
| 102 |
+
- `GET /total_appointments_v2` - Get total appointments in date range (v2)
|
| 103 |
+
- `POST /get_appointment_count` - Get appointment count for specific date
|
| 104 |
+
|
| 105 |
+
### Administrative Endpoints
|
| 106 |
+
- `POST /admin_add_practitioner` - Add practitioner (admin)
|
| 107 |
+
- `POST /admin_add_practitioner_v2` - Add practitioner (admin v2)
|
| 108 |
+
- `GET /generate_prescription` - Generate prescription
|
| 109 |
+
|
| 110 |
+
## Key Changes from Flask to FastAPI
|
| 111 |
+
|
| 112 |
+
1. **Request Handling**: Replaced Flask\'s `request.json` with Pydantic models for request validation
|
| 113 |
+
2. **Response Handling**: Replaced Flask\'s `jsonify()` with FastAPI\'s `JSONResponse`
|
| 114 |
+
3. **File Uploads**: Replaced Flask\'s file handling with FastAPI\'s `UploadFile`
|
| 115 |
+
4. **Dependency Injection**: Used FastAPI\'s dependency injection for database sessions and JWT verification
|
| 116 |
+
5. **Error Handling**: Replaced Flask\'s error handling with FastAPI\'s `HTTPException`
|
| 117 |
+
6. **Static Files**: Replaced Flask\'s static file serving with FastAPI\'s `StaticFiles`
|
| 118 |
+
|
| 119 |
+
## Authentication
|
| 120 |
+
|
| 121 |
+
The application uses JWT tokens for authentication. Include the token in the Authorization header:
|
| 122 |
+
```
|
| 123 |
+
Authorization: Bearer <your_jwt_token>
|
| 124 |
+
```
|
| 125 |
+
|
| 126 |
+
## File Uploads
|
| 127 |
+
|
| 128 |
+
The application supports file uploads for:
|
| 129 |
+
- Patient images
|
| 130 |
+
- Wound images
|
| 131 |
+
- Organization images
|
| 132 |
+
- Medical practitioner images
|
| 133 |
+
|
| 134 |
+
Files are stored in the `uploads/` directory with organized subdirectories.
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
live
|