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(` ...@@ -34,19 +34,24 @@ export const transformToExperiment = jsonata(`
) )
`); `);
export const descriptiveModelToTables = jsonata(` const headerDescriptivie = `
( $e := function($x, $r) {($x != null) ? $fnum($x) : ($r ? $r : '')};
$e := function($x, $r) {($x != null) ? $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) { export const descriptiveModelToTables = jsonata(`
$type($o) = 'object' ? (
$each($o, function($v, $k) {( ${headerDescriptivie}
$type($v) = 'object' ? { $k: $v.count & ' (' & $v.percentage & '%)' } : {
$k: $v
}
)}) ~> $merge()
: {}
};
$vars := $count(data.single.*)-1; $vars := $count(data.single.*)-1;
$varName := $keys(data.single); $varName := $keys(data.single);
...@@ -79,17 +84,7 @@ export const descriptiveModelToTables = jsonata(` ...@@ -79,17 +84,7 @@ export const descriptiveModelToTables = jsonata(`
export const descriptiveSingleToTables = jsonata(` export const descriptiveSingleToTables = jsonata(`
( (
$e := function($x, $r) {($x != null) ? $x : ($r ? $r : '')}; ${headerDescriptivie}
$fn := function($o, $prefix) {
$type($o) = 'object' ?
$each($o, function($v, $k) {(
$type($v) = 'object' ? { $k: $v.count & ' (' & $v.percentage & '%)' } : {
$k: $v
}
)}) ~> $merge()
: {}
};
data.[ data.[
$.single.*@$p#$i.( $.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