Skip to content

Instantly share code, notes, and snippets.

@gzinck
Last active July 7, 2021 13:04
Show Gist options
  • Save gzinck/16a0977230e6f32cac6ee5d15fa098ca to your computer and use it in GitHub Desktop.
Save gzinck/16a0977230e6f32cac6ee5d15fa098ca to your computer and use it in GitHub Desktop.
Script to generate a University of Waterloo ethics application (specifically for Voice UI experiment)
#!/bin/bash
#---------------------------------------------------------------------------
# TO GENERATE YOUR ETHICS FORM
#---------------------------------------------------------------------------
# 1. Install and set up gdoc2pdf from https://github.com/gzinck/gdoc2pdf
# - Verify it works by opening a new terminal and running `gdoc2pdf`.
# - Make sure you are using Node 15.0.1 or later.
# 2. Make sure this script is executable (`chmod u+x generate-ethics.sh`).
# Move it somewhere convenient and add it to your `$PATH` in your shell.
# - This will make it easy to run it from anywhere.
# 3. In the script below, change the variables `FORM_VALUES` and `METHOD` to
# the correct Google Doc links for your specific ethics application.
# - The other links should remain the same because they should use the
# same standard application.
# - The `FORM_VALUES` doc should be a copy of https://docs.google.com/document/d/1y4Gjx9cKh3-iXG3HsPghtEVKo4BujKWM166d1CoLIlw/edit
# - The `METHOD` doc should be a copy of https://docs.google.com/document/d/1R0_xQvjYrq384j0ur_1CNCEQvOPBQTCxM4Gq_XWd4iY/edit
# - For instructions on how to modify the `FORM_VALUES`, refer to the
# gdoc2pdf README: https://github.com/gzinck/gdoc2pdf#adding-in-variables
# 4. Create a new directory with `mkdir`, `cd` into the folder, and run this
# script `generate-ethics.sh`.
# - You must do it in a new folder to make sure the PDF merging step of
# this script works.
# 5. The file `all.pdf` is your ethics application!
#---------------------------------------------------------------------------
# Get the CSS file first
CSS=`which gdoc2pdf | sed 's/bin\/gdoc2pdf/lib\/node_modules\/gdoc2pdf\/src\/styles\/no-h3\.css/'`
echo 'Form values'
FORM_VALUES='https://docs.google.com/document/d/1YCPN67yHKevrIcvQLTb39E5k2_F_zC0icoI3bVyY0-I/edit'
gdoc2pdf -f $FORM_VALUES -v none -o 0-formvals.pdf
echo 'Method'
TEMPLATE='https://docs.google.com/document/d/1R0_xQvjYrq384j0ur_1CNCEQvOPBQTCxM4Gq_XWd4iY/edit'
METHOD='https://docs.google.com/document/d/1jrmnzAUV1px01-xGAHDtVcnj5x-cCq4jYwUOumZJIZc/edit'
gdoc2pdf -f $METHOD -t $TEMPLATE -o 1-method.pdf
echo 'Consent form'
CONSENT='https://docs.google.com/document/d/1EffPq6GcAEmVJo29hvets215AY3NDxFcM8OahDiTwjk/edit'
gdoc2pdf -f $CONSENT -v $FORM_VALUES -o 2-consent.pdf -c $CSS
echo 'Recruitment text'
RECRUIT='https://docs.google.com/document/d/1n45fYI1TSWuzMsQdnvw5j_R3MxF9e2JG_m44yYU1R_o/edit'
gdoc2pdf -f $RECRUIT -v $FORM_VALUES -o 3-recruit.pdf -c $CSS
echo 'Feedback text'
FEEDBACK='https://docs.google.com/document/d/1atErn8uSQ9JH-3T6JevJTOF4VwzSAmmIvVJfV6ucz4o/edit'
gdoc2pdf -f $FEEDBACK -v $FORM_VALUES -o 4-feedback.pdf -c $CSS
echo 'Combine'
echo 'all.pdf' | npx pdfmerge-cli@latest -a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment