Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gateway
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
HBP Medical Informatics Platform
gateway
Commits
cc58c200
Commit
cc58c200
authored
3 years ago
by
stevereis
Browse files
Options
Downloads
Patches
Plain Diff
feat: datashield domain (datasets) integration
parent
995ab67e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/src/engine/connectors/datashield/main.connector.ts
+33
-7
33 additions, 7 deletions
api/src/engine/connectors/datashield/main.connector.ts
api/src/engine/connectors/datashield/transformations.ts
+28
-0
28 additions, 0 deletions
api/src/engine/connectors/datashield/transformations.ts
with
61 additions
and
7 deletions
api/src/engine/connectors/datashield/main.connector.ts
+
33
−
7
View file @
cc58c200
import
{
Observable
}
from
'
rxjs
'
;
import
{
firstValueFrom
,
Observable
}
from
'
rxjs
'
;
import
{
IEngineService
}
from
'
src/engine/engine.interfaces
'
;
import
{
IEngineOptions
,
IEngineService
}
from
'
src/engine/engine.interfaces
'
;
import
{
Domain
}
from
'
src/engine/models/domain.model
'
;
import
{
Domain
}
from
'
src/engine/models/domain.model
'
;
import
{
ExperimentCreateInput
}
from
'
src/engine/models/experiment/input/experiment-create.input
'
;
import
{
ExperimentCreateInput
}
from
'
src/engine/models/experiment/input/experiment-create.input
'
;
import
{
import
{
...
@@ -9,8 +9,20 @@ import {
...
@@ -9,8 +9,20 @@ import {
import
{
ListExperiments
}
from
'
src/engine/models/experiment/list-experiments.model
'
;
import
{
ListExperiments
}
from
'
src/engine/models/experiment/list-experiments.model
'
;
import
{
ExperimentEditInput
}
from
'
src/engine/models/experiment/input/experiment-edit.input
'
;
import
{
ExperimentEditInput
}
from
'
src/engine/models/experiment/input/experiment-edit.input
'
;
import
{
Algorithm
}
from
'
src/engine/models/experiment/algorithm.model
'
;
import
{
Algorithm
}
from
'
src/engine/models/experiment/algorithm.model
'
;
import
{
ENGINE_MODULE_OPTIONS
}
from
'
src/engine/engine.constants
'
;
import
{
Inject
}
from
'
@nestjs/common
'
;
import
{
HttpService
}
from
'
@nestjs/axios
'
;
import
{
REQUEST
}
from
'
@nestjs/core
'
;
import
{
Request
}
from
'
express
'
;
import
{
transformToDomains
}
from
'
./transformations
'
;
export
default
class
DataShieldService
implements
IEngineService
{
export
default
class
DataShieldService
implements
IEngineService
{
constructor
(
@
Inject
(
ENGINE_MODULE_OPTIONS
)
private
readonly
options
:
IEngineOptions
,
private
readonly
httpService
:
HttpService
,
@
Inject
(
REQUEST
)
private
readonly
req
:
Request
,
)
{}
logout
():
void
{
logout
():
void
{
throw
new
Error
(
'
Method not implemented.
'
);
throw
new
Error
(
'
Method not implemented.
'
);
}
}
...
@@ -50,12 +62,26 @@ export default class DataShieldService implements IEngineService {
...
@@ -50,12 +62,26 @@ export default class DataShieldService implements IEngineService {
throw
new
Error
(
'
Method not implemented.
'
);
throw
new
Error
(
'
Method not implemented.
'
);
}
}
getDomains
():
Domain
[]
{
async
getDomains
():
Promise
<
Domain
[]
>
{
throw
new
Error
(
'
Method not implemented.
'
);
const
path
=
this
.
options
.
baseurl
+
'
start
'
;
const
data
=
await
firstValueFrom
(
this
.
httpService
.
get
(
path
,
{
auth
:
{
username
:
'
guest
'
,
password
:
'
guest123
'
},
}),
);
return
[
transformToDomains
.
evaluate
(
data
.
data
)];
}
}
getActiveUser
():
string
{
getActiveUser
():
string
{
throw
new
Error
(
'
Method not implemented.
'
);
const
dummyUser
=
{
username
:
'
anonymous
'
,
subjectId
:
'
anonymousId
'
,
fullname
:
'
anonymous
'
,
email
:
'
anonymous@anonymous.com
'
,
agreeNDA
:
true
,
};
return
JSON
.
stringify
(
dummyUser
);
}
}
editActiveUser
():
Observable
<
string
>
{
editActiveUser
():
Observable
<
string
>
{
...
@@ -83,10 +109,10 @@ export default class DataShieldService implements IEngineService {
...
@@ -83,10 +109,10 @@ export default class DataShieldService implements IEngineService {
}
}
getExperiments
():
string
{
getExperiments
():
string
{
throw
new
Error
(
'
Method not implemented.
'
)
;
return
'
[]
'
;
}
}
getAlgorithmsREST
():
string
{
getAlgorithmsREST
():
string
{
throw
new
Error
(
'
Method not implemented.
'
)
;
return
'
[]
'
;
}
}
}
}
This diff is collapsed.
Click to expand it.
api/src/engine/connectors/datashield/transformations.ts
0 → 100644
+
28
−
0
View file @
cc58c200
// This file contains all transformation queries for JSONata
// see : https://docs.jsonata.org/
import
*
as
jsonata
from
'
jsonata
'
;
export
const
transformToDomains
=
jsonata
(
`
{
"id": "sophia",
"datasets": datasets.{
"id": $.id[0],
"label": $.label[0]
},
"rootGroup": {
"id": "rootGroup",
"label": "Root group",
"groups": groups.id
},
"groups": groups.{
"id": $.id[0],
"label": $.label[0],
"variables": $.variables
},
"variables": $distinct(groups.variables).{
"id": $,
"label": $
}
}
`
);
This diff is collapsed.
Click to expand it.
Preview
0%
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