Skip to content

task: update all CSV sample stores referencing deprecated fields #610

@AlessandroPomponio

Description

@AlessandroPomponio

Issue

CSVSampleStore has had two fields ("constitutivePropertyColumns", "propertyMap") deprecated for a while, and an upgrade path is in place until version 1.6.0:

@pydantic.model_validator(mode="before")
@classmethod
def migrate_old_format(cls, data: dict) -> dict:
"""Migrate old CSVSampleStoreDescription format to new format
Old format (the only one stored before these changes):
- constitutivePropertyColumns at top level (list)
- experiments list with propertyMap (not observedPropertyMap)
- No constitutivePropertyMap in experiment descriptions
Migration:
- Remove constitutivePropertyColumns from top level
- For each experiment desc dict, add constitutivePropertyMap = constitutivePropertyColumns
- For each experiment desc dict, rename propertyMap to observedPropertyMap
"""
if not isinstance(data, dict):
return data
# Check if this is old format (has constitutivePropertyColumns at top level)
if "constitutivePropertyColumns" not in data:
return data
# Old format detected - emit warning and perform migration
warn_deprecated_csv_sample_store_model_in_use(
deprecated_from_version="1.3.5",
removed_from_version="1.6.0",
deprecated_fields=["constitutivePropertyColumns", "propertyMap"],
)
constitutive_columns = data.pop("constitutivePropertyColumns")
# Migrate experiments if present
if "experiments" in data and isinstance(data["experiments"], list):
for exp in data["experiments"]:
if isinstance(exp, dict):
# Rename propertyMap to observedPropertyMap
if "propertyMap" in exp:
exp["observedPropertyMap"] = exp.pop("propertyMap")
# Add constitutivePropertyMap from top-level constitutivePropertyColumns
exp["constitutivePropertyMap"] = constitutive_columns
return data

At the same time, however, some examples YAMLs and some markdown files reference these old keys. Given that the next version will be 1.6.0, we should make sure these are updated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions