Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
G
gateway
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
Show more breadcrumbs
sibmip
gateway
Commits
c952cfa2
Commit
c952cfa2
authored
1 year ago
by
Manuel Spuhler
Browse files
Options
Downloads
Patches
Plain Diff
fix: descriptive stats defensive coding
parent
5ae3c2c8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
api/src/engine/connectors/exareme/handlers/algorithms/descriptive.handler.ts
+23
-16
23 additions, 16 deletions
...ectors/exareme/handlers/algorithms/descriptive.handler.ts
with
23 additions
and
16 deletions
api/src/engine/connectors/exareme/handlers/algorithms/descriptive.handler.ts
+
23
−
16
View file @
c952cfa2
...
...
@@ -34,34 +34,41 @@ export default class DescriptiveHandler extends BaseHandler {
);
const
columns
=
(
variable
)
=>
{
const
stat
=
stats
.
filter
((
s
)
=>
s
.
variable
===
variable
);
const
data
=
(
key
)
=>
const
getProperty
=
(
key
)
=>
stat
.
map
((
d
)
=>
d
.
data
===
null
?
'
No Enough Data
'
:
d
.
data
[
key
]
||
''
,
d
.
data
===
null
||
d
.
data
===
undefined
?
'
Not Enough Data
'
:
d
.
data
[
key
]
||
''
,
);
const
getKeys
=
(
key
)
=>
stat
.
map
((
d
)
=>
(
d
.
data
===
undefined
?
{}
:
d
.
data
[
key
]));
const
stat
=
stats
.
filter
((
s
)
=>
s
.
variable
===
variable
);
const
modalities
=
Array
.
from
(
new
Set
(
data
(
'
counts
'
).
flatMap
((
c
)
=>
Object
.
keys
(
c
))),
new
Set
(
getKeys
(
'
counts
'
).
flatMap
((
c
)
=>
Object
.
keys
(
c
))),
);
const
notEnoughData
=
stat
.
map
((
d
)
=>
d
.
data
).
includes
(
null
);
return
(
(
notEnoughData
&&
[[
variable
,
...
data
(
'
num_total
'
)]])
||
[
[
this
.
lookup
(
variable
,
domain
),
...
data
(
'
num_total
'
)],
[
'
Datapoints
'
,
...
data
(
'
num_dtps
'
)],
[
'
NA
'
,
...
data
(
'
num_na
'
)],
(
notEnoughData
&&
[[
variable
,
...
getProperty
(
'
num_total
'
)]])
||
[
[
this
.
lookup
(
variable
,
domain
),
...
getProperty
(
'
num_total
'
)],
[
'
Datapoints
'
,
...
getProperty
(
'
num_dtps
'
)],
[
'
NA
'
,
...
getProperty
(
'
num_na
'
)],
...(
modalities
.
length
>
0
?
modalities
.
map
((
m
)
=>
[
m
,
...
stat
.
map
((
d
)
=>
d
.
data
.
counts
[
m
]
||
''
),
...
stat
.
map
((
d
)
=>
d
.
data
?
.
counts
[
m
]
||
''
),
])
:
[
[
'
SE
'
,
...
data
(
'
std
'
)],
[
'
mean
'
,
...
data
(
'
mean
'
)],
[
'
min
'
,
...
data
(
'
num_dtps
'
)],
[
'
Q1
'
,
...
data
(
'
q1
'
)],
[
'
Q2
'
,
...
data
(
'
q2
'
)],
[
'
Q3
'
,
...
data
(
'
q3
'
)],
[
'
max
'
,
...
data
(
'
max
'
)],
[
'
SE
'
,
...
getProperty
(
'
std
'
)],
[
'
mean
'
,
...
getProperty
(
'
mean
'
)],
[
'
min
'
,
...
getProperty
(
'
num_dtps
'
)],
[
'
Q1
'
,
...
getProperty
(
'
q1
'
)],
[
'
Q2
'
,
...
getProperty
(
'
q2
'
)],
[
'
Q3
'
,
...
getProperty
(
'
q3
'
)],
[
'
max
'
,
...
getProperty
(
'
max
'
)],
]),
]
);
...
...
This diff is collapsed.
Click to expand it.
Steve Reis
@stevereis93
mentioned in commit
11c63b16
·
1 year ago
mentioned in commit
11c63b16
mentioned in commit 11c63b1601985c136433ae0873432fb0d407e010
Toggle commit list
Steve Reis
@stevereis93
mentioned in commit
d2cb393c
·
1 year ago
mentioned in commit
d2cb393c
mentioned in commit d2cb393c3baf3c83a13e6b25ca10008602141fc8
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment