MedGuard is an iOS app that provides personalized drug safety analysis by combining:
- Genetic Testing (23andMe) - Analyzes cytochrome P450 enzyme variants
- Drug Interaction Database - Checks for drug-drug and gene-drug interactions
- Vital Signs Monitoring - Uses Presage SDK to track heart rate & breathing
- AI-Powered Insights - Gemini API generates comprehensive safety reports
When patients start new medications, doctors rely on general clinical evidence, but individual genetic variations can cause unexpected reactions. MedGuard provides a personalized risk assessment before the first dose.
- π’ GREEN - No significant interactions β Proceed safely
- π‘ YELLOW - Potential interaction β Monitor vitals for 2-4 hours
- π΄ RED - High risk β Consult physician immediately
βββββββββββββββββββββββββββββββββββββββββββββββ
β iOS App (Swift/SwiftUI) β
β - User Interface β
β - Presage SDK Integration (vitals) β
β - File handling (23andMe data) β
β - Local state management β
ββββββββββββββββββββ¬βββββββββββββββββββββββββββ
β
β API Calls
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββ
β Backend Service (optional) β
β - Drug interaction database queries β
β - Activity score calculations β
β - Gemini API integration β
β - Secure API key management β
βββββββββββββββββββββββββββββββββββββββββββββββ
Note: For the hackathon demo, all processing happens client-side in the iOS app for simplicity. The backend is optional and can be added later for production.
- Import 23andMe raw genetic data
- Automatically extracts cytochrome P450 genes:
- CYP2D6 - Affects 25% of drugs (codeine, metoprolol, etc.)
- CYP2C19 - Metabolizes PPIs, antidepressants
- CYP2C9 - Processes warfarin, NSAIDs
- CYP3A4/5 - Metabolizes 50% of medications
- CYP1A2 - Processes caffeine, antipsychotics
- Add all current and planned medications
- Track dosage and frequency
- Easy edit and delete functionality
- 30-second camera-based measurement
- Records heart rate and breathing rate
- Uses Presage SDK for medical-grade accuracy
-
Activity Score Calculation
- Genetic factors (CYP variants)
- Demographic factors (age, sex)
- Lifestyle factors (smoking, alcohol)
-
Drug-Drug Interaction (DDI) Detection
- Cross-references medication list
- Identifies known dangerous combinations
-
Gene-Drug Interaction (GDI) Detection
- Matches medications to genetic profile
- Identifies poor/ultra-rapid metabolizers
-
AI Report Generation (Gemini)
- Concise patient summary
- Detailed clinical explanation
- Specific actionable recommendations
- Track vitals after taking medication
- Compare to baseline measurements
- Alert on significant changes (ΞHR > 20 BPM or ΞBR > 5 BPM)
- macOS with Xcode 15.0 or later
- iOS Device (iPhone with camera) - Simulator won't work for Presage SDK
- 23andMe Account (for DNA data)
- Presage API Key - Get from https://physiology.presagetech.com
# Create new Xcode project
# File β New β Project β iOS β App
# Name: MedGuard
# Interface: SwiftUI
# Language: Swift# Download SmartSpectra Swift SDK
# Add to your project as a local Swift Package
# File β Add Package Dependencies β Add Local
# Select the SDK folder from the documentationCopy these files into your Xcode project:
MedGuard/
βββ ContentView.swift # Main app view
βββ AppState.swift # Data models & API service
βββ VitalsMonitorView.swift # Presage integration
βββ MedicationInputView.swift # Medication management
βββ DNAUploadView.swift # 23andMe upload
βββ AnalysisResultsView.swift # Results display
βββ Info.plist # Camera permissions
Add camera permission:
<key>NSCameraUsageDescription</key>
<string>Required for measuring heart rate and breathing using camera</string>In ContentView.swift:
// Replace with your Presage API key
let apiKey = "YOUR_PRESAGE_API_KEY"
sdk.setApiKey(apiKey)Gemini API key is already included in AppState.swift:
private let geminiAPIKey = "AIzaSyAg24n-YWgkJf8aka251yUPEkKTOLFBdiM"- Connect your iPhone via USB
- Select your device in Xcode
- Click Run (βR)
- Grant camera permission when prompted
score = 1.0 (baseline)
// Genetic factors
if CYP2D6 == "TT": score *= 0.5 // Poor metabolizer
if CYP2C19 == "AA": score *= 0.5
if CYP2C9 != "CC": score *= 0.9
// Demographics
if age > 65: score *= 0.8
if sex == "Female": score *= 0.95
// Lifestyle
if smoking: score *= 1.2 (increased CYP1A2)
if heavy alcohol: score *= 0.85interactions_count = DDI.count + GDI.count
if interactions >= 3 OR score < 0.5 OR score > 1.5:
return RED (danger)
else if interactions >= 1 OR score < 0.7 OR score > 1.3:
return YELLOW (caution)
else if interactions == 0 AND 0.8 <= score <= 1.2:
return GREEN (safe)
else:
return GRAY (unknown)- Gradient Backgrounds - Modern, professional look
- Step-by-step Workflow - Clear progression through analysis
- Traffic Light Visual - Instant risk understanding
- Real-time Vitals - Live heart rate and breathing display
- Shareable Reports - Export to share with doctors
-
Upload Sample DNA
- Use provided sample 23andMe file
- Or create mock data with known CYP variants
-
Add Test Medications
- Example: Warfarin + Aspirin (DDI)
- Example: Codeine + CYP2D6*4/*4 (GDI)
-
Record Baseline
- Use camera to measure vitals
- ~30 seconds for accurate reading
-
Run Analysis
- AI generates comprehensive report
- Risk level displayed as traffic light
-
Monitor (if yellow/red)
- Take medication
- Measure vitals after 2-4 hours
- Compare to baseline
Safe (Green):
Medication: Acetaminophen
DNA: Normal CYP2E1
Result: No interactions, normal metabolism
Caution (Yellow):
Medications: Warfarin + Ibuprofen
Result: Increased bleeding risk
Action: Monitor for bruising/bleeding
Danger (Red):
Medication: Codeine
DNA: CYP2D6 *4/*4 (poor metabolizer)
Result: Reduced pain relief, risk of side effects
Action: Consult physician for alternative
// Package.swift
dependencies: [
.package(path: "../SmartSpectraSwiftSDK") // Presage SDK
]No backend required for demo! Everything runs client-side.
- Backend API for drug database
- HealthKit integration (sleep, activity)
- Push notifications for monitoring reminders
- Family sharing (monitor elderly relatives)
- Pharmacy integration (auto-check new prescriptions)
- Wearable support (Apple Watch vitals)
- Multilingual support
- HIPAA compliance for production
This is a hackathon project! Feel free to:
- Fork and improve
- Add more drug interactions
- Enhance UI/UX
- Integrate additional data sources
MIT License - Build upon this for your own projects!
Team: ARC
Track: Health Tech / AI
Built with: Swift, SwiftUI, Presage SDK, Gemini API
Made with β€οΈ for safer medication use
For questions or demo requests, contact: yaa2076@nyu.edu