UNPKG

@universis/percentile-ranking

Version:

Percentile ranking is a vital part of any student information system. It indicates how well a student performed in comparison to the students in the specific norm group, for example, in the same grade, class, or graduation event. This package implements t

79 lines (78 loc) 3.37 kB
export declare interface Grades { student: number; grade: number; percentileRank?: number; } export declare class PercentileRanking { private _grades; _gradeRank: Map<number, number>; get grades(): Array<Grades>; set grades(gradeArray: Array<Grades>); constructor(grades: Array<Grades>); /** * This calculates the simple percentile rank of all the * grades that were provided during the initialization * of the object */ simplePercentileCalculation(): void; /** * This calculates the complex percentile rank of all the * grades that were provided during the initialization * of the object */ complexPercentileCalculation(): void; /** * Given a grade, calculate the simple percentile rank for that grade * It checks to see if the grade is already included in the initial grade * array and if it is, it checks if there is already a value in the cached * map. If not, it calculates the rank treating smaller and equal grades with * the same coefficient. * If the item isn't included in the initial array, it just creates a new array * and adds the new item to that array instead of overwriting the initial and * proceeds with the same calculation * @param {Grades} item */ calculateSingleSimpleRank(item: Grades): void; /** * Given a grade, calculate the simple percentile rank for that grade * It checks to see if the grade is already included in the initial grade * array and if it is, it checks if there is already a value in the cached * map. If not, it calculates the rank treating smaller grades with * the coefficient equal to 1 and the equal grades with a coefficient of 0.5. * If the item isn't included in the initial array, it just creates a new array * and adds the new item to that array instead of overwriting the initial and * proceeds with the same calculation * @param {Grades} item */ calculateSingleComplexRank(item: Grades): void; /** * Given a grades array, this calculates the simple percentile * rank of all the grades that were provided * @param {Array<Grades>} grades */ static simplePercentileCalculation(grades: Array<Grades>): void; /** * Given a grades array, this calculates the complex percentile * rank of all the grades that were provided * @param {Array<Grades>} grades */ static complexPercentileCalculation(grades: Array<Grades>): void; /** * Given an array of grades, a grade, and an optional cache map, * calculate the simple percentile rank of the given grade and * save the result to the cache map. * @param {Array<Grades>} grades * @param {Grades} item * @param {Map<number,number>} _gradeRank */ static calculateSingleSimpleRank(grades: Array<Grades>, item: Grades, _gradeRank?: Map<number, number>): void; /** * Given an array of grades, a grade, and an optional cache map, * calculate the complex percentile rank of the given grade and * save the result to the cache map. * @param {Array<Grades>} grades * @param {Grades} item * @param {Map<number, number>} _gradeRank */ static calculateSingleComplexRank(grades: Array<Grades>, item: Grades, _gradeRank?: Map<number, number>): void; }