From f5fed2fffca9c2928d680d6e3b29d62aa0dec1b2 Mon Sep 17 00:00:00 2001 From: Katarzyna Rachwal Date: Mon, 26 Aug 2024 16:10:29 -0400 Subject: [PATCH] Adding consent form back with proper handling of print and decline. --- .../experiment-ui/components/consent.html | 8 - template/experiment-ui/index.js.jinja | 68 +++++---- template/experiment-ui/pages.js | 141 +++++++++++++++++- 3 files changed, 182 insertions(+), 35 deletions(-) diff --git a/template/experiment-ui/components/consent.html b/template/experiment-ui/components/consent.html index 4713452..d1129be 100644 --- a/template/experiment-ui/components/consent.html +++ b/template/experiment-ui/components/consent.html @@ -139,14 +139,6 @@

Who to contact with questions:

-
-

Would you like to be re-contacted for future studies?

-

- Yes - No -

-
- diff --git a/template/experiment-ui/index.js.jinja b/template/experiment-ui/index.js.jinja index 6668b40..9ce2bd2 100644 --- a/template/experiment-ui/index.js.jinja +++ b/template/experiment-ui/index.js.jinja @@ -1,4 +1,4 @@ -import { errorPage } from "./pages"; +import { errorPage, consentForm, declinePage } from "./pages"; import main from "./main" {% if firebase %} import { getCondition, setObservation, setBackup } from "autora-firebase-functions"; @@ -10,35 +10,51 @@ import { getCondition } from "./autora-filestore-functions" const index = async () => { - if (process.env.NODE_ENV === 'development' && process.env.NODE_APP_devNoDb === 'True') { - await main(0, 0) - return - } - if (process.env.NODE_APP_useProlificId === 'True') { - const queryString = window.location.search; - const urlParams = new URLSearchParams(queryString); - prolificId = urlParams.get('PROLIFIC_PID'); - } + consentForm(); - let prolificId = "1" // TODO: replace with pID - let condition = await getCondition('autora', prolificId) - if (condition && (prolificId !== null || process.env.NODE_APP_useProlificId === 'False')) { - {% if firebase %} - let observation = await main(condition[0], condition[1]) - waitPage() - await setObservation(db, 'autora', condition[0], observation) - await setBackup(db, 'autora', condition[0], condition[1], observation) - endPage() - {% else %} - await main(condition[0], condition[1]) - {% endif %} - } else { - errorPage() - } + document.getElementById("consent").onclick = async () => { + if (process.env.NODE_ENV === 'development' && process.env.NODE_APP_devNoDb === 'True') { + await main(0, 0); + return; + } + + let prolificId = "1"; + + if (process.env.NODE_APP_useProlificId === 'True') { + const queryString = window.location.search; + const urlParams = new URLSearchParams(queryString); + prolificId = urlParams.get('PROLIFIC_PID'); + } + + let condition = await getCondition('autora', prolificId); + + if (condition && (prolificId !== null || process.env.NODE_APP_useProlificId === 'False')) { + {% if firebase %} + let observation = await main(condition[0], condition[1]); + + waitPage(); + await setObservation(db, 'autora', condition[0], observation); + await setBackup(db, 'autora', condition[0], condition[1], observation); - return false; + endPage(); + + {% else %} + + await main(condition[0], condition[1]); + + {% endif %} + + } else { + errorPage(); + } + + return; + } + document.getElementById("decline").onclick = () => { + declinePage(); + } } await index(); diff --git a/template/experiment-ui/pages.js b/template/experiment-ui/pages.js index ee10895..d8bffd6 100644 --- a/template/experiment-ui/pages.js +++ b/template/experiment-ui/pages.js @@ -36,4 +36,143 @@ function errorPage() { document.body.innerHTML = "

We are sorry, there has been an unexpected technical issue.
Thank you for your understanding.

Prolific" } -export { endPage, waitPage, errorPage }; +function consentForm() { + document.body.innerHTML = ` + +

CONSENT FORM

+ +
+

+ TITLE OF RESEARCH: Research Project Title +
+ PRINCIPAL INVESTIGATOR: Smith, John Ph.D. +
+ PRINCIPAL INVESTIGATOR’S DEPARTMENT: Department, Institution +

+
+ + +

+ You are being invited to take part in a research study. Before you decide to participate in this study, it is important that you understand why the research is being done and what it will involve. Please take the time to read the following information carefully. Please contact the researcher if there is anything that is not clear or if you need more information. +

+ + +

Purpose of the research:

+

+ We are looking to understand... +

+ + +

Expected duration of participation:

+

+ + This experiment should take between 30-45 minutes to complete. +

+ + +

Study Procedures:

+

+ In this experiment, you will... +

+ + +

Risks or discomforts as a result of participation:

+

+ The activities in the study carry no risk / risk of... +

+ + +

+ This study includes questions... +

+ +

+ Examples of such questions are: +

    +
  • Question 1?
  • +
  • Question 2?
  • +
+

+ + +

Benefits as a result of participation:

+

+ There will be no direct benefit to you from this research (aside from the monetary compensation you will receive). +

+ + +

Confidentiality:

+

+ Your responses, after removal of any identifiable private information, could be used for future research studies or distributed to another investigator for future research studies, or shared as part of publication of the research study without additional consent from you. Data will be shared such that it cannot, in any way, be traced back to you. +

+ +

+ In particular, data from this study will be submitted to the National Institute of Mental Health Data Archive (NDA) at the National Institutes of Health (NIH). NDA is a large database where deidentified study data from many National Institute of Mental Health (NIMH) studies are stored and managed. Deidentified study data means that no personal information about you is included. Sharing deidentified study data helps researchers learn new and important things about mental health and substance use more quickly than before. +

+ +

+ Every researcher (and institutions to which they belong) who requests use of your deidentified study data must promise to keep your data safe and promise not to try to learn your identity. Sharing your study data does have some risks, although these risks are rare. Your study data could be accidentally shared with an unauthorized person who may attempt to learn your identity. The study researchers will make every attempt to protect your identity. +

+ + +

Compensation:

+

+ Participants will be compensated with total payment (base payment + bonus) of at least $ dollars per hour (or the relevant fraction for experiments that require less time). +

+ + +

Who to contact with questions:

+

+ 1. Principal investigator: + +

    +
  • Smith, John Ph.D.
  • +
  • Department, Institution
  • +
  • Email: smith@institution.org
  • +
+ +

+ +

+ 2. If you have questions regarding your rights as a research subject, or if problems arise which you do not feel you can discuss with the Investigator, please contact: + +

    +
  • Contact's Title
  • +
  • Office of Contact
  • +
  • Email: contact@institution.org
  • +
+

+

If you wish to save a copy of the consent form, click the Print button to print and/or save as PDF: +
+ +
+

+ +
+ + +

+ I understand the information that was presented and that: + +

+ My participation is voluntary. Refusal to participate will involve no penalty or loss of benefits to which I am otherwise entitled. I may discontinue participation at any time without penalty or loss of benefits. I do not waive any legal rights or release Institution or its agents from liability for negligence. + +
+ + By clicking the box below, I hereby give my consent to be the subject of your research. +

+ + + +`; + document.getElementById('print').onclick = () => { + window.print(); + } +} + +function declinePage() { + let html = `
Thank you for considering participating in our study.
`; + document.body.innerHTML = html; +} + +export { endPage, waitPage, errorPage, consentForm, declinePage };