Skip to content

Latest commit

Β 

History

71 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MedSignal πŸ₯πŸ’Š

A comprehensive medication management platform connecting patients and physicians through secure, FHIR-compliant healthcare data sharing.

MedSignal is a React Native mobile application that helps patients track their medications, maintain adherence, and seamlessly share health data with their physicians. Built with healthcare interoperability standards and enterprise-grade security, MedSignal bridges the gap between personal medication management and professional healthcare oversight.


πŸ“± What is MedSignal?

MedSignal is a dual-interface healthcare application designed for two distinct user roles:

For Patients

A personal medication assistant that:

  • Tracks your medications and schedules with intelligent reminders
  • Analyzes prescription photos using AI to automatically extract medication details
  • Monitors your medication adherence and provides insights
  • Connects you with trusted contacts (family/caregivers) for support
  • Enables secure data sharing with your healthcare providers
  • Helps you find nearby pharmacies and healthcare services
  • Provides medication alternatives and detailed drug information

For Physicians

A practice management dashboard that:

  • Monitors patient medication adherence in real-time
  • Manages patient lists with comprehensive health metrics
  • Sends prescription requests directly to patients
  • Tracks key performance indicators (7-day, 30-day adherence rates)
  • Connects with patients through secure QR code pairing
  • Accesses FHIR-compliant patient medication data

✨ Core Features

🎯 Patient Features

Medication Management

  • Smart Entry System: Add medications manually with autocomplete powered by NIH drug database
  • AI Prescription Scanning: Take a photo of your prescription bottle or label, and OpenAI Vision API automatically extracts:
    • Medication name
    • Dosage strength
    • Quantity
    • Instructions
  • Flexible Scheduling: Set custom medication times (e.g., 8:00 AM, 12:00 PM, 8:00 PM)
  • Visual Organization: See all your medications in a clean, organized list with edit/delete capabilities

Intelligent Reminders

  • Push Notifications: Timely medication reminders delivered as notifications
  • Interactive Actions: Respond directly from notifications:
    • βœ… Taken: Mark medication as taken
    • ⏰ Snooze: Reminder reappears in 10 minutes
    • ❌ Skip: Mark as intentionally skipped
  • Custom Sounds: Distinctive notification sounds for medication alerts
  • Persistent Reminders: Notifications work even when app is closed

Adherence Tracking

  • Visual Analytics: See your medication compliance at a glance
  • Historical Trends: Track adherence over 7-day and 30-day periods
  • Per-Medication Stats: Individual compliance metrics for each medication
  • Streak Tracking: Monitor consecutive days of perfect adherence

Trusted Contacts Network

  • Add Caregivers: Invite family members or friends to help monitor your medications
  • Accountability Support: Trusted contacts can receive adherence updates (feature in development)
  • Emergency Access: Designated contacts for healthcare emergencies
  • Easy Management: Add, edit, or remove trusted contacts anytime

Prescription Request Management

  • Physician Integration: Receive prescription requests from your doctors
  • One-Tap Acceptance: Accept requests to automatically add medications to your tracking
  • Request History: View all past and pending prescription requests
  • Notification Alerts: Get notified when physicians send new prescriptions

Healthcare Provider Connections

  • QR Code Pairing: Scan your physician's QR code to establish secure connection
  • Secure Data Sharing: Share medication data using FHIR healthcare standards
  • Privacy Controls: Choose what data to share and with whom
  • Connection Management: View and manage all physician connections

Location Services

  • Nearby Pharmacies: Find pharmacies near your current location
  • Healthcare Providers: Locate doctors, clinics, and hospitals
  • Interactive Map: Visual map interface powered by React Native Maps
  • Navigation Integration: Get directions to selected locations

Drug Information

  • Medication Alternatives: Find generic or alternative medications
  • Drug Details: Access comprehensive medication information
  • Cost Comparisons: View pricing information for alternatives
  • Side Effects: Understand potential side effects and interactions

πŸ‘¨β€βš•οΈ Physician Features

Practice Dashboard

  • Real-time KPIs: Monitor key metrics at a glance:
    • Total active patients
    • Patients seen today
    • Average 7-day adherence across practice
    • Average 30-day adherence across practice
  • Animated Statistics: Engaging number animations for metric updates
  • Professional Interface: Clean, medical-grade user experience

Patient Management

  • Comprehensive Patient List: View all patients with:
    • Name and contact information
    • Current medications
    • Adherence rates (7-day and 30-day)
    • Last visit date
    • Risk indicators
  • Detailed Patient Profiles: Deep dive into individual patient data:
    • Complete medication history
    • Adherence trends and patterns
    • Prescription request history
    • Trusted contacts information
  • Search and Filter: Quickly find patients or filter by adherence level

Prescription Management

  • Send Prescriptions: Create and send prescription requests to patients
  • Request Tracking: Monitor which prescriptions have been accepted/declined
  • Medication Details: Specify dosage, frequency, and duration
  • Patient Notifications: Patients receive instant alerts for new prescriptions

QR Code System

  • Secure Pairing: Generate unique QR codes for patient connections
  • Session-based Security: QR codes expire after use for enhanced security
  • Easy Onboarding: Patients simply scan to connect with your practice
  • No Manual Entry: Eliminates errors from manual ID entry

Analytics & Insights

  • Adherence Trends: Identify patients who need additional support
  • Practice Performance: Track overall practice medication compliance
  • Risk Stratification: Flag patients with declining adherence
  • Data-driven Care: Make informed decisions based on real medication data

πŸ” Security & Compliance

Authentication & Authorization

  • JWT Token System: Industry-standard JSON Web Tokens for authentication
    • Access tokens (1-hour expiration)
    • Refresh tokens (7-day expiration)
  • Role-based Access Control: Strict separation between patient and physician interfaces
  • Secure Password Storage: Argon2 and bcrypt hashing algorithms
  • Session Management: Persistent, encrypted sessions with automatic cleanup

Data Security

  • Encrypted Storage: All sensitive data encrypted using Expo SecureStore
  • HTTPS Communication: All API calls encrypted in transit
  • Token Isolation: Separate storage for access/refresh tokens (2KB limit compliance)
  • Automatic Session Validation: Corrupted sessions automatically cleared

Healthcare Compliance

  • FHIR R4 Standard: Full compliance with healthcare interoperability standards
  • Medplum Integration: Professional healthcare data platform integration
  • HIPAA-ready Architecture: Built with healthcare privacy regulations in mind
  • Audit Logging: Comprehensive logging for security and compliance

API Security

  • Bearer Token Authentication: RFC 6750 compliant token handling
  • CORS Protection: Configured cross-origin resource sharing
  • Request Validation: Server-side validation of all API requests
  • Rate Limiting: Protection against API abuse (ready for production)

πŸ—οΈ Technical Architecture

Frontend Stack

  • React Native 0.81.4: Cross-platform mobile development
  • Expo ~54.0.10: Managed workflow with powerful SDKs
  • TypeScript: Full type safety and developer experience
  • React Navigation 7: Role-based navigation system
  • Expo Notifications: Rich push notification system
  • Expo Camera: QR code scanning capabilities
  • React Native Maps: Location services and map display

Backend Stack

  • Node.js with Express 5.1.0: RESTful API server
  • Better-SQLite3: Fast, embedded database
  • JWT & Jose: Token generation and validation
  • Argon2/Bcrypt: Password hashing algorithms
  • Medplum Client: FHIR healthcare data integration
  • OpenAI API: AI-powered prescription image analysis
  • CORS Middleware: Secure cross-origin handling

Healthcare Integration

  • FHIR R4: Healthcare interoperability standard
  • Medplum Platform: Professional FHIR server
  • Patient Resources: Standardized patient data format
  • MedicationStatement: FHIR medication tracking
  • RxNorm Coding: Standardized medication identifiers

External Services

  • NIH Drug API: Medication autocomplete and information
  • OpenAI Vision API: Prescription image analysis
  • Medplum FHIR Server: Healthcare data sync and storage
  • Expo Push Notifications: Cloud notification delivery

πŸš€ Getting Started

Prerequisites

  • Node.js 16 or higher
  • npm or yarn package manager
  • Expo CLI (installed automatically with dependencies)
  • iOS Simulator (Mac) or Android Emulator, or physical device
  • Expo Go app (for device testing)

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd HackGT12_Attempt2
  2. Install dependencies:

    npm install
  3. Set up environment variables:

    cp .env.example .env

    Configure your .env file with:

    • MEDPLUM_BASE: Medplum FHIR server URL
    • MEDPLUM_CLIENT_ID: Your Medplum client ID
    • MEDPLUM_CLIENT_SECRET: Your Medplum client secret
    • OPENAI_API_KEY: OpenAI API key for prescription scanning
    • PORT: Backend server port (default: 3000)

Running the Application

Windows:

npm run dev-separate

macOS:

npm run dev-separate-mac

Linux:

npm run dev-separate-linux

Single Terminal (All Platforms):

npm run dev

These commands will:

  1. Start the backend server on port 3000
  2. Launch the Expo development server
  3. Open the Expo DevTools in your browser

Testing on Device

Physical Device:

  1. Install Expo Go from App Store (iOS) or Play Store (Android)
  2. Scan the QR code displayed in the terminal
  3. App will load on your device

iOS Simulator (Mac only):

npm run ios

Android Emulator:

npm run android

πŸ“– User Guide

For Patients

Getting Started

  1. Launch App: Open MedSignal
  2. Choose Role: Select "Patient"
  3. Create Account: Sign up with email and password
  4. Grant Permissions: Allow notifications and camera access

Adding Medications

Manual Entry:

  1. Navigate to "Medication Entry" tab
  2. Tap in the medication name field
  3. Start typing - autocomplete suggestions appear
  4. Select your medication from the list
  5. Enter dosage (e.g., "500 mg")
  6. Set quantity on hand
  7. Choose times per day (1-6)
  8. Set specific times for each dose
  9. Tap "Save Medication"

AI Prescription Scanning:

  1. Navigate to "Medication Entry" tab
  2. Tap "πŸ“· Scan Prescription" button
  3. Choose "Take Photo" or "Choose from Library"
  4. Take a clear photo of your prescription label
  5. AI extracts medication details automatically
  6. Review and adjust any details if needed
  7. Tap "Save Medication"

Managing Medications

  • Edit: Tap medication card, modify details, save changes
  • Delete: Swipe left on medication or tap delete button
  • View Schedule: See all doses in the Adherence tab
  • Mark as Taken: Tap checkmark when you take medication

Responding to Reminders

When a notification appears:

  • Taken: Tap to mark as taken (tracks adherence)
  • Snooze: Reminds you again in 10 minutes
  • Skip: Mark as intentionally skipped (affects adherence)

Tracking Adherence

  1. Navigate to "Adherence" tab
  2. View overall adherence percentage
  3. See per-medication compliance
  4. Check 7-day and 30-day trends
  5. Identify missed doses

Connecting with Physicians

  1. Visit your physician's office
  2. Ask to scan their MedSignal QR code
  3. Open "Share" tab in app
  4. Tap "Scan Physician QR Code"
  5. Allow camera access and scan code
  6. Confirm connection
  7. Your medication data is now securely shared

Managing Prescription Requests

  1. Receive notification of new prescription
  2. Tap notification or open "Prescription Requests" from home
  3. Review medication details from physician
  4. Tap "Accept" to add to your tracking
  5. Or "Decline" if incorrect/unwanted

Adding Trusted Contacts

  1. Navigate to "Trusted Contacts" from home screen
  2. Tap "Add Trusted Contact"
  3. Enter contact information:
    • Name
    • Relationship (spouse, parent, child, friend, caregiver)
    • Phone number
    • Email
  4. Tap "Save Contact"
  5. Contact is added to your support network

For Physicians

Getting Started

  1. Launch App: Open MedSignal
  2. Choose Role: Select "Physician"
  3. Create Account: Sign up with credentials
  4. Access Dashboard: View practice overview

Viewing Dashboard Metrics

  • Total Patients: See total active patient count
  • Seen Today: Patients with activity today
  • 7-Day Adherence: Average compliance last week
  • 30-Day Adherence: Average compliance last month

Managing Patients

  1. From dashboard, tap "View All Patients"
  2. Browse patient list with adherence indicators
  3. Tap patient card to view details
  4. Review:
    • Current medications
    • Adherence rates
    • Medication history
    • Risk indicators

Connecting New Patients

  1. Navigate to "QR Code" tab
  2. Display your unique QR code
  3. Have patient scan code with their device
  4. Connection established automatically
  5. Patient data becomes accessible

Sending Prescriptions

  1. Open patient detail screen
  2. Tap "Send Prescription"
  3. Enter medication details:
    • Drug name
    • Dosage
    • Frequency
    • Duration
  4. Tap "Send to Patient"
  5. Patient receives notification instantly
  6. Track acceptance status

Monitoring Patient Adherence

  • Green indicators: High adherence (>80%)
  • Yellow indicators: Moderate adherence (60-80%)
  • Red indicators: Low adherence (<60%)
  • Detailed view: Tap patient for daily logs

πŸ§ͺ Testing & Development

Available Scripts

npm run backend          # Run backend server only
npm start                # Run Expo frontend only
npm run dev              # Run both (single terminal)
npm run dev-separate     # Run both (Windows, separate windows)
npm run dev-separate-mac # Run both (macOS, separate terminals)
npm run smoke:share      # Run security test suite

Security Testing

npm run smoke:share

Validates:

  • JWT token generation
  • Bearer authentication
  • API security
  • BOLA/IDOR protection

Database Management

node initialize-db.js    # Initialize database
node migrate-*.js        # Run migrations
node test-*.js           # Test database operations

πŸ—‚οΈ Project Structure

HackGT12_Attempt2/
β”œβ”€β”€ App.tsx                      # Main app entry point
β”œβ”€β”€ server.js                    # Backend Express server
β”œβ”€β”€ database.js                  # Database operations
β”œβ”€β”€ medsignal.db                 # SQLite database
β”œβ”€β”€ package.json                 # Dependencies
β”œβ”€β”€ app.json                     # Expo configuration
β”‚
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ auth/                    # Authentication system
β”‚   β”‚   β”œβ”€β”€ AuthContext.tsx      # Auth state management
β”‚   β”‚   β”œβ”€β”€ RoleGuard.tsx        # Role-based routing
β”‚   β”‚   └── session.ts           # SecureStore session management
β”‚   β”‚
β”‚   β”œβ”€β”€ components/              # Reusable components
β”‚   β”‚   β”œβ”€β”€ AuthFlow.tsx         # Auth navigation
β”‚   β”‚   β”œβ”€β”€ DrugSearchField.tsx  # Medication autocomplete
β”‚   β”‚   β”œβ”€β”€ QRScanner.tsx        # QR code scanner
β”‚   β”‚   └── ...
β”‚   β”‚
β”‚   β”œβ”€β”€ screens/                 # App screens
β”‚   β”‚   β”œβ”€β”€ HomeScreen.tsx       # Patient home
β”‚   β”‚   β”œβ”€β”€ MedicationEntryScreen.tsx
β”‚   β”‚   β”œβ”€β”€ AdherenceScreen.tsx
β”‚   β”‚   β”œβ”€β”€ PhysicianDashboard.tsx
β”‚   β”‚   β”œβ”€β”€ PatientsList.tsx
β”‚   β”‚   └── ...
β”‚   β”‚
β”‚   β”œβ”€β”€ navigators/              # Navigation setup
β”‚   β”‚   β”œβ”€β”€ PatientNavigator.tsx
β”‚   β”‚   └── PhysicianNavigator.tsx
β”‚   β”‚
β”‚   β”œβ”€β”€ services/                # External services
β”‚   β”‚   β”œβ”€β”€ openaiVision.ts      # Prescription scanning
β”‚   β”‚   β”œβ”€β”€ physicianApi.ts      # Backend API calls
β”‚   β”‚   └── ...
β”‚   β”‚
β”‚   └── notifications/           # Notification system
β”‚       β”œβ”€β”€ actions.ts           # Channel setup
β”‚       └── responseHandler.ts   # Action handlers
β”‚
β”œβ”€β”€ scripts/                     # Utility scripts
β”œβ”€β”€ docs/                        # Documentation
└── assets/                      # Images and sounds

πŸ”§ Configuration

Backend Configuration (.env)

# Medplum FHIR Integration
MEDPLUM_BASE=https://api.medplum.com/fhir/R4
MEDPLUM_CLIENT_ID=your_client_id
MEDPLUM_CLIENT_SECRET=your_client_secret

# OpenAI Integration
OPENAI_API_KEY=your_openai_api_key

# Server Configuration
PORT=3000
JWT_SECRET=your_secure_jwt_secret

# Environment
NODE_ENV=development

Expo Configuration (app.json)

  • App Name: HackGT12_Attempt2
  • Bundle ID: com.medsignal.app
  • Permissions: Camera, Notifications, Location
  • Plugins: Notifications, SecureStore, Barcode Scanner

🌟 Key Differentiators

Why MedSignal?

  1. AI-Powered: First medication app with prescription scanning using OpenAI Vision
  2. FHIR Compliant: Built on healthcare interoperability standards from day one
  3. Dual Interface: Seamlessly connects patients and physicians in one platform
  4. Adherence Focus: Not just tracking, but actionable compliance insights
  5. Enterprise Security: JWT authentication, encrypted storage, role-based access
  6. Interactive Notifications: Respond to reminders without opening app
  7. Trusted Contacts: Family support network built into the platform
  8. Professional Grade: Healthcare provider dashboard with real analytics

🚧 Roadmap

Coming Soon

  • Family dashboard for trusted contacts
  • Apple Health & Google Fit integration
  • Medication interaction warnings
  • Refill reminders and pharmacy integration
  • Telemedicine appointment scheduling
  • Multi-language support
  • Wearable device integration (Apple Watch, Fitbit)
  • Voice-activated medication logging

Under Development

  • Insurance and cost optimization
  • Medication disposal guidance
  • Clinical trial matching
  • Patient education videos
  • Social features (community support)

πŸ“„ License

Copyright Β© 2025 MedSignal. All rights reserved.


🀝 Contributing

MedSignal is a healthcare application handling sensitive medical data. Contributions must maintain:

  • HIPAA compliance considerations
  • FHIR standard adherence
  • Security best practices
  • Comprehensive testing

πŸ“ž Support

For Technical Issues

  • Check troubleshooting section in docs
  • Review error logs in server-log.txt
  • Verify environment configuration

For Healthcare Integration

Common Issues

Notifications not working:

  1. Grant notification permissions in device settings
  2. Ensure backend server is running
  3. Check notification channel setup (Android)

QR code scanning not working:

  1. Grant camera permissions
  2. Ensure adequate lighting
  3. Hold camera steady over QR code

Backend connection failed:

  1. Verify backend is running on port 3000
  2. Check EXPO_PUBLIC_BACKEND_URL environment variable
  3. Ensure device/emulator is on same network

πŸ† Acknowledgments

Built with:

  • React Native & Expo for cross-platform development
  • Medplum for FHIR healthcare data management
  • OpenAI for AI-powered prescription scanning
  • NIH for comprehensive drug information database
  • The open-source community for incredible tools and libraries

MedSignal - Empowering patients and physicians through intelligent medication management πŸ₯πŸ’Š

About

No description, website, or topics provided.

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages