Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Plain English description of calculator for OBI scores #120

Open
brew opened this issue Jan 2, 2018 · 1 comment
Open

Plain English description of calculator for OBI scores #120

brew opened this issue Jan 2, 2018 · 1 comment
Assignees
Milestone

Comments

@brew
Copy link
Collaborator

brew commented Jan 2, 2018

Explain how the calculator calculates the OBI score. Confirm that the numbers it generates are correct given the issue with the “n/a” and “-1” (#119).

@brew brew self-assigned this Jan 2, 2018
@brew
Copy link
Collaborator Author

brew commented Jan 3, 2018

Each country on the ranking page will receive a display score out of 100.

This score is calculated by the reportgenerator.js module. Specifically in the calculateScore method:

calculateScore(db, questionSet, verbose = false) {
if (questionSet.length === 0) return 0
let acc = 0
let count = 0
_.forEach(questionSet, (x) => {
if (db[x] >= 0) {
acc += db[x]
count++
}
})
if (count === 0) return -1
if (verbose) {
console.log('result', acc, count, (acc / count),
Math.round(acc / count), questionSet)
}
return acc / count
}

calculateScore takes country data from the main data object (_EXPLORER_DATASET in ibp_dataset.js) and a question set.

Questions may be answered with a non-score-contributing value ('e' with a value of -1). These answer values are excluded from the ranking calculations. Answer values of 0 or above are used in the score calculation. These answers are 'scorable'.

For each question in the questionset, scoreable answer values are summed, then divided by the total number of 'scoreable' questions in the questionset. This value is then rounded to provide the final country score for display.

If a country has no scoreable answers (all provided answers are -1), its final score is set to -1, and displayed as 'N/A'.

@pwalsh pwalsh added this to the Current milestone Jan 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants