Repository navigation
Add TMB Digit Span (forward and backward) - #50
Merged
Merged
Conversation
A port of TestMyBrain Digit Span (DigitSpan_Main.v1.May23), in English and
French. The source picks forward or backward report with an ?order= URL
parameter, which an ODC instrument cannot receive, so each order is its own
instrument. Studies can give either or both, and each gets its own score.
render.js takes the order as an argument from index.ts, so it is identical in
both folders, as are the translations, markup, styles and legacy scripts. Only
index.ts and the order-specific instruction animation differ.
Task logic, timing, seeding and scoring are unchanged from the source: digits
shown for 1000 ms each, two trials per length from 2 to 11, stop after two
errors at one length, span = longest length recalled correctly at least once.
The default seed is still the order name, so every participant sees the same
sequences for a given version, as in the original.
Other changes from the source:
- The instruction GIFs are converted to lossless animated webp, about 12 KB
in total instead of 25 KB, with every frame pixel-identical.
digitsStream.gif was byte-identical to begin.gif, so both paths map to one
file.
- The submit-to-file/server step is replaced by done({ results, outcomes }),
and the URL parameters that only controlled it are dropped.
- testVersion is set to DigitSpan_Main.v1.May23 rather than derived from
window.location.pathname, which is meaningless inside an ODC iframe.
- The outcome key stays numCorrect, as the source code emits it. TMB's data
dictionary documents it as num_correct.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds TestMyBrain Digit Span (
DigitSpan_Main.v1.May23, fromscratch/TMB_DigitSpan) as two instruments,TMB_DIGIT_SPAN_FORWARDandTMB_DIGIT_SPAN_BACKWARD, in English and French.Why two instruments
The source picks the report order with an
?order=forward|backwardURL parameter, defaulting to forward. An ODC instrument can't receive URL parameters, so a single port would always run forward. The two orders are also normally treated as separate tests: forward measures short-term span, backward measures working memory, and TMB publishes separate score distributions for them. So each order is its own instrument, and a study can give either or both.1 → 5 → 3153351forwardSpanbackwardSpanrender.jstakes the order as an argument fromindex.ts, so it is byte-identical in both folders, as are the translations, markup, styles and legacy scripts. Onlyindex.tsand the order-specific animation differ, which keeps the pair easy to keep in sync.What's unchanged from the source
Trial logic, timing, seeding and scoring: digits shown for 1000 ms each, two practice trials (
12,123) that repeat until correct, two test trials per length from 2 to 11, early stop after two errors at one length, and span = longest length recalled correctly at least once. The trial and outcome fields match the source code's output. As in the other TMB ports, the legacyTestMyBrain,TestHelper.v1.May23andchooseInput.v1.Apr23scripts are reused; they're identical to the scratch copies apart from formatting.Deliberate deviations
digitsStream.gifwas byte-identical tobegin.gif, so both paths map to one file.done({ results, outcomes }), and the URL parameters that only controlled it (showresults,autosave,filename) are dropped.testVersion: fixed toDigitSpan_Main.v1.May23rather than derived fromwindow.location.pathname, which is meaningless inside an ODC iframe.estimatedDuration: 5: TMB's overview gives no duration, so this is an estimate. A full run to 11 digits takes about 4–5 minutes, and most participants stop earlier.Verification
Both instruments were run end to end against
serve-instrument, using keyboard input:21 34 256 234 5381 8276).29→2→256).span: 3,numCorrect: 3.87,13) score correct, and the forward-order answer238scores wrong.span: 2,numCorrect: 2.reportOrder,responseDevice: "keyboard"andtestVersionset correctly.pnpm lintand Prettier pass.Not yet verified
maxTouchPoints = 0, so both runs used the keyboard path, and the input-choice screen and tap handling are untested. The on-screen number pad renders correctly at phone size, the red.responseHighlightstyle applies, andTestHelper's stylesheet scan for that class succeeds inside the ODC iframe. A real phone or tablet should still be tested before release.Open questions
numCorrectvsnum_correct: the outcome key isnumCorrect, which is what the source code emits. TMB's data dictionary (TMB_DigitSpanDictionary.v1.May23.xlsx) documents it asnum_correct. Switching is a two-line change per folder (render and schema).🤖 Generated with Claude Code