diff --git a/HARP.xcodeproj/project.pbxproj b/HARP.xcodeproj/project.pbxproj new file mode 100644 index 0000000..6c4c052 --- /dev/null +++ b/HARP.xcodeproj/project.pbxproj @@ -0,0 +1,632 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 60; + objects = { + +/* Begin PBXBuildFile section */ + 0D0D76182B0B26BC00B3FA75 /* RandomForest.mlpackage in Sources */ = {isa = PBXBuildFile; fileRef = 0D0D76172B0B26BC00B3FA75 /* RandomForest.mlpackage */; }; + 0D360B212B0173EB00EC1435 /* DataElements.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D360B202B0173EB00EC1435 /* DataElements.swift */; }; + 0D37F44A2B147F15002153AC /* RandomForest2.mlpackage in Sources */ = {isa = PBXBuildFile; fileRef = 0D37F4492B147F15002153AC /* RandomForest2.mlpackage */; }; + 0D4DA6122B071EBF00A9586D /* MainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D4DA6112B071EBF00A9586D /* MainView.swift */; }; + 0D4DA6142B0725FA00A9586D /* CalculateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D4DA6132B0725FA00A9586D /* CalculateView.swift */; }; + 0D4DA6162B0748CB00A9586D /* InputView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D4DA6152B0748CB00A9586D /* InputView.swift */; }; + 0DE864CB2B00370000486A30 /* HARPApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DE864CA2B00370000486A30 /* HARPApp.swift */; }; + 0DE864CF2B00370100486A30 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0DE864CE2B00370100486A30 /* Assets.xcassets */; }; + 0DE864D22B00370100486A30 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0DE864D12B00370100486A30 /* Preview Assets.xcassets */; }; + 0DE864DC2B00370100486A30 /* HARPTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DE864DB2B00370100486A30 /* HARPTests.swift */; }; + 0DE864E62B00370100486A30 /* HARPUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DE864E52B00370100486A30 /* HARPUITests.swift */; }; + 0DE864E82B00370100486A30 /* HARPUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DE864E72B00370100486A30 /* HARPUITestsLaunchTests.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 0DE864D82B00370100486A30 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0DE864BF2B00370000486A30 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 0DE864C62B00370000486A30; + remoteInfo = HARP; + }; + 0DE864E22B00370100486A30 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0DE864BF2B00370000486A30 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 0DE864C62B00370000486A30; + remoteInfo = HARP; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 0D0D76172B0B26BC00B3FA75 /* RandomForest.mlpackage */ = {isa = PBXFileReference; lastKnownFileType = folder.mlpackage; path = RandomForest.mlpackage; sourceTree = ""; }; + 0D360B202B0173EB00EC1435 /* DataElements.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataElements.swift; sourceTree = ""; }; + 0D37F4492B147F15002153AC /* RandomForest2.mlpackage */ = {isa = PBXFileReference; lastKnownFileType = folder.mlpackage; path = RandomForest2.mlpackage; sourceTree = ""; }; + 0D4DA6112B071EBF00A9586D /* MainView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainView.swift; sourceTree = ""; }; + 0D4DA6132B0725FA00A9586D /* CalculateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalculateView.swift; sourceTree = ""; }; + 0D4DA6152B0748CB00A9586D /* InputView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputView.swift; sourceTree = ""; }; + 0DE864C72B00370000486A30 /* HARP.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HARP.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 0DE864CA2B00370000486A30 /* HARPApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HARPApp.swift; sourceTree = ""; }; + 0DE864CE2B00370100486A30 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 0DE864D12B00370100486A30 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + 0DE864D72B00370100486A30 /* HARPTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HARPTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 0DE864DB2B00370100486A30 /* HARPTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HARPTests.swift; sourceTree = ""; }; + 0DE864E12B00370100486A30 /* HARPUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HARPUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 0DE864E52B00370100486A30 /* HARPUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HARPUITests.swift; sourceTree = ""; }; + 0DE864E72B00370100486A30 /* HARPUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HARPUITestsLaunchTests.swift; sourceTree = ""; }; + 0DEFB24B2B00C642001DA92F /* HARP.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = HARP.entitlements; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 0DE864C42B00370000486A30 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 0DE864D42B00370100486A30 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 0DE864DE2B00370100486A30 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 0DE864BE2B00370000486A30 = { + isa = PBXGroup; + children = ( + 0DE864C92B00370000486A30 /* HARP */, + 0DE864DA2B00370100486A30 /* HARPTests */, + 0DE864E42B00370100486A30 /* HARPUITests */, + 0DE864C82B00370000486A30 /* Products */, + ); + sourceTree = ""; + }; + 0DE864C82B00370000486A30 /* Products */ = { + isa = PBXGroup; + children = ( + 0DE864C72B00370000486A30 /* HARP.app */, + 0DE864D72B00370100486A30 /* HARPTests.xctest */, + 0DE864E12B00370100486A30 /* HARPUITests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 0DE864C92B00370000486A30 /* HARP */ = { + isa = PBXGroup; + children = ( + 0D4DA6152B0748CB00A9586D /* InputView.swift */, + 0DEFB24B2B00C642001DA92F /* HARP.entitlements */, + 0D360B202B0173EB00EC1435 /* DataElements.swift */, + 0DE864CA2B00370000486A30 /* HARPApp.swift */, + 0D37F4492B147F15002153AC /* RandomForest2.mlpackage */, + 0D4DA6132B0725FA00A9586D /* CalculateView.swift */, + 0D0D76172B0B26BC00B3FA75 /* RandomForest.mlpackage */, + 0D4DA6112B071EBF00A9586D /* MainView.swift */, + 0DE864CE2B00370100486A30 /* Assets.xcassets */, + 0DE864D02B00370100486A30 /* Preview Content */, + ); + path = HARP; + sourceTree = ""; + }; + 0DE864D02B00370100486A30 /* Preview Content */ = { + isa = PBXGroup; + children = ( + 0DE864D12B00370100486A30 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; + 0DE864DA2B00370100486A30 /* HARPTests */ = { + isa = PBXGroup; + children = ( + 0DE864DB2B00370100486A30 /* HARPTests.swift */, + ); + path = HARPTests; + sourceTree = ""; + }; + 0DE864E42B00370100486A30 /* HARPUITests */ = { + isa = PBXGroup; + children = ( + 0DE864E52B00370100486A30 /* HARPUITests.swift */, + 0DE864E72B00370100486A30 /* HARPUITestsLaunchTests.swift */, + ); + path = HARPUITests; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 0DE864C62B00370000486A30 /* HARP */ = { + isa = PBXNativeTarget; + buildConfigurationList = 0DE864EB2B00370100486A30 /* Build configuration list for PBXNativeTarget "HARP" */; + buildPhases = ( + 0DE864C32B00370000486A30 /* Sources */, + 0DE864C42B00370000486A30 /* Frameworks */, + 0DE864C52B00370000486A30 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = HARP; + productName = HARP; + productReference = 0DE864C72B00370000486A30 /* HARP.app */; + productType = "com.apple.product-type.application"; + }; + 0DE864D62B00370100486A30 /* HARPTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 0DE864EE2B00370100486A30 /* Build configuration list for PBXNativeTarget "HARPTests" */; + buildPhases = ( + 0DE864D32B00370100486A30 /* Sources */, + 0DE864D42B00370100486A30 /* Frameworks */, + 0DE864D52B00370100486A30 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 0DE864D92B00370100486A30 /* PBXTargetDependency */, + ); + name = HARPTests; + productName = HARPTests; + productReference = 0DE864D72B00370100486A30 /* HARPTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 0DE864E02B00370100486A30 /* HARPUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 0DE864F12B00370100486A30 /* Build configuration list for PBXNativeTarget "HARPUITests" */; + buildPhases = ( + 0DE864DD2B00370100486A30 /* Sources */, + 0DE864DE2B00370100486A30 /* Frameworks */, + 0DE864DF2B00370100486A30 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 0DE864E32B00370100486A30 /* PBXTargetDependency */, + ); + name = HARPUITests; + productName = HARPUITests; + productReference = 0DE864E12B00370100486A30 /* HARPUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 0DE864BF2B00370000486A30 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1500; + LastUpgradeCheck = 1500; + TargetAttributes = { + 0DE864C62B00370000486A30 = { + CreatedOnToolsVersion = 15.0.1; + }; + 0DE864D62B00370100486A30 = { + CreatedOnToolsVersion = 15.0.1; + TestTargetID = 0DE864C62B00370000486A30; + }; + 0DE864E02B00370100486A30 = { + CreatedOnToolsVersion = 15.0.1; + TestTargetID = 0DE864C62B00370000486A30; + }; + }; + }; + buildConfigurationList = 0DE864C22B00370000486A30 /* Build configuration list for PBXProject "HARP" */; + compatibilityVersion = "Xcode 15.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 0DE864BE2B00370000486A30; + productRefGroup = 0DE864C82B00370000486A30 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 0DE864C62B00370000486A30 /* HARP */, + 0DE864D62B00370100486A30 /* HARPTests */, + 0DE864E02B00370100486A30 /* HARPUITests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 0DE864C52B00370000486A30 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 0DE864D22B00370100486A30 /* Preview Assets.xcassets in Resources */, + 0DE864CF2B00370100486A30 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 0DE864D52B00370100486A30 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 0DE864DF2B00370100486A30 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 0DE864C32B00370000486A30 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 0D37F44A2B147F15002153AC /* RandomForest2.mlpackage in Sources */, + 0D4DA6142B0725FA00A9586D /* CalculateView.swift in Sources */, + 0D4DA6122B071EBF00A9586D /* MainView.swift in Sources */, + 0D4DA6162B0748CB00A9586D /* InputView.swift in Sources */, + 0D360B212B0173EB00EC1435 /* DataElements.swift in Sources */, + 0DE864CB2B00370000486A30 /* HARPApp.swift in Sources */, + 0D0D76182B0B26BC00B3FA75 /* RandomForest.mlpackage in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 0DE864D32B00370100486A30 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 0DE864DC2B00370100486A30 /* HARPTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 0DE864DD2B00370100486A30 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 0DE864E62B00370100486A30 /* HARPUITests.swift in Sources */, + 0DE864E82B00370100486A30 /* HARPUITestsLaunchTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 0DE864D92B00370100486A30 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 0DE864C62B00370000486A30 /* HARP */; + targetProxy = 0DE864D82B00370100486A30 /* PBXContainerItemProxy */; + }; + 0DE864E32B00370100486A30 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 0DE864C62B00370000486A30 /* HARP */; + targetProxy = 0DE864E22B00370100486A30 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 0DE864E92B00370100486A30 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + "HEADER_SEARCH_PATHS[arch=*]" = "$(SDKROOT)/System/iOSSupport/System/Library/Frameworks/HealthKit.framework/Headers"; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 0DE864EA2B00370100486A30 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 0DE864EC2B00370100486A30 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = HARP/HARP.entitlements; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"HARP/Preview Content\""; + DEVELOPMENT_TEAM = 354CJBUQDJ; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.healthcare-fitness"; + INFOPLIST_KEY_NSHealthClinicalHealthRecordsShareUsageDescription = "Your health records will be used to make risk predictions and recommendations"; + INFOPLIST_KEY_NSHealthShareUsageDescription = "Required for accessing health data"; + INFOPLIST_KEY_NSHealthUpdateUsageDescription = "Required for accessing health data"; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "Tatiana-Patton.HARP"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 0DE864ED2B00370100486A30 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = HARP/HARP.entitlements; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"HARP/Preview Content\""; + DEVELOPMENT_TEAM = 354CJBUQDJ; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.healthcare-fitness"; + INFOPLIST_KEY_NSHealthClinicalHealthRecordsShareUsageDescription = "Your health records will be used to make risk predictions and recommendations"; + INFOPLIST_KEY_NSHealthShareUsageDescription = "Required for accessing health data"; + INFOPLIST_KEY_NSHealthUpdateUsageDescription = "Required for accessing health data"; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "Tatiana-Patton.HARP"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + 0DE864EF2B00370100486A30 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 354CJBUQDJ; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "Tatiana-Patton.HARPTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/HARP.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/HARP"; + }; + name = Debug; + }; + 0DE864F02B00370100486A30 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 354CJBUQDJ; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "Tatiana-Patton.HARPTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/HARP.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/HARP"; + }; + name = Release; + }; + 0DE864F22B00370100486A30 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 354CJBUQDJ; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "Tatiana-Patton.HARPUITests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = HARP; + }; + name = Debug; + }; + 0DE864F32B00370100486A30 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 354CJBUQDJ; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "Tatiana-Patton.HARPUITests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = HARP; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 0DE864C22B00370000486A30 /* Build configuration list for PBXProject "HARP" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0DE864E92B00370100486A30 /* Debug */, + 0DE864EA2B00370100486A30 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 0DE864EB2B00370100486A30 /* Build configuration list for PBXNativeTarget "HARP" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0DE864EC2B00370100486A30 /* Debug */, + 0DE864ED2B00370100486A30 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 0DE864EE2B00370100486A30 /* Build configuration list for PBXNativeTarget "HARPTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0DE864EF2B00370100486A30 /* Debug */, + 0DE864F02B00370100486A30 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 0DE864F12B00370100486A30 /* Build configuration list for PBXNativeTarget "HARPUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0DE864F22B00370100486A30 /* Debug */, + 0DE864F32B00370100486A30 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 0DE864BF2B00370000486A30 /* Project object */; +} diff --git a/HARP.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/HARP.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/HARP.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/HARP.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/HARP.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/HARP.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/HARP.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/HARP.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..0c67376 --- /dev/null +++ b/HARP.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,5 @@ + + + + + diff --git a/HARP.xcodeproj/project.xcworkspace/xcuserdata/user247259.xcuserdatad/WorkspaceSettings.xcsettings b/HARP.xcodeproj/project.xcworkspace/xcuserdata/user247259.xcuserdatad/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..bbfef02 --- /dev/null +++ b/HARP.xcodeproj/project.xcworkspace/xcuserdata/user247259.xcuserdatad/WorkspaceSettings.xcsettings @@ -0,0 +1,14 @@ + + + + + BuildLocationStyle + UseAppPreferences + CustomBuildLocationType + RelativeToDerivedData + DerivedDataLocationStyle + Default + ShowSharedSchemesAutomaticallyEnabled + + + diff --git a/HARP.xcodeproj/xcuserdata/user247259.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/HARP.xcodeproj/xcuserdata/user247259.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..bb288b3 --- /dev/null +++ b/HARP.xcodeproj/xcuserdata/user247259.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,6 @@ + + + diff --git a/HARP.xcodeproj/xcuserdata/user247259.xcuserdatad/xcschemes/xcschememanagement.plist b/HARP.xcodeproj/xcuserdata/user247259.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..c910f25 --- /dev/null +++ b/HARP.xcodeproj/xcuserdata/user247259.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + HARP.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/HARP/Assets.xcassets/AppIcon.appiconset/Contents.json b/HARP/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..4ced18b --- /dev/null +++ b/HARP/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,14 @@ +{ + "images" : [ + { + "filename" : "HARP_logo6.png", + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/HARP/Assets.xcassets/AppIcon.appiconset/HARP_logo6.png b/HARP/Assets.xcassets/AppIcon.appiconset/HARP_logo6.png new file mode 100644 index 0000000..1b4a7f9 Binary files /dev/null and b/HARP/Assets.xcassets/AppIcon.appiconset/HARP_logo6.png differ diff --git a/HARP/Assets.xcassets/Contents.json b/HARP/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/HARP/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/HARP/Assets.xcassets/lightgray.colorset/Contents.json b/HARP/Assets.xcassets/lightgray.colorset/Contents.json new file mode 100644 index 0000000..34fdb07 --- /dev/null +++ b/HARP/Assets.xcassets/lightgray.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.949", + "green" : "0.949", + "red" : "0.949" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/HARP/CalculateView.swift b/HARP/CalculateView.swift new file mode 100644 index 0000000..315aeaa --- /dev/null +++ b/HARP/CalculateView.swift @@ -0,0 +1,105 @@ +// +// CalculateView.swift +// HARP +// +// Created by user247259 on 11/16/23. +// + +import SwiftUI +import UIKit +import HealthKit +import CoreML +import Foundation + +struct CalculateView: View { + @EnvironmentObject var dataModel: DataModel + @EnvironmentObject var api: API + @State private var showAlert = false + @State private var result: Double = 0.0 + @State private var recommendation: String = "" + var body: some View { + VStack { + // Iterate over each set of retrieved data + if dataModel.allRetrievedData.isEmpty { + Text("No data retrieved from Apple Health. \nPlease check your data sharing permissions.") + .padding(15) + } else { + List { + SwiftUI.Section (header: Text("Retrieved factors")) { + ForEach(dataModel.allRetrievedData, id: \.self) { retrievedData in + // Display the retrieved data + HStack { + Text("\(retrievedData["identifier"] ?? "")") + Spacer() + Text("\(retrievedData["data"] ?? "")") + //Text("\(api.dataDict[(retrievedData["identifier"] ?? "")] ?? 0)") + } + } + } + } + } + + Button(action: { + // Predict risk and output results + if UserData.shared.birthYear ?? 0 > 0 && UserData.shared.height ?? 0 > 0 && UserData.shared.weight ?? 0 > 0 && !dataModel.allRetrievedData.isEmpty { + // Calculate age + let currentYear = Calendar.current.component(.year, from: Date()) + let age = Double(currentYear - (UserData.shared.birthYear ?? 0)) + + // Calculate BMI + let BMI = 703 * (UserData.shared.weight ?? 0) / pow(((UserData.shared.height ?? 0) * 12), 2) + + // Predict risk + let model = RandomForest2() + guard let risk = try? model.prediction(Age: age, BMI: BMI, Contraceptive: Double(UserData.shared.contraception ?? 0), HeartDiseaseHistory: Double(UserData.shared.heartDiseaseHistory ?? 0), HeartDiseaseFamilial: Double(UserData.shared.heartDiseaseFamilial ?? 0), DiabetesHistory: Double(UserData.shared.diabetesHistory ?? 0), DiabetesFamilial: Double(UserData.shared.diabetesFamilial ?? 0), Smoking: Double(UserData.shared.smoking ?? 0), PrimaryDiet: Double(UserData.shared.primaryDiet ), StepCount: api.dataDict["StepCount"] ?? 0, DistanceWalkingRunning: api.dataDict["DistanceWalkingRunning"] ?? 0, irregularMenstrualCycles: api.dataDict["IrregularMenstrualCycles"] ?? 0, infrequentMenstrualCycles: api.dataDict["InfrequentMenstrualCycles"] ?? 0, prolongedMenstrualPeriods: api.dataDict["ProlongedMenstrualPeriods"] ?? 0, intermenstrualBleeding: api.dataDict["IntermenstrualBleeding"] ?? 0, persistentIntermenstrualBleeding: api.dataDict["PersistentIntermenstrualBleeding"] ?? 0, heartburn: api.dataDict["Heartburn"] ?? 0, nausea: api.dataDict["Nausea"] ?? 0, dizziness: api.dataDict["Dizziness"] ?? 0, shortnessOfBreath: api.dataDict["ShortnessOfBreath"] ?? 0, chestTightnessOrPain: api.dataDict["ChestTightnessOrPain"] ?? 0, vomiting: api.dataDict["Vomiting"] ?? 0, fainting: api.dataDict["Fainting"] ?? 0, fatigue: api.dataDict["Fatigue"] ?? 0, nightSweats: api.dataDict["NightSweats"] ?? 0, abdominalCramps: api.dataDict["AbdominalCramps"] ?? 0, irregularHeartRhythmEvent: api.dataDict["IrregularHeartRhythmEvent"] ?? 0, highHeartRateEvent: api.dataDict["HighHeartRateEvent"] ?? 0, lowHeartRateEvent: api.dataDict["LowHeartRateEvent"] ?? 0, rapidPoundingOrFlutteringHeartbeat: api.dataDict["RapidPoundingOrFlutteringHeartbeat"] ?? 0, bloodPressureSystolic: api.dataDict["BloodPressureSystolic"] ?? 0, bloodPressureDiastolic: api.dataDict["BloodPressureDiastolic"] ?? 0, heartRate: api.dataDict["HeartRate"] ?? 0) else { + fatalError("Unexpected runtime error.") + } + result = risk.HeartAttack * 100 + switch result{ + case 0.01...4.99: + recommendation = "\nYou’re at low risk for a serious cardiovascular event. Keep moving in a positive direction!\nSchedule an appointment with your healthcare professional to make a plan for a long, heart-healthy life and discuss factors that can increase your risk of heart disease or stroke.\n\nA great place to start is by following a heart-healthy lifestyle:\n- Maintain a heart-healthy diet;\n- Be active;\n- Keep your weight in check." + case 5.00...7.49: + recommendation = "\nYou’re at borderline risk for a serious cardiovascular event.\nYou’ve got some work to do, but you can handle this!\nIt is very important that you make an appointment with your health care professional right now. Based on your risk level, they will probably want to discuss a statin medication to lower your LDL-cholesterol and talk about factors that can increase your risk of heart disease or stroke.\n\nA great place to start is by following a heart-healthy lifestyle:\n- Maintain a heart-healthy diet;\n- Be active;\n- Keep your weight in check." + case 7.50...19.99: + recommendation = "\nYou’re at intermediate risk for a serious cardiovascular event.\nYou’ve got some work to do, but you can handle this!\nSchedule an appointment with your healthcare professional to make a plan for a long, heart-healthy life and discuss factors that can increase your risk of heart disease or stroke. Your health care professional will probably want to check back with you in 1-3 months to see the progress you're making.\n\nFollow the ‘ABCS’ of prevention that can reduce your risk:\n- Asprin Therapy;\n- Blood pressure management;\n- Cholesterol Management;\n- Smoking cessation." + case 20.00...49.99: + recommendation = "\nYou’re at high risk for a serious cardiovascular event.\nYou’ve got some work to do, but you can handle this!\nIt is very important that you make an appointment with your healthcare professional right now. Based on your risk level, they will probably want to discuss a statin medication to lower your LDL-cholesterol.\n\nFollow the ‘ABCS’ of prevention that can reduce your risk:\n- Asprin Therapy;\n- Blood pressure management;\n- Cholesterol Management;\n- Smoking cessation." + case 50.0...100.0: + recommendation = "\nYou’re at very high risk for a serious cardiovascular event.\nCall 911 immediately if you are experiencing the following symptoms:\n- Chest pain or discomfort;\n- Shortness of breath;\n- Pain or discomfort in the jaw, neck, back, arm, or shoulder;\n- Indigestion, heartburn, nausea or vomiting;\n- Fluttering feelings in the chest (palpitations);\n- Swelling of the feet, ankles, legs, or abdomen;\n- Feeling dizzy, light-headed, or unusually tired." + default: + recommendation = "No recommendation could be provided." + } + } + showAlert = true + }, label: { + Text("Calculate Risk") + .frame(width: 140,height: 45, alignment: .center) + .background(Color.indigo) + //.overlay(RoundedRectangle(cornerRadius: 5.0) + //.stroke(Color.gray)) + //.shadow(color: .white, radius:5) + .foregroundColor(.white) + .font(.system(size:17, weight: .bold, design: .default)) + .cornerRadius(8.0) + }) + .alert(isPresented: $showAlert) { + if result > 0 { + let formattedResult = String(format: "%.2f", result) + return Alert( + title: Text("\(formattedResult)%"), + message: Text("This is your predicted heart attack risk based on current data.\n") + + Text("\(recommendation)") + ) + } else { + return Alert( + title: Text("Insufficient Data"), + message: Text("Insufficient data for calculating the risk."), + dismissButton: .default(Text("OK")) + ) + } + } + .padding(35) + } // VStack + //} // ZStack + } +} diff --git a/HARP/DataElements.swift b/HARP/DataElements.swift new file mode 100644 index 0000000..0c5cdf8 --- /dev/null +++ b/HARP/DataElements.swift @@ -0,0 +1,291 @@ +// +// DataElements.swift +// HARP +// +// Created by user247259 on 11/12/23. +// + +import Foundation +import HealthKit +import HealthKitUI +import SwiftUI + +/// An enumeration that defines two categories of data types: Health Records and Fitness Data. +/// Health Records enumerates the clinical records the app would like to access and Fitness Data contains the +/// fitness data types. +let dayRange = -7 /// Number of days, for which to include symptoms and calculate average activity, body measurements, and vitals + +enum Section: CaseIterable { + case fitnessData + case menstrualFlow + case bodyMeasurements + case symptoms + + var displayName: String { + switch self { + case .fitnessData: + return "Fitness Data" + case .menstrualFlow: + return "Menstrual Tracking Data" + case .symptoms: + return "Symptoms" + case .bodyMeasurements: + return "Body Measurements" + } + } + + var types: [HKSampleType] { + switch self { + case .fitnessData: + return [ + HKObjectType.quantityType(forIdentifier: .stepCount)!, + HKObjectType.quantityType(forIdentifier: .distanceWalkingRunning)! + ] + + case .menstrualFlow: + return [ + HKObjectType.categoryType(forIdentifier: .irregularMenstrualCycles)!, + HKObjectType.categoryType(forIdentifier: .infrequentMenstrualCycles)!, + HKObjectType.categoryType(forIdentifier: .prolongedMenstrualPeriods)!, + HKObjectType.categoryType(forIdentifier: .intermenstrualBleeding)!, + HKObjectType.categoryType(forIdentifier: .persistentIntermenstrualBleeding)!, + HKObjectType.categoryType(forIdentifier: .contraceptive)! + ] + + case .symptoms: + return [ + HKObjectType.categoryType(forIdentifier: .heartburn)!, + HKObjectType.categoryType(forIdentifier: .nausea)!, + HKObjectType.categoryType(forIdentifier: .dizziness)!, + HKObjectType.categoryType(forIdentifier: .shortnessOfBreath)!, + HKObjectType.categoryType(forIdentifier: .chestTightnessOrPain)!, + HKObjectType.categoryType(forIdentifier: .vomiting)!, + HKObjectType.categoryType(forIdentifier: .fainting)!, + HKObjectType.categoryType(forIdentifier: .fatigue)!, + HKObjectType.categoryType(forIdentifier: .nightSweats)!, + HKObjectType.categoryType(forIdentifier: .abdominalCramps)!, + HKObjectType.categoryType(forIdentifier: .irregularHeartRhythmEvent)!, + HKObjectType.categoryType(forIdentifier: .highHeartRateEvent)!, + HKObjectType.categoryType(forIdentifier: .lowHeartRateEvent)!, + HKObjectType.categoryType(forIdentifier: .rapidPoundingOrFlutteringHeartbeat)! + ] + + case .bodyMeasurements: + return [ + HKObjectType.quantityType(forIdentifier: .bloodPressureSystolic)!, + HKObjectType.quantityType(forIdentifier: .bloodPressureDiastolic)!, + HKObjectType.quantityType(forIdentifier: .heartRate)!, + HKObjectType.quantityType(forIdentifier: .height)!, + HKObjectType.quantityType(forIdentifier: .bodyMass)! + ] + } + } +} + +enum HKCategoryValueContraceptive: Int { + case unspecified = 1 + case implant = 2 + case injection = 3 + case intrauterineDevice = 4 + case intravaginalRing = 5 + case oral = 6 + case patch = 7 + + var description: String { + switch self { + case .unspecified: return "Unspecified" + case .implant: return "Contraceptive Implant" + case .injection: return "Injectable Contraceptive" + case .intrauterineDevice: return "Intrauterine Device (IUD)" + case .intravaginalRing: return "Contraceptive Intravaginal Ring" + case .oral: return "Oral Contraceptive" + case .patch: return "Contraceptive Patch" + } + } +} + +class API: ObservableObject{ + @Published var retrievedData: [(identifier: String, data: String)] = [] + @Published var dataDict: [String:Double] = [:] + //@EnvironmentObject var api: API + var samples: [HKSample] = [] + var sampleTypes: Set { + return Set(Section.fitnessData.types + Section.menstrualFlow.types + Section.symptoms.types + Section.bodyMeasurements.types) + } + + /// Create an instance of the health store. Use the health store to request authorization to access + /// HealthKit records and to query for the records. + let healthStore = HKHealthStore() + + /// Before accessing clinical records and other health data from HealthKit, the app must ask the user for + /// authorization. The health store's getRequestStatusForAuthorization method allows the app to check + /// if user has already granted authorization. If the user hasn't granted authorization, the app + /// requests authorization from the person using the app. + @objc + func requestAuthorizationIfNeeded(_ sender: AnyObject? = nil) { + healthStore.getRequestStatusForAuthorization(toShare: Set(), read: sampleTypes) { (status, error) in + if status == .unnecessary { + DispatchQueue.main.async { + let message = "Authorization status has been determined, no need to request authorization at this time" + //self.present(message: message, titled: "Already Requested") + print(message) + } + } else { + self.requestAuthorization(sender) + } + print(error ?? " ") + } + } + + /// The health store's requestAuthorization method presents a permissions sheet to the user, allowing the user to + /// choose what data they allow the app to access. + @objc + func requestAuthorization(_ sender: AnyObject? = nil) { + healthStore.requestAuthorization(toShare: nil, read: sampleTypes) { (success, error) in + guard success else { + DispatchQueue.main.async { + //self.handleError(error) + print("Error occurred \(String(describing: error))") + } + return + } + } + } + + /// Query and display data for a specific HKSampleType + func queryAndDisplayData(for sampleType: HKSampleType, section: Section, completion: @escaping (String, String) -> Void) { + let sortDescriptor = [NSSortDescriptor(key: HKSampleSortIdentifierStartDate, ascending: false)] + var limit = 1 + var predicate = HKQuery.predicateForSamples(withStart: nil, end: nil, options: []) + if section == .bodyMeasurements || section == .fitnessData || section == .symptoms { + let endDate = Date() + var startDate = Calendar.current.date(byAdding: DateComponents(day: dayRange), to: endDate)! + startDate = Calendar.current.startOfDay(for: startDate) + //let stepSampleType = HKSampleType.quantityType(forIdentifier: HKQuantityTypeIdentifier(rawValue: sampleType.identifier)) + predicate = HKQuery.predicateForSamples(withStart: startDate, end: endDate, options: .strictStartDate) + if section == .bodyMeasurements || section == .fitnessData { + limit = 0 + } + } + print("Querying for sample type: \(sampleType.identifier)") + // Create a query for the specified sample type + let query = HKSampleQuery(sampleType: sampleType, predicate: predicate, limit: limit, sortDescriptors: sortDescriptor) + { (_, samples_found, error) in + guard let samples = samples_found else { + print("Failed to retrieve samples with error: \(String(describing: error))") + return + } + // Process and display the retrieved samples + self.processAndDisplaySamples(samples, section: section, for: sampleType, completion: completion) + } + healthStore.execute(query) + } + + /// Process and display the retrieved samples + func processAndDisplaySamples(_ samples: [HKSample], section: Section, for sampleType: HKSampleType, completion: @escaping (String, String) -> Void) { + var data: [(identifier: String, data: String)] = [] + var identifier = "" + var sampleInfo = "" + var dailyAVG:Double = 0 + var total = 0 + var unit: HKUnit? = nil + var sampleData = (identifier: identifier, data: sampleInfo) + for sample in samples { + if let quantitySample = sample as? HKQuantitySample { + let quantity = quantitySample.quantity + identifier = sampleType.identifier.replacingOccurrences(of: "HKQuantityTypeIdentifier", with: "") + + if section == .bodyMeasurements || section == .fitnessData { + switch identifier { + case "StepCount": + unit = HKUnit.count() + case "DistanceWalkingRunning": + unit = HKUnit.mile() + case "BloodPressureSystolic": + unit = HKUnit.millimeterOfMercury() + case "BloodPressureDiastolic": + unit = HKUnit.millimeterOfMercury() + case "HeartRate": + unit = HKUnit.count().unitDivided(by: HKUnit.minute()) + case "BodyMass": + unit = HKUnit.pound() + case "Height": + unit = HKUnit.foot() + default: + unit = HKUnit.count() + } + // add values to dailyAVG + dailyAVG += quantitySample.quantity.doubleValue(for: unit!) + total += 1 + } else { + sampleInfo = "\(quantity)" + sampleData = (identifier: identifier, data: sampleInfo) + data.append(sampleData) + completion(identifier, sampleInfo) + dataDict[identifier] = Double(sampleInfo) + print(data) + } + } + // Handle other types of samples + if let catSample = sample as? HKCategorySample { + let value = catSample.value + let valueDesc = value >= 0 ?"Present": "None" + identifier = sampleType.identifier.replacingOccurrences(of: "HKCategoryTypeIdentifier", with: "") + sampleInfo = "\(valueDesc)" + sampleData = (identifier: identifier, data: sampleInfo) + data.append(sampleData) + completion(identifier, sampleInfo) + dataDict[identifier] = 1.0 + if identifier == "Contraceptive" { + if sampleInfo == "Present" { + UserData.shared.contraception = 1 + } else { + UserData.shared.contraception = 0 + } + } + print(data) + } + // Handle clinical types of samples + if let clinicalSample = sample as? HKClinicalRecord { + print("Clinical data found") + guard let fhirRecord = clinicalSample.fhirResource else { + print("No FHIR record found!") + return + } + do { + let jsonDictionary = try JSONSerialization.jsonObject(with: fhirRecord.data, options: []) + print(jsonDictionary) + // Do something with the JSON data here. + } + catch let error { + print("*** An error occurred while parsing the FHIR data: \(error.localizedDescription) ***") + // Handle JSON parse errors here. + } + } + } + // Return agregate samples + if identifier != "" && (section == .bodyMeasurements || section == .fitnessData) { + dailyAVG = total > 0 ? dailyAVG / Double(total) : dailyAVG + sampleInfo = String(format: "%.2f", dailyAVG) + sampleData = (identifier: identifier, data: sampleInfo) + data.append(sampleData) + dataDict[identifier] = Double(sampleInfo) + if let unit_st = unit { + completion("\(identifier) (\(unit_st))", sampleInfo) + } else { + completion(identifier, sampleInfo) + } + if identifier == "Height" { + UserData.shared.height = round(100 * Double(sampleInfo)!) / 100 + } + if identifier == "BodyMass" { + UserData.shared.weight = round(100 * Double(sampleInfo)!) / 100 + } + print(data) + } + } + @objc + func getRetrievedData () -> [String:Double] { + return dataDict + } +} diff --git a/HARP/HARP.entitlements b/HARP/HARP.entitlements new file mode 100644 index 0000000..e3ba5ff --- /dev/null +++ b/HARP/HARP.entitlements @@ -0,0 +1,14 @@ + + + + + com.apple.developer.healthkit + + com.apple.developer.healthkit.access + + health-records + + com.apple.developer.healthkit.background-delivery + + + diff --git a/HARP/HARPApp.swift b/HARP/HARPApp.swift new file mode 100644 index 0000000..442e9e0 --- /dev/null +++ b/HARP/HARPApp.swift @@ -0,0 +1,21 @@ +// +// HARPApp.swift +// HARP +// +// Created by user247259 on 11/11/23. +// + +import SwiftUI + +@main +struct HARPApp: App { + @ObservedObject var api = API() + var body: some Scene { + WindowGroup { + MainView() + //.environmentObject(Input()) + .environmentObject(api) + .environmentObject(DataModel()) + } + } +} diff --git a/HARP/InputView.swift b/HARP/InputView.swift new file mode 100644 index 0000000..a47cfbd --- /dev/null +++ b/HARP/InputView.swift @@ -0,0 +1,139 @@ +// +// InputView.swift +// HARP +// +// Created by user247259 on 11/16/23. +// + +import SwiftUI + +//struct InputView: View { +// let content: () -> Content +// +// init(@ViewBuilder content: @escaping () -> Content) { +// self.content = content +// } +// +// var body: some View { +// content() +// } +//} + +import SwiftUI +import UIKit +import HealthKit + + +struct InputView: View { + @ObservedObject var userData = UserData.shared + @EnvironmentObject var api: API + var body: some View { + //@EnvironmentObject var dataModel: DataModel + + @AppStorage("BirthYear") var birthYear: Int = UserData.shared.birthYear ?? 0 + @AppStorage("Height") var height: Double = UserData.shared.height ?? 0 + @AppStorage("Weight") var weight: Double = UserData.shared.weight ?? 0 + @AppStorage("Contraception") var contraception: Int = UserData.shared.contraception ?? 0 + @AppStorage("HeartDiseaseHistory") var heartDiseaseHistory: Int = UserData.shared.heartDiseaseHistory ?? 0 + @AppStorage("HeartDiseaseFamilial") var heartDiseaseFamilial: Int = UserData.shared.heartDiseaseFamilial ?? 0 + @AppStorage("DiabetesHistory") var diabetesHistory: Int = UserData.shared.diabetesHistory ?? 0 + @AppStorage("DiabetesFamilial") var diabetesFamilial: Int = UserData.shared.diabetesFamilial ?? 0 + @AppStorage("Smoking") var smoking: Int = UserData.shared.smoking ?? 0 + @AppStorage("PrimaryDiet") var primaryDiet: Int = UserData.shared.primaryDiet + + VStack { + Spacer() + if UserData.shared.birthYear ?? 0 > 0 { + Text("Please review and update your information:") + } else { + Text("Please populate your information:") + } + /// Collect user input + Form { + SwiftUI.Section(header: Text("User Input")) { + Picker("Birth Year", selection: $birthYear) { + ForEach(Array(1900..<2030), id: \.self) { year in + Text(String(year)).tag(year) + } + } + .onChange(of: birthYear) { newValue in + UserData.shared.birthYear = newValue + } + //.pickerStyle(WheelPickerStyle()) + + Picker("Height, ft", selection: $height) { + ForEach(Array(stride(from: 3.0, through: 7.0, by: 0.05)), id: \.self) { height in + Text(String(format: "%.2f", height)) + .tag(height) + } + } + .onChange(of: height) { newValue in + UserData.shared.height = newValue + } + + Picker("Weight, lbs", selection: $weight) { + ForEach(Array(stride(from: 30.0, through: 700.0, by: 1.0)), id: \.self) { weight in + Text(String(format: "%.1f", weight)) + .tag(weight) + } + } + .onChange(of: weight) { newValue in + UserData.shared.weight = newValue + } + + Toggle("Do you use contraception?", isOn: Binding( + get: { userData.contraception == 1 }, + set: { newValue in + userData.contraception = newValue ? 1 : 0 + } + )) + + Toggle("Do you have a history of heart disease?", isOn: Binding( + get: { userData.heartDiseaseHistory == 1 }, + set: { newValue in + userData.heartDiseaseHistory = newValue ? 1 : 0 + } + )) + + Toggle("Does heart disease run in your family?", isOn: Binding( + get: { userData.heartDiseaseFamilial == 1 }, + set: { newValue in + userData.heartDiseaseFamilial = newValue ? 1 : 0 + } + )) + + Toggle("Do you have a history of diabetes?", isOn: Binding( + get: { userData.diabetesHistory == 1 }, + set: { newValue in + userData.diabetesHistory = newValue ? 1 : 0 + } + )) + + Toggle("Does diabetes run in your family?", isOn: Binding( + get: { userData.diabetesFamilial == 1 }, + set: { newValue in + userData.diabetesFamilial = newValue ? 1 : 0 + } + )) + + Toggle("Do you smoke?", isOn: Binding( + get: { userData.smoking == 1 }, + set: { newValue in + userData.smoking = newValue ? 1 : 0 + } + )) + + Picker("Primary Diet", selection: $userData.primaryDiet) { + ForEach(userData.dietOptions.sorted(by: { $0.0 < $1.0 }), id: \.key) { key, value in + Text(key).tag(value) + } + } + .onChange(of: userData.primaryDiet) { newValue in + } + } + } + + .padding(5) + } // VStack + } +} diff --git a/HARP/MainView.swift b/HARP/MainView.swift new file mode 100644 index 0000000..0808cf7 --- /dev/null +++ b/HARP/MainView.swift @@ -0,0 +1,155 @@ +// +// ContentView.swift +// HARP +// +// Created by user247259 on 11/11/23. +// + +import SwiftUI +import UIKit +import HealthKit +import Foundation +import Combine + +class DataModel: ObservableObject { + @Published var allRetrievedData: [[String: String]] = [] +} + +struct MainView_Previews: PreviewProvider { + static var previews: some View { + MainView() + //.environmentObject(Input()) + //.environmentObject(Calculate()) + } +} + +enum YesNoOption: Int, CaseIterable { + case yes = 1 + case no = 0 + + var stringValue: String { + switch self { + case .yes: return "Yes" + case .no: return "No" + } + } +} + +extension YesNoOption: ExpressibleByStringLiteral { + init(stringLiteral value: String) { + self = YesNoOption(rawValue: value.lowercased() == "yes" ? 1 : 0) ?? .no + } +} + +let YesNoMapping: [String: Int] = ["Yes": 1, "No": 0] + + +/// Required user input: year of birth, height, weight, history of heart disease for the user and immediate family, smoking, birth control use, and primary diet (selection from a list of standardized options) +class UserData: ObservableObject { + static let shared = UserData() + + @AppStorage("BirthYear") var birthYear: Int? + @AppStorage("Height") var height: Double? + @AppStorage("Weight") var weight: Double? + @AppStorage("Contraception") var contraception: Int? + @AppStorage("HeartDiseaseHistory") var heartDiseaseHistory: Int? + @AppStorage("HeartDiseaseFamilial") var heartDiseaseFamilial: Int? + @AppStorage("DiabetesHistory") var diabetesHistory: Int? + @AppStorage("DiabetesFamilial") var diabetesFamilial: Int? + @AppStorage("Smoking") var smoking: Int? + @AppStorage("PrimaryDiet") var primaryDiet: Int = 0 + + private init() { + } + let dietOptions: [String: Int] = [ + "Health-conscious": 0, + "Vegan": 1, + "Vegetarian": 2, + "Balanced": 3, + "Starchy": 4, + "Meat-based": 5, + "Fast-food": 6 + ] +} + +struct MainView: View { + @State private var storedResponses: [String] = UserDefaults.standard.stringArray(forKey: "StoredResponses") ?? [] + @State private var isEditing: Bool = false + @EnvironmentObject var api: API + //@StateObject var api + @StateObject private var dataModel = DataModel() + + let formatter: MeasurementFormatter = { + let formatter = MeasurementFormatter() + formatter.unitOptions = .providedUnit + formatter.unitStyle = .medium + formatter.numberFormatter.maximumFractionDigits = 1 + return formatter + }() + + /// Create an instance of the health store. Use the health store to request authorization to access + /// HealthKit records and to query for the records. + let healthStore = HKHealthStore() + + var body: some View { + ZStack { + LinearGradient(gradient: Gradient(colors: [.white, .white]), startPoint: .topLeading, endPoint: .bottomTrailing) + .edgesIgnoringSafeArea(.all) + .onAppear() { + retrieveData() + } + VStack { + Image(systemName: "heart.fill") + .imageScale(.large) + .foregroundStyle(.red) + .padding(.top, 15) + .padding(.bottom, 5) + Text("Heart Attack Risk Predictor") + .font(.system(size:25, weight: .medium, design: .rounded)) + .foregroundColor(.indigo) + Spacer(minLength: 20) + + TabView { + InputView () + .tabItem { + Label("Input Data", systemImage: "square.and.pencil") + } + .environmentObject(api) + .environmentObject(dataModel) + + CalculateView() + .tabItem { + Label("Calculate", systemImage: "heart") + } + .environmentObject(api) + .environmentObject(dataModel) + } // tabView + //.environmentObject(dataModel) + //.environmentObject(api) + } + } + } // body + + func retrieveData() { + api.requestAuthorizationIfNeeded() + // Clear existing data + dataModel.allRetrievedData.removeAll() + + // Use HKSampleQuery to query the HealthKit store for samples by type. + for section in Section.allCases { + for sampleType in section.types { + api.queryAndDisplayData(for: sampleType, section: section) {identifier, data in + DispatchQueue.main.async { + let newData = ["identifier": identifier, "data": data] + dataModel.allRetrievedData.append(newData) + } + } + } + } // for + } +} + + +#Preview { + MainView() +} diff --git a/HARP/Preview Content/Preview Assets.xcassets/Contents.json b/HARP/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/HARP/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/HARP/RandomForest.mlpackage/Data/com.apple.CoreML/FeatureDescriptions.json b/HARP/RandomForest.mlpackage/Data/com.apple.CoreML/FeatureDescriptions.json new file mode 100644 index 0000000..b32257d --- /dev/null +++ b/HARP/RandomForest.mlpackage/Data/com.apple.CoreML/FeatureDescriptions.json @@ -0,0 +1,111 @@ +{ + "Outputs" : { + "HeartAttack" : { + "MLFeatureShortDescription" : "--" + } + }, + "Inputs" : { + "HeartDiseaseHistory" : { + "MLFeatureShortDescription" : "--" + }, + "dizziness" : { + "MLFeatureShortDescription" : "--" + }, + "persistentIntermenstrualBleeding" : { + "MLFeatureShortDescription" : "--" + }, + "nightSweats" : { + "MLFeatureShortDescription" : "--" + }, + "DiabetesHistory" : { + "MLFeatureShortDescription" : "--" + }, + "vomiting" : { + "MLFeatureShortDescription" : "--" + }, + "bloodPressureDiastolic" : { + "MLFeatureShortDescription" : "--" + }, + "PrimaryDiet" : { + "MLFeatureShortDescription" : "--" + }, + "infrequentMenstrualCycles" : { + "MLFeatureShortDescription" : "--" + }, + "Smoking" : { + "MLFeatureShortDescription" : "--" + }, + "fatigue" : { + "MLFeatureShortDescription" : "--" + }, + "shortnessOfBreath" : { + "MLFeatureShortDescription" : "--" + }, + "Contraceptive" : { + "MLFeatureShortDescription" : "--" + }, + "DiabetesFamilial" : { + "MLFeatureShortDescription" : "--" + }, + "lowHeartRateEvent" : { + "MLFeatureShortDescription" : "--" + }, + "prolongedMenstrualPeriods" : { + "MLFeatureShortDescription" : "--" + }, + "DistanceWalkingRunning" : { + "MLFeatureShortDescription" : "--" + }, + "nausea" : { + "MLFeatureShortDescription" : "--" + }, + "heartRate" : { + "MLFeatureShortDescription" : "--" + }, + "rapidPoundingOrFlutteringHeartbeat" : { + "MLFeatureShortDescription" : "--" + }, + "BMI" : { + "MLFeatureShortDescription" : "--" + }, + "irregularHeartRhythmEvent" : { + "MLFeatureShortDescription" : "--" + }, + "irregularMenstrualCycles" : { + "MLFeatureShortDescription" : "--" + }, + "heartburn" : { + "MLFeatureShortDescription" : "--" + }, + "fainting" : { + "MLFeatureShortDescription" : "--" + }, + "highHeartRateEvent" : { + "MLFeatureShortDescription" : "--" + }, + "intermenstrualBleeding" : { + "MLFeatureShortDescription" : "--" + }, + "bloodPressureSystolic" : { + "MLFeatureShortDescription" : "--" + }, + "HeartDiseaseFamilial" : { + "MLFeatureShortDescription" : "--" + }, + "Age" : { + "MLFeatureShortDescription" : "--" + }, + "abdominalCramps" : { + "MLFeatureShortDescription" : "--" + }, + "chestTightnessOrPain" : { + "MLFeatureShortDescription" : "--" + }, + "StepCount" : { + "MLFeatureShortDescription" : "--" + } + }, + "TrainingInputs" : { + + } +} \ No newline at end of file diff --git a/HARP/RandomForest.mlpackage/Data/com.apple.CoreML/Metadata.json b/HARP/RandomForest.mlpackage/Data/com.apple.CoreML/Metadata.json new file mode 100644 index 0000000..e3579a3 --- /dev/null +++ b/HARP/RandomForest.mlpackage/Data/com.apple.CoreML/Metadata.json @@ -0,0 +1,12 @@ +{ + "MLModelVersionStringKey" : "--", + "MLModelDescriptionKey" : "HARP_model", + "MLModelCreatorDefinedKey" : { + "com.apple.createml.version" : "13.6.1", + "com.apple.createml.app.tag" : "121.1", + "com.apple.coreml.model.preview.type" : "tabularRegressor", + "com.apple.createml.app.version" : "5.0" + }, + "MLModelAuthorKey" : "user247259", + "MLModelLicenseKey" : "--" +} \ No newline at end of file diff --git a/HARP/RandomForest.mlpackage/Data/com.apple.CoreML/RandomForest.mlmodel b/HARP/RandomForest.mlpackage/Data/com.apple.CoreML/RandomForest.mlmodel new file mode 100644 index 0000000..190d936 Binary files /dev/null and b/HARP/RandomForest.mlpackage/Data/com.apple.CoreML/RandomForest.mlmodel differ diff --git a/HARP/RandomForest.mlpackage/Manifest.json b/HARP/RandomForest.mlpackage/Manifest.json new file mode 100644 index 0000000..7bb25d6 --- /dev/null +++ b/HARP/RandomForest.mlpackage/Manifest.json @@ -0,0 +1,24 @@ +{ + "fileFormatVersion": "1.0.0", + "itemInfoEntries": { + "0F7E19C7-B4F8-4BB4-B337-E76EEDF084B8": { + "author": "com.apple.CoreML", + "description": "External FeatureDescription Overlay", + "name": "FeatureDescriptions.json", + "path": "com.apple.CoreML/FeatureDescriptions.json" + }, + "5C630489-7E96-4187-8EE5-A3692EA8ED3C": { + "author": "com.apple.CoreML", + "description": "CoreML Model Specification", + "name": "RandomForest.mlmodel", + "path": "com.apple.CoreML/RandomForest.mlmodel" + }, + "8EFEB630-9065-4F8B-8062-954C9FDC345F": { + "author": "com.apple.CoreML", + "description": "External Metadata Overlay", + "name": "Metadata.json", + "path": "com.apple.CoreML/Metadata.json" + } + }, + "rootModelIdentifier": "5C630489-7E96-4187-8EE5-A3692EA8ED3C" +} diff --git a/HARP/RandomForest2.mlpackage/Data/com.apple.CoreML/FeatureDescriptions.json b/HARP/RandomForest2.mlpackage/Data/com.apple.CoreML/FeatureDescriptions.json new file mode 100644 index 0000000..b7292ee --- /dev/null +++ b/HARP/RandomForest2.mlpackage/Data/com.apple.CoreML/FeatureDescriptions.json @@ -0,0 +1,111 @@ +{ + "Outputs" : { + "HeartAttack" : { + "MLFeatureShortDescription" : "" + } + }, + "Inputs" : { + "HeartDiseaseHistory" : { + "MLFeatureShortDescription" : "" + }, + "dizziness" : { + "MLFeatureShortDescription" : "" + }, + "persistentIntermenstrualBleeding" : { + "MLFeatureShortDescription" : "" + }, + "nightSweats" : { + "MLFeatureShortDescription" : "" + }, + "DiabetesHistory" : { + "MLFeatureShortDescription" : "" + }, + "vomiting" : { + "MLFeatureShortDescription" : "" + }, + "bloodPressureDiastolic" : { + "MLFeatureShortDescription" : "" + }, + "PrimaryDiet" : { + "MLFeatureShortDescription" : "" + }, + "infrequentMenstrualCycles" : { + "MLFeatureShortDescription" : "" + }, + "Smoking" : { + "MLFeatureShortDescription" : "" + }, + "fatigue" : { + "MLFeatureShortDescription" : "" + }, + "shortnessOfBreath" : { + "MLFeatureShortDescription" : "" + }, + "Contraceptive" : { + "MLFeatureShortDescription" : "" + }, + "DiabetesFamilial" : { + "MLFeatureShortDescription" : "" + }, + "lowHeartRateEvent" : { + "MLFeatureShortDescription" : "" + }, + "prolongedMenstrualPeriods" : { + "MLFeatureShortDescription" : "" + }, + "DistanceWalkingRunning" : { + "MLFeatureShortDescription" : "" + }, + "nausea" : { + "MLFeatureShortDescription" : "" + }, + "heartRate" : { + "MLFeatureShortDescription" : "" + }, + "rapidPoundingOrFlutteringHeartbeat" : { + "MLFeatureShortDescription" : "" + }, + "BMI" : { + "MLFeatureShortDescription" : "" + }, + "irregularHeartRhythmEvent" : { + "MLFeatureShortDescription" : "" + }, + "irregularMenstrualCycles" : { + "MLFeatureShortDescription" : "" + }, + "heartburn" : { + "MLFeatureShortDescription" : "" + }, + "fainting" : { + "MLFeatureShortDescription" : "" + }, + "highHeartRateEvent" : { + "MLFeatureShortDescription" : "" + }, + "intermenstrualBleeding" : { + "MLFeatureShortDescription" : "" + }, + "bloodPressureSystolic" : { + "MLFeatureShortDescription" : "" + }, + "HeartDiseaseFamilial" : { + "MLFeatureShortDescription" : "" + }, + "Age" : { + "MLFeatureShortDescription" : "" + }, + "abdominalCramps" : { + "MLFeatureShortDescription" : "" + }, + "chestTightnessOrPain" : { + "MLFeatureShortDescription" : "" + }, + "StepCount" : { + "MLFeatureShortDescription" : "" + } + }, + "TrainingInputs" : { + + } +} \ No newline at end of file diff --git a/HARP/RandomForest2.mlpackage/Data/com.apple.CoreML/Metadata.json b/HARP/RandomForest2.mlpackage/Data/com.apple.CoreML/Metadata.json new file mode 100644 index 0000000..6d70411 --- /dev/null +++ b/HARP/RandomForest2.mlpackage/Data/com.apple.CoreML/Metadata.json @@ -0,0 +1,9 @@ +{ + "MLModelCreatorDefinedKey" : { + "com.apple.createml.version" : "13.6.1", + "com.apple.createml.app.tag" : "121.1", + "com.apple.createml.app.version" : "5.0", + "com.apple.coreml.model.preview.type" : "tabularRegressor" + }, + "MLModelAuthorKey" : "user247259" +} \ No newline at end of file diff --git a/HARP/RandomForest2.mlpackage/Data/com.apple.CoreML/RandomForest2.mlmodel b/HARP/RandomForest2.mlpackage/Data/com.apple.CoreML/RandomForest2.mlmodel new file mode 100644 index 0000000..ac29519 Binary files /dev/null and b/HARP/RandomForest2.mlpackage/Data/com.apple.CoreML/RandomForest2.mlmodel differ diff --git a/HARP/RandomForest2.mlpackage/Manifest.json b/HARP/RandomForest2.mlpackage/Manifest.json new file mode 100644 index 0000000..8e49177 --- /dev/null +++ b/HARP/RandomForest2.mlpackage/Manifest.json @@ -0,0 +1,24 @@ +{ + "fileFormatVersion": "1.0.0", + "itemInfoEntries": { + "00A53273-C43B-4A31-8715-C6B99CAC7C25": { + "author": "com.apple.CoreML", + "description": "CoreML Model Specification", + "name": "RandomForest2.mlmodel", + "path": "com.apple.CoreML/RandomForest2.mlmodel" + }, + "7126484A-682D-4C97-B217-A4FC8C7C8151": { + "author": "com.apple.CoreML", + "description": "External FeatureDescription Overlay", + "name": "FeatureDescriptions.json", + "path": "com.apple.CoreML/FeatureDescriptions.json" + }, + "90BB8929-7F77-4188-9EC1-CB132F14AC56": { + "author": "com.apple.CoreML", + "description": "External Metadata Overlay", + "name": "Metadata.json", + "path": "com.apple.CoreML/Metadata.json" + } + }, + "rootModelIdentifier": "00A53273-C43B-4A31-8715-C6B99CAC7C25" +} diff --git a/HARPTests/HARPTests.swift b/HARPTests/HARPTests.swift new file mode 100644 index 0000000..c2ef156 --- /dev/null +++ b/HARPTests/HARPTests.swift @@ -0,0 +1,36 @@ +// +// HARPTests.swift +// HARPTests +// +// Created by user247259 on 11/11/23. +// + +import XCTest +@testable import HARP + +final class HARPTests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + // Any test you write for XCTest can be annotated as throws and async. + // Mark your test throws to produce an unexpected failure when your test encounters an uncaught error. + // Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards. + } + + func testPerformanceExample() throws { + // This is an example of a performance test case. + self.measure { + // Put the code you want to measure the time of here. + } + } + +} diff --git a/HARPUITests/HARPUITests.swift b/HARPUITests/HARPUITests.swift new file mode 100644 index 0000000..94d56d0 --- /dev/null +++ b/HARPUITests/HARPUITests.swift @@ -0,0 +1,41 @@ +// +// HARPUITests.swift +// HARPUITests +// +// Created by user247259 on 11/11/23. +// + +import XCTest + +final class HARPUITests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + continueAfterFailure = false + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // UI tests must launch the application that they test. + let app = XCUIApplication() + app.launch() + + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testLaunchPerformance() throws { + if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) { + // This measures how long it takes to launch your application. + measure(metrics: [XCTApplicationLaunchMetric()]) { + XCUIApplication().launch() + } + } + } +} diff --git a/HARPUITests/HARPUITestsLaunchTests.swift b/HARPUITests/HARPUITestsLaunchTests.swift new file mode 100644 index 0000000..c6a76d6 --- /dev/null +++ b/HARPUITests/HARPUITestsLaunchTests.swift @@ -0,0 +1,32 @@ +// +// HARPUITestsLaunchTests.swift +// HARPUITests +// +// Created by user247259 on 11/11/23. +// + +import XCTest + +final class HARPUITestsLaunchTests: XCTestCase { + + override class var runsForEachTargetApplicationUIConfiguration: Bool { + true + } + + override func setUpWithError() throws { + continueAfterFailure = false + } + + func testLaunch() throws { + let app = XCUIApplication() + app.launch() + + // Insert steps here to perform after app launch but before taking a screenshot, + // such as logging into a test account or navigating somewhere in the app + + let attachment = XCTAttachment(screenshot: app.screenshot()) + attachment.name = "Launch Screen" + attachment.lifetime = .keepAlways + add(attachment) + } +}