Skip to content

Commit

Permalink
fix: investigation file rows fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
oyurekten committed Sep 13, 2024
1 parent ef682f4 commit b664483
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions metabolights_utils/isatab/default/investigation_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,15 @@ def add_model_content(cls, prefix, items: List[IsaAbstractModel], properties):
field_key = to_camel(field)
header_name = properties[field_key]["header_name"]
header_name = f"{prefix} {header_name}".strip() if prefix else header_name
if "allOf" in properties[field_key] or "items" in properties[field_key]:
if "allOf" in "allOf" in properties[field_key]:
if (
"allOf" in properties[field_key]
or "items" in properties[field_key]
or "$ref" in properties[field_key]
):
if "allOf" in properties[field_key]:
item_ref: str = properties[field_key]["allOf"][0]["$ref"]
elif "$ref" in properties[field_key]:
item_ref: str = properties[field_key]["$ref"]
else:
item_ref: str = properties[field_key]["items"]["$ref"]
class_name = item_ref.replace("#/definitions/", "").replace(
Expand All @@ -347,17 +353,18 @@ def add_model_content(cls, prefix, items: List[IsaAbstractModel], properties):
if items
else [obj()]
)

item_values = cls.add_model_content(header_name, input_items, props)
rows.extend(item_values)
elif "type" in properties[field_key]:
cls.assign_type(
items, properties, rows, row_map, fields, i, header_name
)
elif "anyOf" in properties[field_key]:

cls.assign_string_type(items, rows, row_map, fields, i, header_name)

else:
logger.error(
f"Unsopported type {properties[field_key]} for prefix {prefix}"
)
return rows

@classmethod
Expand Down

0 comments on commit b664483

Please sign in to comment.