Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Cognitive Reflection Test for Hemlock projects

Project description

Hemlock-CRT is a hemlock extension for adding a cognitive reflection test to hemlock projects.

Installation

With hemlock-CLI (recommended):

$ hlk install hemlock-crt

With pip:

$ pip install hemlock-crt

Quickstart

In this example, we add a CRT with the bat and ball, lily pads, widgets, and students problem. Then we display the results to the participant.

In survey.py:

from flask_login import current_user
from hemlock import Branch, Page, Label, route
from hemlock_crt import crt

@route('/survey')
def start():
    return Branch(
        *crt('bat_ball', 'lily_pads', 'widgets', 'students', page=True),
        Page(
            Label(compile=display_score),
            terminal=True
        )
    )

def display_score(label):
    label.label = '''
    <p>You gave {} correct and {} intuitive answers out of {} CRT questions.
    </p>
    '''.format(
        current_user.g['CRT_Correct'], 
        current_user.g['CRT_Intuitive'], 
        current_user.g['CRT_Total']
    )

app.py is standard from the hemlock template.

Run with:

hlk serve

or

python app.py

Citations

@software{bowen2020hemlock-crt,
  author = {Dillon Bowen},
  title = {Hemlock-CRT},
  url = {https://dsbowen.github.io/hemlock-crt/},
  date = {2020-10-05},
}

@article{frederick2005cognitive,
  title={Cognitive reflection and decision making},
  author={Frederick, Shane},
  journal={Journal of Economic perspectives},
  volume={19},
  number={4},
  pages={25--42},
  year={2005}
}

License

Users must cite this package in any publications which use it.

It is licensed with the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for hemlock-crt, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size hemlock_crt-0.0.2-py3-none-any.whl (7.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size hemlock-crt-0.0.2.tar.gz (5.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page