An open API service indexing awesome lists of open source software.

https://github.com/jaspreetsingh-exe/medxpert-frontend

MedXpert is an Android-based healthcare application that leverages OCR (Tesseract, pdfplumber) and LLMs (OpenAI GPT-3.5) to automate medical report extraction, abnormality detection, and natural language summarization. It features Firebase-powered user authentication, role-based access control, and real-time chatbot integration for medical queries.
https://github.com/jaspreetsingh-exe/medxpert-frontend

android-application chatbot fastapi firebase firestore gpt35turbo healthcare image-to-text kotlin llm medical-report ocr openai-api pdf-to-text python summarization

Last synced: 3 months ago
JSON representation

MedXpert is an Android-based healthcare application that leverages OCR (Tesseract, pdfplumber) and LLMs (OpenAI GPT-3.5) to automate medical report extraction, abnormality detection, and natural language summarization. It features Firebase-powered user authentication, role-based access control, and real-time chatbot integration for medical queries.

Awesome Lists containing this project

README

          

# MedXpert-FrontEnd

Welcome to **MedXpert-FrontEnd**, the Android application of the **MedXpert** system. MedXpert is a smart medical report analysis platform designed to simplify complex medical documents, highlight abnormal readings, and provide users with a clear, easy-to-understand health summary.

This repository contains the full Android app codebase for the MedXpert system, responsible for interacting with users and displaying simplified medical insights retrieved from the backend.

---

## πŸ₯ Problem Statement & Why MedXpert is Useful

### **The Challenge:**
Understanding medical reports can be challenging for non-medical professionals. Many patients struggle to interpret complex test results, abnormal values, and medical terminology. Additionally, doctors often have limited time to explain reports in detail, leaving patients uncertain about their health conditions.

---

## πŸš€ How MedXpert Solves This Problem

### Backend:
The backend of MedXpert is responsible for handling the heavy lifting of medical report analysis. It performs the following tasks:

- βœ… **Extracts Medical Data**: Utilizes advanced OCR technologies like Tesseract and pdfplumber to accurately extract text from PDF and image-based medical reports.
- βœ… **Summarizes Medical Jargon**: Processes complex medical terminologies and converts them into simplified, understandable summaries using AI-powered language models (OpenAI GPT-3.5).
- βœ… **Detects Abnormal Readings**: Scans for abnormal values within the report and highlights potential health concerns through AI-driven analysis.
- βœ… **Powers the Chatbot**: Provides instant, reliable answers to user queries about their medical reports by leveraging LLM (Large Language Model)-based responses.

---

### Frontend:
The frontend of MedXpert provides a seamless and user-friendly Android interface for interacting with the backend features. It handles:

- βœ… **User-Friendly Interface**: Designed to ensure even non-technical users can easily upload reports and view results.
- βœ… **Report Upload & Results Display**: Allows users to submit their reports and receive a detailed analysis and summary of the findings.
- βœ… **Abnormality Highlighting**: Visually marks abnormal values within the summary to help users quickly identify areas of concern.
- βœ… **User Role Management**: Manages user authentication (guest and logged-in users) and enforces usage limits.
- βœ… **Chatbot Interaction**: Facilitates communication with the backend chatbot for personalized health insights and explanations.

---

### βœ… MedXpert makes medical understanding accessible and actionable by:
- βœ… Providing an intuitive Android app interface.
- βœ… Allowing users to upload reports and view summaries.
- βœ… Displaying highlighted abnormalities visually.
- βœ… Managing user roles, limits, and chatbot interactions.

---

## πŸ“₯ Download MedXpert APK

πŸ”— [**Download Latest APK**](https://github.com/JaspreetSingh-exe/MedXpert-FrontEnd/releases/download/v1.0.0/app-debug.apk)

πŸ’‘ Click the link above to download the latest version of the MedXpert app and install it on your Android device.

---

## 🌐 Live Demo

▢️ **Click the image below to watch the full demo video:**

[![Watch the Demo](https://img.youtube.com/vi/-8R1s6liwyo/maxresdefault.jpg)](https://youtu.be/-8R1s6liwyo)

---

## βš™οΈ Features

- **User authentication (Guest & Logged-in users)**


Signup
Signin
Forgot Password

```kotlin
// βœ… Signup
FirebaseAuth.getInstance()
.createUserWithEmailAndPassword(email, password)
.addOnCompleteListener { task ->
if (task.isSuccessful) {
// Signup success
} else {
// Signup failed
}
}

// βœ… Signin
FirebaseAuth.getInstance()
.signInWithEmailAndPassword(email, password)
.addOnCompleteListener { task ->
if (task.isSuccessful) {
// Signin success
} else {
// Signin failed
}
}

// βœ… Forgot Password
FirebaseAuth.getInstance()
.sendPasswordResetEmail(email)
.addOnCompleteListener { task ->
if (task.isSuccessful) {
// Reset email sent
} else {
// Failed to send reset email
}
}
```

- **Upload medical reports (PDF/Image formats)**


File Upload
File Selected
File Uploaded

```kotlin
val intent = Intent(Intent.ACTION_GET_CONTENT)
intent.type = "application/pdf"
startActivityForResult(intent, REQUEST_CODE)
```

- **View simplified summaries and abnormalities of your reports**


Summary



```kotlin
summaryTextView.text = "Summary: ${viewModel.summary}"
```

- **Usage limits based on user roles**:

- **Logged-in Users** (Limit: 5 uploads per day and 10 chabot queries per day):
```kotlin
if (user.isLoggedIn && dailyUploads >= 10) showLimitReached()
```
- **Guest Users** (Limit: 2 uploads per day and not chabot access):
```kotlin
if (user.isGuest && dailyUploads >= 2) showLimitReached()
```


ChatbotLock

- **Integrated chatbot**


ChabotSplash
ChatbotChat

---

## πŸ› οΈ Tech Stack

| Technology | Description |
|-------------------------|-----------------------------------------------------------------------------------------------|
| **Platform** | Android (**Kotlin**) – A modern, concise, and powerful statically typed programming language. |
| **UI Design** | XML Layouts – Declarative UI component design for seamless user experiences. |
| **State Management** | ViewModel + LiveData – Lifecycle-aware components to handle and observe UI-related data. |
| **Authentication** | Firebase Authentication – Secure, scalable user sign-in and account management. |
| **Backend Integration** | OkHttp – Efficient and powerful HTTP client for handling API communication. |
| **Cloud Services** | Firebase – Realtime database, storage, analytics, and backend services. |
| **Deployment** | Google Play Store *(coming soon)* – For global Android app distribution. |

---

### πŸ”„ Example Integrations:

#### OkHttp Setup:
```kotlin
val client = OkHttpClient()

val request = Request.Builder()
.url("https://api.medxpert.com/")
.build()

client.newCall(request).enqueue(object : Callback {
override fun onFailure(call: Call, e: IOException) {
// Handle failure
}

override fun onResponse(call: Call, response: Response) {
// Handle response
}
})
```

#### Firebase Authentication:
```kotlin
FirebaseAuth.getInstance().signInWithEmailAndPassword(email, password)
.addOnCompleteListener { task ->
if (task.isSuccessful) {
// User signed in successfully
}
}
```

---

## πŸ“‚ Project Structure

```
MedXpert/
β”œβ”€β”€ manifests/
β”‚ └── AndroidManifest.xml # Defines essential app configurations and permissions.
β”œβ”€β”€ java/
β”‚ └── com.example.medxpert
β”‚ β”œβ”€β”€ adapters/ # Handles data population in RecyclerViews.
β”‚ β”‚ β”œβ”€β”€ ChatAdapter.kt # Manages chat messages display.
β”‚ β”‚ β”œβ”€β”€ ReportAdapter.kt # Manages report items in a list.
β”‚ β”‚ └── UserAdapter.kt # Manages user list and interactions.
β”‚ β”œβ”€β”€ fragments/ # Modular UI components for various screens.
β”‚ β”‚ β”œβ”€β”€ ChatBotFragment.kt # Chat interface with the medical assistant.
β”‚ β”‚ β”œβ”€β”€ ChatIntroFragment.kt # Introduction to chatbot features.
β”‚ β”‚ β”œβ”€β”€ ResultsFragment.kt # Displays analyzed medical report results.
β”‚ β”‚ └── UploadFragment.kt # Handles medical report upload.
β”‚ β”œβ”€β”€ models/ # Data classes used across the app.
β”‚ β”‚ β”œβ”€β”€ Report.kt # Represents a medical report structure.
β”‚ β”‚ β”œβ”€β”€ User.kt # Represents user profile information.
β”‚ β”‚ └── Message.kt # Represents chat message data.
β”‚ β”œβ”€β”€ DashBoardActivity.kt # Post-login dashboard.
β”‚ β”œβ”€β”€ ForgotPasswordActivity.kt # Allows users to recover passwords.
β”‚ β”œβ”€β”€ MainActivity.kt # App's main entry point handling navigation.
β”‚ β”œβ”€β”€ ProfileActivity.kt # Displays and updates user profile.
β”‚ β”œβ”€β”€ SignInActivity.kt # Manages login functionality.
β”‚ β”œβ”€β”€ SignUpActivity.kt # Handles user registration.
β”‚ └── SplashActivity.kt # Displays splash screen on app startup.
β”œβ”€β”€ res/
β”‚ β”œβ”€β”€ drawable/ # Contains image assets and vector graphics.
β”‚ β”œβ”€β”€ layout/ # Holds all XML UI layout files.
β”‚ β”œβ”€β”€ activity_dash_board.xml # Layout for the dashboard screen.
β”‚ β”œβ”€β”€ activity_forgot_password.xml # Layout for password recovery.
β”‚ β”œβ”€β”€ activity_main.xml # Main container layout.
β”‚ β”œβ”€β”€ activity_profile.xml # User profile screen layout.
β”‚ β”œβ”€β”€ activity_sign_in.xml # Login screen layout.
β”‚ β”œβ”€β”€ activity_sign_up.xml # Registration screen layout.
β”‚ β”œβ”€β”€ activity_splash.xml # Splash screen layout.
β”‚ β”œβ”€β”€ dialog_loading.xml # Loading dialog layout.
β”‚ β”œβ”€β”€ dialog_reset_success.xml # Success dialog after password reset.
β”‚ β”œβ”€β”€ dialog_verification.xml # Verification dialog layout.
β”‚ β”œβ”€β”€ fragment_chat_bot.xml # ChatBot UI layout.
β”‚ β”œβ”€β”€ fragment_chat_intro.xml # Intro screen for chatbot.
β”‚ β”œβ”€β”€ fragment_results.xml # Displays report results.
β”‚ β”œβ”€β”€ fragment_upload.xml # Upload report screen layout.
β”‚ β”œβ”€β”€ item_chat_ai.xml # Layout for AI chat messages.
β”‚ └── item_chat_user.xml # Layout for user chat messages.
β”‚ β”œβ”€β”€ mipmap/ # App launcher icons.
β”‚ β”œβ”€β”€ raw/ # Stores raw assets like instructional videos.
β”‚ └── values/ # XML files for app-wide constants (strings, colors, themes).
β”œβ”€β”€ build.gradle.kts # Gradle build script for project dependencies and settings.
β”œβ”€β”€ proguard-rules.pro # Rules for code obfuscation and optimization.
β”œβ”€β”€ google-services.json # Firebase configuration file.
└── README.md # Project documentation.
```

---

## πŸš€ Installation

### 1. Clone the repository

To clone the project repository, use the following commands:

```bash
git clone https://github.com/JaspreetSingh-exe/MedXpert-FrontEnd.git
cd MedXpert-FrontEnd
```

### 2. Open in Android Studio

Follow these steps to open the project:
- Launch **Android Studio**.
- Select **Open an existing project**.
- Navigate to the cloned directory and select the project.

### 3. Setup environment

Ensure the following configurations:
- Add your Firebase configuration file `google-services.json` to the `/app` directory.
- Connect your project with Firebase through the Firebase Console.
- Define your backend API endpoints in the appropriate service classes.

### 4. Add api_url in `strings.xml`
```xml

https://api.medxpert.com/

```

### 5. Build and run

To run the project:
- Click on the **Run** button or use the shortcut `Shift + F10`.
- Choose a connected device or emulator for testing.

---

## πŸ“ Backend Integration

The MedXpert Android app communicates with the MedXpert Backend API to provide the core functionalities of the application. The backend processes and returns the necessary data, and the frontend handles the presentation and interaction.

### πŸ”„ How the Backend Works with the Frontend:

- **Medical Report Analysis**: When a user uploads a report, the frontend sends the file via an HTTP request to the backend. The backend performs OCR and text extraction, then analyzes the data to detect abnormalities and generate summaries.

- **Summary Generation**: The backend uses AI-powered language models to convert complex medical data into simplified summaries and returns them to the frontend for display.

- **Usage Management**: The backend tracks the number of uploads and chatbot interactions per user and enforces daily usage limits.

- **Chatbot Integration**: The chatbot interface on the app sends user queries to the backend, which generates intelligent, context-aware responses using LLMs.

### πŸ”— Backend Repository
πŸ‘‰ [MedXpert-Backend Repository](https://github.com/JaspreetSingh-exe/MedXpert-Backend-FastAPI)

---

## 🧩 Future Improvements

### πŸ”Ή Dark Mode
Introduce a dark theme option to reduce eye strain and provide a comfortable user experience in low-light conditions.

### πŸ”Ή Upload History and Tracking
Add functionality for users to access and manage a history of their uploaded reports, enabling easy review and re-analysis.

### πŸ”Ή Multi-language Support
Implement support for multiple languages to make the app accessible to a global user base, breaking language barriers in healthcare.

### πŸ”Ή Offline Support
Allow users to view previously analyzed reports and summaries without needing an active internet connection.

---

## 🀝 Open for Contributions
We welcome contributions from developers and UI/UX designers to enhance the MedXpert Application! If you would like to contribute, here’s how you can help:

### **How to Contribute**
1. **Fork the Repository**: Click on the "Fork" button at the top right of this repository.
2. **Clone Your Fork**: Clone the repository to your local machine.
```bash
git clone https://github.com/JaspreetSingh-exe/MedXpert-FrontEnd.git
cd MedXpert-FrontEnd
```
3. **Create a New Branch**: Make sure to create a new branch for your changes.
```bash
git checkout -b feature-new-enhancement
```
4. **Make Your Changes**: Add new features, fix bugs, or improve documentation.
5. **Commit and Push**: Commit your changes and push to your fork.
```bash
git add .
git commit -m "Added a new feature"
git push origin feature-new-enhancement
```
6. **Create a Pull Request**: Submit a pull request (PR) to the `main` branch of this repository.

### **Guidelines for Contributions**
- Follow best practices for **code structure, comments, and documentation**.
- Ensure that your code **passes all tests and does not break existing functionality**.
- If adding a new feature, please **update the documentation accordingly**.
- Be **respectful and collaborative** when reviewing and discussing PRs.

Join me in making **MedXpert a powerful and intelligent AI-based medical report analyzer**! πŸš€

---

## πŸ“ž Support
If you encounter any issues, feel free to create an issue on GitHub.
For any queries reach out at `jaspreetsingh01110@gmail.com`

---

## πŸ“œ License
This project is licensed under the **Apache License 2.0**. See `LICENSE` for details.

---

> ⭐ Don't forget to **star** this repo if you like the project!