npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

compileprofile-spacetests

v0.3.0

Published

A package for evaluating cognitive test results from

Readme

compileprofile-spacetests

A package for evaluating cognitive test results from "Vzhuru do vesmiru" (To Space) cognitive testing platform. This package analyzes performance data from four different cognitive tests: N-back memory tests, spatial cognition tests, Go/No-Go response inhibition tests, and emotion recognition tests.

Installation

npm install compileprofile-spacetests

Usage

import {
  NbackResults,
  SpatialCognitionResults,
  GonogoResults,
  EmotionResults
} from 'compileprofile-spacetests';

// Analyze N-back memory test
const nbackResults = NbackResults(nbackData);

// Analyze spatial cognition test
const spatialResults = SpatialCognitionResults(spatialData);

// Analyze Go/No-Go test
const gonogoResults = GonogoResults(gonogoData);

// Analyze emotion recognition test
const emotionResults = EmotionResults(emotionData);

Test Results

All cognitive tests return results in two parts: common metrics (same for all tests) and special metrics (specific to each test type).

Common Metrics (All Tests)

Every test provides these basic performance measures:

  • n_trials - Total number of test trials completed
  • n_correct_trials - How many responses were correct
  • n_incorrect_trials - How many responses were wrong
  • avg_rt_total - Average reaction time across all trials (milliseconds)
  • avg_rt_correct - Average reaction time for correct answers only
  • avg_rt_incorrect - Average reaction time for wrong answers only
  • performance_score - Overall performance score (0-100, higher is better)

Special Metrics by Test Type

N-back Memory Test

Analyzes working memory by comparing performance on different trial types:

  • target_trials - Performance when participant should respond (saw matching stimulus)
    • Number of target trials, average reaction time, accuracy rate
  • non_target_trials - Performance when participant should not respond
    • Number of non-target trials, average reaction time, accuracy rate

Spatial Cognition Test

Analyzes spatial reasoning by breaking down performance across map characteristics:

  • by_distance - Performance grouped by how far the destination is (1, 2, 3 units)
  • by_angle - Performance grouped by map rotation angle (90°, 180°, 270°)
  • by_rotation - Performance grouped by how much the view was rotated

Each group shows number of trials, average reaction time, and accuracy rate.

Go/No-Go Response Inhibition Test

Analyzes impulse control by examining when to respond vs. when to inhibit:

  • by_block - Performance in each test phase (blocks 1-4 have different rules)
  • go_trials - Trials where participant should press the button
    • Number of trials, average reaction time, accuracy rate
  • nogo_trials - Trials where participant should NOT press the button
    • Number of trials, average reaction time, accuracy rate

Emotion Recognition Test

Analyzes emotion processing by examining recognition patterns:

  • by_emotion - Performance for each emotion type (neutral, sad, happy, surprised, angry)
    • For each emotion: number of trials, average reaction time, accuracy rate
  • confusion_matrix - Shows which emotions get confused with which others
    • Rows = actual emotion, columns = what participant guessed

Performance Scoring

Each test uses a specific algorithm to calculate the performance score (0-100):

  • N-back: Raw accuracy percentage
  • Spatial Cognition: RT/(accuracy) formula with 1000-10000ms bounds
  • Go/No-Go: RT/(accuracy^5) formula with 300-5000ms bounds
  • Emotions: RT/(accuracy^5) formula with 1000-10000ms bounds

Input Data Format

Each test expects an array of trial objects with specific fields:

N-back Test Data

Each trial object should have:

  • is_target - true if participant should respond, false if they shouldn't
  • rt - Reaction time in milliseconds
  • correct - true if response was correct, false if wrong
  • response - What the participant pressed (0 or 1, or null if no response)

Spatial Cognition Test Data

Each trial object should have:

  • stimulus - HTML image tag containing the map image
  • rt - Reaction time in milliseconds
  • response - Direction chosen (0 = left, 1 = right)

Go/No-Go Test Data

Each trial object should have:

  • image - URL to the stimulus image (astronaut, alien, or rocket)
  • rt - Reaction time in milliseconds
  • response - Button press (any number = pressed, null = no press)
  • block_number - Which test phase (1, 2, 3, or 4)

Emotion Recognition Test Data

Each trial object should have:

  • emotion - URL to the emotion face image
  • rt - Reaction time in milliseconds
  • response - Emotion chosen (0=neutral, 1=sad, 2=happy, 3=surprised, 4=angry)

Development

Build the package:

npm run build        # Build both CommonJS and ESM
npm run build:cjs    # Build CommonJS only
npm run build:esm    # Build ESM only

Run tests:

npm test             # Run all tests
npm test -- emotions.test.ts  # Run specific test file

License