From 7b942f7613f381178e7e7b194272b9583b71d992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien?= Date: Fri, 16 May 2025 16:24:07 +0200 Subject: [PATCH 01/10] add EModel --- src/entitysdk/models/emodel.py | 98 ++++++++++++++++++++++++++++++ src/entitysdk/models/etype.py | 28 +++++++++ src/entitysdk/models/morphology.py | 4 +- src/entitysdk/route.py | 1 + 4 files changed, 129 insertions(+), 2 deletions(-) create mode 100644 src/entitysdk/models/emodel.py create mode 100644 src/entitysdk/models/etype.py diff --git a/src/entitysdk/models/emodel.py b/src/entitysdk/models/emodel.py new file mode 100644 index 00000000..3abfaa31 --- /dev/null +++ b/src/entitysdk/models/emodel.py @@ -0,0 +1,98 @@ +"""Ion channel model.""" + +from typing import Annotated + +from pydantic import Field + +from entitysdk.mixin import HasAssets +from entitysdk.models.contribution import Contribution +from entitysdk.models.entity import Entity +from entitysdk.models.etype import ETypeClass +from entitysdk.models.morphology import BrainRegion, License, Species, Strain, ReconstructionMorphology +from entitysdk.models.mtype import MTypeClass +from entitysdk.models.ion_channel_model import IonChannelModel + + +class EModel(HasAssets, Entity): + """Electrical cell model.""" + + name: Annotated[ + str, + Field( + description="The name of the emodel.", + examples="EMS__1372346__cADpyr__13", + ), + ] + description: Annotated[ + str, + Field( + description="A description of the emodel.", + examples="Canonical placeholder morphology e-model with soma and axon initial segment.", + ), + ] + species: Annotated[ + Species, + Field(description="The species for which the emodel applies."), + ] + strain: Annotated[ + Strain | None, + Field(description="The specific strain of the species, if applicable."), + ] = None + brain_region: Annotated[ + BrainRegion, + Field(description="The brain region where the emodel is used or applies."), + ] + license: Annotated[ + License | None, + Field(description="License under which the emodel is distributed."), + ] = None + contributions: Annotated[ + list[Contribution] | None, + Field(description="List of contributions related to this emodel."), + ] = None + iteration: Annotated[ + str, + Field( + description="The iteration of the emodel used during optimisation.", + examples="1372346", + ), + ] + score: Annotated[ + float, + Field( + description="The score of the emodel gotten during validation.", + examples=54.0, + ), + ] + seed: Annotated[ + int, + Field( + description="The RNG seed used during optimisation.", + examples=13, + ), + ] + exemplar_morphology: Annotated[ + ReconstructionMorphology, + Field( + description="The morphology used during optimisation.", + ), + ] = None + etypes: Annotated[ + list[ETypeClass] | None, + Field( + description="The etype classes of the morphology.", + ), + ] = None + mtypes: Annotated[ + list[MTypeClass] | None, + Field( + description="The mtype classes of the morphology.", + ), + ] = None + ion_channel_models: Annotated[ + list[IonChannelModel] | None, + Field( + description="List of ion channel models.", + ), + ] = None + legacy_id: list[str] | None = None diff --git a/src/entitysdk/models/etype.py b/src/entitysdk/models/etype.py new file mode 100644 index 00000000..6d129fe4 --- /dev/null +++ b/src/entitysdk/models/etype.py @@ -0,0 +1,28 @@ +"""EType classification models.""" + +from typing import Annotated + +from pydantic import Field + +from entitysdk.models.entity import Entity + + +class ETypeClass(Entity): + """EType model class.""" + + pref_label: Annotated[ + str, + Field( + description="The preferred label of the etype class.", + ), + ] + definition: Annotated[ + str, + Field( + description="The definition of the etype class.", + ), + ] + alt_label: Annotated[ + str | None, + Field(description="The alternative label of th etype class."), + ] diff --git a/src/entitysdk/models/morphology.py b/src/entitysdk/models/morphology.py index 2e25bd65..cd127401 100644 --- a/src/entitysdk/models/morphology.py +++ b/src/entitysdk/models/morphology.py @@ -149,7 +149,7 @@ class ReconstructionMorphology(HasAssets, Entity): Field( description="The region of the brain where the morphology is located.", ), - ] + ] = None description: Annotated[ str, Field( @@ -162,7 +162,7 @@ class ReconstructionMorphology(HasAssets, Entity): Field( description="The species of the morphology.", ), - ] + ] = None strain: Annotated[ Strain | None, Field( diff --git a/src/entitysdk/route.py b/src/entitysdk/route.py index dd953613..38d49987 100644 --- a/src/entitysdk/route.py +++ b/src/entitysdk/route.py @@ -22,6 +22,7 @@ "Taxonomy": "taxonomy", "IonChannelModel": "ion-channel-model", "Ion": "ion", + "EModel": "emodel", } From bc4a43fc83d556eb908c9297850a1a886bc74fab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien?= Date: Fri, 16 May 2025 16:38:11 +0200 Subject: [PATCH 02/10] lint fix --- src/entitysdk/models/emodel.py | 14 ++++++++++---- src/entitysdk/models/morphology.py | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/entitysdk/models/emodel.py b/src/entitysdk/models/emodel.py index 3abfaa31..8739294a 100644 --- a/src/entitysdk/models/emodel.py +++ b/src/entitysdk/models/emodel.py @@ -1,4 +1,4 @@ -"""Ion channel model.""" +"""Electrical cell model.""" from typing import Annotated @@ -8,9 +8,15 @@ from entitysdk.models.contribution import Contribution from entitysdk.models.entity import Entity from entitysdk.models.etype import ETypeClass -from entitysdk.models.morphology import BrainRegion, License, Species, Strain, ReconstructionMorphology -from entitysdk.models.mtype import MTypeClass from entitysdk.models.ion_channel_model import IonChannelModel +from entitysdk.models.morphology import ( + BrainRegion, + License, + ReconstructionMorphology, + Species, + Strain, +) +from entitysdk.models.mtype import MTypeClass class EModel(HasAssets, Entity): @@ -72,7 +78,7 @@ class EModel(HasAssets, Entity): ), ] exemplar_morphology: Annotated[ - ReconstructionMorphology, + ReconstructionMorphology | None, Field( description="The morphology used during optimisation.", ), diff --git a/src/entitysdk/models/morphology.py b/src/entitysdk/models/morphology.py index cd127401..2e25bd65 100644 --- a/src/entitysdk/models/morphology.py +++ b/src/entitysdk/models/morphology.py @@ -149,7 +149,7 @@ class ReconstructionMorphology(HasAssets, Entity): Field( description="The region of the brain where the morphology is located.", ), - ] = None + ] description: Annotated[ str, Field( @@ -162,7 +162,7 @@ class ReconstructionMorphology(HasAssets, Entity): Field( description="The species of the morphology.", ), - ] = None + ] strain: Annotated[ Strain | None, Field( From 96fafd18a6f2da1c3731942f98c2dcf3f9b97247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien?= Date: Fri, 16 May 2025 16:24:07 +0200 Subject: [PATCH 03/10] add EModel --- src/entitysdk/models/emodel.py | 98 ++++++++++++++++++++++++++++++ src/entitysdk/models/etype.py | 28 +++++++++ src/entitysdk/models/morphology.py | 4 +- src/entitysdk/route.py | 1 + 4 files changed, 129 insertions(+), 2 deletions(-) create mode 100644 src/entitysdk/models/emodel.py create mode 100644 src/entitysdk/models/etype.py diff --git a/src/entitysdk/models/emodel.py b/src/entitysdk/models/emodel.py new file mode 100644 index 00000000..3abfaa31 --- /dev/null +++ b/src/entitysdk/models/emodel.py @@ -0,0 +1,98 @@ +"""Ion channel model.""" + +from typing import Annotated + +from pydantic import Field + +from entitysdk.mixin import HasAssets +from entitysdk.models.contribution import Contribution +from entitysdk.models.entity import Entity +from entitysdk.models.etype import ETypeClass +from entitysdk.models.morphology import BrainRegion, License, Species, Strain, ReconstructionMorphology +from entitysdk.models.mtype import MTypeClass +from entitysdk.models.ion_channel_model import IonChannelModel + + +class EModel(HasAssets, Entity): + """Electrical cell model.""" + + name: Annotated[ + str, + Field( + description="The name of the emodel.", + examples="EMS__1372346__cADpyr__13", + ), + ] + description: Annotated[ + str, + Field( + description="A description of the emodel.", + examples="Canonical placeholder morphology e-model with soma and axon initial segment.", + ), + ] + species: Annotated[ + Species, + Field(description="The species for which the emodel applies."), + ] + strain: Annotated[ + Strain | None, + Field(description="The specific strain of the species, if applicable."), + ] = None + brain_region: Annotated[ + BrainRegion, + Field(description="The brain region where the emodel is used or applies."), + ] + license: Annotated[ + License | None, + Field(description="License under which the emodel is distributed."), + ] = None + contributions: Annotated[ + list[Contribution] | None, + Field(description="List of contributions related to this emodel."), + ] = None + iteration: Annotated[ + str, + Field( + description="The iteration of the emodel used during optimisation.", + examples="1372346", + ), + ] + score: Annotated[ + float, + Field( + description="The score of the emodel gotten during validation.", + examples=54.0, + ), + ] + seed: Annotated[ + int, + Field( + description="The RNG seed used during optimisation.", + examples=13, + ), + ] + exemplar_morphology: Annotated[ + ReconstructionMorphology, + Field( + description="The morphology used during optimisation.", + ), + ] = None + etypes: Annotated[ + list[ETypeClass] | None, + Field( + description="The etype classes of the morphology.", + ), + ] = None + mtypes: Annotated[ + list[MTypeClass] | None, + Field( + description="The mtype classes of the morphology.", + ), + ] = None + ion_channel_models: Annotated[ + list[IonChannelModel] | None, + Field( + description="List of ion channel models.", + ), + ] = None + legacy_id: list[str] | None = None diff --git a/src/entitysdk/models/etype.py b/src/entitysdk/models/etype.py new file mode 100644 index 00000000..6d129fe4 --- /dev/null +++ b/src/entitysdk/models/etype.py @@ -0,0 +1,28 @@ +"""EType classification models.""" + +from typing import Annotated + +from pydantic import Field + +from entitysdk.models.entity import Entity + + +class ETypeClass(Entity): + """EType model class.""" + + pref_label: Annotated[ + str, + Field( + description="The preferred label of the etype class.", + ), + ] + definition: Annotated[ + str, + Field( + description="The definition of the etype class.", + ), + ] + alt_label: Annotated[ + str | None, + Field(description="The alternative label of th etype class."), + ] diff --git a/src/entitysdk/models/morphology.py b/src/entitysdk/models/morphology.py index 117598cb..faa734b6 100644 --- a/src/entitysdk/models/morphology.py +++ b/src/entitysdk/models/morphology.py @@ -35,7 +35,7 @@ class ReconstructionMorphology(HasAssets, Entity): Field( description="The region of the brain where the morphology is located.", ), - ] + ] = None description: Annotated[ str, Field( @@ -48,7 +48,7 @@ class ReconstructionMorphology(HasAssets, Entity): Field( description="The species of the morphology.", ), - ] + ] = None strain: Annotated[ Strain | None, Field( diff --git a/src/entitysdk/route.py b/src/entitysdk/route.py index dd953613..38d49987 100644 --- a/src/entitysdk/route.py +++ b/src/entitysdk/route.py @@ -22,6 +22,7 @@ "Taxonomy": "taxonomy", "IonChannelModel": "ion-channel-model", "Ion": "ion", + "EModel": "emodel", } From 5d84ea02c669ecf94a282c598cbf5b5d352855df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien?= Date: Fri, 16 May 2025 16:38:11 +0200 Subject: [PATCH 04/10] lint fix --- src/entitysdk/models/emodel.py | 14 ++++++++++---- src/entitysdk/models/morphology.py | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/entitysdk/models/emodel.py b/src/entitysdk/models/emodel.py index 3abfaa31..8739294a 100644 --- a/src/entitysdk/models/emodel.py +++ b/src/entitysdk/models/emodel.py @@ -1,4 +1,4 @@ -"""Ion channel model.""" +"""Electrical cell model.""" from typing import Annotated @@ -8,9 +8,15 @@ from entitysdk.models.contribution import Contribution from entitysdk.models.entity import Entity from entitysdk.models.etype import ETypeClass -from entitysdk.models.morphology import BrainRegion, License, Species, Strain, ReconstructionMorphology -from entitysdk.models.mtype import MTypeClass from entitysdk.models.ion_channel_model import IonChannelModel +from entitysdk.models.morphology import ( + BrainRegion, + License, + ReconstructionMorphology, + Species, + Strain, +) +from entitysdk.models.mtype import MTypeClass class EModel(HasAssets, Entity): @@ -72,7 +78,7 @@ class EModel(HasAssets, Entity): ), ] exemplar_morphology: Annotated[ - ReconstructionMorphology, + ReconstructionMorphology | None, Field( description="The morphology used during optimisation.", ), diff --git a/src/entitysdk/models/morphology.py b/src/entitysdk/models/morphology.py index faa734b6..117598cb 100644 --- a/src/entitysdk/models/morphology.py +++ b/src/entitysdk/models/morphology.py @@ -35,7 +35,7 @@ class ReconstructionMorphology(HasAssets, Entity): Field( description="The region of the brain where the morphology is located.", ), - ] = None + ] description: Annotated[ str, Field( @@ -48,7 +48,7 @@ class ReconstructionMorphology(HasAssets, Entity): Field( description="The species of the morphology.", ), - ] = None + ] strain: Annotated[ Strain | None, Field( From c76f17d7a0e53815014713a8ef40f144acd34ee4 Mon Sep 17 00:00:00 2001 From: Eleftherios Zisis Date: Sat, 17 May 2025 19:17:49 +0200 Subject: [PATCH 05/10] Make morphology's brain_region/species optional --- src/entitysdk/models/__init__.py | 2 ++ src/entitysdk/models/morphology.py | 8 ++++---- tests/integration/test_searching.py | 5 +++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/entitysdk/models/__init__.py b/src/entitysdk/models/__init__.py index 8990317d..65dc94fa 100644 --- a/src/entitysdk/models/__init__.py +++ b/src/entitysdk/models/__init__.py @@ -10,12 +10,14 @@ from entitysdk.models.morphology import ReconstructionMorphology from entitysdk.models.mtype import MTypeClass from entitysdk.models.taxonomy import Species, Strain, Taxonomy +from entitysdk.models.emodel import EModel __all__ = [ "Asset", "BrainLocation", "BrainRegion", "Contribution", + "EModel", "IonChannelModel", "License", "MTypeClass", diff --git a/src/entitysdk/models/morphology.py b/src/entitysdk/models/morphology.py index 117598cb..92e9c3e7 100644 --- a/src/entitysdk/models/morphology.py +++ b/src/entitysdk/models/morphology.py @@ -31,11 +31,11 @@ class ReconstructionMorphology(HasAssets, Entity): ), ] = None brain_region: Annotated[ - BrainRegion, + BrainRegion | None, Field( description="The region of the brain where the morphology is located.", ), - ] + ] = None description: Annotated[ str, Field( @@ -44,11 +44,11 @@ class ReconstructionMorphology(HasAssets, Entity): ), ] species: Annotated[ - Species, + Species | None, Field( description="The species of the morphology.", ), - ] + ] = None strain: Annotated[ Strain | None, Field( diff --git a/tests/integration/test_searching.py b/tests/integration/test_searching.py index 443ab2a2..88f94c30 100644 --- a/tests/integration/test_searching.py +++ b/tests/integration/test_searching.py @@ -11,6 +11,10 @@ Role, Species, Strain, + Role, + Organization, + Person, + EModel, ) @@ -27,6 +31,7 @@ Species, Strain, Organization, + EModel, ], ) def test_is_searchable(entity_type, client): From c75395cd3ec366a6fc4facc7bfa4739e76ac57b8 Mon Sep 17 00:00:00 2001 From: Eleftherios Zisis Date: Sat, 17 May 2025 19:20:34 +0200 Subject: [PATCH 06/10] Format --- src/entitysdk/models/__init__.py | 2 +- tests/integration/test_searching.py | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/entitysdk/models/__init__.py b/src/entitysdk/models/__init__.py index 65dc94fa..86a768fc 100644 --- a/src/entitysdk/models/__init__.py +++ b/src/entitysdk/models/__init__.py @@ -5,12 +5,12 @@ from entitysdk.models.brain_location import BrainLocation from entitysdk.models.brain_region import BrainRegion from entitysdk.models.contribution import Contribution, Role +from entitysdk.models.emodel import EModel from entitysdk.models.ion_channel_model import IonChannelModel, NeuronBlock, UseIon from entitysdk.models.license import License from entitysdk.models.morphology import ReconstructionMorphology from entitysdk.models.mtype import MTypeClass from entitysdk.models.taxonomy import Species, Strain, Taxonomy -from entitysdk.models.emodel import EModel __all__ = [ "Asset", diff --git a/tests/integration/test_searching.py b/tests/integration/test_searching.py index 88f94c30..9b410662 100644 --- a/tests/integration/test_searching.py +++ b/tests/integration/test_searching.py @@ -2,6 +2,7 @@ from entitysdk.models import ( Contribution, + EModel, IonChannelModel, License, MTypeClass, @@ -11,10 +12,6 @@ Role, Species, Strain, - Role, - Organization, - Person, - EModel, ) From 46c79f5fa1ff09f478ca8ea3f424630a21c9b4a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien?= Date: Mon, 19 May 2025 11:46:44 +0200 Subject: [PATCH 07/10] add MEModel --- src/entitysdk/models/__init__.py | 2 + src/entitysdk/models/emodel.py | 4 +- src/entitysdk/models/memodel.py | 111 ++++++++++++++++++++++++++++ src/entitysdk/route.py | 1 + tests/integration/test_searching.py | 2 + 5 files changed, 118 insertions(+), 2 deletions(-) create mode 100644 src/entitysdk/models/memodel.py diff --git a/src/entitysdk/models/__init__.py b/src/entitysdk/models/__init__.py index 86a768fc..3e6bcddd 100644 --- a/src/entitysdk/models/__init__.py +++ b/src/entitysdk/models/__init__.py @@ -8,6 +8,7 @@ from entitysdk.models.emodel import EModel from entitysdk.models.ion_channel_model import IonChannelModel, NeuronBlock, UseIon from entitysdk.models.license import License +from entitysdk.models.memodel import MEModel from entitysdk.models.morphology import ReconstructionMorphology from entitysdk.models.mtype import MTypeClass from entitysdk.models.taxonomy import Species, Strain, Taxonomy @@ -20,6 +21,7 @@ "EModel", "IonChannelModel", "License", + "MEModel", "MTypeClass", "NeuronBlock", "Organization", diff --git a/src/entitysdk/models/emodel.py b/src/entitysdk/models/emodel.py index 8739294a..b8e9cec7 100644 --- a/src/entitysdk/models/emodel.py +++ b/src/entitysdk/models/emodel.py @@ -86,13 +86,13 @@ class EModel(HasAssets, Entity): etypes: Annotated[ list[ETypeClass] | None, Field( - description="The etype classes of the morphology.", + description="The etype classes of the emodel.", ), ] = None mtypes: Annotated[ list[MTypeClass] | None, Field( - description="The mtype classes of the morphology.", + description="The mtype classes of the emodel.", ), ] = None ion_channel_models: Annotated[ diff --git a/src/entitysdk/models/memodel.py b/src/entitysdk/models/memodel.py new file mode 100644 index 00000000..0033c85b --- /dev/null +++ b/src/entitysdk/models/memodel.py @@ -0,0 +1,111 @@ +"""Simulatable neuron model.""" + +from typing import Annotated + +from pydantic import Field + +from app.db.types import ValidationStatus +from entitysdk.mixin import HasAssets +from entitysdk.models.contribution import Contribution +from entitysdk.models.emodel import EModel +from entitysdk.models.entity import Entity +from entitysdk.models.etype import ETypeClass +from entitysdk.models.morphology import ( + BrainRegion, + License, + ReconstructionMorphology, + Species, + Strain, +) +from entitysdk.models.mtype import MTypeClass + + +class MEModel(HasAssets, Entity): + """Simulatable neuron model.""" + + name: Annotated[ + str, + Field( + description="The name of the memodel.", + examples="MEM__C060114A5__cADpyr_L5_TPC:A", + ), + ] + description: Annotated[ + str, + Field( + description="A description of the memodel.", + examples="This MEModel is part of OBI curated dataset of morpho-electric models.", + ), + ] + species: Annotated[ + Species, + Field(description="The species for which the memodel applies."), + ] + strain: Annotated[ + Strain | None, + Field(description="The specific strain of the species, if applicable."), + ] = None + brain_region: Annotated[ + BrainRegion, + Field(description="The brain region where the memodel is used or applies."), + ] + license: Annotated[ + License | None, + Field(description="License under which the memodel is distributed."), + ] = None + contributions: Annotated[ + list[Contribution] | None, + Field(description="List of contributions related to this memodel."), + ] = None + iteration: Annotated[ + str | None, + Field( + description="The iteration of the memodel used during optimisation.", + examples="1372346", + ), + ] = None + validation_status: Annotated[ + ValidationStatus, + Field( + description="The validation status of the memodel.", + ), + ] + holding_current: Annotated[ + float, + Field( + description="The holding current of the memodel.", + examples=0.0, + ), + ] = 0.0 + threshold_current: Annotated[ + float, + Field( + description="The threshold current of the memodel.", + examples=0.1, + ), + ] = 0.1 + morphology: Annotated[ + ReconstructionMorphology, + Field( + description="The morphology of the memodel.", + ), + ] + emodel: Annotated[ + EModel, + Field( + description="The emodel of the memodel.", + ), + ] + etypes: Annotated[ + list[ETypeClass] | None, + Field( + description="The etype classes of the memodel.", + ), + ] = None + mtypes: Annotated[ + list[MTypeClass] | None, + Field( + description="The mtype classes of the memodel.", + ), + ] = None + legacy_id: list[str] | None = None diff --git a/src/entitysdk/route.py b/src/entitysdk/route.py index 38d49987..893e3f7d 100644 --- a/src/entitysdk/route.py +++ b/src/entitysdk/route.py @@ -23,6 +23,7 @@ "IonChannelModel": "ion-channel-model", "Ion": "ion", "EModel": "emodel", + "MEModel": "memodel", } diff --git a/tests/integration/test_searching.py b/tests/integration/test_searching.py index 9b410662..6ab22f37 100644 --- a/tests/integration/test_searching.py +++ b/tests/integration/test_searching.py @@ -5,6 +5,7 @@ EModel, IonChannelModel, License, + MEModel, MTypeClass, Organization, Person, @@ -29,6 +30,7 @@ Strain, Organization, EModel, + MEModel, ], ) def test_is_searchable(entity_type, client): From 330348e71775ff1f2dced8d1c632d82716861b49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien?= Date: Mon, 19 May 2025 11:49:15 +0200 Subject: [PATCH 08/10] update EModel and MEModel according to latest changes in Entity --- src/entitysdk/models/emodel.py | 17 +---------------- src/entitysdk/models/memodel.py | 17 +---------------- 2 files changed, 2 insertions(+), 32 deletions(-) diff --git a/src/entitysdk/models/emodel.py b/src/entitysdk/models/emodel.py index b8e9cec7..04a7ec28 100644 --- a/src/entitysdk/models/emodel.py +++ b/src/entitysdk/models/emodel.py @@ -4,7 +4,6 @@ from pydantic import Field -from entitysdk.mixin import HasAssets from entitysdk.models.contribution import Contribution from entitysdk.models.entity import Entity from entitysdk.models.etype import ETypeClass @@ -19,23 +18,9 @@ from entitysdk.models.mtype import MTypeClass -class EModel(HasAssets, Entity): +class EModel(Entity): """Electrical cell model.""" - name: Annotated[ - str, - Field( - description="The name of the emodel.", - examples="EMS__1372346__cADpyr__13", - ), - ] - description: Annotated[ - str, - Field( - description="A description of the emodel.", - examples="Canonical placeholder morphology e-model with soma and axon initial segment.", - ), - ] species: Annotated[ Species, Field(description="The species for which the emodel applies."), diff --git a/src/entitysdk/models/memodel.py b/src/entitysdk/models/memodel.py index 0033c85b..758314db 100644 --- a/src/entitysdk/models/memodel.py +++ b/src/entitysdk/models/memodel.py @@ -5,7 +5,6 @@ from pydantic import Field from app.db.types import ValidationStatus -from entitysdk.mixin import HasAssets from entitysdk.models.contribution import Contribution from entitysdk.models.emodel import EModel from entitysdk.models.entity import Entity @@ -20,23 +19,9 @@ from entitysdk.models.mtype import MTypeClass -class MEModel(HasAssets, Entity): +class MEModel(Entity): """Simulatable neuron model.""" - name: Annotated[ - str, - Field( - description="The name of the memodel.", - examples="MEM__C060114A5__cADpyr_L5_TPC:A", - ), - ] - description: Annotated[ - str, - Field( - description="A description of the memodel.", - examples="This MEModel is part of OBI curated dataset of morpho-electric models.", - ), - ] species: Annotated[ Species, Field(description="The species for which the memodel applies."), From 47c519a70381c45a472fe23e4bc3e390c416a0cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien?= Date: Mon, 19 May 2025 13:38:40 +0200 Subject: [PATCH 09/10] make ETypeClass an Identifiable --- src/entitysdk/models/etype.py | 4 ++-- src/entitysdk/models/memodel.py | 2 +- src/entitysdk/models/morphology.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/entitysdk/models/etype.py b/src/entitysdk/models/etype.py index 6d129fe4..6b47d079 100644 --- a/src/entitysdk/models/etype.py +++ b/src/entitysdk/models/etype.py @@ -4,10 +4,10 @@ from pydantic import Field -from entitysdk.models.entity import Entity +from entitysdk.models.core import Identifiable -class ETypeClass(Entity): +class ETypeClass(Identifiable): """EType model class.""" pref_label: Annotated[ diff --git a/src/entitysdk/models/memodel.py b/src/entitysdk/models/memodel.py index 758314db..e69a27bf 100644 --- a/src/entitysdk/models/memodel.py +++ b/src/entitysdk/models/memodel.py @@ -2,9 +2,9 @@ from typing import Annotated +from app.db.types import ValidationStatus from pydantic import Field -from app.db.types import ValidationStatus from entitysdk.models.contribution import Contribution from entitysdk.models.emodel import EModel from entitysdk.models.entity import Entity diff --git a/src/entitysdk/models/morphology.py b/src/entitysdk/models/morphology.py index 624aec88..727a893e 100644 --- a/src/entitysdk/models/morphology.py +++ b/src/entitysdk/models/morphology.py @@ -26,7 +26,7 @@ class ReconstructionMorphology(Entity): Field( description="The region of the brain where the morphology is located.", ), - ] + ] = None species: Annotated[ Species | None, Field( From cf5fef5718d51d0fc15dc778d84d1ddabccf481f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien?= Date: Mon, 19 May 2025 13:50:02 +0200 Subject: [PATCH 10/10] define ValidationStatus in typedef.py --- src/entitysdk/models/memodel.py | 2 +- src/entitysdk/typedef.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/entitysdk/models/memodel.py b/src/entitysdk/models/memodel.py index e69a27bf..1d1a72f8 100644 --- a/src/entitysdk/models/memodel.py +++ b/src/entitysdk/models/memodel.py @@ -2,7 +2,6 @@ from typing import Annotated -from app.db.types import ValidationStatus from pydantic import Field from entitysdk.models.contribution import Contribution @@ -17,6 +16,7 @@ Strain, ) from entitysdk.models.mtype import MTypeClass +from entitysdk.typedef import ValidationStatus class MEModel(Entity): diff --git a/src/entitysdk/typedef.py b/src/entitysdk/typedef.py index 3ea7063f..119b79a6 100644 --- a/src/entitysdk/typedef.py +++ b/src/entitysdk/typedef.py @@ -1,7 +1,7 @@ """Type definitions.""" import uuid -from enum import StrEnum +from enum import StrEnum, auto ID = uuid.UUID @@ -11,3 +11,13 @@ class DeploymentEnvironment(StrEnum): staging = "staging" production = "production" + + +class ValidationStatus(StrEnum): + """Validation status.""" + + created = auto() + initialized = auto() + running = auto() + done = auto() + error = auto()