<commit_before>scorify
=======

A simple tool for scoring psychological self-report questionnaires.

## Background

Many psychology studies use one or more self-report questionnaires to understand their participants. Generally, these are recorded by software programs that let you download a CSV file of the results, one participant per row, one question per column.

Scoring these files is a bunch of work. Oftentimes, many questionnaires (or sub-scales) are included in one CSV file. Often, half of the questions are "reverse-scored" to combat the tendancy people have to agree with questions. Scoring these files usually means spending a whole bunch of time in Excel, and no one likes doing that.

Scorify aims to fix this.

## Example

What you'll do is create a tab- or comma-separated "scoring file" that looks like:

<table>
<tr><td>layout</td><td>header</td><td> </td><td> </td></tr>
<tr><td>layout</td><td>data...</td><td> </td><td> </td></tr>
<tr><td>exclude</td><td>PPT_COL</td><td>bad_ppt1</td><td> </td></tr>
<tr><td>exclude</td><td>PPT_COL</td><td>bad_ppt2</td><td> </td></tr>
<tr><td>transform</td><td>normal</td><td>map(1:5, 1:5)</td><td> </td></tr>
<tr><td>transform</td><td>reverse</td><td>map(1:5, 5:1)</td><td> </td></tr>
<tr><td>score</td><td>PPT_COL</td><td> </td><td> </td></tr>
<tr><td>score</td><td>HAPPY_Q1</td><td>HAPPY</td><td>normal</td></tr>
<tr><td>score</td><td>SAD_Q1</td><td>SAD</td><td>normal</td></tr>
<tr><td>score</td><td>HAPPY_Q2</td><td>HAPPY</td><td>reverse</td></tr>
<tr><td>measure</td><td>HAPPY_SCORE</td><td>mean(HAPPY)</td><td> </td></tr>
<tr><td>measure</td><td>SAD_SCORE</td><td>mean(SAD)</td><td> </td></tr>
</table>

When run on data that contains PPT_COL, HAPPY_Q1, SAD_Q1, and HAPPY_Q2 columns, the output will be:

PPT_COL | HAPPY_Q1 (HAPPY) | SAD_Q1 (SAD) | HAPPY_Q2 (HAPPY) | HAPPY_SCORE | SAD_SCORE
--------|------------------|--------------|------------------|-------------|----------
ppt1 | 4 | 2 | 3 | 3.5 | 2
ppt2 | 2 | 5 | 1 | 1.5 | 5


## Credits

TODO properly credit docopt, schema<commit_msg>Big readme update<commit_after>scorify
=======

A simple tool for scoring psychological self-report questionnaires.

## Background

Many psychology studies use one or more self-report questionnaires to understand their participants. Generally, these are recorded by software programs that let you download a CSV file of the results, one participant per row, one question per column.

Scoring these files is a bunch of work. Oftentimes, many questionnaires (or sub-scales) are included in one CSV file. Often, half of the questions are "reverse-scored" to combat the tendancy people have to agree with questions. Scoring these files usually means spending a whole bunch of time in Excel, and no one likes doing that.

Scorify aims to fix this.

## Installation

scorify has no dependencies (execpt Python 2.? probably 5) or greater. So:

`pip install scorify`

should have you set up.

## Installed commands:

#### `score_data`

    Score questionnaire responses.

    Usage:
      scorify [options] <scoresheet> <datafile>
      scorify -h | --help

    Options:
      -h --help            Show this screen
      --version            Show version
      --exclusions=<file>  A scoresheet with additional exclude commands
      --nans-as=<string>   Print NaNs as this [default: NaN]
      -q --quiet           Don't print errors

## Example scoresheet

What you'll do is create a tab- or comma-separated "scoresheet" that looks like:

<table>
<tr><td>layout</td><td>header</td><td> </td><td> </td></tr>
<tr><td>layout</td><td>data</td><td> </td><td> </td></tr>
<tr><td>exclude</td><td>PPT_COL</td><td>bad_ppt1</td><td> </td></tr>
<tr><td>exclude</td><td>PPT_COL</td><td>bad_ppt2</td><td> </td></tr>
<tr><td>transform</td><td>normal</td><td>map(1:5, 1:5)</td><td> </td></tr>
<tr><td>transform</td><td>reverse</td><td>map(1:5, 5:1)</td><td> </td></tr>
<tr><td>score</td><td>PPT_COL</td><td> </td><td> </td></tr>
<tr><td>score</td><td>HAPPY_Q1</td><td>happy</td><td>normal</td></tr>
<tr><td>score</td><td>SAD_Q1</td><td>sad</td><td>normal</td></tr>
<tr><td>score</td><td>HAPPY_Q2</td><td>happy</td><td>reverse</td></tr>
<tr><td>measure</td><td>happy_score</td><td>mean(happy)</td><td> </td></tr>
<tr><td>measure</td><td>sad_score</td><td>mean(sad)</td><td> </td></tr>
</table>

When run on data that contains PPT_COL, HAPPY_Q1, SAD_Q1, and HAPPY_Q2 columns, the output will be:

PPT_COL | HAPPY_Q1 (happy) | SAD_Q1 (sad) | HAPPY_Q2 (happy) | happy_score | sad_score
--------|------------------|--------------|------------------|-------------|----------
ppt1 | 4 | 2 | 3 | 3.5 | 2
ppt2 | 2 | 5 | 1 | 1.5 | 5


## Credits

Scorify packages two excellent libraries: [docopt](https://github.com/docopt/docopt) and [schema](https://github.com/halst/schema).

docopt is copyright (c) 2013 <NAME>, <EMAIL>
schema is copyright (c) 2012 <NAME>, <EMAIL>

Hey, look at that! Same guy.
{'fraction_non_alphanumeric': 0.21380710659898478, 'fraction_numerical': 0.015431472081218273, 'mean_word_length': 3.9457831325301207, 'pattern_counts': {'":': 0, '<': 255, '<?xml version=': 0, '>': 255, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '152595', 'n_tokens_mistral': 1859, 'n_tokens_neox': 1757, 'n_words': 475}