Skip to content
Snippets Groups Projects
Commit d6d99e94 authored by Steve Reis's avatar Steve Reis
Browse files

Merge branch 'sprint-1/issue-75' into 'rc'

[SPRINT-1][Issue-75] Fix integer issue on algorithms selection

See merge request sibmip/gateway!108
parents 2c857006 9628edae
No related branches found
No related tags found
No related merge requests found
...@@ -47,7 +47,7 @@ export const dataToDataset = (data: Entity): Dataset => { ...@@ -47,7 +47,7 @@ export const dataToDataset = (data: Entity): Dataset => {
//FIXME: Dirty workaround should be improved //FIXME: Dirty workaround should be improved
const lookupTypes = { const lookupTypes = {
integer: 'int', int: 'integer',
}; };
export const dataToVariable = (data: VariableEntity): Variable => { export const dataToVariable = (data: VariableEntity): Variable => {
......
...@@ -6,7 +6,11 @@ const transformToAlgorithms = jsonata(` ...@@ -6,7 +6,11 @@ const transformToAlgorithms = jsonata(`
'integer': 'NumberParameter', 'integer': 'NumberParameter',
'real': 'NumberParameter' 'real': 'NumberParameter'
}; };
$dictTypes:= {
'int': 'integer'
};
$checkVal:= function($val) { $val ? $val : undefined}; $checkVal:= function($val) { $val ? $val : undefined};
$getOrDefault:= function($v, $d) { $v ? $v : $d };
$excludedParams:= ['centers', 'formula']; $excludedParams:= ['centers', 'formula'];
$includes:= ['ANOVA_ONEWAY','ANOVA','LINEAR_REGRESSION', $includes:= ['ANOVA_ONEWAY','ANOVA','LINEAR_REGRESSION',
'LOGISTIC_REGRESSION', 'LOGISTIC_REGRESSION_CV','TTEST_INDEPENDENT','TTEST_PAIRED', 'LOGISTIC_REGRESSION', 'LOGISTIC_REGRESSION_CV','TTEST_INDEPENDENT','TTEST_PAIRED',
...@@ -20,15 +24,17 @@ const transformToAlgorithms = jsonata(` ...@@ -20,15 +24,17 @@ const transformToAlgorithms = jsonata(`
$v='true' ? true : ($v='false'? false : undefined) $v='true' ? true : ($v='false'? false : undefined)
)}; )};
$extract:= function($v) { $extract:= function($v) {
$v? (
{ $categorical:=$v.columnValuesIsCategorical;
"hint": $v.desc, $varTypes:= ($split($getOrDefault($v.columnValuesSQLType, ''), ',')[]) ~> $map($trim) ~> $map(function($value) { $getOrDefault($lookup($dictTypes, $value), $value) });
"isRequired": $truthy($checkVal($v.valueNotBlank)), $v?
"hasMultiple": $truthy($checkVal($v.valueMultiple)), {
"allowedTypes": $v.columnValuesIsCategorical = '' and $v.columnValuesSQLType = '' ? "hint": $v.desc,
undefined : $append($v.columnValuesIsCategorical = '' ? "isRequired": $truthy($checkVal($v.valueNotBlank)),
['nominal'] : [], $truthy($v.columnValuesIsCategorical) ? 'nominal' : $map(($checkVal($v.columnValuesSQLType) ~> $split(',')), $trim)) "hasMultiple": $truthy($checkVal($v.valueMultiple)),
} : undefined "allowedTypes": $categorical = '' and $v.columnValuesSQLType = '' ? undefined : $append($categorical = '' ? ['nominal'] : [], $truthy($categorical) ? 'nominal' : $varTypes)
} : undefined
)
}; };
$[name in $includes].{ $[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