A comprehensive web application that helps non-medical users understand their lab reports through structured data extraction, trend analysis, and AI-powered explanations—without providing diagnosis or treatment advice.
This tool explains what your lab values mean but does NOT:
- ✗ Diagnose medical conditions
- ✗ Recommend treatments
- ✗ Replace your doctor's judgment
✓ Always discuss your results with your healthcare provider ✓ Seek immediate care for urgent symptoms
- 🔐 Secure Authentication: Firebase Auth with email/password and Google OAuth
- 📄 Document Upload: Drag-and-drop PDF lab report uploads
- 🤖 AI-Powered Extraction: Google Document AI for structured data extraction
- 📊 Trend Analysis: BigQuery-powered historical trend tracking
- 💡 AI Explanations: Gemini 2.0 Flash for plain-language explanations
- 🔒 Safety Guardrails: Built-in protection against diagnosis/treatment language
- 📈 Visualizations: Interactive charts showing test trends over time
- 🔄 Report Comparison: Side-by-side comparison of multiple reports
- React 18
- Vite
- Firebase SDK (Auth, Firestore, Storage)
- Recharts for data visualization
- React Router for navigation
- Google Cloud Functions (Node.js)
- Google Document AI
- BigQuery (data warehouse)
- Google Gemini 2.0 Flash
- Firebase Admin SDK
medical-report-interpreter/
├── frontend/
│ ├── src/
│ │ ├── components/
│ │ │ ├── Auth/
│ │ │ │ ├── Login.jsx
│ │ │ │ ├── Signup.jsx
│ │ │ │ └── Auth.css
│ │ │ ├── Upload/
│ │ │ │ ├── ReportUploader.jsx
│ │ │ │ ├── UploadProgress.jsx
│ │ │ │ └── Upload.css
│ │ │ ├── Dashboard/
│ │ │ │ ├── ReportsList.jsx
│ │ │ │ ├── ReportViewer.jsx
│ │ │ │ ├── TestCard.jsx
│ │ │ │ ├── TrendChart.jsx
│ │ │ │ └── Dashboard.css
│ │ │ └── Analysis/
│ │ │ ├── ExplanationView.jsx
│ │ │ ├── TrendInsights.jsx
│ │ │ ├── ComparisonView.jsx
│ │ │ └── Analysis.css
│ │ ├── pages/
│ │ │ ├── Dashboard.jsx
│ │ │ └── Dashboard.css
│ │ ├── config/
│ │ │ └── firebase.js
│ │ ├── utils/
│ │ │ └── api.js
│ │ ├── App.jsx
│ │ ├── App.css
│ │ └── main.jsx
│ ├── public/
│ ├── package.json
│ └── vite.config.js
├── functions/
│ ├── src/
│ │ ├── index.js
│ │ ├── extractLabData.js
│ │ ├── analyzeReport.js
│ │ ├── getTrends.js
│ │ ├── compareReports.js
│ │ └── safetyGuardrails.js
│ └── package.json
├── bigquery/
│ └── schema.sql
├── config/
│ └── document-ai-config.json
├── firebase.json
├── firestore.rules
├── storage.rules
└── README.md
- 📖 SETUP_GUIDE.md - Complete step-by-step setup instructions
- 🚀 QUICK_START.md - Fast setup for beginners
- 🔧 TROUBLESHOOTING.md - Common issues and solutions
- 📁 FILE_ORGANIZATION.md - Detailed file structure
New to the project? Start with QUICK_START.md for the fastest path to a working app.
Need detailed setup? See SETUP_GUIDE.md for comprehensive instructions.
- Node.js 18+
- Firebase CLI (
npm install -g firebase-tools) - Google Cloud account with billing enabled
- Firebase project
- Create a Firebase project at Firebase Console
- Enable Authentication (Email/Password and Google)
- Create Firestore database
- Create Storage bucket
- Install Firebase CLI:
npm install -g firebase-tools - Login:
firebase login - Initialize project:
firebase init
-
Enable the following APIs in Google Cloud Console:
- Document AI API
- BigQuery API
- Cloud Functions API
-
Create a Document AI processor:
- Go to Document AI Console
- Create a Form Parser Processor
- Note the Processor ID
-
Create BigQuery dataset:
bq mk --dataset medical_reports
-
Run the schema SQL:
bq query --use_legacy_sql=false < bigquery/schema.sql
VITE_FIREBASE_API_KEY=your_api_key_here
VITE_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your_project_id
VITE_FIREBASE_STORAGE_BUCKET=your_project.appspot.com
VITE_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
VITE_FIREBASE_APP_ID=your_app_id
VITE_CLOUD_FUNCTIONS_URL=https://your-region-your-project.cloudfunctions.net/apifirebase functions:config:set \
gcp.project_id="your-project-id" \
document_ai.processor_id="your-processor-id" \
document_ai.location="us" \
bigquery.dataset="medical_reports" \
gemini.api_key="your-gemini-api-key"Or set environment variables directly:
firebase functions:config:set gemini.api_key="your-api-key"cd frontend
npm installcd functions
npm installfirebase deploy --only functionscd frontend
npm run build
cd ..
firebase deploy --only hostingfirebase deploy --only firestore:rules,storagecd frontend
npm run devfirebase emulators:start- Sign Up/Login: Create an account or sign in with Google
- Upload Report: Drag and drop a PDF lab report
- View Results: See extracted test values with color-coded status
- Get Explanation: Click "Get AI Explanation" for plain-language insights
- View Trends: See historical trends for specific tests
- Compare Reports: Select multiple reports to compare side-by-side
- Keyword Blocking: Automatically removes diagnosis/treatment language
- Disclaimer: Every AI response includes safety disclaimer
- Rate Limiting: 10 requests per minute per user
- Authentication: All endpoints require valid Firebase Auth token
- User Isolation: Users can only access their own data
All endpoints require Firebase Auth Bearer token.
Process a PDF lab report and extract structured data.
Request:
{
"pdfUri": "gs://bucket/path/to/file.pdf",
"userId": "user_123"
}Generate AI-powered explanation for a report.
Request:
{
"reportId": "report_123"
}Get historical trends for a specific test.
Request:
{
"userId": "user_123",
"testName": "Hemoglobin"
}Compare multiple reports side-by-side.
Request:
{
"reportIds": ["report_1", "report_2"]
}- Upload various lab report formats (Quest, LabCorp, hospital labs)
- Verify data extraction accuracy (>95% for standard formats)
- Test trend calculations with synthetic historical data
- Validate safety guardrails block diagnosis language
- Check responsive design on mobile devices
- Verify authentication and authorization
- Load test Cloud Functions (100 concurrent users)
- Confirm HIPAA compliance considerations (encryption at rest/transit)
- All data encrypted in transit (HTTPS)
- Firebase Storage encryption at rest
- BigQuery encryption at rest
- User data isolation via Firestore security rules
- Rate limiting to prevent abuse
- No PII stored in logs
- Verify processor ID is correct
- Check processor is trained for lab report format
- Review Document AI response format
- Verify dataset and table exist
- Check service account permissions
- Ensure schema matches expected format
- Verify API key is set correctly
- Check API quota limits
- Review prompt format
This is a production application. Please ensure:
- All safety guardrails are maintained
- No diagnosis/treatment language in code or responses
- Proper error handling
- Security best practices
This project is for educational purposes. Ensure compliance with healthcare regulations (HIPAA, etc.) before production use.
- SETUP_GUIDE.md - Complete setup with all configurations
- QUICK_START.md - Fast setup for beginners
- TROUBLESHOOTING.md - Solutions to common problems
- FILE_ORGANIZATION.md - Project structure explained
For issues or questions:
- Check TROUBLESHOOTING.md first
- Review SETUP_GUIDE.md for configuration
- Check official documentation: