post https://api-lib.bambu.life/api/riskProfiling/v2/calcRiskScore
The Risk Scoring API computes an overall risk score and all underlying sub-scores, based on individual questions' answers, scores, number of risk buckets. It can deal with rounding, capping and flooring of scores by specific sub-scores. It can also normalise answers to fit in the risk buckets range. Risk Scoring API.
Request Data
Name | Data Type | Mandatory | Description | Sample Value | Remarks |
---|---|---|---|---|---|
nbRiskBuckets | number [2; 100] | Y | Number of risk buckets | 5 | example: “5” for 5 risk buckets: all goals will be scored between 1 (low risk) to 5 (high risk). |
roundUpFlag | boolean | N | Flag indicating if we round the overall score to the upper integer | true | If roundUpFlag, roundDownFlag, or roundFlag flag is missing, it is deemed FALSE (i.e. no such rounding). Validation: there cannot be more than 1 of these 3 flags with value TRUE. |
roundDownFlag | boolean | N | Flag indicating if we round the overall score to the lower integer | true | If roundUpFlag, roundDownFlag, or roundFlag flag is missing, it is deemed FALSE (i.e. no such rounding). Validation: there cannot be more than 1 of these 3 flags with value TRUE. |
roundFlag | boolean | N | Flag indicating if we round the overall score to the nearest integer | true | If roundUpFlag, roundDownFlag, or roundFlag flag is missing, it is deemed FALSE (i.e. no such rounding). Validation: there cannot be more than 1 of these 3 flags with value TRUE. |
questionnaire | object | Y | List of questions | {questionId : ...} | Contains up to 10 nested levels in object questionnaire. Each level contains up to 10 questions. |
questionId | string, ““, 255 char max, [a-z], [A-Z], [0-9], “-”, “_” | Y | Question Id | "1" | |
questionCategoryName | string, ““, 300 char max, [a-z], [A-Z], [0-9], “-”, “_”, “,”, “.”, (space) | Y | Question’s category name (it will be used to group questions together by category and to compute a score for that category) | “Risk Capacity” | E.g. “Risk Capacity” |
questionCapFlag | boolean | N | Flags telling us if this question’s score acts as a cap for the higher level score | true | If missing, Flag is deemed equal to “FALSE” (no cap). we cannot have questionCapFlag and questionFloorFlag to be TRUE. |
questionFloorFlag | boolean | N | Flags telling us if this question’s score acts as a floor for the higher level score | true | If missing, Flag is deemed equal to “FALSE” (no cap). we cannot have questionCapFlag and questionFloorFlag to be TRUE. |
questionAnswer | number, [0; 100000000000] | Y/N | Question’s answer (numeric only) | 10 | If we are at the most granular level, then questionAnswer or questionScore must be provided. |
questionScore | number, [1; nbRiskBuckets] | Y/N | Question’s score (numeric only) | 10 | If we are at the most granular level, then questionAnswer or questionScore must be provided. |
questionWeight | number, [0; 1] | Y/N | Question’s score’s weight when computing the higher level score | 0.5 | sum{questionWeight} must be equal to 1 for each level. |
questionNormalisationFactor1 | number, [0; 100000000000] | N | Lower Factor used to translate the question’s answer to the [1, nbRiskBuckets] range | 1 | You must pass questionNormalisationFactor1 and questionNormalisationFactor2 if questionScore is empty. questionNormalisationFactor2 cannot be equal to questionNormalisationFactor1. |
questionNormalisationFactor2 | number, [0; 100000000000] | N | Upper Factor used to translate the question’s answer to the [1, nbRiskBuckets] range | 1 | You must pass questionNormalisationFactor1 and questionNormalisationFactor2 if questionScore is empty. questionNormalisationFactor2 cannot be equal to questionNormalisationFactor1. |
questionRoundUpFlag | boolean | N | Flag indicating if we round the overall score to the upper integer | true | If questionRoundUpFlag, questionRoundDownFlag, or questionRoundFlag is missing, it is deemed FALSE (i.e. no such rounding) |
questionRoundDownFlag | boolean | N | Flag indicating if we round the overall score to the lower integer | true | If questionRoundUpFlag, questionRoundDownFlag, or questionRoundFlag is missing, it is deemed FALSE (i.e. no such rounding) |
questionRoundFlag | boolean | N | Flag indicating if we round the overall score to the nearest integer | true | If questionRoundUpFlag, questionRoundDownFlag, or questionRoundFlag is missing, it is deemed FALSE (i.e. no such rounding) |
questionDetails | object | N | List of underlying questions | {questionId : ...} | No such object if we are at the end of a branch. This object has the same structure as the questionnaire object. |
Response Data
Name | Data Type | Mandatory | Description | Sample Value | Remarks |
---|---|---|---|---|---|
status | string, ““, 300 char max, [a-z], [A-Z], [0-9], “-”, “_”, “,”, “.”, (space) | N | Indicates error | ||
message | string, ““, 300 char max, [a-z], [A-Z], [0-9], “-”, “_”, “,”, “.”, (space) | N | Explains error | ||
overallScore | number, [1; nbRiskBuckets] | Y | Overall risk score | 25 | |
overallScoreDetails | object | Y | Overall risk score’s details | {questionCategoryName: ..., questionScore:..., questionScoreDetails:...} | This is nested object. |
questionCategoryName | string, ““, 300 char max, [a-z], [A-Z], [0-9], “-”, “_”, “,”, “.”, (space) | N | Question’s category name | "Risk Capacity" | |
questionScore | number, [1; nbRiskBuckets] | Y | Question’s score | 13 | |
questionScoreDetails | object | Y | Level 1 score’s details | {questionCategoryName: ..., questionScore:..., questionScoreDetails:...} |