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

Merge branch '36-round-descriptive-stats-results' into 'develop'

Resolve "Round descriptive stats results"

Closes #36

See merge request sibmip/gateway!15
parents 67e51f8f 56183cba
No related branches found
No related tags found
No related merge requests found
......@@ -34,19 +34,24 @@ export const transformToExperiment = jsonata(`
)
`);
export const descriptiveModelToTables = jsonata(`
(
$e := function($x, $r) {($x != null) ? $x : ($r ? $r : '')};
const headerDescriptivie = `
$e := function($x, $r) {($x != null) ? $fnum($x) : ($r ? $r : '')};
$fnum := function($x) { $type($x) = 'number' ? $round($number($x),3) : $x };
$fn := function($o, $prefix) {
$type($o) = 'object' ?
$each($o, function($v, $k) {(
$type($v) = 'object' ? { $k: $v.count & ' (' & $v.percentage & '%)' } : {
$k: $v
}
)}) ~> $merge()
: {}
};`;
$fn := function($o, $prefix) {
$type($o) = 'object' ?
$each($o, function($v, $k) {(
$type($v) = 'object' ? { $k: $v.count & ' (' & $v.percentage & '%)' } : {
$k: $v
}
)}) ~> $merge()
: {}
};
export const descriptiveModelToTables = jsonata(`
(
${headerDescriptivie}
$vars := $count(data.single.*)-1;
$varName := $keys(data.single);
......@@ -79,17 +84,7 @@ export const descriptiveModelToTables = jsonata(`
export const descriptiveSingleToTables = jsonata(`
(
$e := function($x, $r) {($x != null) ? $x : ($r ? $r : '')};
$fn := function($o, $prefix) {
$type($o) = 'object' ?
$each($o, function($v, $k) {(
$type($v) = 'object' ? { $k: $v.count & ' (' & $v.percentage & '%)' } : {
$k: $v
}
)}) ~> $merge()
: {}
};
${headerDescriptivie}
data.[
$.single.*@$p#$i.(
......
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