core-tasks v1.0.0-beta.1
Description
The tasks are all housed in this single repo using a monorepo like-structure. Which task is run is selected at run time based on the passed in parameters. This can be run standalone as a web app or as an npm package (in ROAD for example). The 'Task Launcher' is simply the name of the class that runs the whole app code.
App code flow
As a Standalone web app
serve.js -> index.js -> taskConfig.js -> load assets, corpus, setup store -> jsPsych timeline is ran
As a npm package
wherever the package is used -> index.js -> taskConfig.js -> load assets, corpus, setup store -> jsPsych timeline is ran
How the task launcher works
The app can run in two different modes, and as such uses two different build processes. For standalone, the code is built with Webpack. As an npm package, the code is built with Rollup. They work fundamentally the same regardless of where they are run.
The TaskLauncher class takes in 4 parameters, 1 being optional. firekit, game params, user params, and the display element to attach the jsPsych code to. The display element is optional.
As a Standalone web app
As a standlone web app, the built code includes the serve folder. The entry point is in serve.js. This folder also includes the config for Firestore. The serve.js file includes some additional hooks (functions) from Firebase to check the authentication. In this mode, however, we do not use any authentication but treat the user as a guest. The TaskLauncher class requires 3 things to run: firekit, user params, and game params. In standalone, we get all the parameters we need for the game from query strings.
As a npm package (In development)
As an npm package the packaged code does not include the serve folder. You use it as you would any typical npm package. Install it, import it, and run the code. Just like standlone, it requires a firekit instance, game params, and user params.
Import TaskLauncher from 'core-tasks'
const task = new TaskLauncher(firekit, gameParams, userParams);
task.run();
What is firekit?
Firekit is an SDK developed by the ROAR team that allows for a streamlined interaction with Firestore and Firebase. It provides useful functions and tools for task development.
Project structure
Currently under development
The overarching goal of this project is to simplify task developent, improve productivity, and decrease task development time. Previously, each task was in it's own separate repo which led to a ton of WET ("Write Everything Twice" or in this case X times the amount of tasks) code.
Task specifc code lives in the task folder. Each child folder is named after it's respective task name. Within that there is a trials folder and a timeline file. Addiotionally there may be helper functions in a helper folder. Common code that is used throughout multiple tasks is in the shared folder. This also has a helpers and a trials folder. Lastly, we has a taskSetup and taskConfig file. The task setup file has up global instances / variables that we need to pass all throughout the tasks. The taskConfig file is where everything comes together for a task. There are 5 main parts to a task, the config, the store (you can think of this as global state), how to load the corpus (if the task needs it), where to get translations (TBD), and how to build the task timeline.
All of these parts in the task config file are ran after recieving the corresponding task name.
Current Tasks & Parameters
In standalone web app mode, tasks and parameters can be changes through query strings. These query string parameters are listed below.
Common Parameters
Note: corpus is no longer a required parameter, each task has it's defaults
task: 'egma-math' | 'matrix-reasoning' | 'mental-rotation' | 'hearts-and-flowers' | 'memory-game' | 'same-different-selection' | 'theory-of-mind' | 'trog' [string] (optional)
age: [number] (optional) ,
audioFeedback: "neutral" ['string'] (optional),
skipInstructions: [boolean] (optional),
sequentialPractice: [boolean] (optional)
sequentialStimulus: [boolean] (optional)
corpus: "*task-name-here*-item-bank" [string] (optional),
buttonLayout: "default" | "grid" | "column" | "diamond" | "triple" [string] (optional),
trials: [number] (optional),
stimulusBlocks: [number] (optional),
numOfPracticeTrials: [number] (optional),
keyHelpers: [boolean] (optional)
Math (includes Number Line) - Default
Matrix Reasoning
Mental Rotation
Hearts and Flowers
Memory Game
Same Different Selection
TROG
Theory of Mind
How ROAR / LEVANTE Tasks work within the greater ROAD infrastructure
9 days ago
9 days ago
9 days ago
12 days ago
19 days ago
27 days ago
27 days ago
27 days ago
3 months ago
5 months ago