Skip to content

Commit

Permalink
Migrates project to Spezi (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
vishnuravi committed Jun 13, 2023
1 parent 20c9534 commit 7f3920a
Show file tree
Hide file tree
Showing 14 changed files with 212 additions and 205 deletions.
266 changes: 137 additions & 129 deletions HealthGPT.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,102 +1,102 @@
{
"pins" : [
{
"identity" : "cardinalkit",
"identity" : "fhirmodels",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/CardinalKit",
"location" : "https://github.com/apple/FHIRModels",
"state" : {
"revision" : "b5476acaeb57092068a945e7750ab84ce02ddbc6",
"version" : "0.4.1"
"revision" : "861afd5816a98d38f86220eab2f812d76cad84a0",
"version" : "0.5.0"
}
},
{
"identity" : "cardinalkitfhir",
"identity" : "healthkitonfhir",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/CardinalKitFHIR.git",
"location" : "https://github.com/StanfordBDHG/HealthKitOnFHIR",
"state" : {
"revision" : "08bb7850b72ea5593dff6d9b104db03a4cfe8997",
"version" : "0.2.1"
"revision" : "d10f408766264183cd50bb117b99580255520aa3",
"version" : "0.2.3"
}
},
{
"identity" : "cardinalkithealthkit",
"identity" : "openai",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/CardinalKitHealthKit.git",
"location" : "https://github.com/MacPaw/OpenAI.git",
"state" : {
"revision" : "91c4a61689485ab76e3b6777f9477c7c8147184f",
"version" : "0.1.0"
"revision" : "4da423fe637a628ebee8f214217a9e96060a5222",
"version" : "0.2.1"
}
},
{
"identity" : "cardinalkithealthkittofhiradapter",
"identity" : "spezi",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/CardinalKitHealthKitToFHIRAdapter.git",
"location" : "https://github.com/StanfordSpezi/Spezi.git",
"state" : {
"revision" : "b5bc6e8a26672880714311fc6afd8ee050e1dc97",
"version" : "0.2.0"
"revision" : "57ddc03668efce968e1376fbd686915c76d1dfa7",
"version" : "0.5.1"
}
},
{
"identity" : "cardinalkitonboarding",
"identity" : "spezifhir",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/CardinalKitOnboarding.git",
"location" : "https://github.com/StanfordSpezi/SpeziFHIR.git",
"state" : {
"revision" : "5f3d47dfcbdfb2fbb7e9484cc15f798b2730085f",
"version" : "0.2.1"
"revision" : "6303e65ba339f89b86a6dc09aab243b50de33cd7",
"version" : "0.3.0"
}
},
{
"identity" : "cardinalkitstorage",
"identity" : "spezihealthkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/CardinalKitStorage.git",
"location" : "https://github.com/StanfordSpezi/SpeziHealthKit.git",
"state" : {
"revision" : "4d8eb123b083016324c38f54f9d8024566459408",
"version" : "0.2.2"
"revision" : "7ae7c344c052fb7bdc9490cb4296b87a0abb8326",
"version" : "0.2.1"
}
},
{
"identity" : "cardinalkitviews",
"identity" : "spezihealthkittofhiradapter",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/CardinalKitViews",
"location" : "https://github.com/StanfordSpezi/SpeziHealthKitToFHIRAdapter.git",
"state" : {
"revision" : "eefa262d96a930fb6339de194a2e574b5fbc8810",
"version" : "0.2.1"
"revision" : "e43f2c05cebcd16a697397721e6a2d72bf418a9c",
"version" : "0.3.0"
}
},
{
"identity" : "fhirmodels",
"identity" : "spezionboarding",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/FHIRModels",
"location" : "https://github.com/StanfordSpezi/SpeziOnboarding.git",
"state" : {
"revision" : "861afd5816a98d38f86220eab2f812d76cad84a0",
"version" : "0.5.0"
"revision" : "10109f18d7958098dbbc4c32786d237a57400f85",
"version" : "0.3.0"
}
},
{
"identity" : "healthkitonfhir",
"identity" : "spezistorage",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/HealthKitOnFHIR",
"location" : "https://github.com/StanfordSpezi/SpeziStorage.git",
"state" : {
"revision" : "d10f408766264183cd50bb117b99580255520aa3",
"version" : "0.2.3"
"revision" : "5dc128a257a6b4f7d2f4d96803c0cf89238bb922",
"version" : "0.3.1"
}
},
{
"identity" : "openai",
"identity" : "speziviews",
"kind" : "remoteSourceControl",
"location" : "https://github.com/MacPaw/OpenAI.git",
"location" : "https://github.com/StanfordSpezi/SpeziViews",
"state" : {
"revision" : "4da423fe637a628ebee8f214217a9e96060a5222",
"version" : "0.2.1"
"revision" : "c6975e84c735b8b8a13740012c1c194f48893fa8",
"version" : "0.3.0"
}
},
{
"identity" : "xctestextensions",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/XCTestExtensions.git",
"state" : {
"revision" : "3037f2e8ad1cd2e08a0dfbe5f0a4866445102150",
"version" : "0.4.0"
"revision" : "54fd8030dbd0f34426ab28ff2593611dd5506357",
"version" : "0.4.2"
}
},
{
Expand All @@ -111,10 +111,10 @@
{
"identity" : "xctruntimeassertions",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/XCTRuntimeAssertions",
"location" : "https://github.com/StanfordBDHG/XCTRuntimeAssertions.git",
"state" : {
"revision" : "654b3e49219c0e2303ae8b4ea8edf5e12d168e12",
"version" : "0.2.1"
"revision" : "8471ac76b9bb5645ba5ccb36a893919fccbf8851",
"version" : "0.2.3"
}
}
],
Expand Down
5 changes: 2 additions & 3 deletions HealthGPT/HealthGPT/HealthGPTView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
// SPDX-License-Identifier: MIT
//

import CardinalKitFHIR
import CardinalKitSecureStorage
import HealthKit
import OpenAI
import SpeziFHIR
import SpeziSecureStorage
import SwiftUI


struct HealthGPTView: View {
@AppStorage(StorageKeys.openAIModel) var openAIModel = Model.gpt3_5Turbo
@EnvironmentObject var secureStorage: SecureStorage<FHIR>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
// SPDX-License-Identifier: MIT
//

import CardinalKit
import CardinalKitFHIR
import CardinalKitHealthKit
import CardinalKitHealthKitToFHIRAdapter
import CardinalKitSecureStorage
import HealthKit
import Spezi
import SpeziFHIR
import SpeziHealthKit
import SpeziHealthKitToFHIRAdapter
import SpeziSecureStorage
import SwiftUI


class TemplateAppDelegate: CardinalKitAppDelegate {
class HealthGPTAppDelegate: SpeziAppDelegate {
override var configuration: Configuration {
Configuration(standard: FHIR()) {
SecureStorage()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Security
import SwiftUI


private struct TemplateAppTestingSetup: ViewModifier {
private struct HealthGPTAppTestingSetup: ViewModifier {
@AppStorage(StorageKeys.onboardingFlowComplete) var completedOnboardingFlow = false

func resetKeychain() {
Expand Down Expand Up @@ -49,6 +49,6 @@ private struct TemplateAppTestingSetup: ViewModifier {

extension View {
func testingSetup() -> some View {
self.modifier(TemplateAppTestingSetup())
self.modifier(HealthGPTAppTestingSetup())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
// SPDX-License-Identifier: MIT
//

import CardinalKit
import Spezi
import SwiftUI


@main
struct TemplateApplication: App {
@UIApplicationDelegateAdaptor(TemplateAppDelegate.self) var appDelegate
struct HealthGPTApplication: App {
@UIApplicationDelegateAdaptor(HealthGPTAppDelegate.self) var appDelegate
@AppStorage(StorageKeys.onboardingFlowComplete) var completedOnboardingFlow = false

var body: some Scene {
Expand All @@ -28,7 +28,7 @@ struct TemplateApplication: App {
OnboardingFlow()
}
.testingSetup()
.cardinalKit(appDelegate)
.spezi(appDelegate)
}
}
}
6 changes: 3 additions & 3 deletions HealthGPT/Onboarding/ApiKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
// SPDX-License-Identifier: MIT
//

import CardinalKitFHIR
import CardinalKitOnboarding
import CardinalKitSecureStorage
import SpeziFHIR
import SpeziOnboarding
import SpeziSecureStorage
import SwiftUI


Expand Down
4 changes: 2 additions & 2 deletions HealthGPT/Onboarding/Disclaimer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
// SPDX-License-Identifier: MIT
//

import CardinalKitFHIR
import CardinalKitOnboarding
import SpeziFHIR
import SpeziOnboarding
import SwiftUI


Expand Down
6 changes: 3 additions & 3 deletions HealthGPT/Onboarding/HealthKitPermissions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
// SPDX-License-Identifier: MIT
//

import CardinalKitFHIR
import CardinalKitHealthKit
import CardinalKitOnboarding
import SpeziFHIR
import SpeziHealthKit
import SpeziOnboarding
import SwiftUI


Expand Down
2 changes: 1 addition & 1 deletion HealthGPT/Onboarding/ModelSelection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
// SPDX-License-Identifier: MIT
//

import CardinalKitOnboarding
import OpenAI
import SpeziOnboarding
import SwiftUI


Expand Down
2 changes: 1 addition & 1 deletion HealthGPT/Onboarding/Welcome.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// SPDX-License-Identifier: MIT
//

import CardinalKitOnboarding
import SpeziOnboarding
import SwiftUI


Expand Down
2 changes: 1 addition & 1 deletion HealthGPT/SharedContext/StorageKeys.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//


/// Constants shared across the CardinalKit Teamplate Application to access
/// Constants shared across the HealthGPT Application to access
/// storage information including the `AppStorage` and `SceneStorage`
enum StorageKeys {
// MARK: - Onboarding
Expand Down
4 changes: 2 additions & 2 deletions HealthGPT/Supporting Files/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"WELCOME_AREA2_TITLE" = "Apple Health";
"WELCOME_AREA2_DESCRIPTION" = "HealthGPT can surface data from Apple Health to use in conversations with ChatGPT.";

"WELCOME_AREA3_TITLE" = "The CardinalKit Framework";
"WELCOME_AREA3_DESCRIPTION" = "HealthGPT was built with the CardinalKit open-source digital health framework at Stanford University.";
"WELCOME_AREA3_TITLE" = "The Spezi Framework";
"WELCOME_AREA3_DESCRIPTION" = "HealthGPT was built with the Spezi open-source digital health framework at Stanford University.";

"WELCOME_BUTTON" = "Continue";

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ SPDX-License-Identifier: MIT

![Example Conversation](Figures/Example.png)

HealthGPT is an experimental iOS app based on [CardinalKit](https://github.com/StanfordBDHG/CardinalKit) that allows users to interact with their health data stored in the Apple Health app using natural language.
HealthGPT is an experimental iOS app based on [Stanford Spezi](https://github.com/StanfordSpezi/Spezi) that allows users to interact with their health data stored in the Apple Health app using natural language.
The application offers an easy-to-extend solution for those looking to make large language model powered apps within the Apple Health ecosystem.

The initial prototype based on [CardinalKit](https://github.com/StanfordBDHG/CardinalKit) and the [CardinalKitTemplateApplication](https://github.com/StanfordBDHG/CardinalKitTemplateApplication/) was built by [Varun Shenoy](https://varunshenoy.com).
The initial prototype based on [Spezi](https://github.com/StanfordSpezi/Spezi) (formerly CardinalKit) and the [SpeziTemplateApplication](https://github.com/StanfordSpezi/SpeziTemplateApplication/) was built by [Varun Shenoy](https://varunshenoy.com).

## Features

- Chat-style interface for user-friendly health data interaction
- Integration with the Apple Health app to ensure seamless first-party data usage
- Extensible architecture built on [CardinalKit](https://github.com/StanfordBDHG/CardinalKit) for easy customization
- Extensible architecture built on [Stanford Spezi](https://github.com/StanfordSpezi/Spezi) for easy customization
- GPT-3.5 + GPT-4 access through the [OpenAI](https://github.com/MacPaw/OpenAI) Swift module
- Out of the box support for querying sleep, step count, active energy, exercise minutes, heart rate, and body mass.

Expand Down

0 comments on commit 7f3920a

Please sign in to comment.