Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include motion.json file with the results and update clocks #4

Merged
merged 10 commits into from
Jul 6, 2022
Merged
61 changes: 20 additions & 41 deletions BiAffectViewBuilder/BiAffectViewBuilder.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
FF29ACA12862A92E002A42AE /* TrailmakingResultObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF29ACA02862A92E002A42AE /* TrailmakingResultObject.swift */; };
FF29ACA42862BFBA002A42AE /* TrailmakingPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF29ACA32862BFBA002A42AE /* TrailmakingPoint.swift */; };
FFA2306128613D1500120300 /* TrailmakingStepView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFA2306028613D1500120300 /* TrailmakingStepView.swift */; };
FFBC90FF286A42C700029A59 /* AssessmentModel in Frameworks */ = {isa = PBXBuildFile; productRef = FFBC90FE286A42C700029A59 /* AssessmentModel */; };
FFBC9101286A42C700029A59 /* AssessmentModelUI in Frameworks */ = {isa = PBXBuildFile; productRef = FFBC9100286A42C700029A59 /* AssessmentModelUI */; };
FFD8C45C285C30B5000FC950 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = FFD8C45E285C30B5000FC950 /* Localizable.strings */; };
FFD8C45F285C30FC000FC950 /* Trail_Making.json in Resources */ = {isa = PBXBuildFile; fileRef = FFD8C461285C30FC000FC950 /* Trail_Making.json */; };
FFD8C462285C3108000FC950 /* Go-No-Go.json in Resources */ = {isa = PBXBuildFile; fileRef = FFD8C464285C3108000FC950 /* Go-No-Go.json */; };
Expand All @@ -29,8 +27,10 @@
FFE2A6CC285BA9A8009805C0 /* GoNoGoStepObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFE2A6C3285BA9A8009805C0 /* GoNoGoStepObject.swift */; };
FFE2A6CD285BA9A8009805C0 /* BiAffectAssessmentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFE2A6C5285BA9A8009805C0 /* BiAffectAssessmentView.swift */; };
FFE2A6CE285BA9A8009805C0 /* GoNoGoStepView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFE2A6C6285BA9A8009805C0 /* GoNoGoStepView.swift */; };
FFE2A6D3285BAA9B009805C0 /* MobilePassiveData in Frameworks */ = {isa = PBXBuildFile; productRef = FFE2A6D2285BAA9B009805C0 /* MobilePassiveData */; };
FFE2A6D5285BAA9B009805C0 /* MotionSensor in Frameworks */ = {isa = PBXBuildFile; productRef = FFE2A6D4285BAA9B009805C0 /* MotionSensor */; };
FFF4295C286F667A00361337 /* AssessmentModel in Frameworks */ = {isa = PBXBuildFile; productRef = FFF4295B286F667A00361337 /* AssessmentModel */; };
FFF4295E286F667A00361337 /* AssessmentModelUI in Frameworks */ = {isa = PBXBuildFile; productRef = FFF4295D286F667A00361337 /* AssessmentModelUI */; };
FFF42960286F667A00361337 /* MobilePassiveData in Frameworks */ = {isa = PBXBuildFile; productRef = FFF4295F286F667A00361337 /* MobilePassiveData */; };
FFF42962286F667A00361337 /* MotionSensor in Frameworks */ = {isa = PBXBuildFile; productRef = FFF42961286F667A00361337 /* MotionSensor */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -56,17 +56,19 @@
FFE2A6C3285BA9A8009805C0 /* GoNoGoStepObject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GoNoGoStepObject.swift; sourceTree = "<group>"; };
FFE2A6C5285BA9A8009805C0 /* BiAffectAssessmentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BiAffectAssessmentView.swift; sourceTree = "<group>"; };
FFE2A6C6285BA9A8009805C0 /* GoNoGoStepView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GoNoGoStepView.swift; sourceTree = "<group>"; };
FFF42959286F660E00361337 /* AssessmentModelKMM */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = AssessmentModelKMM; path = ../../AssessmentModelKMM; sourceTree = "<group>"; };
FFF4295A286F663A00361337 /* MobilePassiveData-SDK */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = "MobilePassiveData-SDK"; path = "../../MobilePassiveData-SDK"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
FFE2A6A5285BA8AA009805C0 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FFE2A6D5285BAA9B009805C0 /* MotionSensor in Frameworks */,
FFBC90FF286A42C700029A59 /* AssessmentModel in Frameworks */,
FFBC9101286A42C700029A59 /* AssessmentModelUI in Frameworks */,
FFE2A6D3285BAA9B009805C0 /* MobilePassiveData in Frameworks */,
FFF42962286F667A00361337 /* MotionSensor in Frameworks */,
FFF4295E286F667A00361337 /* AssessmentModelUI in Frameworks */,
FFF42960286F667A00361337 /* MobilePassiveData in Frameworks */,
FFF4295C286F667A00361337 /* AssessmentModel in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -187,6 +189,8 @@
FFE2A6CF285BA9FE009805C0 /* Packages */ = {
isa = PBXGroup;
children = (
FFF42959286F660E00361337 /* AssessmentModelKMM */,
FFF4295A286F663A00361337 /* MobilePassiveData-SDK */,
);
name = Packages;
sourceTree = "<group>";
Expand Down Expand Up @@ -215,10 +219,10 @@
);
name = BiAffectViewBuilder;
packageProductDependencies = (
FFE2A6D2285BAA9B009805C0 /* MobilePassiveData */,
FFE2A6D4285BAA9B009805C0 /* MotionSensor */,
FFBC90FE286A42C700029A59 /* AssessmentModel */,
FFBC9100286A42C700029A59 /* AssessmentModelUI */,
FFF4295B286F667A00361337 /* AssessmentModel */,
FFF4295D286F667A00361337 /* AssessmentModelUI */,
FFF4295F286F667A00361337 /* MobilePassiveData */,
FFF42961286F667A00361337 /* MotionSensor */,
);
productName = BiAffectViewBuilder;
productReference = FFE2A6A8285BA8AA009805C0 /* BiAffectViewBuilder.app */;
Expand Down Expand Up @@ -249,8 +253,6 @@
);
mainGroup = FFE2A69F285BA8AA009805C0;
packageReferences = (
FFE2A6D1285BAA9B009805C0 /* XCRemoteSwiftPackageReference "MobilePassiveData-SDK" */,
FFBC90FD286A42C700029A59 /* XCRemoteSwiftPackageReference "AssessmentModelKMM" */,
);
productRefGroup = FFE2A6A9285BA8AA009805C0 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -524,44 +526,21 @@
};
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
FFBC90FD286A42C700029A59 /* XCRemoteSwiftPackageReference "AssessmentModelKMM" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/Sage-Bionetworks/AssessmentModelKMM.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.7.5;
};
};
FFE2A6D1285BAA9B009805C0 /* XCRemoteSwiftPackageReference "MobilePassiveData-SDK" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/Sage-Bionetworks/MobilePassiveData-SDK.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.2.4;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
FFBC90FE286A42C700029A59 /* AssessmentModel */ = {
FFF4295B286F667A00361337 /* AssessmentModel */ = {
isa = XCSwiftPackageProductDependency;
package = FFBC90FD286A42C700029A59 /* XCRemoteSwiftPackageReference "AssessmentModelKMM" */;
productName = AssessmentModel;
};
FFBC9100286A42C700029A59 /* AssessmentModelUI */ = {
FFF4295D286F667A00361337 /* AssessmentModelUI */ = {
isa = XCSwiftPackageProductDependency;
package = FFBC90FD286A42C700029A59 /* XCRemoteSwiftPackageReference "AssessmentModelKMM" */;
productName = AssessmentModelUI;
};
FFE2A6D2285BAA9B009805C0 /* MobilePassiveData */ = {
FFF4295F286F667A00361337 /* MobilePassiveData */ = {
isa = XCSwiftPackageProductDependency;
package = FFE2A6D1285BAA9B009805C0 /* XCRemoteSwiftPackageReference "MobilePassiveData-SDK" */;
productName = MobilePassiveData;
};
FFE2A6D4285BAA9B009805C0 /* MotionSensor */ = {
FFF42961286F667A00361337 /* MotionSensor */ = {
isa = XCSwiftPackageProductDependency;
package = FFE2A6D1285BAA9B009805C0 /* XCRemoteSwiftPackageReference "MobilePassiveData-SDK" */;
productName = MotionSensor;
};
/* End XCSwiftPackageProductDependency section */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,41 +1,25 @@
{
"pins" : [
{
"identity" : "assessmentmodelkmm",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Sage-Bionetworks/AssessmentModelKMM.git",
"state" : {
"revision" : "850d98c99152139160287126c20881b214fef2fb",
"version" : "0.7.5"
"object": {
"pins": [
{
"package": "JsonModel",
"repositoryURL": "https://github.com/Sage-Bionetworks/JsonModel-Swift.git",
"state": {
"branch": null,
"revision": "996d4807c42f0660c62b4cec0f95230dd1341639",
"version": "1.5.0"
}
},
{
"package": "SharedMobileUI",
"repositoryURL": "https://github.com/Sage-Bionetworks/SharedMobileUI-AppleOS.git",
"state": {
"branch": null,
"revision": "a3c4ff73d2b222d5a246f617d5c2b062eb3abfe4",
"version": "0.17.0"
}
}
},
{
"identity" : "jsonmodel-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Sage-Bionetworks/JsonModel-Swift.git",
"state" : {
"revision" : "ca85a1bb5272f428d050d514d72fdea05c95f6fb",
"version" : "1.4.10"
}
},
{
"identity" : "mobilepassivedata-sdk",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Sage-Bionetworks/MobilePassiveData-SDK.git",
"state" : {
"revision" : "9c48602422ff2de9404112b9f2ed98c0a9ca2c44",
"version" : "1.2.4"
}
},
{
"identity" : "sharedmobileui-appleos",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Sage-Bionetworks/SharedMobileUI-AppleOS.git",
"state" : {
"revision" : "a3c4ff73d2b222d5a246f617d5c2b062eb3abfe4",
"version" : "0.17.0"
}
}
],
"version" : 2
]
},
"version": 1
}
8 changes: 4 additions & 4 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
"repositoryURL": "https://github.com/Sage-Bionetworks/JsonModel-Swift.git",
"state": {
"branch": null,
"revision": "dcce83598aa1e81478b6bd9adee38c8ed167665b",
"version": "1.4.9"
"revision": "996d4807c42f0660c62b4cec0f95230dd1341639",
"version": "1.5.0"
}
},
{
"package": "MobilePassiveData",
"repositoryURL": "https://github.com/Sage-Bionetworks/MobilePassiveData-SDK.git",
"state": {
"branch": null,
"revision": "9c48602422ff2de9404112b9f2ed98c0a9ca2c44",
"version": "1.2.4"
"revision": "1c271f053bd3be9e2f45ea4c1c3cced3e47304c1",
"version": "1.3.1"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ let package = Package(
from: "0.7.5"),
.package(name: "MobilePassiveData",
url: "https://github.com/Sage-Bionetworks/MobilePassiveData-SDK.git",
from: "1.2.4"),
from: "1.3.1"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
Expand Down
10 changes: 1 addition & 9 deletions Sources/BiAffectSDK/BiAffectSDK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,7 @@ import AssessmentModel
import AssessmentModelUI
import JsonModel

let kBaseJsonSchemaURL = URL(string: "https://biaffect.github.io/biaffectsdk/schemas/v1/")!

public final class BiAffectSDK {
public class func setup() {
#if os(iOS)
PermissionAuthorizationHandler.registerAdaptorIfNeeded(MotionSensor.MotionAuthorization.shared)
#endif
}
}
let kBaseJsonSchemaURL = URL(string: "https://biaffect.github.io/biaffectsdk/json/schemas/v1/")!

public enum BiAffectIdentifier : String, CaseIterable {
case trailmaking = "Trail_Making", goNoGo = "Go-No-Go"
Expand Down
21 changes: 15 additions & 6 deletions Sources/BiAffectSDK/GoNoGo/GoNoGoResultObject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

import Foundation
import JsonModel
import MobilePassiveData

extension SerializableResultType {
static let gonogo: SerializableResultType = "gonogo"
Expand All @@ -46,7 +47,7 @@ public final class GoNoGoResultObject : MultiplatformResultData, SerializableRes
public let identifier: String
public var startDateTime: Date
public var endDateTime: Date?
public var startUptime: TimeInterval?
public var startUptime: SystemUptime?
public var responses: [Response]
public var motionError: ErrorResultObject?

Expand All @@ -69,11 +70,13 @@ public final class GoNoGoResultObject : MultiplatformResultData, SerializableRes

public struct Response : Codable, Hashable {
private enum CodingKeys : String, OrderedEnumCodingKey {
case timestamp, resetTimestamp, timeToThreshold, go, incorrect, samples
case stepPath, timestamp, resetTimestamp, timeToThreshold, stimulusDelay, go, incorrect, samples
}
public let timestamp: TimeInterval
public let resetTimestamp: TimeInterval
public let timeToThreshold: TimeInterval
public let stepPath: String?
public let timestamp: SystemUptime
public let resetTimestamp: SystemUptime
public let timeToThreshold: SecondDuration
public let stimulusDelay: SecondDuration
public let go: Bool
public let incorrect: Bool
public let samples: [Sample]?
Expand Down Expand Up @@ -169,6 +172,9 @@ extension GoNoGoResultObject.Response : DocumentableStruct {
throw DocumentableError.invalidCodingKey(codingKey, "\(codingKey) is not recognized for this class")
}
switch key {
case .stepPath:
return .init(propertyType: .primitive(.string), propertyDescription:
"A marker that matches the 'stepPath' in the 'motion.json' file with raw motion sensor data.")
case .timestamp:
return .init(propertyType: .primitive(.number), propertyDescription:
"""
Expand All @@ -188,6 +194,9 @@ extension GoNoGoResultObject.Response : DocumentableStruct {
Time from when the stimulus occurred to the threshold being reached.
For a timeout or false start, this value will be zero.
""")
case .stimulusDelay:
return .init(propertyType: .primitive(.number), propertyDescription:
"The delay (in seconds) from reset until the stimulus is shown.")
case .go:
return .init(propertyType: .primitive(.boolean), propertyDescription:
"YES if a go test and NO if a no go test.")
Expand All @@ -201,7 +210,7 @@ extension GoNoGoResultObject.Response : DocumentableStruct {
}

public static func examples() -> [GoNoGoResultObject.Response] {
[.init(timestamp: 0, resetTimestamp: 120492.081, timeToThreshold: 0.1, go: true, incorrect: true, samples: nil)]
[.init(stepPath: "0", timestamp: 0, resetTimestamp: 120492.081, timeToThreshold: 0.1, stimulusDelay: 7.3, go: true, incorrect: true, samples: nil)]
}
}

Expand Down
7 changes: 6 additions & 1 deletion Sources/BiAffectSDK/GoNoGo/GoNoGoStepObject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ struct GoNoGoStepObject : SerializableNode, Step, Codable {
_minimumStimulusInterval = "minimumStimulusInterval",
_thresholdAcceleration = "thresholdAcceleration",
_numberOfAttempts = "numberOfAttempts",
_timeout = "timeout"
_timeout = "timeout",
_maxTotalAttempts = "maxTotalAttempts"
}

private(set) var serializableType: SerializableNodeType = .gonogo
Expand All @@ -75,6 +76,10 @@ struct GoNoGoStepObject : SerializableNode, Step, Codable {
var numberOfAttempts: Int { _numberOfAttempts ?? 9 }
private(set) var _numberOfAttempts: Int?

/// The max number of attempts to try before quitting.
var maxTotalAttempts: Int { _maxTotalAttempts ?? 18 }
private(set) var _maxTotalAttempts: Int?

/// The interval permitted after the stimulus until the test fails, if the threshold is not reached.
var timeout: TimeInterval { _timeout ?? 3.0 }
private(set) var _timeout: TimeInterval?
Expand Down
Loading