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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@easydriver/scores-computation

v2.6.0

Published

This package exports functions to calculate the results of an exam.

Downloads

14

Readme

edt-scores-calculation

This package exports functions to calculate the results of an exam.

Usage

The package expose a factory which can be used to customize the compute functions.

Normally the default configuration is adequate to compute exams scores for the EDT project.

const scoreComputer = require('@easydriver/scores-computation')()

// `me` is a User object
const exam = await Exam.findOne({ user: me._id }).lean()
const corpus = await ExamContent.findOne({ _id: exam.examContent }).lean()

// If you want the objective and the subjective scores
const scores = scoreComputer.compute({
    questions: corpus.content,
    answers: exam.answers,
})

// If you want only one of the two
const objectiveScores = scoreComputer.computeObjective({
    questions: corpus.content,
    answers: exam.answers,
})

const subjectiveScores = scoreComputer.computeSubjective({
    questions: corpus.content,
    answers: exam.answers,
})

## Score object

TODO

## Statistics

The scoreComputer allows to compute the scores but also to generate some statistics about corpus. By calling the method getStatistics you can retrieve these statistics.

:warning: By default the scoresComputer's methods will not collect stats. You must turn on the collect by setting the option collectStats to true

const scoresComputer = require('@easydriver/scores-computation')({ collectStats: true })

Here is an example with commentary to understand the generated stats :

{
    // `calls` key contains function call counters
    "calls": {
        "compute": 86,
        "computeObjective": 86,
        "computeSubjective": 86
    },

    // `questions` key contains per question statistics
    "questions": {
        "5c5c093de7471c378ad4dc98": {
            "answeredCnt": 27,               // Indicates how many times this question has been answered

            "successRate": 0.666,            // Indicates the success rate of this question
            "partialSuccessRate": 0.333,     // Indicates the proportion of incomplete response
                                             // ---> only usefull for multiple choice question

            "responseTime": {                // Statistics about reponse time (in millisecondes)
                "min": 1787,
                "max": 40124,
                "average": 17161
            },
            "answerDistribution": {          // For each possible answer, indicates how many times the answer is
                "0": 0,                      // picked by the user
                "1": 0,
                "2": 0,
                "3": 0,
                "4": 0.7407407407407407,     // Ex: picked in 74% of cases
                "5": 0,                      // Ex: never picked
                "6": 0.8148148148148148,
                "7": 0.9259259259259259,
                "8": 0.8148148148148148
            }
        },

        // ...
    }
}