deriva-ml 1.13.2__py3-none-any.whl → 1.13.3__py3-none-any.whl

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.
@@ -2,7 +2,7 @@ import argparse
2
2
  import sys
3
3
  from typing import Optional, Any
4
4
 
5
- from deriva.core import DerivaServer, get_credential
5
+ from deriva.core import DerivaServer, get_credential, ErmrestCatalog
6
6
  from deriva.core.ermrest_model import Model
7
7
  from deriva.core.ermrest_model import (
8
8
  builtin_types,
@@ -12,11 +12,9 @@ from deriva.core.ermrest_model import (
12
12
  ForeignKey,
13
13
  Key,
14
14
  )
15
- from deriva.core.utils.core_utils import tag as chaise_tags
16
15
 
17
16
  from deriva_ml import MLVocab
18
- from deriva_ml.schema_setup.annotations import generate_annotation
19
- from deriva_ml.deriva_model import DerivaModel
17
+ from deriva_ml.schema_setup.annotations import generate_annotation, asset_annotation
20
18
 
21
19
 
22
20
  def create_dataset_table(
@@ -24,6 +22,7 @@ def create_dataset_table(
24
22
  execution_table: Table,
25
23
  project_name: str,
26
24
  dataset_annotation: Optional[dict] = None,
25
+ version_annotation: Optional[dict] = None,
27
26
  ):
28
27
  dataset_table = schema.create_table(
29
28
  Table.define(
@@ -48,7 +47,9 @@ def create_dataset_table(
48
47
  )
49
48
  )
50
49
 
51
- dataset_version = schema.create_table(define_table_dataset_version(schema.name))
50
+ dataset_version = schema.create_table(
51
+ define_table_dataset_version(schema.name, version_annotation)
52
+ )
52
53
  dataset_table.create_reference(("Version", True, dataset_version))
53
54
 
54
55
  # Nested datasets.
@@ -64,7 +65,7 @@ def create_dataset_table(
64
65
  )
65
66
 
66
67
 
67
- def define_table_dataset_version(sname: str):
68
+ def define_table_dataset_version(sname: str, annotation: Optional[dict] = None):
68
69
  return Table.define(
69
70
  tname="Dataset_Version",
70
71
  column_defs=[
@@ -80,9 +81,18 @@ def define_table_dataset_version(sname: str):
80
81
  Column.define(
81
82
  "Minid", builtin_types.text, comment="URL to MINID for dataset"
82
83
  ),
84
+ Column.define(
85
+ "Snapshot",
86
+ builtin_types.text,
87
+ comment="Catalog Snapshot ID for dataset",
88
+ ),
83
89
  ],
90
+ annotations=annotation,
84
91
  key_defs=[Key.define(["Dataset", "Version"])],
85
- fkey_defs=[ForeignKey.define(["Dataset"], sname, "Dataset", ["RID"])],
92
+ fkey_defs=[
93
+ ForeignKey.define(["Dataset"], sname, "Dataset", ["RID"]),
94
+ ForeignKey.define(["Execution"], sname, "Execution", ["RID"]),
95
+ ],
86
96
  )
87
97
 
88
98
 
@@ -113,18 +123,15 @@ def create_asset_table(
113
123
  execution_table,
114
124
  asset_type_table,
115
125
  asset_role_table,
116
- annotation: Optional[dict] = None,
117
126
  ):
118
- annotation = annotation if annotation is not None else {}
119
127
  asset_table = schema.create_table(
120
128
  Table.define_asset(
121
129
  sname=schema.name,
122
130
  tname=asset_name,
123
131
  hatrac_template="/hatrac/metadata/{{MD5}}.{{Filename}}",
124
- annotations=annotation,
125
132
  )
126
133
  )
127
- atable = schema.create_table(
134
+ schema.create_table(
128
135
  Table.define_association(
129
136
  [
130
137
  (asset_name, asset_table),
@@ -142,6 +149,7 @@ def create_asset_table(
142
149
  )
143
150
  )
144
151
  atable.create_reference(asset_role_table)
152
+ asset_annotation(asset_table)
145
153
  return asset_table
146
154
 
147
155
 
@@ -203,15 +211,19 @@ def create_workflow_table(schema: Schema, annotations: Optional[dict[str, Any]]
203
211
 
204
212
 
205
213
  def create_ml_schema(
206
- model: Model, schema_name: str = "deriva-ml", project_name: Optional[str] = None
214
+ catalog: ErmrestCatalog,
215
+ schema_name: str = "deriva-ml",
216
+ project_name: Optional[str] = None,
207
217
  ):
218
+ project_name = project_name or schema_name
219
+
220
+ model = catalog.getCatalogModel()
208
221
  if model.schemas.get(schema_name):
209
222
  model.schemas[schema_name].drop(cascade=True)
223
+
210
224
  # get annotations
211
- deriva_model = DerivaModel(model)
212
- annotations = generate_annotation(deriva_model)
225
+ annotations = generate_annotation(model, schema_name)
213
226
 
214
- model.annotations.update(annotations["catalog_annotation"])
215
227
  client_annotation = {
216
228
  "tag:misd.isi.edu,2015:display": {"name": "Users"},
217
229
  "tag:isrd.isi.edu,2016:table-display": {
@@ -229,7 +241,6 @@ def create_ml_schema(
229
241
  schema = model.create_schema(
230
242
  Schema.define(schema_name, annotations=annotations["schema_annotation"])
231
243
  )
232
- project_name = project_name or schema_name
233
244
 
234
245
  # Create workflow and execution table.
235
246
 
@@ -248,7 +259,11 @@ def create_ml_schema(
248
259
  schema, annotations["execution_annotation"]
249
260
  )
250
261
  create_dataset_table(
251
- schema, execution_table, project_name, annotations["dataset_annotation"]
262
+ schema,
263
+ execution_table,
264
+ project_name,
265
+ annotations["dataset_annotation"],
266
+ annotations["dataset_version_annotation"],
252
267
  )
253
268
 
254
269
  create_asset_table(
@@ -257,69 +272,22 @@ def create_ml_schema(
257
272
  execution_table,
258
273
  asset_type_table,
259
274
  asset_role_table,
260
- annotations["execution_metadata_annotation"],
261
275
  )
276
+
262
277
  create_asset_table(
263
278
  schema,
264
279
  "Execution_Asset",
265
280
  execution_table,
266
281
  asset_type_table,
267
282
  asset_role_table,
268
- annotations["execution_asset_annotation"],
269
283
  )
270
284
 
271
285
  # File table
272
286
  create_file_table(schema, execution_table, project_name)
273
287
 
274
- create_www_schema(model)
275
288
  initialize_ml_schema(model, schema_name)
276
289
 
277
290
 
278
- def create_www_schema(model: Model):
279
- """
280
- Set up a new schema and tables to hold web-page like content. The tables include a page table, and an asset
281
- table that can have images that are referred to by the web page. Pages are written using markdown.
282
- :return:
283
- """
284
- if model.schemas.get("www"):
285
- model.schemas["www"].drop(cascade=True)
286
- www_schema = model.create_schema(
287
- Schema.define(
288
- "www", comment="Schema for tables that will be displayed as web content"
289
- )
290
- )
291
- www_schema.create_table(
292
- Table.define(
293
- "Page",
294
- column_defs=[
295
- Column.define(
296
- "Title",
297
- builtin_types.text,
298
- nullok=False,
299
- comment="Unique title for the page",
300
- ),
301
- Column.define(
302
- "Content",
303
- builtin_types.markdown,
304
- comment="Content of the page in markdown",
305
- ),
306
- ],
307
- key_defs=[Key.define(["Title"])],
308
- annotations={
309
- chaise_tags.table_display: {
310
- "detailed": {
311
- "hide_column_headers": True,
312
- "collapse_toc_panel": True,
313
- }
314
- },
315
- chaise_tags.visible_foreign_keys: {"detailed": {}},
316
- chaise_tags.visible_columns: {"detailed": ["Content"]},
317
- },
318
- )
319
- )
320
- return www_schema
321
-
322
-
323
291
  def initialize_ml_schema(model: Model, schema_name: str = "deriva-ml"):
324
292
  catalog = model.catalog
325
293
  asset_type = catalog.getPathBuilder().schemas[schema_name].tables["Asset_Type"]
@@ -3,16 +3,20 @@
3
3
  "isrd-systems": ["https://auth.globus.org/3938e0d0-ed35-11e5-8641-22000ab4b42b"],
4
4
  "isrd-staff": ["https://auth.globus.org/176baec4-ed26-11e5-8e88-22000ab4b42b"],
5
5
  "isrd-testers": ["https://auth.globus.org/9d596ac6-22b9-11e6-b519-22000aef184d"],
6
+ "eye-ai": ["https://auth.globus.org/d38e6f4d-ac96-11ed-8ab4-7b5a369c0a53"],
6
7
 
8
+ "local-admin": ["admin"],
7
9
  "project-admins": ["isrd-systems"],
8
- "project-curators": ["isrd-systems"],
9
- "project-writers": ["isrd-systems"],
10
- "project-users": ["isrd-systems"],
10
+ "project-writers": ["isrd-systems", "eye-ai"],
11
+
12
+ "project-curators": ["isrd-systems", "local-admin", "eye-ai" ],
13
+ "project-users": ["isrd-systems", "local-admin", "eye-ai"],
11
14
 
12
15
  "empty": [],
13
16
  "public": ["*"],
14
17
  "admins": [
15
18
  "project-admins",
19
+ "local-admin",
16
20
  "isrd-systems"
17
21
  ],
18
22
  "curators": ["project-curators"],
deriva_ml/upload.py CHANGED
@@ -98,10 +98,10 @@ def is_feature_dir(path: Path) -> Optional[re.Match]:
98
98
 
99
99
  def normalize_asset_dir(path: str) -> Optional[tuple[str, str]]:
100
100
  """Parse a path to an asset file and return the asset table name and file name"""
101
-
102
- if not (m := re.match(asset_path_regex, path)):
101
+ path = Path(path)
102
+ if not (m := re.match(asset_path_regex, path.as_posix())):
103
103
  return None
104
- return f"{m['schema']}/{m['asset_table']}", Path(path).name
104
+ return f"{m['schema']}/{m['asset_table']}", path.name
105
105
 
106
106
 
107
107
  def upload_root(prefix: Path | str) -> Path:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deriva-ml
3
- Version: 1.13.2
3
+ Version: 1.13.3
4
4
  Summary: Utilities to simplify use of Dervia and Pandas to create reproducable ML pipelines
5
5
  Author-email: ISRD <isrd-dev@isi.edu>
6
6
  Requires-Python: >=3.10
@@ -13,7 +13,7 @@ Requires-Dist: regex~=2024.7.24
13
13
  Requires-Dist: pydantic>=2.10.6
14
14
  Requires-Dist: semver>3.0.0
15
15
  Requires-Dist: setuptools>=64
16
- Requires-Dist: setuptools-scm<=6.0
16
+ Requires-Dist: setuptools-scm>=8.0
17
17
  Requires-Dist: nbstripout
18
18
  Requires-Dist: papermill
19
19
  Dynamic: license-file
@@ -0,0 +1,31 @@
1
+ deriva_ml/__init__.py,sha256=GfneBq7xDphMqUQY96sW9ixRj74M3UTUCmD4KMIRSaM,1101
2
+ deriva_ml/database_model.py,sha256=D5vY0HqsCzWzbQVuK5jsImeEfjgg9wMe6fjDz8ucZqc,14695
3
+ deriva_ml/dataset.py,sha256=UmVX3CQxjvi3pVudnbdpAddE4MJz230QnepICAb5Rag,60136
4
+ deriva_ml/dataset_aux_classes.py,sha256=IyPAbZUoVWjnm4hcpLet2mkJvKHRGN__IEwcAIrH-u4,6597
5
+ deriva_ml/dataset_bag.py,sha256=yS8oYVshfFtRDyhGPRqtbvxjyd3ZFF29lrB783OP4vM,11849
6
+ deriva_ml/demo_catalog.py,sha256=NBBsnF955jGpsGTgYFjeBn2580MjRuzC1MqqdrkaHAU,12081
7
+ deriva_ml/deriva_definitions.py,sha256=3rkl0TsOoVR3QdZdAHvR--Zgt1FvW1et3BEL-_bjLVM,10768
8
+ deriva_ml/deriva_ml_base.py,sha256=FQirlTQvOUs25G0WGxnlVj3uF3PQbMX96nNj9s9arTI,38565
9
+ deriva_ml/deriva_model.py,sha256=yMuJ3C8-anl1qf7lFBkiswVMWcheI_TUV5G_GvlzVCk,13565
10
+ deriva_ml/execution.py,sha256=qcxqkF0gxmPfwLQb-ooyagFawgO9sK4CQfzJOfBmMp4,38330
11
+ deriva_ml/execution_configuration.py,sha256=7fiIbtzz9nmkxA9-GTiN6Ln2twfaOLivwJwGZb8gAL0,14163
12
+ deriva_ml/execution_environment.py,sha256=bCRKrCELDbGQDo7_FKfw7e8iMzVjSRZK3baKkqH5-_0,3264
13
+ deriva_ml/feature.py,sha256=07g0uSrhumdopJluWuWSRMrzagaikAOihqB09bzXBP4,5475
14
+ deriva_ml/history.py,sha256=XRZ_mmxOnspUJAoC_XEH_DhSgfLLW8Kiub3CxpQPftw,2830
15
+ deriva_ml/run_notebook.py,sha256=vhmij4P1Va52MIj8hOc-WmjLRp3sTmK6p7LXCWrzejc,6308
16
+ deriva_ml/test_functions.py,sha256=-eqLHjjCQCLBNAr1ofbZekNiCOfMISSACRxT_YHER8I,4396
17
+ deriva_ml/test_notebook.ipynb,sha256=_5D6rkSGbmENPJZbDgfZ6-yt94BNEwxytVUDmG3RE3w,10166
18
+ deriva_ml/upload.py,sha256=VgCb0fUfm_siOW1p3g1MwenFIL8dpHzZHrVhzZGbHb4,16113
19
+ deriva_ml/schema_setup/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
+ deriva_ml/schema_setup/annotations.py,sha256=0lGFa7PLwlFXXps26OYQm1vuWdsfCtbL2v2FqjyehC8,17739
21
+ deriva_ml/schema_setup/create_schema.py,sha256=PTbUL00A-IwuMqADFEHvGTeRgU9UyBmQlw94EGseHhE,10305
22
+ deriva_ml/schema_setup/policy.json,sha256=5ykB8nnZFl-oCHzlAwppCFKJHWJFIkYognUMVEanfY8,1826
23
+ deriva_ml/schema_setup/table_comments_utils.py,sha256=-2_ubEpoH7ViLVb-ZfW9wZbQ26DTKNgjkCABMzGu4i4,2140
24
+ deriva_ml/test-files/execution-parameters.json,sha256=1vBqXlaMa0cysonE20TweVDfTGRdSi9CUuAkW1xiYNo,36
25
+ deriva_ml/test-files/notebook-parameters.json,sha256=7uEE2sLQSrSc9cEGQ_RKE7t5dwkEYv0qLo5mRbzo8Og,108
26
+ deriva_ml-1.13.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
27
+ deriva_ml-1.13.3.dist-info/METADATA,sha256=D4ar2arJ8tkT9-YTAWl-r_CsJJA42rb2RKqcD8tOkF8,999
28
+ deriva_ml-1.13.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
29
+ deriva_ml-1.13.3.dist-info/entry_points.txt,sha256=cJnALMa6pjdk6RQCt4HFbKHqALpVa0k6wPeQDPedLJI,295
30
+ deriva_ml-1.13.3.dist-info/top_level.txt,sha256=I1Q1dkH96cRghdsFRVqwpa2M7IqJpR2QPUNNc5-Bnpw,10
31
+ deriva_ml-1.13.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (79.0.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,31 +0,0 @@
1
- deriva_ml/__init__.py,sha256=GfneBq7xDphMqUQY96sW9ixRj74M3UTUCmD4KMIRSaM,1101
2
- deriva_ml/database_model.py,sha256=lMbAEqn4n0m7h_JstMX_LX9gbvBIEydG3sRilPn3eLU,14885
3
- deriva_ml/dataset.py,sha256=W1TSHgkdXNw2v5hC0UBrivCKadMK1LaFd6YIjHE9jZA,60786
4
- deriva_ml/dataset_aux_classes.py,sha256=YxjQnu2kS9kK_f8bGqhmgE6ty9GNeitCxfvReT9vaM0,6537
5
- deriva_ml/dataset_bag.py,sha256=yS8oYVshfFtRDyhGPRqtbvxjyd3ZFF29lrB783OP4vM,11849
6
- deriva_ml/demo_catalog.py,sha256=9Qo3JD4bUIwnL3ngPctc2QBeWApvMR_5UyaK9ockTrY,11536
7
- deriva_ml/deriva_definitions.py,sha256=avdOgxtB60yb8XsWm-AYtCdvg2QkQbyfkZuA9xx9t2U,9221
8
- deriva_ml/deriva_ml_base.py,sha256=FYSTQl4mNePC8IxC70rS5D0VmLNPccfFkkiVneDxJpY,38678
9
- deriva_ml/deriva_model.py,sha256=wytGCAHutiUaRfnRKr80Ks_P6ci0_wXRU3vq3lthfYU,13260
10
- deriva_ml/execution.py,sha256=otMkdjF15SEWg99mvWrTpnKz7-BWp9b8XbFf6iwfmtg,37697
11
- deriva_ml/execution_configuration.py,sha256=7fiIbtzz9nmkxA9-GTiN6Ln2twfaOLivwJwGZb8gAL0,14163
12
- deriva_ml/execution_environment.py,sha256=bCRKrCELDbGQDo7_FKfw7e8iMzVjSRZK3baKkqH5-_0,3264
13
- deriva_ml/feature.py,sha256=07g0uSrhumdopJluWuWSRMrzagaikAOihqB09bzXBP4,5475
14
- deriva_ml/history.py,sha256=qTDLDs8Ow_6r7mDO0gZm0Fg81SWKOAgtCU5pzZoDRgM,2828
15
- deriva_ml/run_notebook.py,sha256=vhmij4P1Va52MIj8hOc-WmjLRp3sTmK6p7LXCWrzejc,6308
16
- deriva_ml/test_functions.py,sha256=-eqLHjjCQCLBNAr1ofbZekNiCOfMISSACRxT_YHER8I,4396
17
- deriva_ml/test_notebook.ipynb,sha256=_5D6rkSGbmENPJZbDgfZ6-yt94BNEwxytVUDmG3RE3w,10166
18
- deriva_ml/upload.py,sha256=gHTGXAVlf56EwNzmw5zY0gbBf8h08eU2q2GBbb2FdVc,16087
19
- deriva_ml/schema_setup/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
- deriva_ml/schema_setup/annotations.py,sha256=v0gTpmWYxRqsQ-bcnQzsr8WowGv2pi9pZUsO3WWnu1U,9528
21
- deriva_ml/schema_setup/create_schema.py,sha256=hNMc-v5tferd0UjfdB6nBw7Rc_o-Mg6NkPqQGie9YOw,11700
22
- deriva_ml/schema_setup/policy.json,sha256=77sf0Imy6CAQV0_VwwbA56_KROJ05WXsvT-Wjtkk538,1633
23
- deriva_ml/schema_setup/table_comments_utils.py,sha256=-2_ubEpoH7ViLVb-ZfW9wZbQ26DTKNgjkCABMzGu4i4,2140
24
- deriva_ml/test-files/execution-parameters.json,sha256=1vBqXlaMa0cysonE20TweVDfTGRdSi9CUuAkW1xiYNo,36
25
- deriva_ml/test-files/notebook-parameters.json,sha256=7uEE2sLQSrSc9cEGQ_RKE7t5dwkEYv0qLo5mRbzo8Og,108
26
- deriva_ml-1.13.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
27
- deriva_ml-1.13.2.dist-info/METADATA,sha256=uuvCztFgxOwWM34egjr65pW8-2pYGCtV_xofT5TmcLg,999
28
- deriva_ml-1.13.2.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
29
- deriva_ml-1.13.2.dist-info/entry_points.txt,sha256=cJnALMa6pjdk6RQCt4HFbKHqALpVa0k6wPeQDPedLJI,295
30
- deriva_ml-1.13.2.dist-info/top_level.txt,sha256=I1Q1dkH96cRghdsFRVqwpa2M7IqJpR2QPUNNc5-Bnpw,10
31
- deriva_ml-1.13.2.dist-info/RECORD,,