A modern web application for generating AI-powered medical reports from audio recordings.
- Upload audio recordings of doctor-patient conversations
- Automatic transcription using OpenAI Whisper
- AI-generated medical reports with department-specific context
- Clean and modern UI with Tailwind CSS
- Real-time form validation and error handling
- Responsive design for all devices
- Install dependencies:
npm install- Start the development server:
npm startThe frontend will be available at http://localhost:3000
/src/components/- React components/src/main.tsx- Application entry point/src/index.css- Global styles and Tailwind imports
- React 18
- Tailwind CSS
- Headless UI
- TypeScript
- Vite
The project uses:
- TypeScript for type safety
- Tailwind CSS for styling
- Vite for fast development and building
- ESLint for code quality
- Prettier for code formatting
The frontend expects a FastAPI backend running on http://localhost:8000 with the following endpoint:
- POST
/api/reports/add- Upload audio and generate report- Accepts multipart/form-data with:
- patient_id (UUID)
- doctor_id (UUID)
- department (string)
- audio_file (file)
- Accepts multipart/form-data with:
FastAPI backend application with Supabase integration for token management.
oneai/
├── main.py # FastAPI application entry point
├── config.py # Supabase client configuration
├── models.py # Pydantic models
├── routes/
│ ├── __init__.py
│ └── token_routes.py # Token generation routes
├── requirements.txt # Python dependencies
└── README.md # This file
-
Install dependencies:
pip install -r requirements.txt
-
Create environment file: Create a
.envfile in the project root with the following variables:SUPABASE_URL=https://splrdvpkhvdkqouduxje.supabase.co SUPABASE_KEY=your_supabase_anon_key_here SUPABASE_SERVICE_ROLE_KEY=your_service_role_key_here OPENAI_API_KEY=your_openai_api_key_here -
Supabase Setup: Make sure your Supabase project has the following tables:
userstokensreportsappointmentsuploaded_files
Required table structures:
Users table:
CREATE TABLE users ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), name VARCHAR NOT NULL, email VARCHAR NOT NULL UNIQUE, created_at TIMESTAMP DEFAULT NOW() );
Tokens table:
CREATE TABLE tokens ( id SERIAL PRIMARY KEY, token_code VARCHAR(8) NOT NULL, patient_id UUID NOT NULL, created_at TIMESTAMP DEFAULT NOW(), expires_at TIMESTAMP, FOREIGN KEY (patient_id) REFERENCES users(id) );
Reports table:
CREATE TABLE reports ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), patient_id UUID NOT NULL, department VARCHAR(50) NOT NULL, transcription TEXT NOT NULL, report TEXT NOT NULL, summary TEXT NOT NULL, created_at TIMESTAMP DEFAULT NOW(), FOREIGN KEY (patient_id) REFERENCES users(id) );
# Using Python directly
python main.py
# Or using uvicorn
uvicorn main:app --reload --host 0.0.0.0 --port 8000The API will be available at http://localhost:8000
Once the server is running, you can access:
- Interactive API docs:
http://localhost:8000/docs - ReDoc documentation:
http://localhost:8000/redoc
-
POST
/api/reports/add -
Description: AI-powered clinical voice-to-report generation with department-specific processing
-
Request: Multipart form data
patient_id: UUID of existing patientdepartment: Medical department (general, cardiology, ent, neurology, orthopedics, pediatrics, dermatology)audio_file: Doctor-patient conversation audio file (webm, wav, mp3, m4a)
-
Response:
{ "id": "uuid", "patient_id": "uuid", "department": "cardiology", "transcription": "Cleaned doctor-patient conversation...", "report": "Department-specific formatted medical report...", "summary": "AI-generated summary with key insights and health alerts...", "created_at": "2023-01-01T12:00:00Z" } -
GET
/api/reports/list -
Description: List all medical reports
-
Response:
{ "reports": [...] } -
GET
/api/reports/{report_id} -
Description: Get specific report by ID
-
POST
/api/users/create-user -
Description: Create a new user/patient
-
Request Body:
{ "name": "John Doe", "email": "john@example.com" } -
Response:
{ "id": "uuid", "name": "John Doe", "email": "john@example.com", "created_at": "2023-01-01T12:00:00Z" } -
GET
/api/users/list-users -
Description: List all users
- POST
/api/tokens/generate-token - Description: Generate a new token for a patient
- Request Body:
{ "patient_id": "uuid" } - Response:
{ "token_code": "ABC12345", "patient_id": "uuid", "created_at": "2023-01-01T12:00:00Z", "expires_at": "2023-01-02T12:00:00Z" }
- GET
/health - Description: Check if the API is running
- Response:
{ "status": "healthy" }
| Variable | Description |
|---|---|
SUPABASE_URL |
Your Supabase project URL |
SUPABASE_KEY |
Your Supabase anon key |
SUPABASE_SERVICE_ROLE_KEY |
Your Supabase service role key (for admin operations) |
OPENAI_API_KEY |
Your OpenAI API key for Whisper and GPT-3.5 |
fastapi- Modern web framework for building APIsuvicorn- ASGI server for running the applicationsupabase- Python client for Supabasepython-dotenv- Load environment variables from .env filepydantic- Data validation and settings managementopenai- OpenAI API client for Whisper and GPT-3.5python-multipart- File upload handlingaiofiles- Async file operations