A comprehensive Flutter application demonstrating the implementation of FHIR (Fast Healthcare Interoperability Resources) standards for healthcare data management and interoperability.
fhir_demo_vid.MOV
- What is FHIR?
- Purpose in Healthcare
- Project Overview
- Features
- Code Structure
- Libraries Used
- Installation Guide
- Usage
- Configuration
FHIR (Fast Healthcare Interoperability Resources) is a modern healthcare data exchange standard developed by HL7 (Health Level Seven International). FHIR provides a standardized way to represent and exchange healthcare information electronically between different healthcare systems, applications, and devices.
Key characteristics of FHIR:
- RESTful API: Uses standard HTTP protocols for data exchange
- Resource-based: Healthcare data is organized into modular "resources" (Patient, Observation, Medication, etc.)
- JSON/XML Support: Data can be represented in modern, widely-supported formats
- Interoperability: Enables seamless communication between disparate healthcare systems
FHIR addresses critical healthcare challenges:
- Data Interoperability: Enables different healthcare systems to communicate and share patient data seamlessly
- Patient Care Continuity: Ensures patient information is accessible across different healthcare providers
- Mobile Health Applications: Facilitates the development of patient-facing apps with secure access to health records
- Clinical Decision Support: Provides standardized data for AI and analytics tools
- Regulatory Compliance: Supports healthcare data standards required by regulations (e.g., HIPAA, GDPR)
- Research & Analytics: Standardized data format enables large-scale health data analysis
This Flutter application demonstrates a complete FHIR-compliant healthcare management system with the following capabilities:
- Patient Registration: Register new patients with FHIR Patient resources
- Clinical Observations: Record vital signs, lab results, and other health observations
- Prescriptions Management: Create and manage medication prescriptions
- Diagnosis Recording: Document patient diagnoses and conditions
- Appointments Scheduling: Book and manage healthcare appointments
- Laboratory Results: Track and display lab test results
- Multi-language Support: English and German localization
- Secure Data Storage: Encrypted local storage with Hive
- Multi-server Support: Connect to different FHIR servers (HAPI, Kodjin, Firefly, or custom)
- Register Patient - Add new patient records with complete demographic information
- Diagnosis - Record medical diagnoses with severity levels and clinical status
- Prescriptions - Manage medication prescriptions with dosage and frequency
- Observations - Track vital signs (blood pressure, heart rate, temperature, etc.)
- Appointments - Schedule and manage patient appointments
- Lab Results - Record and view laboratory test results
- ✅ Support for multiple FHIR servers:
- HAPI FHIR Server (
https://hapi.fhir.org/baseR4) - Kodjin (
https://demo.kodjin.com/fhir) - Firefly Server (
https://server.fire.ly) - Custom server URL configuration
- HAPI FHIR Server (
- ✅ API key authentication support
- ✅ Connection testing
- Secure token-based authentication
- Automatic token refresh
- Network connectivity monitoring
- Smart retry mechanism with exponential backoff
- Responsive UI with Material Design
- Multi-language support (English, German)
- Local data persistence with Hive
- Custom reusable UI components
- Dark/Light theme support
The project follows Clean Architecture principles with clear separation of concerns:
lib/
├── main.dart # Application entry point
├── constants/ # App-wide constants and configurations
│ ├── api_constants.dart # API endpoints and configurations
│ ├── api_url.dart # FHIR server URLs
│ ├── app_colors.dart # Color scheme
│ ├── app_images.dart # Image assets
│ ├── fhir_server_type_enum.dart # FHIR server types
│ ├── nav_routes.dart # Navigation routes
│ └── ... # Other constants
├── hive_helper/ # Local database configuration
│ ├── cache_helper.dart # Hive initialization
│ ├── hive_adapters.dart # Custom type adapters
│ └── register_adapters.dart # Adapter registration
├── src/
│ ├── controller/ # Business logic (Riverpod)
│ │ ├── auth_controller.dart # Authentication logic
│ │ ├── patient_controller.dart # Patient management
│ │ ├── observations_controller.dart
│ │ ├── prescriptions_controller.dart
│ │ ├── diagnosis_controller.dart
│ │ ├── appointments_controller.dart
│ │ ├── lab_results_controller.dart
│ │ └── ... # Other controllers
│ ├── domain/ # Business entities and contracts
│ │ ├── entities/ # Domain models
│ │ │ ├── patient_entity.dart
│ │ │ ├── project_observation_entity.dart
│ │ │ ├── project_prescription_entity.dart
│ │ │ └── ...
│ │ ├── models/ # Data models
│ │ └── repository/ # Repository interfaces
│ │ ├── auth_repository.dart
│ │ ├── fhir_repositories/ # FHIR-specific repos
│ │ └── network/ # Network layer
│ └── presentation/ # UI layer
│ ├── views/ # Application screens
│ │ ├── auth_view.dart
│ │ ├── splash_view.dart
│ │ ├── bottom_nav_view.dart
│ │ └── forms/ # Medical form views
│ │ ├── register_patient_view.dart
│ │ ├── observations_view.dart
│ │ ├── prescriptions_view.dart
│ │ ├── diagnosis_view.dart
│ │ ├── appointments_view.dart
│ │ └── lab_view.dart
│ └── widgets/ # Reusable UI components
│ └── themes/ # App theming
└── utils/ # Utility functions
├── loader_util.dart
├── shared_pref_util.dart
├── token_utils.dart
└── validations.dart
- Clean Architecture: Separation of concerns with domain, data, and presentation layers
- State Management: Riverpod for reactive state management
- Repository Pattern: Abstracts data sources from business logic
- Dependency Injection: Riverpod for dependency management
| Library | Version | Purpose |
|---|---|---|
fhir_r4 |
^0.4.3 | FHIR R4 resource models and validation |
flutter_riverpod |
^2.6.1 | State management solution |
dio |
^5.9.0 | HTTP client for API requests |
dio_smart_retry |
^7.0.1 | Automatic retry for failed requests |
hive |
^2.2.3 | Lightweight local database |
hive_flutter |
^1.1.0 | Hive integration for Flutter |
flutter_secure_storage |
^9.2.4 | Secure storage for sensitive data (tokens) |
easy_localization |
^3.0.7 | Internationalization support |
internet_connection_checker_plus |
^2.7.2 | Network connectivity monitoring |
flutter_animate |
^4.5.2 | Animation utilities |
uuid |
^4.5.1 | Generate unique identifiers |
crypto |
^3.0.6 | Cryptographic functions |
intl |
^0.20.2 | Internationalization utilities |
| Library | Version | Purpose |
|---|---|---|
build_runner |
^2.4.13 | Code generation |
hive_generator |
^2.0.1 | Generate Hive adapters |
flutter_lints |
^5.0.0 | Linting rules |
- Flutter SDK: Version 3.7.0 or higher
- Dart SDK: Version 3.7.0 or higher
- IDE: VS Code, Android Studio, or IntelliJ IDEA
- Xcode: (macOS only) For iOS development
- Android Studio: For Android development
-
Clone the repository
git clone https://github.com/Captured-Heart/fhir_demo.git cd fhir_demo -
Install Flutter dependencies
flutter pub get
-
Generate required files
flutter pub run build_runner build --delete-conflicting-outputs
-
Run the application
For iOS:
flutter run -d ios
For Android:
flutter run -d android
For Web:
flutter run -d chrome
-
Navigate to the iOS directory:
cd ios -
Install CocoaPods dependencies:
pod install
-
Open the workspace in Xcode:
open Runner.xcworkspace
-
Configure signing & capabilities in Xcode
- Ensure you have Android SDK installed
- The project uses Gradle Kotlin DSL (
.ktsfiles) - Minimum SDK: Check
android/app/build.gradle.kts - Update
local.propertieswith your Android SDK path
- Authentication: Login with FHIR server credentials
- Server Configuration: Select or configure your FHIR server:
- HAPI FHIR (Public test server)
- Kodjin Demo
- Firefly
- Custom server URL
- Register new patients with demographic information
- Search and view existing patients
- Update patient records
- Record vital signs (blood pressure, heart rate, temperature, etc.)
- Document clinical findings
- View observation history
- Create medication prescriptions
- Specify dosage, frequency, and duration
- Track prescription status
- Document patient conditions
- Record diagnosis codes
- Link diagnoses to patients
- Schedule patient appointments
- View appointment calendar
- Manage appointment status
- View lab test results
- Track lab orders
- Display result trends
Edit lib/constants/fhir_server_type_enum.dart to add custom servers:
enum FhirServerType {
hapi('https://hapi.fhir.org/baseR4'),
kodjin('https://demo.kodjin.com/fhir'),
firefly('https://server.fire.ly'),
custom('https://your-server.com/fhir');
final String baseUrl;
const FhirServerType(this.baseUrl);
}Modify lib/constants/api_constants.dart for timeout and retry settings:
static const Duration connectTimeout = Duration(seconds: 10);
static const Duration receiveTimeout = Duration(seconds: 15);
static const int maxRetries = 3;Add new translations in assets/l10n/:
en-US.json- English translationsde-DE.json- German translations
Customize app themes in lib/src/presentation/widgets/themes/app_themes.dart
- Patient
- Observation
- MedicationRequest
- Appointment
- DiagnosticReport (Lab Results)
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Nkpozi Marcel Kelechi - Captured-Heart
Captured-Heart on X: @_Captured_Heart
- HAPI FHIR - Open-source FHIR server
- HAPI Swagger - HAPI Demo Server R4 Endpoint Swagger docs
- HL7 FHIR - FHIR specification
- FHIR-FLI - FHIR-FLI Documentation
- Flutter Community for amazing packages and support
For issues, questions, or contributions, please visit the GitHub repository or email knkpozi@gmail.com.
This is a demo application for educational and development purposes. It should not be used in production healthcare environments without proper:
- Security audits
- Compliance certifications (HIPAA, GDPR, etc.)
- Medical device regulations approval
- Professional healthcare IT review
Always consult with healthcare compliance experts before deploying healthcare applications in production.
Last Updated: January 2026
Built with 💜 using Flutter and FHIR