BeatHF is a heart failure management iOS app developed for the Stanford Biodesign CardinalKit Buildathon 2020. The app helps reduce hospital readmissions for patients with congestive heart failure by monitoring symptoms and providing early intervention alerts.
Problem: Patients with advanced congestive heart failure have some of the highest hospital readmission rates. Many readmissions are preventable if early warning symptoms (particularly weight gain) are identified and treated with oral medications.
Solution: BeatHF provides daily symptom tracking, heart rate monitoring via HealthKit, and a tiered alert system to help patients self-manage their condition and know when to contact their doctor.
14-question assessment covering:
- Medication adherence
- Shortness of breath (with branching logic for severity)
- Weight gain monitoring (2-3 lbs overnight / 5 lbs per week)
- Sleep disturbances
- Dizziness/syncope
- Rapid heartbeat
- Chest pain
- Swelling
- Integrates with HealthKit
- Analyzes last 24 hours of heart rate data
- Alerts if heart rate is <40 or >120 bpm
- Visual status indicators (green checkmark / red warning)
- Yellow Alerts: Mild symptoms - monitor closely
- Orange Alerts: Moderate symptoms - contact doctor today
- Red Alerts: Severe symptoms - call doctor immediately or 911
- Built on CardinalKit (Stanford's medical research platform)
- Secure onboarding and consent flow
- Data synced to Firebase
- HIPAA-compliant data handling
- Profile and progress tracking
- Framework: CardinalKit (Stanford)
- UI: ResearchKit (Apple's research framework)
- Backend: Firebase (Firestore, Auth, Storage, Analytics)
- Health Data: HealthKit
- Language: Swift
- Dependency Manager: CocoaPods
- macOS with Xcode 11+
- CocoaPods installed (
sudo gem install cocoapods) - iOS 13.0+ device or simulator
- Firebase project (free tier is sufficient)
- Apple Developer account (for HealthKit entitlements)
git clone https://github.com/yourusername/beatHF.git
cd beatHF- Go to Firebase Console
- Create a new project (or use existing)
- Add an iOS app to your project
- Download the
GoogleService-Info.plistfile - Copy it to
CardinalKit-Example/CardinalKit/Supporting Files/
# The project includes a template file showing the structure
cp CardinalKit-Example/CardinalKit/Supporting\ Files/GoogleService-Info-Template.plist \
CardinalKit-Example/CardinalKit/Supporting\ Files/GoogleService-Info.plist
# Edit GoogleService-Info.plist with your Firebase credentials- Enable Firestore Database in Firebase Console
- Enable Authentication → Email/Password provider
- Enable Storage
Update the bundle identifier in:
CardinalKit-Example/CardinalKit.xcodeproj/project.pbxprojCardinalKit-Example/CardinalKit/Supporting Files/Info.plistCardinalKit-Example/CardinalKit-Example.entitlements
Replace com.yourcompany.yourapp with your actual bundle ID.
- Open
CardinalKit.xcodeprojin Xcode - Select the
CardinalKit_Exampletarget - Go to "Signing & Capabilities"
- Add your Apple Developer Team
- Enable HealthKit capability
Edit CardinalKit-Example/CardinalKit/Components/Profile/StaticProfileViewController.swift:
// Line 84: Update support email
mailComposeViewController.setToRecipients(["your-support@email.com"])
// Line 68: Update support phone
guard let number = URL(string: "tel://YOUR_PHONE_NUMBER") else { return }cd CardinalKit-Example
pod installopen CardinalKit.xcworkspaceBuild and run on a physical device (HealthKit doesn't work in simulator).
beatHF/
├── CardinalKit/ # CardinalKit framework source
│ └── Source/
│ ├── Components/ # Core framework modules
│ └── Supporting Files/ # Utilities & extensions
├── CardinalKit-Example/ # BeatHF app implementation
│ └── CardinalKit/
│ ├── Components/
│ │ ├── Study/ # Survey tasks & questions
│ │ ├── Onboarding/ # Consent & registration
│ │ ├── Profile/ # User profile & settings
│ │ └── Networking/ # Firebase integration
│ ├── Supporting Files/
│ │ ├── CKConfiguration.plist # App configuration
│ │ └── GoogleService-Info.plist # Firebase config (not in repo)
│ └── HeartRateReview.swift # Heart rate monitoring
└── README.md
Edit CardinalKit-Example/CardinalKit/Supporting Files/CKConfiguration.plist to customize:
- Consent form sections
- Onboarding text
- Health permissions requests
- App colors
Edit CardinalKit-Example/CardinalKit/Components/Study/StudyTasks.swift to modify:
- Question text
- Branching logic
- Alert thresholds
Edit CardinalKit-Example/HeartRateReview.swift:
// Line 21: Modify heart rate alert thresholds
if heartRate < 40 || heartRate > 120 {
// Trigger warning
}Set up Firestore security rules:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /users/{userId}/{document=**} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
}
}- Onboarding Flow: Test consent, registration, and HealthKit permissions
- Daily Survey: Complete survey with various answer combinations
- Heart Rate Monitoring: Check alert logic with simulated data
- Data Sync: Verify data appears in Firebase console
- Profile: Test passcode change, contact support, withdrawal
- Requires iOS 13.0+ (project from 2020)
- HealthKit only works on physical devices
- Firebase Realtime Database deprecated (migrate to Firestore)
- ResearchKit dependency may need updates for newer iOS versions
This app is a prototype developed during a 48-hour buildathon. It should NOT be used for actual patient care without:
- Clinical validation studies
- IRB approval
- FDA clearance (if applicable)
- Proper medical oversight
- Updated dependencies and security review
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Original Team: Stanford Biodesign CardinalKit Buildathon 2020
- Framework: CardinalKit by Stanford University
- Research Tools: ResearchKit by Apple
- Backend: Firebase by Google
MIT License - see LICENSE file for details.
This software is provided for educational and research purposes only. It is not intended for use in medical diagnosis or treatment. Always consult with qualified healthcare professionals for medical advice.
For questions about:
- CardinalKit: Visit cardinalkit.org
- This project: Open an issue on GitHub


