Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
concepts-processing
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Package registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor 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
meldb
concepts-processing
Commits
3c3ae717
Commit
3c3ae717
authored
2 months ago
by
Jakub Dylag
Browse files
Options
Downloads
Patches
Plain Diff
Allow multiple files per concept set - validation passed
parent
7ec0e5c5
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
acmc/phen.py
+34
-33
34 additions, 33 deletions
acmc/phen.py
with
34 additions
and
33 deletions
acmc/phen.py
+
34
−
33
View file @
3c3ae717
...
...
@@ -514,46 +514,47 @@ def validate(phen_dir: str):
# create a list of all the concept set names defined in the concept set configuration
concept_set_names
=
[]
for
item
in
phenotype
[
"
concept_sets
"
]:
# if item["name"] in concept_set_names:
# validation_errors.append(
# f"Duplicate concept set defined in concept sets {item['name'] }"
# )
# else:
concept_set_names
.
append
(
item
[
"
name
"
])
# check codes definition
for
item
in
phenotype
[
"
concept_sets
"
]:
# check concepte code file exists
concept_code_file_path
=
concepts_path
/
item
[
"
file
"
][
"
path
"
]
if
not
concept_code_file_path
.
exists
():
validation_errors
.
append
(
f
"
Coding file
{
str
(
concept_code_file_path
.
resolve
())
}
does not exist
"
)
# check concepte code file is not empty
if
concept_code_file_path
.
stat
().
st_size
==
0
:
if
item
[
"
name
"
]
in
concept_set_names
:
validation_errors
.
append
(
f
"
Coding file
{
str
(
concept
_co
de
_
fi
le_path
.
resolve
())
}
is an empty file
"
f
"
Duplicate
concept
set
defi
ned in concept sets
{
item
[
'
name
'
]
}
"
)
else
:
concept_set_names
.
append
(
item
[
"
name
"
])
# check code file type is supported
if
concept_code_file_path
.
suffix
not
in
CODE_FILE_TYPES
:
raise
ValueError
(
f
"
Unsupported filetype
{
concept_code_file_path
.
suffix
}
, only support csv, xlsx, xls code file types
"
)
# check codes definition
for
files
in
phenotype
[
"
concept_sets
"
]:
for
item
in
files
[
"
files
"
]:
# check concepte code file exists
concept_code_file_path
=
concepts_path
/
item
[
"
path
"
]
if
not
concept_code_file_path
.
exists
():
validation_errors
.
append
(
f
"
Coding file
{
str
(
concept_code_file_path
.
resolve
())
}
does not exist
"
)
# check columns specified are a supported medical coding type
for
column
in
item
[
"
file
"
][
"
columns
"
]:
if
column
not
in
code_types
:
# check concepte code file is not empty
if
concept_code_file_path
.
stat
().
st_size
==
0
:
validation_errors
.
append
(
f
"
Co
lumn type
{
column
}
for
file
{
concept_code_file_path
}
is not supported
"
f
"
Co
ding
file
{
str
(
concept_code_file_path
.
resolve
())
}
is an empty file
"
)
# check the actions are supported
if
"
actions
"
in
item
[
"
file
"
]:
for
action
in
item
[
"
file
"
][
"
actions
"
]:
if
action
not
in
COL_ACTIONS
:
validation_errors
.
append
(
f
"
Action
{
action
}
is not supported
"
)
# check code file type is supported
if
concept_code_file_path
.
suffix
not
in
CODE_FILE_TYPES
:
raise
ValueError
(
f
"
Unsupported filetype
{
concept_code_file_path
.
suffix
}
, only support csv, xlsx, xls code file types
"
)
# check columns specified are a supported medical coding type
for
column
in
item
[
"
columns
"
]:
if
column
not
in
code_types
:
validation_errors
.
append
(
f
"
Column type
{
column
}
for file
{
concept_code_file_path
}
is not supported
"
)
# check the actions are supported
if
"
actions
"
in
item
:
for
action
in
item
[
"
actions
"
]:
if
action
not
in
COL_ACTIONS
:
validation_errors
.
append
(
f
"
Action
{
action
}
is not supported
"
)
if
len
(
validation_errors
)
>
0
:
_logger
.
error
(
validation_errors
)
...
...
This diff is collapsed.
Click to expand it.
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