entitysdk 0.2.1__tar.gz → 0.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. {entitysdk-0.2.1/src/entitysdk.egg-info → entitysdk-0.2.3}/PKG-INFO +17 -2
  2. {entitysdk-0.2.1 → entitysdk-0.2.3}/README.md +16 -1
  3. entitysdk-0.2.1/examples/searching.ipynb → entitysdk-0.2.3/examples/01_searching.ipynb +14 -7
  4. entitysdk-0.2.1/examples/morphology.ipynb → entitysdk-0.2.3/examples/02_morphology.ipynb +52 -15
  5. entitysdk-0.2.1/examples/contribution.ipynb → entitysdk-0.2.3/examples/03_contribution.ipynb +13 -6
  6. {entitysdk-0.2.1 → entitysdk-0.2.3}/src/entitysdk/client.py +1 -1
  7. {entitysdk-0.2.1 → entitysdk-0.2.3}/src/entitysdk/common.py +1 -1
  8. entitysdk-0.2.3/src/entitysdk/models/__init__.py +37 -0
  9. entitysdk-0.2.3/src/entitysdk/models/brain_location.py +33 -0
  10. entitysdk-0.2.3/src/entitysdk/models/brain_region.py +37 -0
  11. {entitysdk-0.2.1 → entitysdk-0.2.3}/src/entitysdk/models/contribution.py +7 -2
  12. {entitysdk-0.2.1 → entitysdk-0.2.3}/src/entitysdk/models/core.py +1 -1
  13. entitysdk-0.2.3/src/entitysdk/models/electrical_cell_recording.py +92 -0
  14. entitysdk-0.2.3/src/entitysdk/models/emodel.py +89 -0
  15. entitysdk-0.2.3/src/entitysdk/models/entity.py +74 -0
  16. entitysdk-0.2.3/src/entitysdk/models/etype.py +28 -0
  17. entitysdk-0.2.3/src/entitysdk/models/ion_channel_model.py +157 -0
  18. entitysdk-0.2.3/src/entitysdk/models/license.py +33 -0
  19. entitysdk-0.2.3/src/entitysdk/models/memodel.py +96 -0
  20. entitysdk-0.2.3/src/entitysdk/models/morphology.py +54 -0
  21. {entitysdk-0.2.1 → entitysdk-0.2.3}/src/entitysdk/models/mtype.py +2 -2
  22. entitysdk-0.2.3/src/entitysdk/models/subject.py +41 -0
  23. entitysdk-0.2.3/src/entitysdk/models/taxonomy.py +72 -0
  24. {entitysdk-0.2.1 → entitysdk-0.2.3}/src/entitysdk/route.py +6 -1
  25. entitysdk-0.2.3/src/entitysdk/types.py +67 -0
  26. {entitysdk-0.2.1 → entitysdk-0.2.3}/src/entitysdk/util.py +1 -1
  27. {entitysdk-0.2.1 → entitysdk-0.2.3/src/entitysdk.egg-info}/PKG-INFO +17 -2
  28. {entitysdk-0.2.1 → entitysdk-0.2.3}/src/entitysdk.egg-info/SOURCES.txt +20 -4
  29. {entitysdk-0.2.1 → entitysdk-0.2.3}/tests/integration/test_searching.py +15 -4
  30. entitysdk-0.2.3/tests/unit/models/data/electrical_cell_recording.json +123 -0
  31. entitysdk-0.2.3/tests/unit/models/data/ion_channel_model.json +112 -0
  32. {entitysdk-0.2.1 → entitysdk-0.2.3}/tests/unit/models/data/reconstruction_morphology.json +10 -18
  33. entitysdk-0.2.3/tests/unit/models/test_brain_region.py +23 -0
  34. entitysdk-0.2.3/tests/unit/models/test_electrical_cell_recording.py +42 -0
  35. entitysdk-0.2.3/tests/unit/models/test_init.py +17 -0
  36. entitysdk-0.2.3/tests/unit/models/test_ion_channel_model.py +60 -0
  37. {entitysdk-0.2.1 → entitysdk-0.2.3}/tests/unit/test_client.py +12 -7
  38. {entitysdk-0.2.1 → entitysdk-0.2.3}/tests/unit/test_common.py +1 -1
  39. entitysdk-0.2.1/src/entitysdk/models/__init__.py +0 -1
  40. entitysdk-0.2.1/src/entitysdk/models/entity.py +0 -38
  41. entitysdk-0.2.1/src/entitysdk/models/morphology.py +0 -223
  42. entitysdk-0.2.1/src/entitysdk/typedef.py +0 -13
  43. {entitysdk-0.2.1 → entitysdk-0.2.3}/.github/workflows/sdist.yml +0 -0
  44. {entitysdk-0.2.1 → entitysdk-0.2.3}/.github/workflows/tox.yml +0 -0
  45. {entitysdk-0.2.1 → entitysdk-0.2.3}/.gitignore +0 -0
  46. {entitysdk-0.2.1 → entitysdk-0.2.3}/CHANGELOG.rst +0 -0
  47. {entitysdk-0.2.1 → entitysdk-0.2.3}/CONTRIBUTING.md +0 -0
  48. {entitysdk-0.2.1 → entitysdk-0.2.3}/LICENSE.txt +0 -0
  49. {entitysdk-0.2.1 → entitysdk-0.2.3}/pyproject.toml +0 -0
  50. {entitysdk-0.2.1 → entitysdk-0.2.3}/setup.cfg +0 -0
  51. {entitysdk-0.2.1 → entitysdk-0.2.3}/src/entitysdk/__init__.py +0 -0
  52. {entitysdk-0.2.1 → entitysdk-0.2.3}/src/entitysdk/config.py +0 -0
  53. {entitysdk-0.2.1 → entitysdk-0.2.3}/src/entitysdk/core.py +0 -0
  54. {entitysdk-0.2.1 → entitysdk-0.2.3}/src/entitysdk/exception.py +0 -0
  55. {entitysdk-0.2.1 → entitysdk-0.2.3}/src/entitysdk/mixin.py +0 -0
  56. {entitysdk-0.2.1 → entitysdk-0.2.3}/src/entitysdk/models/agent.py +0 -0
  57. {entitysdk-0.2.1 → entitysdk-0.2.3}/src/entitysdk/models/asset.py +0 -0
  58. {entitysdk-0.2.1 → entitysdk-0.2.3}/src/entitysdk/models/base.py +0 -0
  59. {entitysdk-0.2.1 → entitysdk-0.2.3}/src/entitysdk/models/response.py +0 -0
  60. {entitysdk-0.2.1 → entitysdk-0.2.3}/src/entitysdk/result.py +0 -0
  61. {entitysdk-0.2.1 → entitysdk-0.2.3}/src/entitysdk/serdes.py +0 -0
  62. {entitysdk-0.2.1 → entitysdk-0.2.3}/src/entitysdk/token_manager.py +0 -0
  63. {entitysdk-0.2.1 → entitysdk-0.2.3}/src/entitysdk.egg-info/dependency_links.txt +0 -0
  64. {entitysdk-0.2.1 → entitysdk-0.2.3}/src/entitysdk.egg-info/requires.txt +0 -0
  65. {entitysdk-0.2.1 → entitysdk-0.2.3}/src/entitysdk.egg-info/top_level.txt +0 -0
  66. {entitysdk-0.2.1 → entitysdk-0.2.3}/tests/__init__.py +0 -0
  67. {entitysdk-0.2.1 → entitysdk-0.2.3}/tests/integration/__init__.py +0 -0
  68. {entitysdk-0.2.1 → entitysdk-0.2.3}/tests/integration/conftest.py +0 -0
  69. {entitysdk-0.2.1 → entitysdk-0.2.3}/tests/unit/__init__.py +0 -0
  70. {entitysdk-0.2.1 → entitysdk-0.2.3}/tests/unit/conftest.py +0 -0
  71. {entitysdk-0.2.1 → entitysdk-0.2.3}/tests/unit/models/__init__.py +0 -0
  72. {entitysdk-0.2.1 → entitysdk-0.2.3}/tests/unit/models/data/.gitignore +0 -0
  73. {entitysdk-0.2.1 → entitysdk-0.2.3}/tests/unit/models/test_agent.py +0 -0
  74. {entitysdk-0.2.1 → entitysdk-0.2.3}/tests/unit/models/test_asset.py +0 -0
  75. {entitysdk-0.2.1 → entitysdk-0.2.3}/tests/unit/models/test_contribution.py +0 -0
  76. {entitysdk-0.2.1 → entitysdk-0.2.3}/tests/unit/models/test_morphology.py +0 -0
  77. {entitysdk-0.2.1 → entitysdk-0.2.3}/tests/unit/test_base.py +0 -0
  78. {entitysdk-0.2.1 → entitysdk-0.2.3}/tests/unit/test_config.py +0 -0
  79. {entitysdk-0.2.1 → entitysdk-0.2.3}/tests/unit/test_result.py +0 -0
  80. {entitysdk-0.2.1 → entitysdk-0.2.3}/tests/unit/test_route.py +0 -0
  81. {entitysdk-0.2.1 → entitysdk-0.2.3}/tests/unit/test_serdes.py +0 -0
  82. {entitysdk-0.2.1 → entitysdk-0.2.3}/tests/unit/test_token_manager.py +0 -0
  83. {entitysdk-0.2.1 → entitysdk-0.2.3}/tests/unit/test_util.py +0 -0
  84. {entitysdk-0.2.1 → entitysdk-0.2.3}/tests/unit/util.py +0 -0
  85. {entitysdk-0.2.1 → entitysdk-0.2.3}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: entitysdk
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  Summary: Python library for interacting with the entitycore service
5
5
  Author-email: Open Brain Institute <info@openbraininstitute.org>
6
6
  Maintainer-email: Open Brain Institute <info@openbraininstitute.org>
@@ -39,6 +39,21 @@ entitysdk is a Python library for interacting with the [entitycore service][enti
39
39
  ```bash
40
40
  pip install entitysdk
41
41
  ```
42
+
43
+ ## Obtaining a valid access token
44
+
45
+ An access token can be retrieved easily using the obi-auth helper library.
46
+
47
+ ```bash
48
+ pip install obi-auth
49
+ ```
50
+
51
+ ```python
52
+ from obi_auth import get_token
53
+
54
+ access_token = get_token(environment="staging")
55
+ ```
56
+
42
57
  ## Quick Start
43
58
 
44
59
  ```python
@@ -49,11 +64,11 @@ from entitysdk.models.morphology import ReconstructionMorphology
49
64
 
50
65
  # Initialize client
51
66
  client = Client(
52
- api_url="http://api.example.com",
53
67
  project_context=ProjectContext(
54
68
  project_id=UUID("your-project-id"),
55
69
  virtual_lab_id=UUID("your-lab-id")
56
70
  )
71
+ environment="staging"
57
72
  )
58
73
 
59
74
  # Search for morphologies
@@ -18,6 +18,21 @@ entitysdk is a Python library for interacting with the [entitycore service][enti
18
18
  ```bash
19
19
  pip install entitysdk
20
20
  ```
21
+
22
+ ## Obtaining a valid access token
23
+
24
+ An access token can be retrieved easily using the obi-auth helper library.
25
+
26
+ ```bash
27
+ pip install obi-auth
28
+ ```
29
+
30
+ ```python
31
+ from obi_auth import get_token
32
+
33
+ access_token = get_token(environment="staging")
34
+ ```
35
+
21
36
  ## Quick Start
22
37
 
23
38
  ```python
@@ -28,11 +43,11 @@ from entitysdk.models.morphology import ReconstructionMorphology
28
43
 
29
44
  # Initialize client
30
45
  client = Client(
31
- api_url="http://api.example.com",
32
46
  project_context=ProjectContext(
33
47
  project_id=UUID("your-project-id"),
34
48
  virtual_lab_id=UUID("your-lab-id")
35
49
  )
50
+ environment="staging"
36
51
  )
37
52
 
38
53
  # Search for morphologies
@@ -13,14 +13,15 @@
13
13
  "\n",
14
14
  "from entitysdk.client import Client\n",
15
15
  "from entitysdk.common import ProjectContext\n",
16
- "from entitysdk.models.agent import Organization, Person\n",
17
- "from entitysdk.models.contribution import Role\n",
18
- "from entitysdk.models.morphology import (\n",
16
+ "from entitysdk.models import (\n",
17
+ " MTypeClass,\n",
18
+ " Organization,\n",
19
+ " Person,\n",
19
20
  " ReconstructionMorphology,\n",
21
+ " Role,\n",
20
22
  " Species,\n",
21
23
  " Strain,\n",
22
24
  ")\n",
23
- "from entitysdk.models.mtype import MTypeClass\n",
24
25
  "\n",
25
26
  "entitycore_api_url = \"http://127.0.0.1:8000\"\n",
26
27
  "project_context = ProjectContext(\n",
@@ -28,7 +29,13 @@
28
29
  " project_id=\"0dbced5f-cc3d-488a-8c7f-cfb8ea039dc6\",\n",
29
30
  ")\n",
30
31
  "client = Client(api_url=entitycore_api_url, project_context=project_context)\n",
31
- "token = os.getenv(\"ACCESS_TOKEN\", \"XXX\")"
32
+ "token = os.getenv(\"ACCESS_TOKEN\", \"XXX\")\n",
33
+ "\n",
34
+ "# uncomment for staging\n",
35
+ "# from obi_auth import get_token\n",
36
+ "\n",
37
+ "# token = get_token(environment=\"staging\")\n",
38
+ "# client = Client(environment=\"staging\")"
32
39
  ]
33
40
  },
34
41
  {
@@ -239,7 +246,7 @@
239
246
  "id": "fae8506b-9cbc-433b-a17d-6ce3d84bcf4c",
240
247
  "metadata": {},
241
248
  "source": [
242
- "## Find morphologies of a specifix mtype id"
249
+ "## Find morphologies by mtype"
243
250
  ]
244
251
  },
245
252
  {
@@ -282,7 +289,7 @@
282
289
  "name": "python",
283
290
  "nbconvert_exporter": "python",
284
291
  "pygments_lexer": "ipython3",
285
- "version": "3.12.9"
292
+ "version": "3.12.10"
286
293
  }
287
294
  },
288
295
  "nbformat": 4,
@@ -16,7 +16,7 @@
16
16
  "\n",
17
17
  "from entitysdk.client import Client\n",
18
18
  "from entitysdk.common import ProjectContext\n",
19
- "from entitysdk.models.morphology import (\n",
19
+ "from entitysdk.models import (\n",
20
20
  " BrainLocation,\n",
21
21
  " BrainRegion,\n",
22
22
  " ReconstructionMorphology,\n",
@@ -46,7 +46,14 @@
46
46
  " project_id=\"0dbced5f-cc3d-488a-8c7f-cfb8ea039dc6\",\n",
47
47
  ")\n",
48
48
  "client = Client(api_url=entitycore_api_url, project_context=project_context)\n",
49
- "token = os.getenv(\"ACCESS_TOKEN\", \"XXX\")"
49
+ "token = os.getenv(\"ACCESS_TOKEN\", \"XXX\")\n",
50
+ "\n",
51
+ "# uncomment for staging\n",
52
+ "# from obi_auth import get_token\n",
53
+ "# token = get_token(environment=\"staging\")\n",
54
+ "# Replace this with your vlab project url in staging\n",
55
+ "# project_context = ProjectContext.from_vlab_url(\"https://staging.openbraininstitute.org/app/virtual-lab/lab/594fd60d-7a38-436f-939d-500feaa13bba/project/ff89ca07-6613-4922-9ab0-2637221db8b5/home\")\n",
56
+ "# client = Client(environment=\"staging\", project_context=project_context)"
50
57
  ]
51
58
  },
52
59
  {
@@ -92,13 +99,35 @@
92
99
  {
93
100
  "cell_type": "code",
94
101
  "execution_count": null,
95
- "id": "45d75d53-71f1-4213-8355-4937c1e27558",
102
+ "id": "e5dde536-0c58-4d42-a834-1b1a0ec17e9d",
96
103
  "metadata": {},
97
104
  "outputs": [],
98
105
  "source": [
99
106
  "rprint(strain)"
100
107
  ]
101
108
  },
109
+ {
110
+ "cell_type": "code",
111
+ "execution_count": null,
112
+ "id": "5d42a174-9737-4477-830a-3dc908dea925",
113
+ "metadata": {},
114
+ "outputs": [],
115
+ "source": [
116
+ "brain_region = client.search_entity(\n",
117
+ " entity_type=BrainRegion, query={\"annotation_value\": 68}, token=token\n",
118
+ ").one()"
119
+ ]
120
+ },
121
+ {
122
+ "cell_type": "code",
123
+ "execution_count": null,
124
+ "id": "282200cd-ad0c-4bb3-bc21-88de85289179",
125
+ "metadata": {},
126
+ "outputs": [],
127
+ "source": [
128
+ "rprint(brain_region)"
129
+ ]
130
+ },
102
131
  {
103
132
  "cell_type": "markdown",
104
133
  "id": "a0193055-3448-4d1c-99cc-4d953727ef4e",
@@ -114,19 +143,11 @@
114
143
  "metadata": {},
115
144
  "outputs": [],
116
145
  "source": [
117
- "# No GET endpoint yet for brain-region\n",
118
- "\n",
119
146
  "brain_location = BrainLocation(\n",
120
147
  " x=4101.52490234375,\n",
121
148
  " y=1173.8499755859375,\n",
122
149
  " z=4744.60009765625,\n",
123
150
  ")\n",
124
- "brain_region = BrainRegion(\n",
125
- " id=68,\n",
126
- " name=\"Frontal pole, layer 1\",\n",
127
- " acronym=\"FRP1\",\n",
128
- " children=[],\n",
129
- ")\n",
130
151
  "morphology = ReconstructionMorphology(\n",
131
152
  " name=\"my-morph\",\n",
132
153
  " description=\"A morphology\",\n",
@@ -153,7 +174,25 @@
153
174
  "id": "83fb7e5e-73b5-4227-aa22-90bb789b0907",
154
175
  "metadata": {},
155
176
  "source": [
156
- "## Register morphology and upload assets"
177
+ "## Register morphology"
178
+ ]
179
+ },
180
+ {
181
+ "cell_type": "code",
182
+ "execution_count": null,
183
+ "id": "2e32a168",
184
+ "metadata": {},
185
+ "outputs": [],
186
+ "source": [
187
+ "registered = client.register_entity(entity=morphology, token=token)"
188
+ ]
189
+ },
190
+ {
191
+ "cell_type": "markdown",
192
+ "id": "c0d500bd",
193
+ "metadata": {},
194
+ "source": [
195
+ "## Upload assets"
157
196
  ]
158
197
  },
159
198
  {
@@ -163,8 +202,6 @@
163
202
  "metadata": {},
164
203
  "outputs": [],
165
204
  "source": [
166
- "registered = client.register_entity(entity=morphology, token=token)\n",
167
- "\n",
168
205
  "with tempfile.TemporaryDirectory() as tdir:\n",
169
206
  " file1 = Path(tdir, \"morph.h5\")\n",
170
207
  " file1.write_text(\"h5\")\n",
@@ -428,7 +465,7 @@
428
465
  "name": "python",
429
466
  "nbconvert_exporter": "python",
430
467
  "pygments_lexer": "ipython3",
431
- "version": "3.12.9"
468
+ "version": "3.12.10"
432
469
  }
433
470
  },
434
471
  "nbformat": 4,
@@ -13,9 +13,7 @@
13
13
  "\n",
14
14
  "from entitysdk.client import Client\n",
15
15
  "from entitysdk.common import ProjectContext\n",
16
- "from entitysdk.models.agent import Organization\n",
17
- "from entitysdk.models.contribution import Contribution, Role\n",
18
- "from entitysdk.models.morphology import ReconstructionMorphology\n",
16
+ "from entitysdk.models import Contribution, Organization, ReconstructionMorphology, Role\n",
19
17
  "\n",
20
18
  "entitycore_api_url = \"http://127.0.0.1:8000\"\n",
21
19
  "project_context = ProjectContext(\n",
@@ -23,7 +21,14 @@
23
21
  " project_id=\"0dbced5f-cc3d-488a-8c7f-cfb8ea039dc6\",\n",
24
22
  ")\n",
25
23
  "client = Client(api_url=entitycore_api_url, project_context=project_context)\n",
26
- "token = os.getenv(\"ACCESS_TOKEN\", \"XXX\")"
24
+ "token = os.getenv(\"ACCESS_TOKEN\", \"XXX\")\n",
25
+ "\n",
26
+ "# uncomment for staging\n",
27
+ "# from obi_auth import get_token\n",
28
+ "# token = get_token(environment=\"staging\")\n",
29
+ "# Replace this with your vlab project url in staging\n",
30
+ "# project_context = ProjectContext.from_vlab_url(\"https://staging.openbraininstitute.org/app/virtual-lab/lab/594fd60d-7a38-436f-939d-500feaa13bba/project/ff89ca07-6613-4922-9ab0-2637221db8b5/home\")\n",
31
+ "# client = Client(environment=\"staging\", project_context=project_context)"
27
32
  ]
28
33
  },
29
34
  {
@@ -82,7 +87,7 @@
82
87
  "outputs": [],
83
88
  "source": [
84
89
  "morphology = client.search_entity(\n",
85
- " entity_type=ReconstructionMorphology, token=token, limit=1\n",
90
+ " entity_type=ReconstructionMorphology, token=token, limit=1, query={\"name__ilike\": \"my-morph\"}\n",
86
91
  ").first()"
87
92
  ]
88
93
  },
@@ -135,6 +140,8 @@
135
140
  "metadata": {},
136
141
  "outputs": [],
137
142
  "source": [
143
+ "# Note: It will fail if registered twice\n",
144
+ "# because there is a uniqueness constraint on (agent, morphology_id)\n",
138
145
  "registered = client.register_entity(entity=contribution, token=token)"
139
146
  ]
140
147
  },
@@ -193,7 +200,7 @@
193
200
  "name": "python",
194
201
  "nbconvert_exporter": "python",
195
202
  "pygments_lexer": "ipython3",
196
- "version": "3.12.9"
203
+ "version": "3.12.10"
197
204
  }
198
205
  },
199
206
  "nbformat": 4,
@@ -13,7 +13,7 @@ from entitysdk.models.asset import Asset, LocalAssetMetadata
13
13
  from entitysdk.models.core import Identifiable
14
14
  from entitysdk.result import IteratorResult
15
15
  from entitysdk.token_manager import TokenManager
16
- from entitysdk.typedef import ID, DeploymentEnvironment
16
+ from entitysdk.types import ID, DeploymentEnvironment
17
17
  from entitysdk.util import build_api_url
18
18
 
19
19
 
@@ -7,7 +7,7 @@ from uuid import UUID
7
7
  from pydantic import BaseModel
8
8
 
9
9
  from entitysdk.exception import EntitySDKError
10
- from entitysdk.typedef import DeploymentEnvironment
10
+ from entitysdk.types import DeploymentEnvironment
11
11
 
12
12
  UUID_RE = "[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}"
13
13
 
@@ -0,0 +1,37 @@
1
+ """Models for entitysdk."""
2
+
3
+ from entitysdk.models.agent import Organization, Person
4
+ from entitysdk.models.asset import Asset
5
+ from entitysdk.models.brain_location import BrainLocation
6
+ from entitysdk.models.brain_region import BrainRegion
7
+ from entitysdk.models.contribution import Contribution, Role
8
+ from entitysdk.models.electrical_cell_recording import ElectricalCellRecording
9
+ from entitysdk.models.emodel import EModel
10
+ from entitysdk.models.ion_channel_model import IonChannelModel, NeuronBlock, UseIon
11
+ from entitysdk.models.license import License
12
+ from entitysdk.models.memodel import MEModel
13
+ from entitysdk.models.morphology import ReconstructionMorphology
14
+ from entitysdk.models.mtype import MTypeClass
15
+ from entitysdk.models.taxonomy import Species, Strain, Taxonomy
16
+
17
+ __all__ = [
18
+ "Asset",
19
+ "BrainLocation",
20
+ "BrainRegion",
21
+ "Contribution",
22
+ "ElectricalCellRecording",
23
+ "EModel",
24
+ "IonChannelModel",
25
+ "License",
26
+ "MEModel",
27
+ "MTypeClass",
28
+ "NeuronBlock",
29
+ "Organization",
30
+ "Person",
31
+ "ReconstructionMorphology",
32
+ "Role",
33
+ "Species",
34
+ "Strain",
35
+ "Taxonomy",
36
+ "UseIon",
37
+ ]
@@ -0,0 +1,33 @@
1
+ """Brain location model."""
2
+
3
+ from typing import Annotated
4
+
5
+ from pydantic import Field
6
+
7
+ from entitysdk.models.core import Struct
8
+
9
+
10
+ class BrainLocation(Struct):
11
+ """BrainLocation model."""
12
+
13
+ x: Annotated[
14
+ float,
15
+ Field(
16
+ examples=[1.0, 2.0, 3.0],
17
+ description="The x coordinate of the brain location.",
18
+ ),
19
+ ]
20
+ y: Annotated[
21
+ float,
22
+ Field(
23
+ examples=[1.0, 2.0, 3.0],
24
+ description="The y coordinate of the brain location.",
25
+ ),
26
+ ]
27
+ z: Annotated[
28
+ float,
29
+ Field(
30
+ examples=[1.0, 2.0, 3.0],
31
+ description="The z coordinate of the brain location.",
32
+ ),
33
+ ]
@@ -0,0 +1,37 @@
1
+ """BrainRegion model."""
2
+
3
+ from typing import Annotated
4
+
5
+ from pydantic import Field
6
+
7
+ from entitysdk.models.core import Identifiable
8
+ from entitysdk.types import ID
9
+
10
+
11
+ class BrainRegion(Identifiable):
12
+ """BrainRegion model."""
13
+
14
+ name: Annotated[
15
+ str,
16
+ Field(
17
+ examples=["Thalamus"],
18
+ description="The name of the brain region.",
19
+ ),
20
+ ]
21
+ annotation_value: Annotated[
22
+ int, Field(examples=[997], description="The annotation voxel value.")
23
+ ]
24
+ acronym: Annotated[
25
+ str,
26
+ Field(
27
+ examples=["TH"],
28
+ description="The acronym of the brain region.",
29
+ ),
30
+ ]
31
+ parent_structure_id: Annotated[
32
+ ID | None, Field(examples=[], description="The parent region structure UUID.")
33
+ ]
34
+ hierarchy_id: Annotated[
35
+ ID, Field(examples=[], description="The brain hierarchy that includes this brain region.")
36
+ ]
37
+ color_hex_triplet: Annotated[str, Field(description="Region's color hex triplet.")]
@@ -6,7 +6,6 @@ from pydantic import Field
6
6
 
7
7
  from entitysdk.models.agent import AgentUnion
8
8
  from entitysdk.models.core import Identifiable
9
- from entitysdk.models.entity import Entity
10
9
 
11
10
 
12
11
  class Role(Identifiable):
@@ -42,6 +41,12 @@ class Contribution(Identifiable):
42
41
  ),
43
42
  ]
44
43
  entity: Annotated[
45
- Entity | None,
44
+ "Entity | None",
46
45
  Field(description="The entity that resulted in this contribution."),
47
46
  ] = None
47
+
48
+
49
+ # Update forward reference for Entity
50
+ from entitysdk.models.entity import Entity # noqa: E402
51
+
52
+ Contribution.model_rebuild(force=True)
@@ -6,7 +6,7 @@ from typing import Annotated
6
6
  from pydantic import Field
7
7
 
8
8
  from entitysdk.models.base import BaseModel
9
- from entitysdk.typedef import ID
9
+ from entitysdk.types import ID
10
10
 
11
11
 
12
12
  class Struct(BaseModel):
@@ -0,0 +1,92 @@
1
+ """Electrical cell recording models."""
2
+
3
+ from typing import Annotated
4
+
5
+ from pydantic import Field
6
+
7
+ from entitysdk.models.brain_region import BrainRegion
8
+ from entitysdk.models.entity import Entity
9
+ from entitysdk.models.license import License
10
+ from entitysdk.models.subject import Subject
11
+ from entitysdk.types import (
12
+ ElectricalRecordingOrigin,
13
+ ElectricalRecordingStimulusShape,
14
+ ElectricalRecordingStimulusType,
15
+ ElectricalRecordingType,
16
+ )
17
+
18
+
19
+ class ElectricalRecordingStimulus(Entity):
20
+ """Electrical cell recording stimulus model."""
21
+
22
+ dt: float | None = None
23
+ injection_type: ElectricalRecordingStimulusType
24
+ shape: ElectricalRecordingStimulusShape
25
+ start_time: float | None = None
26
+ end_time: float | None = None
27
+
28
+
29
+ class ElectricalCellRecording(Entity):
30
+ """Electrical cell recording model."""
31
+
32
+ ljp: Annotated[
33
+ float,
34
+ Field(
35
+ title="Liquid Junction Potential",
36
+ description="Correction applied to the voltage trace, in mV",
37
+ examples=[0.1],
38
+ ),
39
+ ] = 0.0
40
+ recording_location: Annotated[
41
+ list[str],
42
+ Field(
43
+ title="Recording Location",
44
+ description=(
45
+ "Location on the cell where recording was performed, in hoc-compatible format."
46
+ ),
47
+ ),
48
+ ]
49
+ recording_type: Annotated[
50
+ ElectricalRecordingType,
51
+ Field(
52
+ title="Recording Type",
53
+ description="Recording type.",
54
+ ),
55
+ ]
56
+ recording_origin: Annotated[
57
+ ElectricalRecordingOrigin,
58
+ Field(
59
+ title="Recording Origin",
60
+ description="Recording origin.",
61
+ ),
62
+ ]
63
+ comment: Annotated[
64
+ str | None,
65
+ Field(
66
+ title="Comment",
67
+ description="Comment with further details.",
68
+ ),
69
+ ] = None
70
+ brain_region: Annotated[
71
+ BrainRegion,
72
+ Field(
73
+ description="The region of the brain where the morphology is located.",
74
+ ),
75
+ ]
76
+ subject: Annotated[
77
+ Subject,
78
+ Field(title="Subject", description="The subject of the electrical cell recording."),
79
+ ]
80
+ stimuli: Annotated[
81
+ list[ElectricalRecordingStimulus] | None,
82
+ Field(
83
+ title="Electrical Recording Stimuli",
84
+ description="List of stimuli applied to the cell with their respective time steps",
85
+ ),
86
+ ] = None
87
+ license: Annotated[
88
+ License | None,
89
+ Field(
90
+ description="The license attached to the morphology.",
91
+ ),
92
+ ] = None
@@ -0,0 +1,89 @@
1
+ """Electrical cell model."""
2
+
3
+ from typing import Annotated
4
+
5
+ from pydantic import Field
6
+
7
+ from entitysdk.models.contribution import Contribution
8
+ from entitysdk.models.entity import Entity
9
+ from entitysdk.models.etype import ETypeClass
10
+ from entitysdk.models.ion_channel_model import IonChannelModel
11
+ from entitysdk.models.morphology import (
12
+ BrainRegion,
13
+ License,
14
+ ReconstructionMorphology,
15
+ Species,
16
+ Strain,
17
+ )
18
+ from entitysdk.models.mtype import MTypeClass
19
+
20
+
21
+ class EModel(Entity):
22
+ """Electrical cell model."""
23
+
24
+ species: Annotated[
25
+ Species,
26
+ Field(description="The species for which the emodel applies."),
27
+ ]
28
+ strain: Annotated[
29
+ Strain | None,
30
+ Field(description="The specific strain of the species, if applicable."),
31
+ ] = None
32
+ brain_region: Annotated[
33
+ BrainRegion,
34
+ Field(description="The brain region where the emodel is used or applies."),
35
+ ]
36
+ license: Annotated[
37
+ License | None,
38
+ Field(description="License under which the emodel is distributed."),
39
+ ] = None
40
+ contributions: Annotated[
41
+ list[Contribution] | None,
42
+ Field(description="List of contributions related to this emodel."),
43
+ ] = None
44
+ iteration: Annotated[
45
+ str,
46
+ Field(
47
+ description="The iteration of the emodel used during optimisation.",
48
+ examples="1372346",
49
+ ),
50
+ ]
51
+ score: Annotated[
52
+ float,
53
+ Field(
54
+ description="The score of the emodel gotten during validation.",
55
+ examples=54.0,
56
+ ),
57
+ ]
58
+ seed: Annotated[
59
+ int,
60
+ Field(
61
+ description="The RNG seed used during optimisation.",
62
+ examples=13,
63
+ ),
64
+ ]
65
+ exemplar_morphology: Annotated[
66
+ ReconstructionMorphology | None,
67
+ Field(
68
+ description="The morphology used during optimisation.",
69
+ ),
70
+ ] = None
71
+ etypes: Annotated[
72
+ list[ETypeClass] | None,
73
+ Field(
74
+ description="The etype classes of the emodel.",
75
+ ),
76
+ ] = None
77
+ mtypes: Annotated[
78
+ list[MTypeClass] | None,
79
+ Field(
80
+ description="The mtype classes of the emodel.",
81
+ ),
82
+ ] = None
83
+ ion_channel_models: Annotated[
84
+ list[IonChannelModel] | None,
85
+ Field(
86
+ description="List of ion channel models.",
87
+ ),
88
+ ] = None
89
+ legacy_id: list[str] | None = None