Skip to content

Commit

Permalink
Merge pull request #12 from DouglasNeuroInformatics/dev
Browse files Browse the repository at this point in the history
code review finished and addressed.
  • Loading branch information
CMonnin authored Aug 9, 2024
2 parents d592c30 + 7ce184f commit cdd6636
Show file tree
Hide file tree
Showing 27 changed files with 2,326 additions and 1,051 deletions.
18 changes: 0 additions & 18 deletions .eslintrc.cjs

This file was deleted.

4 changes: 1 addition & 3 deletions .github/workflows/node-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ name: Deploy static content to Pages
on:
# Runs on pushes targeting the default branch
push:
branches:
- main
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -22,7 +21,6 @@ concurrency:
cancel-in-progress: true

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lts/iron
7 changes: 0 additions & 7 deletions docs/source/api.rst

This file was deleted.

30 changes: 30 additions & 0 deletions docs/source/home.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Welcome to PictureNamingTask's documentation!
===================================

**PictureNamingTask**
This is task is a modernized version of a classic neuropsychological task known as a "picture naming task", where an individual is presented with a set of pictures of sheet of paper and asked to name each of them (The "Boston Naming Test"[1] being the most frequently used). The classic task is "fixed" in terms of the number of images and which images are shown. Classically, the number correct and the answer provided are recorded as a measurement. This expands on the classic version by allowing a user to add and remove stimuli as they deem necessary. Each stimulus also has a difficulty level associated with it. This allows for dynamic advancement and regression according to schedule set by the task administrator.

The following pieces of data are recorded and downloaded in a .csv file at the end of session:

- The stimulus
- The correct response
- The difficulty level
- The language
- Response time for stimulus screen
- The correct/incorrect answer
- The response/notes logged by experimenter


Check out the :doc:`usage` section for further information, including
how to :ref:`installation` the project.


Contents
--------

.. toctree::

home
usage


30 changes: 0 additions & 30 deletions docs/source/index.rst

This file was deleted.

69 changes: 53 additions & 16 deletions docs/source/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,33 @@ Usage
Serving locally
------------

To use PictureNameingTask locally a simple http server can be used. Either download the dist from the github or build the package from source eg `npm build`. Then the index.html file can be served locally.
For example using python3 first navitage to the directory containing the index.html file then:
To use PictureNamingTask locally a simple http server can be used. Either download the dist from the github or build the package from source eg ``npm build`` Then the index.html file can be served locally.
Python3 offers a command to serve the index.html locally with one command. First ensure python3 is installed. `It can be found here <https://www.python.org/downloads/>`_. Choose the appropriate package for the OS that you have.
Using a terminal or powershell first navitage to the directory containing the index.html file then:

.. code-block:: console
cd path/to/index.html
python3 -m http.server``
cd path/to/directory/containing/index.html
python -m http.server
This will provide an ouput that looks something like this:

.. code-block:: console
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
To access this go to the provided url in your browser.
For example http://0.0.0.0:8000/
If port 8000 is already in use an error will be displayed.
To start the server on another port use (example 8080):

.. code-block:: console
python -m http.server 8080
More information about ``python http.server`` can be found here https://docs.python.org/3/library/http.server.html

.. _adding-stimuli
Adding stimuli
----------------
Expand All @@ -22,24 +42,41 @@ Stimuli are added to the data.csv found in the `dist/assets` directory as follow
.. csv-table:: stimuli :rst:dir:`csv-table`
:header: "stimulus", "difficultyLevel", "correctResponse","language"

"path/to/img_of_a_dog.jpg", "1", "A dog", "EN"
"path/to/img_of_a_cat.jpg", "2", "A cat", "EN"
"path/to/img_of_a_dog.jpg", "1", "Un chien", "FR"
"path/to/img_of_a_cat.jpg", "2", "Un chat", "FR"
"path/to/img_of_a_dog.jpg", "1", "A dog", "en"
"path/to/img_of_a_cat.jpg", "2", "A cat", "en"
"path/to/img_of_a_dog.jpg", "1", "Un chien", "fr"
"path/to/img_of_a_cat.jpg", "2", "Un chat", "fr"

.. _changing-experiment-settings
Changing experiment settings
----------------

Experiment settings are changed in the experimentSettings.csv file which can found in the `dist/assets` directory. These settings are described below:
Experiment settings are changed in the experimentSettings.csv file which is located in the `dist/assets` directory. A template for this file can be found in the `public` directory: `public/experimentSettings <https://github.com/DouglasNeuroInformatics/PictureNamingTask/blob/main/public/experimentSettings.csv>`
These settings are described below:

- totalNumberOfTrialsToRun: this is the number of images to be shown, a number
- advancementSchedule: the number of correct answers that are required to increase the difficutly level by one, a number
- regressionSchedule: the number of incorrect answers required to decrease the difficutly level by one, a number
- language: the language of experiment, `EN` or `FR`
- seed: a seed for the psuedorandom number generator, a number
- totalNumberOfTrialsToRun <number>: this is the number of images to be shown
- advancementSchedule <number>: the number of correct answers that are required to increase the difficulty level by one
- regressionSchedule <number>: the number of incorrect answers required to decrease the difficulty level by one
- language <text>: the language of experiment, currently `en` or `fr`
- seed <number>: a seed for the psuedorandom number generator
- initialDifficulty <number>: the difficulty that the task will start with
- numberOfLevels <number>: the number of levels that are available for the task

.. csv-table:: experimentSettings :rst:dir:`csv-table`
:header: totalNumberOfTrialsToRun, advancementSchedule, regressionSchedule, language, seed
5, 2, 0, EN, 42
:header: totalNumberOfTrialsToRun, advancementSchedule, regressionSchedule, language, seed, initialDifficulty, numberOfLevels,
5, 2, 0, en, 42, 1, 9

.. _adding-additional-languge
Adding additional language
------------

Adding additional languages can be accomplished by accessing the `locales` directory in `dist/assets` and adding a `translation.json` for the language of interest.
`translation.json` must be placed in a `locales/XX/` directory where `XX` is the two letter language code for the language of interest.
Images with the corresponding language code must be included in the `data.csv` as per :ref:`adding-stimuli`.





3 changes: 3 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { config } from "@douglasneuroinformatics/eslint-config";

export default config();
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html lang="en">
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
Expand All @@ -8,6 +8,6 @@

<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
25 changes: 11 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "picture-naming-task",
"private": true,
"version": "0.0.0",
"version": "0.1.0",
"author": "Cian Monnin",
"description": "jsPysch implmentation of the Boston Naming Task with multilingual support",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint": "tsc && eslint --fix src",
"preview": "vite preview"
},
"dependencies": {
Expand All @@ -17,26 +18,22 @@
"@jspsych/plugin-preload": "^2.0.0",
"@jspsych/plugin-survey-html-form": "^2.0.0",
"@jspsych/plugin-survey-text": "^2.0.0",
"@types/dompurify": "^3.0.5",
"@types/node": "^20.14.12",
"dompurify": "^3.1.6",
"i18next": "^23.12.2",
"i18next-http-backend": "^2.5.2",
"jsdom": "^24.1.1",
"jspsych": "^8.0.1",
"papaparse": "^5.4.1",
"pure-rand": "^6.1.0",
"react": "^18.3.1",
"react-dom": "^18.3.1"
"pure-rand": "^6.1.0"
},
"devDependencies": {
"@douglasneuroinformatics/eslint-config": "^4.3.0",
"@douglasneuroinformatics/tsconfig": "^1.0.1",
"@types/papaparse": "^5.3.14",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.17.0",
"@typescript-eslint/parser": "^7.17.0",
"@vitejs/plugin-react": "^4.3.1",
"eslint": "^8.57.0",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.9",
"typescript": "^5.5.4",
"typescript": "~5.5.4",
"vite": "^5.3.4"
},
"packageManager": "[email protected]"
Expand Down
Loading

0 comments on commit cdd6636

Please sign in to comment.