The objective is to create an end-to-end demonstration of the FHIR protocol.
What I mean by end-to-end, from an information source such as an iPhone.
Collect your health data in Apple format (HealthKit), transform it into FHIR and then send it to the InterSystems IRIS for Health repository.
This information must be accessible via a web interface.
TL;DR: iPhone -> InterSystems FHIR -> Web Page.
How-To run this demo
Prerequisites
For the client part (iOS)
Xcode 12
For the server and Web app
Docker
Install Xcode
Not much to say here, open the AppStore, search for Xcode, Install.
Open the SwiftUi project
Swift is Apple's programming language for iOS, Mac, Apple TV and Apple Watch. It is the replacement for objective-C.
Double click on Swift-FHIR-Iris.xcodeproj
Open the simulator by a click on the top left arrow.
Configure the simulator
Go to Health
Click Steps
Add Data
Lunch the InterSystems FHIR Server
In the root folder of this git, run the following command:
docker-compose up -d
At the end of the building process you will be able to connect to the FHIR repository :
// Request authorization to access HealthKit.func requestAuthorization(){// Requesting authorization./// - Tag: RequestAuthorizationletwriteDataTypes:Set<HKSampleType>=dataTypesToWrite()letreadDataTypes:Set<HKObjectType>=dataTypesToRead()// requset authorization
healthStore.requestAuthorization(toShare: writeDataTypes, read: readDataTypes){(success, error)in
if !success {// Handle the error here.}else{DispatchQueue.main.async{self.authorizedHK = true
}}}}
Where healthStore is the object of HKHealthStore().
The HKHealthStore is like the database of healthdata in iOS.
dataTypesToWrite and dataTypesToRead are the object we would like to query in the database.
The authorization need a purpose and this is done in the Info.plist xml file by adding:
<key>NSHealthClinicalHealthRecordsShareUsageDescription</key>
<string>Read data for IrisExporter</string>
<key>NSHealthShareUsageDescription</key>
<string>Send data to IRIS</string>
<key>NSHealthUpdateUsageDescription</key>
<string>Write date for IrisExporter</string>