Skip to content
Snippets Groups Projects
Commit 9628edae authored by stevereis's avatar stevereis
Browse files

fix(exareme): Type issue on algorithm param (integer)

Closes #75
parent 2c857006
No related branches found
No related tags found
No related merge requests found
......@@ -47,7 +47,7 @@ export const dataToDataset = (data: Entity): Dataset => {
//FIXME: Dirty workaround should be improved
const lookupTypes = {
integer: 'int',
int: 'integer',
};
export const dataToVariable = (data: VariableEntity): Variable => {
......
......@@ -6,7 +6,11 @@ const transformToAlgorithms = jsonata(`
'integer': 'NumberParameter',
'real': 'NumberParameter'
};
$dictTypes:= {
'int': 'integer'
};
$checkVal:= function($val) { $val ? $val : undefined};
$getOrDefault:= function($v, $d) { $v ? $v : $d };
$excludedParams:= ['centers', 'formula'];
$includes:= ['ANOVA_ONEWAY','ANOVA','LINEAR_REGRESSION',
'LOGISTIC_REGRESSION', 'LOGISTIC_REGRESSION_CV','TTEST_INDEPENDENT','TTEST_PAIRED',
......@@ -20,15 +24,17 @@ const transformToAlgorithms = jsonata(`
$v='true' ? true : ($v='false'? false : undefined)
)};
$extract:= function($v) {
$v?
{
"hint": $v.desc,
"isRequired": $truthy($checkVal($v.valueNotBlank)),
"hasMultiple": $truthy($checkVal($v.valueMultiple)),
"allowedTypes": $v.columnValuesIsCategorical = '' and $v.columnValuesSQLType = '' ?
undefined : $append($v.columnValuesIsCategorical = '' ?
['nominal'] : [], $truthy($v.columnValuesIsCategorical) ? 'nominal' : $map(($checkVal($v.columnValuesSQLType) ~> $split(',')), $trim))
} : undefined
(
$categorical:=$v.columnValuesIsCategorical;
$varTypes:= ($split($getOrDefault($v.columnValuesSQLType, ''), ',')[]) ~> $map($trim) ~> $map(function($value) { $getOrDefault($lookup($dictTypes, $value), $value) });
$v?
{
"hint": $v.desc,
"isRequired": $truthy($checkVal($v.valueNotBlank)),
"hasMultiple": $truthy($checkVal($v.valueMultiple)),
"allowedTypes": $categorical = '' and $v.columnValuesSQLType = '' ? undefined : $append($categorical = '' ? ['nominal'] : [], $truthy($categorical) ? 'nominal' : $varTypes)
} : undefined
)
};
$[name in $includes].{
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment