Skip to content

Commit a06c5a7

Browse files
add SingleNeuronSimulation and SingleNeuronSynaptomeSimulation (#73)
* add SingleNeuronSimulation and SingleNeuronSynaptomeSimulation * add synaptome-related entities and NestedMEModel
1 parent 6b45595 commit a06c5a7

File tree

8 files changed

+232
-7
lines changed

8 files changed

+232
-7
lines changed

src/entitysdk/models/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717
from entitysdk.models.mtype import MTypeClass
1818
from entitysdk.models.simulation import Simulation
1919
from entitysdk.models.simulation_campaign import SimulationCampaign
20+
from entitysdk.models.single_neuron_simulation import SingleNeuronSimulation
21+
from entitysdk.models.single_neuron_synaptome_simulation import SingleNeuronSynaptomeSimulation
2022
from entitysdk.models.subject import Subject
23+
from entitysdk.models.synaptome import SingleNeuronSynaptome
2124
from entitysdk.models.taxonomy import Species, Strain, Taxonomy
2225
from entitysdk.models.validation_result import ValidationResult
2326

@@ -43,6 +46,9 @@
4346
"Role",
4447
"Simulation",
4548
"SimulationCampaign",
49+
"SingleNeuronSimulation",
50+
"SingleNeuronSynaptome",
51+
"SingleNeuronSynaptomeSimulation",
4652
"Species",
4753
"Strain",
4854
"Subject",

src/entitysdk/models/memodel.py

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
from pydantic import Field
66

7+
from entitysdk.models.base import BaseModel
78
from entitysdk.models.contribution import Contribution
9+
from entitysdk.models.core import Identifiable
810
from entitysdk.models.emodel import EModel
911
from entitysdk.models.entity import Entity
1012
from entitysdk.models.etype import ETypeClass
@@ -20,7 +22,49 @@
2022
from entitysdk.types import ValidationStatus
2123

2224

23-
class MEModel(Entity):
25+
class MEModelBase(BaseModel):
26+
"""Base for simulatable neuron model."""
27+
28+
name: Annotated[
29+
str | None,
30+
Field(
31+
examples=["Entity 1"],
32+
description="The name of the entity.",
33+
),
34+
] = None
35+
description: Annotated[
36+
str | None,
37+
Field(
38+
examples=["This is entity 1"],
39+
description="The description of the entity.",
40+
),
41+
] = None
42+
validation_status: Annotated[
43+
ValidationStatus,
44+
Field(
45+
description="The validation status of the memodel.",
46+
),
47+
]
48+
49+
50+
class NestedMEModel(MEModelBase, Identifiable):
51+
"""Nested simulatable neuron model."""
52+
53+
etypes: Annotated[
54+
list[ETypeClass] | None,
55+
Field(
56+
description="The etype classes of the memodel.",
57+
),
58+
] = None
59+
mtypes: Annotated[
60+
list[MTypeClass] | None,
61+
Field(
62+
description="The mtype classes of the memodel.",
63+
),
64+
] = None
65+
66+
67+
class MEModel(MEModelBase, Entity):
2468
"""Simulatable neuron model."""
2569

2670
species: Annotated[
@@ -50,12 +94,6 @@ class MEModel(Entity):
5094
examples="1372346",
5195
),
5296
] = None
53-
validation_status: Annotated[
54-
ValidationStatus,
55-
Field(
56-
description="The validation status of the memodel.",
57-
),
58-
]
5997
holding_current: Annotated[
6098
float | None,
6199
Field(
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
"""Single neuron simulation."""
2+
3+
from typing import Annotated
4+
5+
from pydantic import Field
6+
7+
from entitysdk.models.entity import Entity
8+
from entitysdk.models.memodel import NestedMEModel
9+
from entitysdk.types import SingleNeuronSimulationStatus
10+
11+
12+
class SingleNeuronSimulation(Entity):
13+
"""Single neuron simulation."""
14+
15+
seed: Annotated[
16+
int,
17+
Field(
18+
description="Random number generator seed used during the simulation.",
19+
examples=42,
20+
),
21+
]
22+
injection_location: Annotated[
23+
list[str],
24+
Field(
25+
description="List of locations where the stimuli were injected, "
26+
"in hoc-compatible format.",
27+
examples="soma[0]",
28+
),
29+
]
30+
recording_location: Annotated[
31+
list[str],
32+
Field(
33+
description="List of locations where the stimuli were recorded, "
34+
"in hoc-compatible format.",
35+
examples="soma[0]",
36+
),
37+
]
38+
status: Annotated[
39+
SingleNeuronSimulationStatus,
40+
Field(
41+
description="Status of the simulation. Can be .started, .failure, .success",
42+
examples=SingleNeuronSimulationStatus.success,
43+
),
44+
]
45+
me_model: Annotated[
46+
NestedMEModel,
47+
Field(
48+
description="The me-model (single cell model) that was simulated, in nested form.",
49+
),
50+
]
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
"""Single neuron synaptome simulation."""
2+
3+
from typing import Annotated
4+
5+
from pydantic import Field
6+
7+
from entitysdk.models.entity import Entity
8+
from entitysdk.models.synaptome import NestedSynaptome
9+
from entitysdk.types import SingleNeuronSimulationStatus
10+
11+
12+
class SingleNeuronSynaptomeSimulation(Entity):
13+
"""Single neuron synaptome simulation."""
14+
15+
seed: Annotated[
16+
int,
17+
Field(
18+
description="Random number generator seed used during the simulation.",
19+
examples=42,
20+
),
21+
]
22+
injection_location: Annotated[
23+
list[str],
24+
Field(
25+
description="List of locations where the stimuli were injected, "
26+
"in hoc-compatible format.",
27+
examples="soma[0]",
28+
),
29+
]
30+
recording_location: Annotated[
31+
list[str],
32+
Field(
33+
description="List of locations where the stimuli were recorded, "
34+
"in hoc-compatible format.",
35+
examples="soma[0]",
36+
),
37+
]
38+
status: Annotated[
39+
SingleNeuronSimulationStatus,
40+
Field(
41+
description="Status of the simulation. Can be .started, .failure, .success",
42+
examples=SingleNeuronSimulationStatus.success,
43+
),
44+
]
45+
synaptome: Annotated[
46+
NestedSynaptome,
47+
Field(
48+
description="The synaptome that was simulated, in nested form.",
49+
examples="85663316-a7ff-4107-9eb9-236de8868c5c",
50+
),
51+
]

src/entitysdk/models/synaptome.py

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
"""Single neuron synaptome."""
2+
3+
from typing import Annotated
4+
5+
from pydantic import Field
6+
7+
from entitysdk.models.base import BaseModel
8+
from entitysdk.models.contribution import Contribution
9+
from entitysdk.models.core import Identifiable
10+
from entitysdk.models.entity import Entity
11+
from entitysdk.models.memodel import NestedMEModel
12+
from entitysdk.models.morphology import BrainRegion
13+
14+
15+
class SingleNeuronSynaptomeBase(BaseModel):
16+
"""Base for single neuron synaptome."""
17+
18+
name: Annotated[
19+
str | None,
20+
Field(
21+
examples=["Entity 1"],
22+
description="The name of the entity.",
23+
),
24+
] = None
25+
description: Annotated[
26+
str | None,
27+
Field(
28+
examples=["This is entity 1"],
29+
description="The description of the entity.",
30+
),
31+
] = None
32+
seed: Annotated[
33+
int,
34+
Field(
35+
description="Random number generator seed.",
36+
examples=42,
37+
),
38+
]
39+
40+
41+
class NestedSynaptome(SingleNeuronSynaptomeBase, Identifiable):
42+
"""Nested single neuron synaptome."""
43+
44+
pass
45+
46+
47+
class SingleNeuronSynaptome(SingleNeuronSynaptomeBase, Entity):
48+
"""Single neuron synaptome."""
49+
50+
brain_region: Annotated[
51+
BrainRegion,
52+
Field(description="The brain region where the memodel is used or applies."),
53+
]
54+
contributions: Annotated[
55+
list[Contribution] | None,
56+
Field(description="List of contributions related to this memodel."),
57+
] = None
58+
me_model: Annotated[
59+
NestedMEModel,
60+
Field(
61+
description="The me-model (single cell model) the synaptome applies to.",
62+
),
63+
]

src/entitysdk/route.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
"ReconstructionMorphology": "reconstruction-morphology",
2828
"Simulation": "simulation",
2929
"SimulationCampaign": "simulation-campaign",
30+
"SingleNeuronSimulation": "single-neuron-simulation",
31+
"SingleNeuronSynaptome": "single-neuron-synaptome",
32+
"SingleNeuronSynaptomeSimulation": "single-neuron-synaptome-simulation",
3033
"Role": "role",
3134
"Species": "species",
3235
"Strain": "strain",

src/entitysdk/types.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ class ValidationStatus(StrEnum):
2626
error = auto()
2727

2828

29+
class SingleNeuronSimulationStatus(StrEnum):
30+
"""Single neuron simulation status."""
31+
32+
started = auto()
33+
failure = auto()
34+
success = auto()
35+
36+
2937
class ElectricalRecordingType(StrEnum):
3038
"""Electrical cell recording type."""
3139

tests/integration/test_searching.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
Person,
1414
ReconstructionMorphology,
1515
Role,
16+
SingleNeuronSimulation,
17+
SingleNeuronSynaptome,
18+
SingleNeuronSynaptomeSimulation,
1619
Species,
1720
Strain,
1821
ValidationResult,
@@ -37,6 +40,9 @@
3740
ElectricalCellRecording,
3841
ValidationResult,
3942
MEModelCalibrationResult,
43+
SingleNeuronSimulation,
44+
SingleNeuronSynaptomeSimulation,
45+
SingleNeuronSynaptome,
4046
],
4147
)
4248
def test_is_searchable(entity_type, client):

0 commit comments

Comments
 (0)