Skip to content

About

AI-powered Polypharmacy Safety Companion built with Kotlin Multiplatform (Android & iOS).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

16 Commits

Folders and files

Repository files navigation

logo1

MedGuard AI

Medication safety is often overlooked, yet dangerous drug interactions are one of the most common preventable healthcare risks. MedGuard AI is a cross-platform mobile application designed to help users identify potentially harmful medication combinations in a clear, accessible, and reliable way.

Inspired by real-world medication safety challenges, MedGuard AI combines a deterministic rule-based risk engine with optional AI-powered explanations to ensure the app remains functional even when AI services are unavailable. The focus is on patient safety, accessibility, and trust, rather than blind dependence on AI.

Built using Kotlin Multiplatform and Compose Multiplatform, MedGuard AI runs seamlessly on Android and iOS, demonstrating how healthcare-focused tools can be built responsibly across platforms without sacrificing reliability.

Key Features

Medication Interaction Analysis Detects potentially dangerous combinations such as:

  • Anticoagulants + NSAIDs

  • Opioids + Benzodiazepines / Alcohol

  • Polypharmacy risks

  • Known high-risk drug pairings

  • Rule-Based Risk Engine (Always Works) A deterministic safety engine classifies interactions into:

    • 🟒 Low Risk
    • 🟑 Moderate Risk
    • πŸ”΄ High Risk
  • πŸ€– Optional AI Insights AI explanations enhance understanding when available β€” but the app never breaks if AI fails.

  • πŸ“Š Visual Risk Graphs Simple green / yellow / red bar graphs to help users instantly understand risk severity.

  • πŸ“· Text-Based Medication Scanner Allows users to scan medicine labels or prescriptions and auto-populate medication names.

  • β™Ώ Accessibility Mode Larger text, high-contrast UI, and simplified layouts for elderly users and patients with visual impairments.

  • ⚠️ Medical Disclaimer & Safe Design Clear disclaimers ensure users understand that MedGuard AI is an informational tool, not a replacement for professional medical advice.


πŸŽ₯ Demo Video and Screenshots

πŸ‘‰ [https://drive.google.com/file/d/1PDhA0t0rWj2uandyjBn5EI9AS4mYo8vD/view?usp=drive_link]

image image image image

πŸŽ₯ Essay Link

Project Structure

This is a Kotlin Multiplatform (KMP) project targeting Android and iOS.

MedGuardKMP/
β”œβ”€β”€ composeApp/
β”‚   β”œβ”€β”€ commonMain/      # Shared UI, logic, and domain code
β”‚   β”œβ”€β”€ androidMain/     # Android-specific implementations
β”‚   └── iosMain/         # iOS-specific implementations
β”‚
β”œβ”€β”€ iosApp/              # iOS application entry point
└── README.md
  • commonMain contains all shared Compose UI, risk engine logic, and models.
  • Platform-specific code is isolated cleanly to avoid duplication.

How to Run the Project

Prerequisites

  • JDK 17 or higher
  • Android Studio (latest stable)
  • Xcode (for iOS builds)
  • Kotlin Multiplatform plugin
  • Compose Multiplatform plugin

Follow the official setup guide: πŸ‘‰ https://www.jetbrains.com/help/kotlin-multiplatform-dev/multiplatform-create-first-app.html


▢️ Build & Run β€” Android

Clone the repository: https://github.com/SillyMarvellousChad/MedGuardKMP.git

macOS / Linux

./gradlew :composeApp:assembleDebug

Windows

.\gradlew.bat :composeApp:assembleDebug

Or simply use the Run button in Android Studio.


▢️ Build & Run β€” iOS

  1. Open the iosApp folder in Xcode
  2. Select a simulator or device
  3. Click Run

πŸ”‘ AI Configuration (Optional)

MedGuard AI does NOT require AI to function.

If you want AI explanations:

  1. Create a Gemini API key πŸ‘‰ https://aistudio.google.com/

  2. Add a local.properties file:

apiKey=your-gemini-api-key
model=gemini-2.5-flash

If the API fails or is missing, the app automatically falls back to rule-based safety analysis.


How to Try Key Features

This section explains how to explore MedGuard AI’s core functionality once the app is running.

1️⃣ Medication Interaction Check (Rule-Based + AI)

Launch the app.

Enter medications in the input field, separated by commas (example: Metformin, Amlodipine, Atorvastatin).

Tap β€œCheck Interactions”.

The app will:

Instantly display a rule-based safety assessment (Low / Moderate / High risk)

Show a clear explanation of why the risk level was assigned

Optionally display an AI-generated insight when the AI service is available

If the AI service is unavailable, the app gracefully falls back to the rule-based engine.

2️⃣ Scan Medicines (Camera / Demo Mode)

Tap β€œπŸ“· Scan Medicines”.

On supported platforms, point the camera at a medicine label (or use the demo scan button if running in emulator mode).

The detected medicines are automatically filled into the input field.

Tap β€œCheck Interactions” to analyze the scanned medications.

This demonstrates how MedGuard AI can reduce manual input and improve accessibility.

3️⃣ Risk Visualization (Graphs)

After running an interaction check, the app displays a visual risk graph:

🟒 Green bar β†’ Low risk

🟑 Yellow bar β†’ Moderate risk

πŸ”΄ Red bar β†’ High risk

This provides quick, intuitive feedback for users without medical expertise.

Architecture

MedGuard AI follows a clean, layered architecture:

  • UI Layer (Compose Multiplatform) Screens, accessibility controls, graphs, and scanner UI.

  • Domain Layer Risk engine, risk rules, and deterministic safety evaluation.

  • Optional AI Layer Non-blocking AI explanations with graceful fallback.

This architecture ensures stability, testability, and safety, which is essential for healthcare-oriented software. Ar


πŸ§ͺ Why This Project Matters

  • Prioritizes user safety over novelty
  • Demonstrates responsible AI usage
  • Works even when AI services fail
  • Designed for real patients, not just demos
  • Fully cross-platform with shared UI & logic

⚠️ Medical Disclaimer

MedGuard AI provides informational medication safety insights only. It is not a diagnostic tool and does not replace professional medical advice.

Always consult a qualified healthcare professional before starting, stopping, or combining medications.


Built Using

  • Kotlin Multiplatform
  • Compose Multiplatform
  • Gemini API (optional)
  • Kotlin Coroutines
  • Material 3
  • Modern Android & iOS toolchains

πŸ“„ License

This project is licensed under the Apache License 2.0.

About

AI-powered Polypharmacy Safety Companion built with Kotlin Multiplatform (Android & iOS).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages