AI-powered medical consult note automation for doctors
Attentus is a comprehensive mobile application that helps doctors automate the creation of medical consultation notes using AI. The app combines React Native (Expo) frontend with a Node.js/Express backend, featuring real-time speech-to-text transcription, AI-powered note generation, secure patient management, and inter-doctor communication. Built with modern technologies including MongoDB for data persistence, Firebase for authentication and file storage, Google Cloud Speech-to-Text for audio processing, and OpenAI for intelligent note generation.
- Frontend: React Native with Expo
- Backend: Node.js with Express
- Database: MongoDB Atlas
- Authentication: Firebase Admin SDK
- File Storage: Firebase Storage
- Speech Processing: Google Cloud Speech-to-Text
- AI Integration: OpenAI GPT for note generation
- Real-time Communication: WebSocket support for chat features
Before setting up the project, ensure you have the following installed and configured:
- Node.js (v14 or higher)
- npm (Node Package Manager)
- Expo CLI (
npm install -g @expo/cli) - Expo Go app on your mobile device
- MongoDB Atlas account for database hosting
- Google Cloud project with Speech-to-Text API enabled
- Firebase project for authentication and file storage
- OpenAI API account for AI-powered note generation
- Google Cloud SDK (optional, for API management)
Create a .env file in the backend/ directory with the following variables:
# MongoDB Connection
MONGODB_URI=mongodb+srv://username:[email protected]/database?retryWrites=true&w=majority
# OpenAI Configuration
OPENAI_API_KEY=sk-your-openai-api-key-here
# Google Cloud Speech-to-Text
GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/google-speech-credentials.json
GOOGLE_CLOUD_PROJECT="your-project-id"
# JWT Authentication
JWT_SECRET=your-jwt-secret-key-here
# Firebase Configuration
FIREBASE_STORAGE_BUCKET=your-project.appspot.comUpdate the API host in frontend/api/client.js:
const API_HOST = '192.168.68.121'; // Replace with your LAN IP address
const BACKEND_URL = `http://${API_HOST}:3001`;Attentus/
βββ frontend/ # React Native Expo app
β βββ screens/ # App screens
β β βββ Auth/ # Authentication screens
β β βββ components/ # Reusable components
β βββ navigation/ # Navigation configuration
β βββ context/ # React Context providers
β βββ api/ # API client configuration
β βββ assets/ # Images and static files
βββ backend/ # Node.js Express server
β βββ src/
β β βββ controllers/ # Route controllers
β β βββ models/ # MongoDB models
β β βββ routes/ # API routes
β β βββ middlewares/ # Custom middlewares
β β βββ services/ # Business logic services
β β βββ config/ # Configuration files
β βββ credentials/ # Service account files
β βββ scripts/ # Utility scripts
βββ README.md
git clone <repository-url>
cd Attentus
# Install backend dependencies
cd backend
npm install
# Install frontend dependencies
cd ../frontend
npm installPlace your service account JSON files in the backend/credentials/ directory:
firebase-admin.json- Firebase Admin SDK credentials (required for file storage and authentication)
Before starting the backend, run:
npm run enable-apiThis ensures the Speech-to-Text API is active in your GCP project.
Note: If you don't have Google Cloud SDK installed, you can manually enable the Speech-to-Text API at: https://console.cloud.google.com/apis/library/speech.googleapis.com
- Copy the environment variables from the section above
- Update the MongoDB connection string with your Atlas credentials
- Add your OpenAI API key
- Configure Firebase project settings
- Update the frontend API host to your local IP address
- Ensure all required credentials are in the
backend/credentials/directory
cd backend
npm startThe backend will start on port 3001 (configurable via PORT environment variable).
cd frontend
npm startThis will start the Expo development server. Scan the QR code with Expo Go to run the app on your device.
- Secure login/signup with Firebase authentication
- JWT token-based session management
- Protected API routes
- Doctor profile management with first/last name support
- Voice profile upload during signup
- Add and manage patient information
- Store vital signs and contact details
- Patient history tracking
- Search and filter patients
- Patient consult note history
- Create and schedule appointments
- Real-time audio recording during consultations
- Audio file upload support (MP3, M4A, WAV, etc.)
- Speech-to-text transcription via Google Cloud
- AI-powered consultation note generation with doctor/patient context
- Manual note editing and refinement
- Weight and height tracking
- Appointment status management
- AI-generated consultation notes from audio transcripts
- Preview mode with clickable full note viewing
- Dedicated read-only consult note viewing screen
- Note sharing in doctor communications
- Patient-specific consult note history
- Inter-doctor communication
- Real-time messaging
- Doctor search and filtering
- Consult note sharing in chat messages
- Professional consult note components in chat
- Doctor profile customization
- Digital signature upload
- Consultation note templates
- Professional information management
POST /api/auth/login- User loginPOST /api/auth/signup- User registration with voice profile
GET /api/doctors/me- Get current doctor profilePUT /api/doctors/me- Update doctor profileGET /api/doctors- List all doctors for chatPOST /api/doctors/me/signature- Upload signature
GET /api/patients- Get all patientsPOST /api/patients- Create new patientGET /api/patients/:id- Get patient detailsPUT /api/patients/:id- Update patient information
GET /api/appointments- Get all appointmentsPOST /api/appointments- Create appointmentPUT /api/appointments/:id- Update appointmentPOST /api/appointments/:id/record- Submit audio recording/uploadDELETE /api/appointments/:id- Cancel appointment
GET /api/chats- Get all chatsPOST /api/chats- Create new chatGET /api/chats/:id- Get chat details with messagesPOST /api/chats/:id/message- Send message with consult note support
# Backend with auto-restart
cd backend && npm run dev
# Frontend with hot reload
cd frontend && npm start# Build frontend
cd frontend && expo build:android # or expo build:ios
# Deploy backend
cd backend && npm run build# Backend
npm run start # Start production server
npm run dev # Start development server with nodemon
npm run enable-api # Enable Google Cloud Speech-to-Text API
# Frontend
npm start # Start Expo development server
npm run android # Run on Android emulator
npm run ios # Run on iOS simulator- All API endpoints are protected with JWT authentication
- File uploads are validated and stored securely in Firebase Storage
- Environment variables are used for sensitive configuration
- CORS is configured for secure cross-origin requests
- Input validation and sanitization on all endpoints
- Secure audio file handling with proper MIME type validation
- Protected patient data with role-based access control