Build FHIR-based healthcare applications with Spezi.
The Spezi FHIR Swift Package provides essential building blocks for developing FHIR-based mobile healthcare applications using the Spezi framework. It includes comprehensive tools for FHIR resource management, HealthKit integration, and mock patient data for testing and development.
You need to add the SpeziFHIR Swift package to your app in Xcode or Swift package.
Important
If your application is not yet configured to use Spezi, follow the Spezi setup article to set up the core Spezi infrastructure.
Spezi FHIR provides a number of targets to help developers integrate FHIR functionality in their Spezi-based applications:
SpeziFHIR
: Core FHIR resource management, storage, and utilities for working with FHIR R4 and DSTU2 resources.SpeziFHIRHealthKit
: Seamless integration between HealthKit data and FHIR resources, enabling conversion of health data to FHIR format.SpeziFHIRMockPatients
: Mock patient data and FHIR bundles for testing and development purposes.
The core module provides essential FHIR functionality including the FHIRStore
, an observable store for managing and organizing FHIR resources by category. The FHIRResource
type serves as a wrapper for FHIR resources with additional metadata and utilities. Combined, they provide tools for searching, copying, and manipulating FHIR resources that are compatible with both FHIR R4 and DSTU2 specifications.
Configure the FHIRStore
in your SpeziAppDelegate
to manage FHIR resources in your application:
import Spezi
import SpeziFHIR
class ExampleAppDelegate: SpeziAppDelegate {
override var configuration: Configuration {
Configuration {
FHIRStore()
}
}
}
Use the FHIRStore
to manage FHIR resources in your application as well as adding and removing FHIRResource
s in the FHIRStore
.
import SpeziFHIR
import SwiftUI
struct ExampleView: View {
@Environment(FHIRStore.self) private var fhirStore
var body: some View {
List {
Section("Observations") {
ForEach(fhirStore.observations) { observation in
Text(observation.displayName)
}
}
Section("Conditions") {
ForEach(fhirStore.conditions) { condition in
Text(condition.displayName)
}
}
}
}
}
Seamlessly integrate HealthKit data with FHIR resources including easy ways to add HKSample
s to the FHIRStore
while loading attachments from the FHIR resources stored in HealthKit or attached information such as voltage information of symptoms for electrocardiograms.
For more information, please refer to the API documentation.
The target offers easily loadable mock patient data for testing and development. For more information, please refer to the API documentation.
Contributions to this project are welcome. Please make sure to read the contribution guidelines and the contributor covenant code of conduct first.
This project is licensed under the MIT License. See Licenses for more information.