Skip to content
Alessandro edited this page Jan 14, 2019 · 2 revisions

Documentation

Workflow

Note: the name of the study on webcdi.stanford.edu must be called "Wordful Study (official)" This is the name used in redcap for redirecting participants and by webcdi for payment special cases.

  1. Participant clicks on survey link (link may change in the future)

  2. Participant supplies name & email address

  3. Participant receives email from redcap after consent form is submitted that contains link to initial CDI. This link will go to webcdi.stanford.edu/interface/[researcher]/[study]/new_participant, with the query parameters supplying both the record ID (created by redcap, but to be used as subject ID in webcdi) and email address of the participant (not saved by webcdi, but sent to Wordful for user registration). This URL is currently only being used for the Wordful study. All of these parameters (including study name etc.) can only be edited inside of Redcap (Edit Instruments -> Automated Invitations -> Modify). To change how Webcdi handles this information, you must go to the new_participant (webcdi/researcher_UI/views) view and find the administer_new_participant function.

  4. The administer_new_participant function will extract record ID from parameter (which is obscured to some extent to prevent abuse) and search for the corresponding subject ID in webcdi. There are 3 cases:

  • No administrations. This means participant is clicking the link for the first time. Webcdi will ping Wordful and create new administration. Participant will be redirected to that link.
  • Exactly 1 administration. If the query param "final_cdi" is in the URL, then webcdi will create new administration, as this indicates that participant is clicking on link to final CDI for the first time. If this query param is not present, then participant is simply continuing the initial CDI.
  • more than 1 administration. Participant is continuing final CDI.

Payment

  1. Prior to beginning the study, researcher must supply Amazon gift card codes to webcdi. This is done by enabling Amazon gift card payment (checkbox in the form that shows up when you initially create a study) AND entering payment codes by clicking "Update Study" in the researcher interface. In case of different payments (as is the case in the Wordful Study), you must enter all $5 gift amounts once and submit, and then update the study once again to enter all $25 gift card amounts.

  2. On the backend, webcdi must know when to supply a $5 vs. $25 gift card. This is done in the cdi form view(webcdi/cdi_forms/views) in the cdi_form function when a form is submitted (request method is 'POST'). Now, when the view is checking to see whether payment is enabled for the study, it will do another check to see if the study is called "Wordful Study (Official)". This is a hacky way to do it but it's the way it's implemented right now. If the study has this name, it will check whether the CDI that was just submitted is the first administration or second administration to be submitted. If the first, find a $5 gift card in the db, else find a $25 gift card. Once a gift card is used, it will be marked as used in the db and cannot be used again. If you accidentally used a gift card for practice and want to reuse, you must mark it as so in the database.