Skip to content

StanfordSpezi/SpeziFHIR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Spezi FHIR

Build and Test codecov DOI

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 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.

Targets

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.

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:

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 FHIRResources 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)
                }
            }
        }
    }
}

SpeziFHIRHealthKit

Seamlessly integrate HealthKit data with FHIR resources including easy ways to add HKSamples 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.

SpeziFHIRMockPatients

The target offers easily loadable mock patient data for testing and development. For more information, please refer to the API documentation.

Contributing

Contributions to this project are welcome. Please make sure to read the contribution guidelines and the contributor covenant code of conduct first.

License

This project is licensed under the MIT License. See Licenses for more information.

Spezi Footer Spezi Footer

Sponsor this project

Contributors 7

Languages