You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
2.0 KiB
Swift
60 lines
2.0 KiB
Swift
//
|
|
// ConsentDocument.swift
|
|
// RK-Journals
|
|
//
|
|
// Created by Juan David Lopez Regalado on 11/11/24.
|
|
//
|
|
|
|
import Foundation
|
|
import ResearchKit
|
|
|
|
public var ConsentDocument: ORKConsentDocument {
|
|
|
|
let consentDocument = ORKConsentDocument()
|
|
consentDocument.title = "Introducción a ResearchKit" // O título de tu preferencia
|
|
|
|
// Tipos de secciones y sus contenidos
|
|
let sectionTypes: [ORKConsentSectionType] = [
|
|
.overview,
|
|
.dataGathering,
|
|
.privacy,
|
|
.dataUse,
|
|
.timeCommitment,
|
|
.studySurvey,
|
|
.studyTasks,
|
|
.withdrawing
|
|
]
|
|
|
|
let text = [
|
|
"Sección 1: Bienvenido. Este estudio trata sobre...",
|
|
"Sección 2: Recopilación de datos. Este estudio recopilará datos...",
|
|
"Sección 3: Privacidad. Valoramos su privacidad...",
|
|
"Sección 4: Uso de datos. Los datos recopilados se utilizarán para...",
|
|
"Sección 5: Compromiso de tiempo. Este estudio le llevará aproximadamente...",
|
|
"Sección 6: Encuesta del estudio. Para este estudio, deberá completar una encuesta...",
|
|
"Sección 7: Tareas del estudio. Se le solicitará que realice estas tareas...",
|
|
"Sección 8: Retiro. Para retirarse del estudio..."
|
|
]
|
|
|
|
// Crear secciones y añadirlas al documento de consentimiento
|
|
var sections: [ORKConsentSection] = []
|
|
|
|
for (index, sectionType) in sectionTypes.enumerated() {
|
|
let section = ORKConsentSection(type: sectionType)
|
|
let localizedText = NSLocalizedString(text[index], comment: "")
|
|
let localizedSummary = localizedText.components(separatedBy: ".")[0] + "."
|
|
|
|
section.summary = localizedSummary
|
|
section.content = localizedText
|
|
sections.append(section)
|
|
}
|
|
|
|
consentDocument.sections = sections
|
|
|
|
// Agregar la firma de consentimiento
|
|
let signature = ORKConsentSignature(forPersonWithTitle: "Participante", dateFormatString: nil, identifier: "ConsentDocumentParticipantSignature")
|
|
consentDocument.addSignature(signature)
|
|
|
|
return consentDocument
|
|
}
|