@blueabel/assesment_utils

1.0.6 • Public • Published

Rating Scale Library

This library provides functionalities related to rating scales. The core functions allow for determining the rating scale of choices, translating scores between different scales, and aggregating scores based on provided answers.

Functions

setRatingScale(choices)

  • Description: Determines the rating scale of an array of choices based on a lookup table and adds it as a key.
  • Input:
    • choices: An array of choice objects with a required score property and any other optional properties.
  • Output: The array with choice objects having a rating_scale property.

translateScore(score, fromScale, toScale)

  • Description: Translates a score from one rating scale to another.
  • Input:
    • score: The score to be translated.
    • fromScale: The original rating scale of the score (e.g., "7_point").
    • toScale: The target rating scale to which the score should be translated (e.g., "5_point").
  • Output: The translated score rounded to three decimal places.

calculateResult(answers, context)

  • Description: Calculates aggregated scores for each domain based on provided answers.
  • Input:
    • answers: An array of answers where each answer contains a score, domain_id, optional facet_id, and an optional rating scale.
    • context: Contextual information for processing the answers. The desired rating scale to which all answers should be translated (e.g., "5_point").
  • Output: An object where each key is a domain_id and each value contains aggregated scores.

Notes

  • Facets will not be processed if domain_id is an array in the calculateResult function.

Usage

const { setRatingScale, translateScore, calculateResult } = require('@blueabel/assesment_utils');

Package Sidebar

Install

npm i @blueabel/assesment_utils

Weekly Downloads

1

Version

1.0.6

License

MIT

Unpacked Size

8.54 kB

Total Files

3

Last publish

Collaborators

  • ops-123abc