Commit 55b33257 authored by Christophe Benz's avatar Christophe Benz
Browse files

Do not parse twice

parent 3b88da65
Pipeline #352142 passed with stage
in 1 minute and 28 seconds
......@@ -24,7 +24,7 @@ from typing import (
)
import dirsync
from pydantic import ValidationError, parse_obj_as
from pydantic import ValidationError
from dbnomics_data_model.errors import DBnomicsDataModelError
from dbnomics_data_model.model.category_tree import CategoryTree
......@@ -1023,15 +1023,7 @@ class FileSystemStorage(Storage):
Start by reading series metadata in dataset.json `series` property,
and for each one read the corresponding TSV file for observations.
"""
try:
series_json_list = parse_obj_as(List[TsvSeriesJson], dataset_json.series)
except ValidationError as exc:
dataset_json_path = self.get_dataset_json_path(dataset_code)
raise SeriesMetadataLoadError(
f"Could not build model instances from the 'series' attribute of JSON file: {str(dataset_json_path)}"
) from exc
for series_json in series_json_list:
for series_json in dataset_json.series:
series_code = series_json.code
if series_codes is not None and series_code not in series_codes:
continue
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment