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
35fb1696
Commit
35fb1696
authored
3 years ago
by
stevereis
Browse files
Options
Downloads
Patches
Plain Diff
Add comments and clean
parent
9e9f84ac
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/.env.defaults
+1
-1
1 addition, 1 deletion
api/.env.defaults
api/src/engine/connectors/csv/main.connector.ts
+10
-12
10 additions, 12 deletions
api/src/engine/connectors/csv/main.connector.ts
with
11 additions
and
13 deletions
api/.env.defaults
+
1
−
1
View file @
35fb1696
ENGINE_TYPE=csv
ENGINE_TYPE=csv
ENGINE_BASE_URL=http://
127.0.0.1:8080/services/
ENGINE_BASE_URL=http
s
://
docs.google.com/spreadsheets/d/1yjslZQCOMCxkjr4xQ-NmTMNEjhpdmZgijbn83za80Ak/export?format=tsv
GATEWAY_PORT=8081
GATEWAY_PORT=8081
\ No newline at end of file
This diff is collapsed.
Click to expand it.
api/src/engine/connectors/csv/main.connector.ts
+
10
−
12
View file @
35fb1696
...
@@ -55,8 +55,7 @@ export default class CSVService implements IEngineService {
...
@@ -55,8 +55,7 @@ export default class CSVService implements IEngineService {
}
}
async
getDomains
():
Promise
<
Domain
[]
>
{
async
getDomains
():
Promise
<
Domain
[]
>
{
const
path
=
const
path
=
this
.
options
.
baseurl
;
'
https://docs.google.com/spreadsheets/d/1yjslZQCOMCxkjr4xQ-NmTMNEjhpdmZgijbn83za80Ak/export?format=tsv
'
;
const
{
data
}
=
await
firstValueFrom
(
this
.
httpService
.
get
<
string
>
(
path
));
const
{
data
}
=
await
firstValueFrom
(
this
.
httpService
.
get
<
string
>
(
path
));
...
@@ -65,12 +64,12 @@ export default class CSVService implements IEngineService {
...
@@ -65,12 +64,12 @@ export default class CSVService implements IEngineService {
.
map
((
row
)
=>
row
.
split
(
'
\t
'
).
filter
((
i
)
=>
i
))
.
map
((
row
)
=>
row
.
split
(
'
\t
'
).
filter
((
i
)
=>
i
))
.
filter
((
row
)
=>
row
.
length
>=
2
);
.
filter
((
row
)
=>
row
.
length
>=
2
);
rows
.
shift
();
// headers
rows
.
shift
();
//
remove
headers
const
vars
=
[];
const
vars
=
[];
const
groups
:
Dictionary
<
Group
>
=
{};
const
groups
:
Dictionary
<
Group
>
=
{};
const
rootGroup
:
Group
=
{
const
rootGroup
:
Group
=
{
id
:
'
root
'
,
id
:
'
Global group
'
,
groups
:
[],
groups
:
[],
};
};
...
@@ -80,7 +79,7 @@ export default class CSVService implements IEngineService {
...
@@ -80,7 +79,7 @@ export default class CSVService implements IEngineService {
label
:
row
[
0
],
label
:
row
[
0
],
};
};
row
.
shift
();
row
.
shift
();
// get ride of the variable name, keep only groups
vars
.
push
(
variable
);
vars
.
push
(
variable
);
...
@@ -97,9 +96,9 @@ export default class CSVService implements IEngineService {
...
@@ -97,9 +96,9 @@ export default class CSVService implements IEngineService {
};
};
});
});
const
groupId
=
row
[
row
.
length
-
1
].
toLowerCase
();
const
groupId
=
row
[
row
.
length
-
1
].
toLowerCase
();
// group's variable container
groups
[
groupId
].
variables
=
[...
groups
[
groupId
].
variables
,
variable
.
id
];
groups
[
groupId
].
variables
.
push
(
variable
.
id
);
// add
variable
row
row
.
reverse
()
.
reverse
()
...
@@ -109,20 +108,19 @@ export default class CSVService implements IEngineService {
...
@@ -109,20 +108,19 @@ export default class CSVService implements IEngineService {
if
(
i
!==
row
.
length
-
1
)
{
if
(
i
!==
row
.
length
-
1
)
{
const
parentId
=
row
[
i
+
1
].
toLowerCase
();
const
parentId
=
row
[
i
+
1
].
toLowerCase
();
groups
[
parentId
].
groups
=
groups
[
parentId
].
groups
if
(
groups
[
parentId
].
groups
.
indexOf
(
groupId
)
===
-
1
)
?
[...
new
Set
([...
groups
[
parentId
].
groups
,
groupId
])]
groups
[
parentId
].
groups
.
push
(
groupId
);
:
[
groupId
];
}
}
});
});
});
});
rootGroup
.
groups
=
[...
new
Set
(
rootGroup
.
groups
)];
rootGroup
.
groups
=
[...
new
Set
(
rootGroup
.
groups
)];
// get distinct values
return
[
return
[
{
{
id
:
'
Dummy
'
,
id
:
'
Dummy
'
,
label
:
'
Dummy
'
,
label
:
'
Dummy
'
,
datasets
:
[{
id
:
'
DummyDataset
'
,
label
:
'
DummyDataset
'
}],
datasets
:
[{
id
:
'
DummyDataset
'
,
label
:
'
Dummy
Dataset
'
}],
groups
:
Object
.
values
(
groups
),
groups
:
Object
.
values
(
groups
),
rootGroup
:
rootGroup
,
rootGroup
:
rootGroup
,
variables
:
vars
,
variables
:
vars
,
...
...
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