Consent Complete

main
parent 06473f167e
commit b041eb5e18

BIN
.DS_Store vendored

Binary file not shown.

@ -219,4 +219,45 @@ Now is necessary program the trigger, it means the button that show the consent.
The following GIF shows how the drag would be done and the code will be placed below.
![](images/buttondrag.gif)
```
import UIKit
import ResearchKit
import ResearchKitUI
class ConsentViewController: UIViewController, ORKTaskViewControllerDelegate {
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.hidesBackButton = false
// Do any additional setup after loading the view.
}
@IBAction func consentButton(_ sender: UIButton) {
let taskViewController = ORKTaskViewController(task: ConsentTask, taskRun: nil)
taskViewController.delegate = self
taskViewController.modalPresentationStyle = .fullScreen
present(taskViewController, animated: true, completion: nil)
}
func taskViewController(_ taskViewController: ORKTaskViewController, didFinishWith reason: ORKTaskFinishReason, error: (any Error)?) {
if let error = error {
print("Error en ResearchKit: \(error.localizedDescription)")
}
taskViewController.dismiss(animated: true, completion: nil)
}
}
```
It's necessary put all the code, because it add a ORKTaskViewCOntroller and a "if" in errors.
If you push the button, the consent will be open.
![](images/consentopen.gif)
Its time for IPAQ and MMSE, This questionnaires

@ -30,7 +30,7 @@
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="Consent"/>
<connections>
<action selector="consentButton:" destination="xKL-Ef-1nP" eventType="touchUpInside" id="XYG-Bb-d3l"/>
<segue destination="lvo-yg-Lu5" kind="presentation" modalPresentationStyle="fullScreen" id="vlh-0O-3LO"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4pd-9H-Ncy">
@ -39,6 +39,9 @@
<fontDescription key="fontDescription" type="system" pointSize="23"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="MMSE"/>
<connections>
<segue destination="ahB-6Y-Icj" kind="presentation" modalPresentationStyle="fullScreen" id="t6x-F9-vaW"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="A4y-6U-7HN">
<rect key="frame" x="152" y="284" width="88" height="40"/>
@ -46,19 +49,220 @@
<fontDescription key="fontDescription" type="system" pointSize="23"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="IPAQ"/>
<connections>
<segue destination="S22-SL-o9Y" kind="presentation" modalPresentationStyle="fullScreen" id="iX5-D7-dwX"/>
</connections>
</button>
</subviews>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
<navigationItem key="navigationItem" id="4rD-Na-eIC"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
<exit id="xKL-Ef-1nP" userLabel="Exit" sceneMemberID="exit"/>
</objects>
<point key="canvasLocation" x="125.95419847328243" y="-11.267605633802818"/>
<point key="canvasLocation" x="199" y="-74"/>
</scene>
<!--View Controller-->
<scene sceneID="e5a-1Y-kYY">
<objects>
<viewController modalPresentationStyle="fullScreen" id="S22-SL-o9Y" customClass="IPAQViewController" customModule="SAGE_RK_ML" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="2U2-Yo-p5E">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="IPAQ" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Iky-tZ-OCT">
<rect key="frame" x="175" y="109" width="43" height="24"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="20"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="figure.walk" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="Jsj-03-tKh">
<rect key="frame" x="76" y="188" width="240" height="128"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="c4j-nR-7xU">
<rect key="frame" x="161" y="669" width="70" height="35"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" title="Home"/>
<connections>
<segue destination="BYZ-38-t0r" kind="presentation" modalPresentationStyle="fullScreen" id="8hx-cW-jDM"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="KTn-2y-bnX">
<rect key="frame" x="152" y="712" width="88" height="35"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" title="Consent"/>
<connections>
<segue destination="lvo-yg-Lu5" kind="presentation" modalPresentationStyle="fullScreen" id="Jdl-Ep-172"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="TZe-Fy-eGH">
<rect key="frame" x="159" y="755" width="73" height="35"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" title="MMSE"/>
<connections>
<segue destination="ahB-6Y-Icj" kind="presentation" modalPresentationStyle="fullScreen" id="lXi-PC-4J2"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4g2-g3-a7D">
<rect key="frame" x="138" y="365" width="117" height="35"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" title="START IPAQ"/>
</button>
</subviews>
<viewLayoutGuide key="safeArea" id="bYh-bj-sLE"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
<navigationItem key="navigationItem" id="ZHm-FA-kCn"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="xoL-uz-hDv" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1627" y="-135"/>
</scene>
<!--View Controller-->
<scene sceneID="wXc-Fg-Xnu">
<objects>
<viewController modalPresentationStyle="fullScreen" id="ahB-6Y-Icj" customClass="MMSEViewController" customModule="SAGE_RK_ML" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8Se-QX-Qsm">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="MMSE" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="WuW-Iy-hKj">
<rect key="frame" x="167" y="124" width="58" height="24"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="20"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="brain" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="NuK-jo-rEd">
<rect key="frame" x="76" y="202" width="240" height="128"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Hrx-L0-08K">
<rect key="frame" x="132" y="374" width="129" height="35"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" title="START MMSE"/>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eho-20-v6v">
<rect key="frame" x="161" y="656" width="70" height="35"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" title="Home"/>
<connections>
<segue destination="BYZ-38-t0r" kind="presentation" modalPresentationStyle="fullScreen" id="SfP-lb-dfJ"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="BtJ-1I-ttV">
<rect key="frame" x="165" y="699" width="61" height="35"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" title="IPAQ"/>
<connections>
<segue destination="S22-SL-o9Y" kind="presentation" modalPresentationStyle="fullScreen" id="A9M-nd-TBd"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="O9Y-tq-N2z">
<rect key="frame" x="152" y="742" width="88" height="35"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" title="Consent"/>
<connections>
<segue destination="lvo-yg-Lu5" kind="presentation" modalPresentationStyle="fullScreen" id="X5M-2w-MCk"/>
</connections>
</button>
</subviews>
<viewLayoutGuide key="safeArea" id="uM1-OP-AZi"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
<navigationItem key="navigationItem" id="7jQ-pF-FbL"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="tJc-Iv-i9j" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="935" y="289"/>
</scene>
<!--Title-->
<scene sceneID="YsP-tr-NCf">
<objects>
<viewController modalPresentationStyle="fullScreen" id="lvo-yg-Lu5" customClass="ConsentViewController" customModule="SAGE_RK_ML" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ioq-kT-0Eo">
<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" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="LiM-Xz-Gno">
<rect key="frame" x="118" y="366" width="159" height="35"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" title="START CONSENT"/>
<connections>
<action selector="consentButton:" destination="lvo-yg-Lu5" eventType="touchUpInside" id="3Rp-b8-eTc"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pSX-pQ-d3y">
<rect key="frame" x="162" y="654" width="70" height="35"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" title="Home"/>
<connections>
<segue destination="BYZ-38-t0r" kind="presentation" modalPresentationStyle="fullScreen" id="dCa-QO-6p8"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="cTq-vE-9ae">
<rect key="frame" x="166" y="697" width="61" height="35"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" title="IPAQ"/>
<connections>
<segue destination="S22-SL-o9Y" kind="presentation" modalPresentationStyle="fullScreen" id="54Z-4A-uuH"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="CYQ-fT-r3E">
<rect key="frame" x="160" y="740" width="73" height="35"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" title="MMSE"/>
<connections>
<segue destination="ahB-6Y-Icj" kind="presentation" modalPresentationStyle="fullScreen" id="Nwn-tC-EI2"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="CONSENT" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Vht-RE-ODs">
<rect key="frame" x="150" y="103" width="93" height="24"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="20"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="signature" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="HHW-2d-Z3x">
<rect key="frame" x="76" y="189" width="240" height="128"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
</subviews>
<viewLayoutGuide key="safeArea" id="R06-xw-ppJ"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
<navigationItem key="navigationItem" title="Title" id="v0A-UJ-tlc"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="TbJ-vW-X9k" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="934" y="-422"/>
</scene>
</scenes>
<inferredMetricsTieBreakers>
<segue reference="Jdl-Ep-172"/>
<segue reference="lXi-PC-4J2"/>
<segue reference="54Z-4A-uuH"/>
<segue reference="8hx-cW-jDM"/>
</inferredMetricsTieBreakers>
<resources>
<image name="brain" catalog="system" width="128" height="107"/>
<image name="figure.walk" catalog="system" width="94" height="128"/>
<image name="signature" catalog="system" width="128" height="89"/>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>

@ -6,16 +6,16 @@
//
import UIKit
import ResearchKit
import ResearchKitUI
class ConsentViewController: UIViewController, ORKTaskViewControllerDelegate {
func taskViewController(_ taskViewController: ORKTaskViewController, didFinishWith reason: ORKTaskFinishReason, error: (any Error)?) {
<#code#>
}
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.hidesBackButton = false
// Do any additional setup after loading the view.
}
@ -23,17 +23,16 @@ class ConsentViewController: UIViewController, ORKTaskViewControllerDelegate {
@IBAction func consentButton(_ sender: UIButton) {
let taskViewController = ORKTaskViewController(task: ConsentTask, taskRun: nil)
taskViewController.delegate = self
taskViewController.modalPresentationStyle = .fullScreen
present(taskViewController, animated: true, completion: nil)
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
func taskViewController(_ taskViewController: ORKTaskViewController, didFinishWith reason: ORKTaskFinishReason, error: (any Error)?) {
if let error = error {
print("Error en ResearchKit: \(error.localizedDescription)")
}
taskViewController.dismiss(animated: true, completion: nil)
}
*/
}

BIN
images/.DS_Store vendored

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 KiB

After

Width:  |  Height:  |  Size: 228 KiB

Loading…
Cancel
Save