Add files via upload
parent
d1ee766319
commit
73a3e8c37d
Binary file not shown.
@ -0,0 +1,36 @@
|
|||||||
|
//
|
||||||
|
// AppDelegate.swift
|
||||||
|
// surveys-example
|
||||||
|
//
|
||||||
|
// Created by Juan David López Regalado on 12/06/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
@main
|
||||||
|
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||||
|
// Override point for customization after application launch.
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: UISceneSession Lifecycle
|
||||||
|
|
||||||
|
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
|
||||||
|
// Called when a new scene session is being created.
|
||||||
|
// Use this method to select a configuration to create the new scene with.
|
||||||
|
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
|
||||||
|
}
|
||||||
|
|
||||||
|
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
|
||||||
|
// Called when the user discards a scene session.
|
||||||
|
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
|
||||||
|
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"colors" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"platform" : "ios",
|
||||||
|
"size" : "1024x1024"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "pcie-logo.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 645 KiB |
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||||
|
<dependencies>
|
||||||
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
|
||||||
|
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||||
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
|
</dependencies>
|
||||||
|
<scenes>
|
||||||
|
<!--View Controller-->
|
||||||
|
<scene sceneID="EHf-IW-A2E">
|
||||||
|
<objects>
|
||||||
|
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||||
|
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
|
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
||||||
|
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
||||||
|
</view>
|
||||||
|
</viewController>
|
||||||
|
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
|
</objects>
|
||||||
|
<point key="canvasLocation" x="53" y="375"/>
|
||||||
|
</scene>
|
||||||
|
</scenes>
|
||||||
|
</document>
|
@ -0,0 +1,68 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
|
||||||
|
<device id="retina6_12" orientation="portrait" appearance="light"/>
|
||||||
|
<dependencies>
|
||||||
|
<deployment identifier="iOS"/>
|
||||||
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
|
||||||
|
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||||
|
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||||
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
|
</dependencies>
|
||||||
|
<scenes>
|
||||||
|
<!--View Controller-->
|
||||||
|
<scene sceneID="tne-QT-ifu">
|
||||||
|
<objects>
|
||||||
|
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="surveys_example" customModuleProvider="target" sceneMemberID="viewController">
|
||||||
|
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
|
<subviews>
|
||||||
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="udU-YT-Wn2">
|
||||||
|
<rect key="frame" x="128" y="533" width="137" height="52"/>
|
||||||
|
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||||
|
<state key="normal" title="Start Survey"/>
|
||||||
|
<buttonConfiguration key="configuration" style="plain" title="Start Survey" titleAlignment="center">
|
||||||
|
<fontDescription key="titleFontDescription" style="UICTFontTextStyleTitle3"/>
|
||||||
|
</buttonConfiguration>
|
||||||
|
<connections>
|
||||||
|
<action selector="startSurveyTapped:" destination="BYZ-38-t0r" eventType="touchUpInside" id="0G5-au-7td"/>
|
||||||
|
</connections>
|
||||||
|
</button>
|
||||||
|
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" text="Biomarker analysis study on Apple devices to detect the level of sedentary lifestyle." textAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="O9Y-Kh-XQC">
|
||||||
|
<rect key="frame" x="72" y="146" width="248" height="311"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
|
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||||
|
<color key="textColor" systemColor="labelColor"/>
|
||||||
|
<fontDescription key="fontDescription" name="GillSans" family="Gill Sans" pointSize="36"/>
|
||||||
|
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
|
||||||
|
</textView>
|
||||||
|
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="pcie-logo" translatesAutoresizingMaskIntoConstraints="NO" id="jV5-Zs-y7v">
|
||||||
|
<rect key="frame" x="97" y="690" width="198" height="111"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
|
</imageView>
|
||||||
|
</subviews>
|
||||||
|
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
||||||
|
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||||
|
<constraints>
|
||||||
|
<constraint firstItem="udU-YT-Wn2" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="474" id="4Lv-uj-sfs"/>
|
||||||
|
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="udU-YT-Wn2" secondAttribute="trailing" constant="128" id="KxA-OY-V2k"/>
|
||||||
|
<constraint firstItem="6Tk-OE-BBY" firstAttribute="bottom" secondItem="udU-YT-Wn2" secondAttribute="bottom" constant="233" id="q22-wR-4RZ"/>
|
||||||
|
<constraint firstItem="udU-YT-Wn2" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="128" id="sa7-Jh-KZz"/>
|
||||||
|
</constraints>
|
||||||
|
</view>
|
||||||
|
</viewController>
|
||||||
|
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||||
|
</objects>
|
||||||
|
<point key="canvasLocation" x="55.725190839694655" y="3.5211267605633805"/>
|
||||||
|
</scene>
|
||||||
|
</scenes>
|
||||||
|
<resources>
|
||||||
|
<image name="pcie-logo" width="3766" height="1429"/>
|
||||||
|
<systemColor name="labelColor">
|
||||||
|
<color white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||||
|
</systemColor>
|
||||||
|
<systemColor name="systemBackgroundColor">
|
||||||
|
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||||
|
</systemColor>
|
||||||
|
</resources>
|
||||||
|
</document>
|
@ -0,0 +1,79 @@
|
|||||||
|
//
|
||||||
|
// ConsentManager.swift
|
||||||
|
// surveys-example
|
||||||
|
//
|
||||||
|
// Created by Juan David López Regalado on 12/06/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import UIKit
|
||||||
|
import ResearchKit
|
||||||
|
|
||||||
|
class ConsentManager{
|
||||||
|
static let shared = ConsentManager()
|
||||||
|
|
||||||
|
func createConsentTask() -> ORKTask{
|
||||||
|
|
||||||
|
// Pagina de Welcome
|
||||||
|
let welcomeStep = ORKInstructionStep(identifier: "consentWelcomeInstructionStep")
|
||||||
|
welcomeStep.title = "Welcome!"
|
||||||
|
welcomeStep.iconImage = UIImage(systemName: "hand.wave")
|
||||||
|
welcomeStep.detailText = "Thank you for being part of the biomarker project aimed at determining the level of sedentary lifestyle. However, before accepting, please read the next part." // explain the consent
|
||||||
|
|
||||||
|
let sign = ORKInstructionStep(identifier: "signAccept")
|
||||||
|
sign.title = "Please Sign if you Accept"
|
||||||
|
|
||||||
|
|
||||||
|
// Pagina del before you join
|
||||||
|
let beforeYouJoin = ORKInstructionStep(identifier: "informedConsentInstructionStep")
|
||||||
|
beforeYouJoin.iconImage = UIImage(systemName: "doc.text.magnifyinglass")
|
||||||
|
beforeYouJoin.title = "Before You Join"
|
||||||
|
|
||||||
|
let sharingHealthDataBodyItem = ORKBodyItem(text: "The study will ask you to share some of your Health data.",
|
||||||
|
detailText: nil,
|
||||||
|
image: UIImage(systemName: "heart.fill"),
|
||||||
|
learnMoreItem: nil,
|
||||||
|
bodyItemStyle: .image)
|
||||||
|
|
||||||
|
let completingTasksBodyItem = ORKBodyItem(text: "You will be asked to complete various tasks over the duration of the study.",
|
||||||
|
detailText: nil,
|
||||||
|
image: UIImage(systemName: "checkmark.circle.fill"),
|
||||||
|
learnMoreItem: nil,
|
||||||
|
bodyItemStyle: .image)
|
||||||
|
|
||||||
|
let signatureBodyItem = ORKBodyItem(text: "Before joining, we will ask you to sign an informed consent document.",
|
||||||
|
detailText: nil,
|
||||||
|
image: UIImage(systemName: "signature"),
|
||||||
|
learnMoreItem: nil,
|
||||||
|
bodyItemStyle: .image)
|
||||||
|
|
||||||
|
let secureDataBodyItem = ORKBodyItem(text: "Your data is kept private and secure.",
|
||||||
|
detailText: nil,
|
||||||
|
image: UIImage(systemName: "lock.fill"),
|
||||||
|
learnMoreItem: nil,
|
||||||
|
bodyItemStyle: .image)
|
||||||
|
|
||||||
|
beforeYouJoin.bodyItems = [
|
||||||
|
sharingHealthDataBodyItem,
|
||||||
|
completingTasksBodyItem,
|
||||||
|
signatureBodyItem,
|
||||||
|
secureDataBodyItem
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
let instructionSteps = [sign]
|
||||||
|
|
||||||
|
let webViewStep = ORKWebViewStep(identifier: "WebViewStepIdentifier", instructionSteps:instructionSteps)
|
||||||
|
webViewStep.showSignatureAfterContent = true
|
||||||
|
|
||||||
|
|
||||||
|
let task = ORKOrderedTask(identifier: "ConsentTask", steps: [welcomeStep, beforeYouJoin, webViewStep, /*other steps*/])
|
||||||
|
|
||||||
|
return task
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>UIApplicationSceneManifest</key>
|
||||||
|
<dict>
|
||||||
|
<key>UIApplicationSupportsMultipleScenes</key>
|
||||||
|
<false/>
|
||||||
|
<key>UISceneConfigurations</key>
|
||||||
|
<dict>
|
||||||
|
<key>UIWindowSceneSessionRoleApplication</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>UISceneConfigurationName</key>
|
||||||
|
<string>Default Configuration</string>
|
||||||
|
<key>UISceneDelegateClassName</key>
|
||||||
|
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
|
||||||
|
<key>UISceneStoryboardFile</key>
|
||||||
|
<string>Main</string>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
@ -0,0 +1,52 @@
|
|||||||
|
//
|
||||||
|
// SceneDelegate.swift
|
||||||
|
// surveys-example
|
||||||
|
//
|
||||||
|
// Created by Juan David López Regalado on 12/06/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||||
|
|
||||||
|
var window: UIWindow?
|
||||||
|
|
||||||
|
|
||||||
|
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
|
||||||
|
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
|
||||||
|
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
|
||||||
|
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
|
||||||
|
guard let _ = (scene as? UIWindowScene) else { return }
|
||||||
|
}
|
||||||
|
|
||||||
|
func sceneDidDisconnect(_ scene: UIScene) {
|
||||||
|
// Called as the scene is being released by the system.
|
||||||
|
// This occurs shortly after the scene enters the background, or when its session is discarded.
|
||||||
|
// Release any resources associated with this scene that can be re-created the next time the scene connects.
|
||||||
|
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
|
||||||
|
}
|
||||||
|
|
||||||
|
func sceneDidBecomeActive(_ scene: UIScene) {
|
||||||
|
// Called when the scene has moved from an inactive state to an active state.
|
||||||
|
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
|
||||||
|
}
|
||||||
|
|
||||||
|
func sceneWillResignActive(_ scene: UIScene) {
|
||||||
|
// Called when the scene will move from an active state to an inactive state.
|
||||||
|
// This may occur due to temporary interruptions (ex. an incoming phone call).
|
||||||
|
}
|
||||||
|
|
||||||
|
func sceneWillEnterForeground(_ scene: UIScene) {
|
||||||
|
// Called as the scene transitions from the background to the foreground.
|
||||||
|
// Use this method to undo the changes made on entering the background.
|
||||||
|
}
|
||||||
|
|
||||||
|
func sceneDidEnterBackground(_ scene: UIScene) {
|
||||||
|
// Called as the scene transitions from the foreground to the background.
|
||||||
|
// Use this method to save data, release shared resources, and store enough scene-specific state information
|
||||||
|
// to restore the scene back to its current state.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,417 @@
|
|||||||
|
//
|
||||||
|
// Tasks.swift
|
||||||
|
// surveys-example
|
||||||
|
//
|
||||||
|
// Created by Juan David López Regalado on 14/06/24.
|
||||||
|
//
|
||||||
|
import Foundation
|
||||||
|
import ResearchKit
|
||||||
|
|
||||||
|
class SurveyManager {
|
||||||
|
static let shared = SurveyManager()
|
||||||
|
|
||||||
|
func createSurveyTask() -> ORKTask {
|
||||||
|
|
||||||
|
// Agradecimiento y explicaciojn
|
||||||
|
let thankUJoin = ORKInstructionStep(identifier: "thankUJoin")
|
||||||
|
thankUJoin.title = "Thank You!"
|
||||||
|
thankUJoin.iconImage = UIImage(systemName: "heart.fill")
|
||||||
|
thankUJoin.detailText = "Thanks For Join Us, I Would Appreciate It If You Answered The Next Questions as Honestly as Possible, remember That Your Data is Private, it will not be Shared with Anyone Else and Will Only be Used for the Proposed Study."
|
||||||
|
|
||||||
|
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||||
|
// Ficha de identificacion
|
||||||
|
|
||||||
|
let personalInfoStepTitle = "Personal Information"
|
||||||
|
let personalInfoStep = ORKInstructionStep(identifier: "personalInfoStep")
|
||||||
|
personalInfoStep.title = personalInfoStepTitle
|
||||||
|
personalInfoStep.text = "Here you will find questions about your personal data"
|
||||||
|
personalInfoStep.image = UIImage(systemName: "person.fill")
|
||||||
|
|
||||||
|
|
||||||
|
// Nombre
|
||||||
|
let textQuestionStepTitle = "Name"
|
||||||
|
let textAnswerFormat = ORKTextAnswerFormat(maximumLength: 30)
|
||||||
|
textAnswerFormat.multipleLines = false
|
||||||
|
let textQuestionStep = ORKQuestionStep(identifier: "textName", title: textQuestionStepTitle, question: "What is your name?", answer: textAnswerFormat)
|
||||||
|
|
||||||
|
// Sexo
|
||||||
|
let multiGenderChoice = "Sex"
|
||||||
|
let gendChoices = [
|
||||||
|
ORKTextChoice(text: "Male", value: "male" as NSString),
|
||||||
|
ORKTextChoice(text: "Female", value: "female" as NSString),
|
||||||
|
ORKTextChoice(text: "I prefer not to say", value: "Inf" as NSString)]
|
||||||
|
|
||||||
|
let genderChoiceFormat = ORKTextChoiceAnswerFormat(style: .singleChoice, textChoices: gendChoices)
|
||||||
|
let multiGenderQuestionStep = ORKQuestionStep(identifier: "multiGenderQuestionStep", title: multiGenderChoice,question: "What is your Sex?", answer: genderChoiceFormat)
|
||||||
|
|
||||||
|
// Fecha de nacimiento
|
||||||
|
let dobStepTitle = "Date of Birth"
|
||||||
|
let dobAnswerFormat = ORKDateAnswerFormat(style: .date)
|
||||||
|
let dobStep = ORKQuestionStep(identifier: "dobStep", title: dobStepTitle, question: "When were you born?", answer: dobAnswerFormat)
|
||||||
|
|
||||||
|
|
||||||
|
// Peso
|
||||||
|
let weighQuestion = ORKFormItem(sectionTitle: "What is your weight?")
|
||||||
|
|
||||||
|
let weightQuestionFormItem = ORKFormItem(identifier: "weightQuestionForm", text: nil, answerFormat: ORKAnswerFormat.weightAnswerFormat())
|
||||||
|
weightQuestionFormItem.placeholder = "Tap here"
|
||||||
|
|
||||||
|
let weighForm = ORKFormStep(identifier: "WeightQuestionIde", title: "Weigh", text: " ")
|
||||||
|
weighForm.formItems = [weighQuestion, weightQuestionFormItem]
|
||||||
|
|
||||||
|
// Estatura
|
||||||
|
let heightQuestion = ORKFormItem(sectionTitle: "What is your height?")
|
||||||
|
|
||||||
|
let heightQuestionFormItem = ORKFormItem(identifier: "weightQuestionForm", text: nil, answerFormat: ORKAnswerFormat.heightAnswerFormat())
|
||||||
|
heightQuestionFormItem.placeholder = "Tap here"
|
||||||
|
|
||||||
|
let heightForm = ORKFormStep(identifier: "HeightQuestionIde", title: "Height", text: " ")
|
||||||
|
heightForm.formItems = [heightQuestion, heightQuestionFormItem]
|
||||||
|
|
||||||
|
// Residencia
|
||||||
|
let residenceChoice = "Reside"
|
||||||
|
let residenceChoices = [
|
||||||
|
ORKTextChoice(text: "Urban", value: "urban" as NSString),
|
||||||
|
ORKTextChoice(text: "Sub-urban", value: "suburban" as NSString),
|
||||||
|
ORKTextChoice(text: "Rural", value: "Rural" as NSString)]
|
||||||
|
|
||||||
|
let residenceChoiceFormat = ORKTextChoiceAnswerFormat(style: .singleChoice, textChoices: residenceChoices)
|
||||||
|
let residenceQuestionStep = ORKQuestionStep(identifier: "residenceStep", title: residenceChoice,question: "Where do you Reside?", answer: residenceChoiceFormat)
|
||||||
|
|
||||||
|
|
||||||
|
// Pregunta de ocupación
|
||||||
|
let occupationQuestionTitle = "Occupation"
|
||||||
|
let occupationChoices = [
|
||||||
|
ORKTextChoice(text: "Student", value: "student" as NSString),
|
||||||
|
ORKTextChoice(text: "Employed", value: "employed" as NSString),
|
||||||
|
ORKTextChoice(text: "Self-Employed", value: "self_employed" as NSString),
|
||||||
|
ORKTextChoice(text: "Unemployed", value: "unemployed" as NSString),
|
||||||
|
ORKTextChoice(text: "Retired", value: "retired" as NSString),
|
||||||
|
ORKTextChoice(text: "Homemaker", value: "homemaker" as NSString),
|
||||||
|
ORKTextChoice(text: "Other", value: "other" as NSString)
|
||||||
|
]
|
||||||
|
|
||||||
|
let occupationChoiceFormat = ORKValuePickerAnswerFormat(textChoices: occupationChoices)
|
||||||
|
let occupationQuestionStep = ORKQuestionStep(identifier: "occupationQuestionStep", title: occupationQuestionTitle, question: "What is your occupation?", answer: occupationChoiceFormat)
|
||||||
|
|
||||||
|
// Pregunta adicional para especificar detalles de ocupación
|
||||||
|
let specifyOccupationDetailsTitle = "Please specify your occupation:"
|
||||||
|
let specifyOccupationAnswerFormat = ORKTextAnswerFormat(maximumLength: 100)
|
||||||
|
specifyOccupationAnswerFormat.multipleLines = true // Permitir múltiples líneas para detalles extensos
|
||||||
|
let specifyOccupationDetailsStep = ORKQuestionStep(identifier: "specifyOccupationDetailsStep", title: specifyOccupationDetailsTitle, question: "Please specify your occupation:", answer: specifyOccupationAnswerFormat)
|
||||||
|
|
||||||
|
// Añadir la pregunta adicional después de la pregunta de ocupación
|
||||||
|
let occupationFormStep = ORKFormStep(identifier: "OccupationFormStep", title: "Occupation", text: "Select your occupation and specify details if necessary.")
|
||||||
|
occupationFormStep.formItems = [
|
||||||
|
ORKFormItem(identifier: "OccupationFormItem", text: nil, answerFormat: occupationChoiceFormat),
|
||||||
|
ORKFormItem(identifier: "SpecifyOccupationDetailsFormItem", text: nil, answerFormat: specifyOccupationAnswerFormat)
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-
|
||||||
|
|
||||||
|
// Heredo Familiares
|
||||||
|
|
||||||
|
let hereditaryInfoStepTitle = "Hereditary Family History"
|
||||||
|
let hereditaryInfoStep = ORKInstructionStep(identifier: "hereditaryInfoStep")
|
||||||
|
hereditaryInfoStep.title = hereditaryInfoStepTitle
|
||||||
|
hereditaryInfoStep.text = "Here you will find questions about your family, and their diseases"
|
||||||
|
hereditaryInfoStep.image = UIImage(systemName: "person.3.fill")
|
||||||
|
|
||||||
|
// Patologías hereditarias
|
||||||
|
let patologyChoice = "Pathologies"
|
||||||
|
let patologyChoices = [
|
||||||
|
ORKTextChoice(text: "Diabetes", value: "diabetes" as NSString),
|
||||||
|
ORKTextChoice(text: "Heart Disease", value: "heartDisease" as NSString),
|
||||||
|
ORKTextChoice(text: "Hypertension", value: "hypertension" as NSString),
|
||||||
|
ORKTextChoice(text: "Cancer", value: "cancer" as NSString),
|
||||||
|
ORKTextChoice(text: "Asthma", value: "asthma" as NSString)]
|
||||||
|
|
||||||
|
let patologyChoiceFormat = ORKTextChoiceAnswerFormat(style: .multipleChoice, textChoices: patologyChoices)
|
||||||
|
let patologyQuestionStep = ORKQuestionStep(identifier: "patologyStep", title: patologyChoice, question: "Select only the pathologies that your close relatives such as father, mother, grandfather or grandmother have or had.", answer: patologyChoiceFormat)
|
||||||
|
|
||||||
|
|
||||||
|
// Patologías mentales hereditarias
|
||||||
|
let mentalPatologyChoice = "Mental Pathologies"
|
||||||
|
let mentalPatologyChoices = [
|
||||||
|
ORKTextChoice(text: "Bipolarity", value: "bipolarity" as NSString),
|
||||||
|
ORKTextChoice(text: "Autism", value: "autism" as NSString),
|
||||||
|
ORKTextChoice(text: "Depression", value: "depression" as NSString),
|
||||||
|
ORKTextChoice(text: "ADHD", value: "adhd" as NSString),
|
||||||
|
ORKTextChoice(text: "Anxiety", value: "anxiety" as NSString)]
|
||||||
|
|
||||||
|
let mentalPatologyChoiceFormat = ORKTextChoiceAnswerFormat(style: .multipleChoice, textChoices: mentalPatologyChoices)
|
||||||
|
let mentalPatologyQuestionStep = ORKQuestionStep(identifier: "mentalPatologyStep", title: mentalPatologyChoice, question: "Select only the mental pathologies that your close relatives such as father, mother, grandfather or grandmother have or had.", answer: mentalPatologyChoiceFormat)
|
||||||
|
|
||||||
|
|
||||||
|
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||||
|
|
||||||
|
// Antecedentes personales patológicos
|
||||||
|
|
||||||
|
let persInfoStepTitle = "Pathological personal history"
|
||||||
|
let persInfoStep = ORKInstructionStep(identifier: "persInfoStep")
|
||||||
|
persInfoStep.title = persInfoStepTitle
|
||||||
|
persInfoStep.text = "In this part you will find questions about the diseases you suffered or suffer from."
|
||||||
|
persInfoStep.image = UIImage(systemName: "person.crop.circle")
|
||||||
|
|
||||||
|
// Enfermedades propias
|
||||||
|
let diseasesChoice = "Diseases"
|
||||||
|
let diseasesChoices = [
|
||||||
|
ORKTextChoice(text: "Diabetes", value: "diabetes" as NSString),
|
||||||
|
ORKTextChoice(text: "Heart Disease", value: "heartDisease" as NSString),
|
||||||
|
ORKTextChoice(text: "Hypertension", value: "hypertension" as NSString),
|
||||||
|
ORKTextChoice(text: "Cancer", value: "cancer" as NSString),
|
||||||
|
ORKTextChoice(text: "Asthma", value: "asthma" as NSString),
|
||||||
|
ORKTextChoice(text: "Hepatitis", value: "hepatitis" as NSString),
|
||||||
|
ORKTextChoice(text: "Covid", value: "covid" as NSString),
|
||||||
|
ORKTextChoice(text: "Tuberculosis", value: "tuberculosis" as NSString),
|
||||||
|
ORKTextChoice(text: "AIDS", value: "aids" as NSString),
|
||||||
|
ORKTextChoice(text: "Bipolarity", value: "bipolarity" as NSString),
|
||||||
|
ORKTextChoice(text: "Autism", value: "autism" as NSString),
|
||||||
|
ORKTextChoice(text: "Depression", value: "depression" as NSString),
|
||||||
|
ORKTextChoice(text: "ADHD", value: "adhd" as NSString),
|
||||||
|
ORKTextChoice(text: "Anxiety", value: "anxiety" as NSString)]
|
||||||
|
|
||||||
|
let diseasesChoiceFormat = ORKTextChoiceAnswerFormat(style: .multipleChoice, textChoices: diseasesChoices)
|
||||||
|
let diseasesQuestionStep = ORKQuestionStep(identifier: "diseasesStep", title: diseasesChoice, question: "Select the diseases you have had or suffer from.", answer: diseasesChoiceFormat)
|
||||||
|
|
||||||
|
|
||||||
|
// Vacunacion
|
||||||
|
let vaccinationQuestionTitle = "Vaccination"
|
||||||
|
let vaccinationChoices = [
|
||||||
|
ORKTextChoice(text: "Yes", value: "never" as NSString),
|
||||||
|
ORKTextChoice(text: "No", value: "little" as NSString),
|
||||||
|
ORKTextChoice(text: "I don't remember ", value: "moderate" as NSString),]
|
||||||
|
|
||||||
|
let vaccinationChoiceFormat = ORKValuePickerAnswerFormat(textChoices: vaccinationChoices)
|
||||||
|
let vaccinationQuestionStep = ORKQuestionStep(identifier: "vaccinationQuestionStep", title: vaccinationQuestionTitle, question: "Do you have your complete vaccination schedule?", answer: vaccinationChoiceFormat)
|
||||||
|
|
||||||
|
// Bebedor alcohol
|
||||||
|
let alcoholQuestionTitle = "Alcohol drinker"
|
||||||
|
let alcoholChoices = [
|
||||||
|
ORKTextChoice(text: "No Drinks Alcohol", value: "nodrink" as NSString),
|
||||||
|
ORKTextChoice(text: "Social Drinker", value: "social" as NSString),
|
||||||
|
ORKTextChoice(text: "Occasional Drinker ", value: "occasional" as NSString),
|
||||||
|
ORKTextChoice(text: "Dependent Drinker", value: "dependent" as NSString),]
|
||||||
|
|
||||||
|
let alcoholChoiceFormat = ORKValuePickerAnswerFormat(textChoices: alcoholChoices)
|
||||||
|
let alcoholQuestionStep = ORKQuestionStep(identifier: "alcoholQuestionStep", title: alcoholQuestionTitle, question: "What kind of drinker are you?", answer: alcoholChoiceFormat)
|
||||||
|
|
||||||
|
// fumador tabaco
|
||||||
|
let smokeQuestionTitle = "Tobacco Smoker"
|
||||||
|
let smokeChoices = [
|
||||||
|
ORKTextChoice(text: "No Smoker", value: "nosmoke" as NSString),
|
||||||
|
ORKTextChoice(text: "Social Smoker", value: "socialsmoke" as NSString),
|
||||||
|
ORKTextChoice(text: "Occasional Smoker ", value: "occasionalsmoke" as NSString),
|
||||||
|
ORKTextChoice(text: "Dependent Smoker", value: "dependentsmoke" as NSString),]
|
||||||
|
|
||||||
|
let smokeChoiceFormat = ORKValuePickerAnswerFormat(textChoices: smokeChoices)
|
||||||
|
let smokeQuestionStep = ORKQuestionStep(identifier: "smokeQuestionStep", title: smokeQuestionTitle, question: "What kind of smoker are you?", answer: smokeChoiceFormat)
|
||||||
|
|
||||||
|
// drogas
|
||||||
|
let drugsPatologyChoice = "Drugs"
|
||||||
|
let drugsPatologyChoices = [
|
||||||
|
ORKTextChoice(text: "I do not consume drugs", value: "nodrugs" as NSString),
|
||||||
|
ORKTextChoice(text: "Marihuana", value: "marihuana" as NSString),
|
||||||
|
ORKTextChoice(text: "Cocaine", value: "cocaine" as NSString),
|
||||||
|
ORKTextChoice(text: "MDMA (Ectasty)", value: "mdma" as NSString),
|
||||||
|
ORKTextChoice(text: "Heroine", value: "heroine" as NSString),
|
||||||
|
ORKTextChoice(text: "Methamphetamine", value: "metha" as NSString),
|
||||||
|
ORKTextChoice(text: "LSD", value: "lsd" as NSString),
|
||||||
|
ORKTextChoice(text: "Hallucinogenic Mushrooms", value: "mushrooms" as NSString),
|
||||||
|
ORKTextChoice(text: "Other", value: "other" as NSString),]
|
||||||
|
|
||||||
|
let drugsPatologyChoiceFormat = ORKTextChoiceAnswerFormat(style: .multipleChoice, textChoices: drugsPatologyChoices)
|
||||||
|
let drugsPatologyQuestionStep = ORKQuestionStep(identifier: "drugsPatologyStep", title: drugsPatologyChoice, question: "Select the drug or drugs you consume", answer: drugsPatologyChoiceFormat)
|
||||||
|
|
||||||
|
let frecuencyDrugsQuestionTitle = "Frequency of Drug Use"
|
||||||
|
let frecuencyDrugsChoices = [
|
||||||
|
ORKTextChoice(text: "Never", value: "never" as NSString),
|
||||||
|
ORKTextChoice(text: "A little", value: "little" as NSString),
|
||||||
|
ORKTextChoice(text: "Moderate", value: "moderate" as NSString),
|
||||||
|
ORKTextChoice(text: "A lot", value: "lot" as NSString),]
|
||||||
|
|
||||||
|
let frecuencyDrugsChoiceFormat = ORKValuePickerAnswerFormat(textChoices: frecuencyDrugsChoices)
|
||||||
|
let frecuencyDrugsQuestionStep = ORKQuestionStep(identifier: "frecuencyDrugsQuestionStep", title: frecuencyDrugsQuestionTitle, question: "How often do you use drugs?", answer: frecuencyDrugsChoiceFormat)
|
||||||
|
|
||||||
|
|
||||||
|
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||||
|
|
||||||
|
// Antecedentes no patológicos
|
||||||
|
|
||||||
|
let noPersInfoStepTitle = "Non-pathological history"
|
||||||
|
let noPersInfoStep = ORKInstructionStep(identifier: "moPersInfoStep")
|
||||||
|
noPersInfoStep.title = noPersInfoStepTitle
|
||||||
|
noPersInfoStep.text = "In this section, you'll find questions about your non-pathological backgrounds, such as your daily activities and personal habits."
|
||||||
|
noPersInfoStep.image = UIImage(systemName: "book.fill")
|
||||||
|
|
||||||
|
|
||||||
|
// pregunta de actividad física en escala de likert
|
||||||
|
let scaleQuestionStepTitle = "Physical activity"
|
||||||
|
let scaleAnswerFormat = ORKScaleAnswerFormat(maximumValue: 10, minimumValue: 0, defaultValue: 5, step: 1)
|
||||||
|
let scaleQuestionStep = ORKQuestionStep(identifier: "scaleQuestionStep", title: scaleQuestionStepTitle,question: "How active are you?", answer: scaleAnswerFormat)
|
||||||
|
|
||||||
|
|
||||||
|
// Tipo de actividad fisica que realizas.
|
||||||
|
let multiChoiceQuestionStepTitle = "What types of physical activities do you do?"
|
||||||
|
let textChoices = [
|
||||||
|
ORKTextChoice(text: "Walking", value: "walking" as NSString),
|
||||||
|
ORKTextChoice(text: "Running", value: "running" as NSString),
|
||||||
|
ORKTextChoice(text: "Swimming", value: "swimming" as NSString),
|
||||||
|
ORKTextChoice(text: "Cycling", value: "cycling" as NSString),
|
||||||
|
ORKTextChoice(text: "Soccer", value: "soccer" as NSString),
|
||||||
|
ORKTextChoice(text: "Basketball", value: "basketball" as NSString),
|
||||||
|
ORKTextChoice(text: "Tennis", value: "tennis" as NSString),
|
||||||
|
ORKTextChoice(text: "Baseball", value: "baseball" as NSString),
|
||||||
|
ORKTextChoice(text: "Golf", value: "golf" as NSString),
|
||||||
|
ORKTextChoice(text: "Athletics", value: "athletic" as NSString),
|
||||||
|
ORKTextChoice(text: "Football", value: "football" as NSString),
|
||||||
|
ORKTextChoice(text: "Martial Arts", value: "martialarts" as NSString),
|
||||||
|
ORKTextChoice(text: "Other", value: "other" as NSString),
|
||||||
|
|
||||||
|
]
|
||||||
|
let multiChoiceAnswerFormat = ORKTextChoiceAnswerFormat(style: .multipleChoice, textChoices: textChoices)
|
||||||
|
let multiChoiceQuestionStep = ORKQuestionStep(identifier: "multiChoiceQuestionStep", title: multiChoiceQuestionStepTitle, question: "Select the activities you do regularly", answer: multiChoiceAnswerFormat)
|
||||||
|
|
||||||
|
// hobbies
|
||||||
|
let hobbieQuestionStepTitle = "What types of physical activities do you do?"
|
||||||
|
let hobbietextChoices = [
|
||||||
|
ORKTextChoice(text: "Reading", value: "reading" as NSString),
|
||||||
|
ORKTextChoice(text: "Watching movies and series", value: "watchingmovies" as NSString),
|
||||||
|
ORKTextChoice(text: "Video Gaming", value: "gaming" as NSString),
|
||||||
|
ORKTextChoice(text: "Cooking and baking", value: "cooking" as NSString),
|
||||||
|
ORKTextChoice(text: "Traveling", value: "traveling" as NSString),
|
||||||
|
ORKTextChoice(text: "Gardening", value: "gardening" as NSString),
|
||||||
|
ORKTextChoice(text: "Arts", value: "arts" as NSString),
|
||||||
|
ORKTextChoice(text: "Music", value: "music" as NSString),
|
||||||
|
ORKTextChoice(text: "Photography", value: "photography" as NSString),
|
||||||
|
ORKTextChoice(text: "Writing", value: "writing" as NSString),
|
||||||
|
ORKTextChoice(text: "Dancing", value: "dancing" as NSString),
|
||||||
|
ORKTextChoice(text: "Other", value: "other" as NSString),
|
||||||
|
|
||||||
|
]
|
||||||
|
let hobbieAnswerFormat = ORKTextChoiceAnswerFormat(style: .multipleChoice, textChoices: hobbietextChoices)
|
||||||
|
let hobbieQuestionStep = ORKQuestionStep(identifier: "hobbieQuestionStep", title: hobbieQuestionStepTitle, question: "Select the activities you do regularly", answer: hobbieAnswerFormat)
|
||||||
|
|
||||||
|
// level of study
|
||||||
|
let studyQuestionTitle = "Level of study"
|
||||||
|
let studyChoices = [
|
||||||
|
ORKTextChoice(text: "Elementary School", value: "elementary" as NSString),
|
||||||
|
ORKTextChoice(text: "Middle School", value: "middle" as NSString),
|
||||||
|
ORKTextChoice(text: "High School", value: "high" as NSString),
|
||||||
|
ORKTextChoice(text: "Bachelor's Degree", value: "bachelor" as NSString),
|
||||||
|
ORKTextChoice(text: "Master's Degree", value: "master" as NSString),
|
||||||
|
ORKTextChoice(text: "Doctorate", value: "doctorate" as NSString),
|
||||||
|
ORKTextChoice(text: "Other", value: "other" as NSString),
|
||||||
|
]
|
||||||
|
|
||||||
|
let studyChoiceFormat = ORKValuePickerAnswerFormat(textChoices: studyChoices)
|
||||||
|
let studyQuestionStep = ORKQuestionStep(identifier: "studyQuestionStep", title: studyQuestionTitle, question: "What is your level of study?", answer: studyChoiceFormat)
|
||||||
|
|
||||||
|
// transporte
|
||||||
|
let transportationQuestionTitle = "Transportation"
|
||||||
|
let transportationChoices = [
|
||||||
|
ORKTextChoice(text: "Telecommuting (remote work)", value: "telecommuting" as NSString),
|
||||||
|
ORKTextChoice(text: "Car", value: "car" as NSString),
|
||||||
|
ORKTextChoice(text: "Public Transport (bus, subway, tram, train)", value: "publictransport" as NSString),
|
||||||
|
ORKTextChoice(text: "Bicycle", value: "bicycle" as NSString),
|
||||||
|
ORKTextChoice(text: "Motorcycle", value: "motorcycle" as NSString),
|
||||||
|
ORKTextChoice(text: "Walking", value: "walking" as NSString),
|
||||||
|
ORKTextChoice(text: "Electric Scooter", value: "electricscooter" as NSString),
|
||||||
|
ORKTextChoice(text: "Skateboard", value: "skateboard" as NSString),
|
||||||
|
ORKTextChoice(text: "Other", value: "other" as NSString),
|
||||||
|
]
|
||||||
|
|
||||||
|
let transportationChoiceFormat = ORKValuePickerAnswerFormat(textChoices: transportationChoices)
|
||||||
|
let transportationQuestionStep = ORKQuestionStep(identifier: "transportationQuestionStep", title: transportationQuestionTitle, question: "What is the means of transportation you use from home to work or school?", answer: transportationChoiceFormat)
|
||||||
|
|
||||||
|
//Alimentación
|
||||||
|
|
||||||
|
let foodQuestionTitle = "Alimentation"
|
||||||
|
let foodChoices = [
|
||||||
|
ORKTextChoice(text: "Good", value: "good" as NSString),
|
||||||
|
ORKTextChoice(text: "Average", value: "average" as NSString),
|
||||||
|
ORKTextChoice(text: "Poor", value: "poor" as NSString),]
|
||||||
|
|
||||||
|
let foodChoiceFormat = ORKValuePickerAnswerFormat(textChoices: foodChoices)
|
||||||
|
let foodQuestionStep = ORKQuestionStep(identifier: "foodQuestionStep", title: foodQuestionTitle, question: "How would you describe your quality and quantity of food?", answer: foodChoiceFormat)
|
||||||
|
|
||||||
|
// cuantas veces comes
|
||||||
|
let alimentationQuestionStepTitle = "Alimentation"
|
||||||
|
let alimentationAnswerFormat = ORKScaleAnswerFormat(maximumValue: 10, minimumValue: 0, defaultValue: 3, step: 1)
|
||||||
|
let alimentationQuestionStep = ORKQuestionStep(identifier: "alimentationQuestionStep", title: alimentationQuestionStepTitle,question: "How many meals do you have a day?", answer: alimentationAnswerFormat)
|
||||||
|
|
||||||
|
// tipo de alimento
|
||||||
|
let typeFoodChoice = "Types of food"
|
||||||
|
let typeFoodChoices = [
|
||||||
|
ORKTextChoice(text: "Chicken", value: "chicken" as NSString),
|
||||||
|
ORKTextChoice(text: "Beef", value: "beef" as NSString),
|
||||||
|
ORKTextChoice(text: "Pork", value: "pork" as NSString),
|
||||||
|
ORKTextChoice(text: "Seafood", value: "seafood" as NSString),
|
||||||
|
ORKTextChoice(text: "Fruits/Vegetables", value: "fruitsvegetables" as NSString),
|
||||||
|
ORKTextChoice(text: "Other", value: "other" as NSString)
|
||||||
|
]
|
||||||
|
|
||||||
|
let typeFoodChoiceFormat = ORKTextChoiceAnswerFormat(style: .multipleChoice, textChoices: typeFoodChoices)
|
||||||
|
let typeFoodQuestionStep = ORKQuestionStep(identifier: "typeFoodStep", title: typeFoodChoice, question: "SWhat type of food do you eat?", answer: typeFoodChoiceFormat)
|
||||||
|
|
||||||
|
|
||||||
|
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||||
|
|
||||||
|
// Mostrar las preguntas
|
||||||
|
|
||||||
|
return ORKOrderedTask(identifier: "SurveyTask", steps: [thankUJoin, personalInfoStep, textQuestionStep, multiGenderQuestionStep, dobStep, weighForm, heightForm, residenceQuestionStep, occupationQuestionStep, occupationFormStep, hereditaryInfoStep, patologyQuestionStep, mentalPatologyQuestionStep, persInfoStep, diseasesQuestionStep, vaccinationQuestionStep, alcoholQuestionStep, smokeQuestionStep, drugsPatologyQuestionStep, frecuencyDrugsQuestionStep,noPersInfoStep, scaleQuestionStep, multiChoiceQuestionStep, hobbieQuestionStep, studyQuestionStep, transportationQuestionStep, foodQuestionStep, alimentationQuestionStep, typeFoodQuestionStep])
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*// Telefono
|
||||||
|
let phoneNumber = "Phone Number"
|
||||||
|
let phoneNumberCan = ORKTextAnswerFormat(maximumLength: 10)
|
||||||
|
phoneNumberCan.multipleLines = false
|
||||||
|
let phoneNumberTap = ORKQuestionStep(identifier: "phoneNum", title: phoneNumber, question: "What is your Phone Number", answer: phoneNumberCan)
|
||||||
|
|
||||||
|
// Pregunta de domicilio (dirección)
|
||||||
|
let addressStepTitle = "Address"
|
||||||
|
|
||||||
|
let streetAnswerFormat = ORKTextAnswerFormat(maximumLength: 100)
|
||||||
|
streetAnswerFormat.multipleLines = false
|
||||||
|
let streetFormItem = ORKFormItem(identifier: "streetFormItem", text: "Street: ", answerFormat: streetAnswerFormat)
|
||||||
|
|
||||||
|
let numberAnswerFormat = ORKTextAnswerFormat(maximumLength: 50)
|
||||||
|
numberAnswerFormat.multipleLines = false
|
||||||
|
let numberFormItem = ORKFormItem(identifier: "numberFormItem", text: "Number: ", answerFormat: numberAnswerFormat)
|
||||||
|
|
||||||
|
let zipCodeAnswerFormat = ORKTextAnswerFormat(maximumLength: 10)
|
||||||
|
zipCodeAnswerFormat.multipleLines = false
|
||||||
|
let zipCodeFormItem = ORKFormItem(identifier: "zipCodeFormItem", text: "ZIP Code: ", answerFormat: zipCodeAnswerFormat)
|
||||||
|
|
||||||
|
let cityAnswerFormat = ORKTextAnswerFormat(maximumLength: 50)
|
||||||
|
cityAnswerFormat.multipleLines = false
|
||||||
|
let cityFormItem = ORKFormItem(identifier: "cityFormItem", text: "City: ", answerFormat: cityAnswerFormat)
|
||||||
|
|
||||||
|
let stateAnswerFormat = ORKTextAnswerFormat(maximumLength: 50)
|
||||||
|
stateAnswerFormat.multipleLines = false
|
||||||
|
let stateFormItem = ORKFormItem(identifier: "stateFormItem", text: "State: ", answerFormat: stateAnswerFormat)
|
||||||
|
|
||||||
|
let countryAnswerFormat = ORKTextAnswerFormat(maximumLength: 50)
|
||||||
|
countryAnswerFormat.multipleLines = false
|
||||||
|
let countryFormItem = ORKFormItem(identifier: "countryFormItem", text: "Country: ", answerFormat: countryAnswerFormat)
|
||||||
|
|
||||||
|
let addressFormStep = ORKFormStep(identifier: "AddressFormStep", title: addressStepTitle, text: "Enter your address")
|
||||||
|
addressFormStep.formItems = [streetFormItem, numberFormItem, zipCodeFormItem, cityFormItem, stateFormItem, countryFormItem]
|
||||||
|
|
||||||
|
// Estado civil
|
||||||
|
let maritalStatusChoice = "Marital Status"
|
||||||
|
let maritalStatusChoices = [
|
||||||
|
ORKTextChoice(text: "Single", value: "single" as NSString),
|
||||||
|
ORKTextChoice(text: "Married", value: "married" as NSString),
|
||||||
|
ORKTextChoice(text: "Divorced", value: "divorced" as NSString),
|
||||||
|
ORKTextChoice(text: "Widowed", value: "widowed" as NSString),
|
||||||
|
ORKTextChoice(text: "I prefer not to say", value: "prefer_not_to_say" as NSString)
|
||||||
|
]
|
||||||
|
let maritalStatusChoiceFormat = ORKValuePickerAnswerFormat(textChoices: maritalStatusChoices)
|
||||||
|
let maritalStatusQuestionStep = ORKQuestionStep(identifier: "maritalStatusQuestionStep", title: maritalStatusChoice, question: "What is your marital status", answer: maritalStatusChoiceFormat)*/
|
@ -0,0 +1,49 @@
|
|||||||
|
//
|
||||||
|
// ViewController.swift
|
||||||
|
// surveys-example
|
||||||
|
//
|
||||||
|
// Created by Juan David López Regalado on 12/06/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
import ResearchKit
|
||||||
|
import ResearchKitUI
|
||||||
|
|
||||||
|
class ViewController: UIViewController, ORKTaskViewControllerDelegate {
|
||||||
|
|
||||||
|
override func viewDidLoad() {
|
||||||
|
super.viewDidLoad()
|
||||||
|
// Do any additional setup after loading the view.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@IBAction func startSurveyTapped(_ sender: Any) {
|
||||||
|
let consentTask = ConsentManager.shared.createConsentTask()
|
||||||
|
let taskViewController = ORKTaskViewController(task: consentTask, taskRun: nil)
|
||||||
|
|
||||||
|
taskViewController.delegate = self
|
||||||
|
present(taskViewController,animated: true, completion: nil)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func taskViewController(_ taskViewController: ORKTaskViewController, didFinishWith reason: ORKTaskFinishReason, error: (any Error)?) {
|
||||||
|
taskViewController.dismiss(animated: true, completion: nil)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if reason == .completed {
|
||||||
|
startSurvey()
|
||||||
|
}
|
||||||
|
|
||||||
|
func startSurvey() {
|
||||||
|
let surveyTask = SurveyManager.shared.createSurveyTask()
|
||||||
|
let taskViewController = ORKTaskViewController(task: surveyTask, taskRun: nil)
|
||||||
|
|
||||||
|
taskViewController.delegate = self
|
||||||
|
present(taskViewController, animated: true, completion: nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue