<commit_before>## LMS Export results

Export results (betygsunderlag) from canvas to something that can be
used for Ladok import (first attempt).

### Node version

This project uses node version 8.

    nvm install 8
    npm install
    npm run start-dev

http://localhost:3001/api/node/_about

#### Common errors

When trying to run node-api as a standalone you might encounter the following error:
```
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
```
This is because the SSL information is incorrect in localSettings.js. Set ```useSsl: false``` to avoid this.

### Setup canvas

```
curl -X POST 'https://kth.test.instructure.com/api/v1/accounts/1/external_tools' \
     -H "Authorization: Bearer $CANVAS_TOKEN" \
     -F 'name=Exportera resultat' \
     -F 'consumer_key=asdfg' \
     -F 'shared_secret=lkjh' \
     -F 'url=http://$HOSTNAME:3001/api/node/post' \
     -F 'privacy_level=public' \
     -F 'course_navigation[text]=Exportera resultat' \
     -F 'course_navigation[default]=false' \
     -F 'course_navigation[enabled]=true'
```
<commit_msg>Improve canvas setup script.<commit_after>## LMS Export results

Export results (betygsunderlag) from canvas to something that can be
used for Ladok import (first attempt).

### Node version

This project uses node version 8.

    nvm install 8
    npm install
    npm run start-dev

http://localhost:3001/api/node/_about

#### Common errors

When trying to run node-api as a standalone you might encounter the following error:
```
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
```
This is because the SSL information is incorrect in localSettings.js. Set ```useSsl: false``` to avoid this.

### Setup canvas

```
NAME="Exportera resultat $USER"
curl -X POST 'https://kth.test.instructure.com/api/v1/accounts/1/external_tools' \
     -H "Authorization: Bearer $CANVAS_TOKEN" \
     -F 'name=$NAME' \
     -F 'consumer_key=asdfg' \
     -F 'shared_secret=lkjh' \
     -F 'url=http://$HOSTNAME:3001/api/lms-export-results/post' \
     -F 'privacy_level=public' \
     -F 'course_navigation[text]=$NAME' \
     -F 'course_navigation[default]=false' \
     -F 'course_navigation[enabled]=true'
```

{'fraction_non_alphanumeric': 0.12866817155756208, 'fraction_numerical': 0.010835214446952596, 'mean_word_length': 3.7148936170212767, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '154051', 'n_tokens_mistral': 749, 'n_tokens_neox': 713, 'n_words': 206}