Skip to content

Commit

Permalink
Task/modify array splitter gim 27 (#20)
Browse files Browse the repository at this point in the history
* Adjust array splitter
  • Loading branch information
galinatremper committed Apr 17, 2023
1 parent 1fdc54b commit 1600055
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -542,5 +542,5 @@ valid-metaclass-classmethod-first-arg=cls

# Exceptions that will emit a warning when being caught. Defaults to
# "BaseException, Exception".
overgeneral-exceptions=BaseException,
Exception
overgeneral-exceptions=builtins.BaseException,
builtins.Exception
17 changes: 12 additions & 5 deletions metadata_transpiler_service/core/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,19 @@ async def generate_embedded_json_from(
submission_field_name,
line,
)
if embedded_json_fields:
if not embedded_json_fields:
continue
alias_list = [
v.strip() for v in embedded_json_fields["alias"].split(";")
]
for entity_alias in alias_list:
if submission_field.startswith("link_"):
embedded_json_fields["alias"] = entity_alias
ref_dictionary = await get_refs(
embedded_json_fields, ref_dictionary
)

if not await exists_in(
embedded_json_fields["alias"], embedded_list
):
if not await exists_in(entity_alias, embedded_list):
embedded_list.append(embedded_json_fields)

if submission_field.startswith("link_"):
Expand Down Expand Up @@ -237,7 +241,10 @@ async def transform(
) -> List:
"""Transform string value to list of values depending on the required type
(string, array, attribute(s), enumeration, embedded entity (concept))"""
list_values = cell_value.split(";")
if cell_type != "alias":
list_values = [v.strip() for v in cell_value.split(";")]
else:
list_values = [cell_value]
if cell_type == "has_attribute":
list_attr = []
if single_col_name is not None:
Expand Down

0 comments on commit 1600055

Please sign in to comment.