Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

MediLocker

MediLocker is a Flutter mobile application for securely storing and managing medical records such as prescriptions, lab reports, and X-ray images. It uses Firebase Authentication, Firestore, Firebase Storage, Google ML Kit OCR, AI-based report summarization, and local medicine reminders.

Features

  • Google Sign-In with Firebase Authentication
  • Dashboard with quick actions for upload, reports, reminders, and profile
  • Upload medical reports from camera or file picker
  • Firebase Storage upload and Firestore metadata tracking
  • OCR text extraction for image-based reports using Google ML Kit
  • AI summary generation using Gemini API or OpenAI API
  • Reports list with thumbnails, upload dates, and summary previews
  • Report detail page with extracted text and sharing actions
  • Medicine reminders using flutter_local_notifications
  • Bottom navigation and healthcare-themed Material 3 UI

Project Structure

lib/
  models/
  screens/
  services/
  utils/
  widgets/

Packages Used

  • firebase_core
  • firebase_auth
  • cloud_firestore
  • firebase_storage
  • google_sign_in
  • google_mlkit_text_recognition
  • image_picker
  • file_picker
  • http
  • flutter_local_notifications
  • timezone
  • share_plus
  • url_launcher

Run Locally

  1. Install Flutter and verify with:
flutter doctor
  1. Open the project:
cd /Users/palakpandit/Documents/New\ project/medilocker
  1. Create a Firebase project in the Firebase console.

  2. Enable these Firebase products:

  • Authentication
  • Cloud Firestore
  • Storage
  1. Enable Google Sign-In inside Firebase Authentication.

  2. Configure FlutterFire:

dart pub global activate flutterfire_cli
flutterfire configure

This generates platform-specific Firebase configuration. You can keep the existing lib/firebase_options.dart placeholder file or replace it with the generated one.

  1. For Android, add your SHA-1 and SHA-256 fingerprints in Firebase so Google Sign-In works.

You also need the Web OAuth client ID as the Google server client ID for Android sign-in with google_sign_in v7. Pass it with --dart-define=GOOGLE_SERVER_CLIENT_ID=....

  1. For iOS:
  • Add GoogleService-Info.plist to ios/Runner/
  • Open ios/Runner.xcworkspace in Xcode
  • Add the reversed client ID to URL Types
  1. Set your AI provider and API key using --dart-define.

Gemini example:

flutter run \
  --dart-define=GOOGLE_SERVER_CLIENT_ID=YOUR_FIREBASE_WEB_CLIENT_ID \
  --dart-define=AI_PROVIDER=gemini \
  --dart-define=AI_API_KEY=YOUR_GEMINI_API_KEY \
  --dart-define=AI_MODEL=gemini-1.5-flash

OpenAI example:

flutter run \
  --dart-define=GOOGLE_SERVER_CLIENT_ID=YOUR_FIREBASE_WEB_CLIENT_ID \
  --dart-define=AI_PROVIDER=openai \
  --dart-define=AI_API_KEY=YOUR_OPENAI_API_KEY \
  --dart-define=AI_MODEL=gpt-4.1-mini
  1. Install dependencies and run:
flutter pub get
flutter run

Firestore Data Model

reports

{
  "userId": "firebase-user-id",
  "reportType": "prescription",
  "uploadDate": "timestamp",
  "fileURL": "https://storage-download-url",
  "fileName": "report.jpg",
  "mimeType": "image/jpeg",
  "extractedText": "OCR result",
  "aiSummary": "Patient-friendly summary"
}

reminders

{
  "userId": "firebase-user-id",
  "medicineName": "Amoxicillin",
  "timeOfDay": "09:00",
  "durationDays": 7,
  "createdAt": "timestamp"
}

Suggested Firestore Rules

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /reports/{reportId} {
      allow read, write: if request.auth != null && request.auth.uid == request.resource.data.userId;
    }
    match /reminders/{reminderId} {
      allow read, write: if request.auth != null && request.auth.uid == request.resource.data.userId;
    }
    match /users/{userId} {
      allow read, write: if request.auth != null && request.auth.uid == userId;
    }
  }
}

Suggested Storage Rules

rules_version = '2';
service firebase.storage {
  match /b/{bucket}/o {
    match /medical_reports/{userId}/{allPaths=**} {
      allow read, write: if request.auth != null && request.auth.uid == userId;
    }
  }
}

Notes

  • OCR currently runs on image files. PDFs are uploaded and organized, but not OCR-processed by this version.
  • If no AI API key is set, the app falls back to a basic local preview summary.
  • Use a real generated firebase_options.dart before production deployment.
image image image image image

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages