https://github.com/stanfordspezi/spezifhir
The Spezi FHIR Standard & Related Modules
https://github.com/stanfordspezi/spezifhir
fhir ios spezi stanford swift xcode
Last synced: 6 months ago
JSON representation
The Spezi FHIR Standard & Related Modules
- Host: GitHub
- URL: https://github.com/stanfordspezi/spezifhir
- Owner: StanfordSpezi
- License: mit
- Created: 2023-02-16T06:45:47.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-06-05T01:07:12.000Z (about 1 year ago)
- Last Synced: 2025-07-06T19:58:22.042Z (12 months ago)
- Topics: fhir, ios, spezi, stanford, swift, xcode
- Language: Swift
- Homepage: https://swiftpackageindex.com/StanfordSpezi/SpeziFHIR/documentation/
- Size: 3.81 MB
- Stars: 12
- Watchers: 10
- Forks: 3
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
- Citation: CITATION.cff
Awesome Lists containing this project
README
# Spezi FHIR
[](https://github.com/StanfordSpezi/SpeziFHIR/actions/workflows/build-and-test.yml)
[](https://codecov.io/gh/StanfordSpezi/SpeziFHIR)
[](https://doi.org/10.5281/zenodo.7803123)
[](https://swiftpackageindex.com/StanfordSpezi/SpeziFHIR)
[](https://swiftpackageindex.com/StanfordSpezi/SpeziFHIR)
Build FHIR-based healthcare applications with Spezi.
## Overview
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.
## Setup
### Add SpeziFHIR as a Dependency
You need to add the SpeziFHIR Swift package to
[your app in Xcode](https://developer.apple.com/documentation/xcode/adding-package-dependencies-to-your-app#) or
[Swift package](https://developer.apple.com/documentation/xcode/creating-a-standalone-swift-package-with-xcode#Add-a-dependency-on-another-Swift-package).
> [!IMPORTANT]
> If your application is not yet configured to use Spezi, follow the [Spezi setup article](https://swiftpackageindex.com/stanfordspezi/spezi/documentation/spezi/initial-setup) to set up the core Spezi infrastructure.
## Targets
Spezi FHIR provides a number of targets to help developers integrate FHIR functionality in their Spezi-based applications:
- [`SpeziFHIR`](https://swiftpackageindex.com/stanfordspezi/spezifhir/documentation/spezifhir): Core FHIR resource management, storage, and utilities for working with FHIR R4 and DSTU2 resources.
- [`SpeziFHIRHealthKit`](https://swiftpackageindex.com/stanfordspezi/spezifhir/documentation/spezifhirhealthkit): Seamless integration between HealthKit data and FHIR resources, enabling conversion of health data to FHIR format.
- [`SpeziFHIRMockPatients`](https://swiftpackageindex.com/stanfordspezi/spezifhir/documentation/spezifhirmockpatients): Mock patient data and FHIR bundles for testing and development purposes.
### SpeziFHIR
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.
#### FHIRStore
Configure the `FHIRStore` in your `SpeziAppDelegate` to manage FHIR resources in your application:
```swift
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`.
```swift
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)
}
}
}
}
}
```
### SpeziFHIRHealthKit
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](https://swiftpackageindex.com/stanfordspezi/spezifhir/documentation/spezifhirhealthkit).
### SpeziFHIRMockPatients
The target offers easily loadable mock patient data for testing and development.
For more information, please refer to the [API documentation](https://swiftpackageindex.com/stanfordspezi/spezifhir/documentation/spezifhirmockpatients).
## Contributing
Contributions to this project are welcome. Please make sure to read the [contribution guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md) and the [contributor covenant code of conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md) first.
## License
This project is licensed under the MIT License. See [Licenses](https://github.com/StanfordSpezi/SpeziFHIR/tree/main/LICENSES) for more information.

