Score using MAS
Parameters:
Name | Type | Description |
---|---|---|
restaf |
store
|
store |
masControl |
object
|
object from masSetup |
modelName |
string
|
name of model to be executed |
scenario |
object
|
can be [{name: var1, value: value1},{...} ] or {varname: value,...} |
stepName |
string
|
if not specified it will default to score or execute |
- returns scoring results
promise
Example
async function example (models, payload) {
await store.logon(payload);
let masControl = await restaflib.masSetup(store, models);
let defaults = {
prescriber_count : 1,
strength_per_unit: 15,
age : 74,
avg_opioid_prescriber_rate: 10.4,
doctorshop_med : 1,
max_avg_med_90 : 10,
max_mme_per_day: 40,
max_opioid_prescriber_rate: 13.21,
opioid_days: 3
};
let inp = restaflib.masDescribe(masControl, models[0], 'score');
print.object(inp, 'describe for score model');
inp = inp.map((n) => {
n.value = defaults[n.name];
return n;
});
print.object(inp, 'updated input for score model');
let result = await restaflib.masRun (store, masControl, models[0], inp, 'score');
print.object(result, 'scoring result');
}