Gen3SchemaDev 2.3.3__tar.gz → 2.3.5__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 (22) hide show
  1. {gen3schemadev-2.3.3 → gen3schemadev-2.3.5}/PKG-INFO +2 -4
  2. {gen3schemadev-2.3.3 → gen3schemadev-2.3.5}/README.md +0 -2
  3. {gen3schemadev-2.3.3 → gen3schemadev-2.3.5}/pyproject.toml +2 -2
  4. {gen3schemadev-2.3.3 → gen3schemadev-2.3.5}/src/gen3schemadev/converter.py +10 -1
  5. {gen3schemadev-2.3.3 → gen3schemadev-2.3.5}/src/gen3schemadev/validators/rule_validator.py +17 -0
  6. {gen3schemadev-2.3.3 → gen3schemadev-2.3.5}/LICENSE +0 -0
  7. {gen3schemadev-2.3.3 → gen3schemadev-2.3.5}/src/gen3schemadev/__init__.py +0 -0
  8. {gen3schemadev-2.3.3 → gen3schemadev-2.3.5}/src/gen3schemadev/cli.py +0 -0
  9. {gen3schemadev-2.3.3 → gen3schemadev-2.3.5}/src/gen3schemadev/ddvis.py +0 -0
  10. {gen3schemadev-2.3.3 → gen3schemadev-2.3.5}/src/gen3schemadev/schema/__init__.py +0 -0
  11. {gen3schemadev-2.3.3 → gen3schemadev-2.3.5}/src/gen3schemadev/schema/gen3_template.py +0 -0
  12. {gen3schemadev-2.3.3 → gen3schemadev-2.3.5}/src/gen3schemadev/schema/input_schema.py +0 -0
  13. {gen3schemadev-2.3.3 → gen3schemadev-2.3.5}/src/gen3schemadev/schema/schema_templates/_definitions.yaml +0 -0
  14. {gen3schemadev-2.3.3 → gen3schemadev-2.3.5}/src/gen3schemadev/schema/schema_templates/_settings.yaml +0 -0
  15. {gen3schemadev-2.3.3 → gen3schemadev-2.3.5}/src/gen3schemadev/schema/schema_templates/_terms.yaml +0 -0
  16. {gen3schemadev-2.3.3 → gen3schemadev-2.3.5}/src/gen3schemadev/schema/schema_templates/core_metadata_collection.yaml +0 -0
  17. {gen3schemadev-2.3.3 → gen3schemadev-2.3.5}/src/gen3schemadev/schema/schema_templates/gen3_metaschema.yml +0 -0
  18. {gen3schemadev-2.3.3 → gen3schemadev-2.3.5}/src/gen3schemadev/schema/schema_templates/program.yaml +0 -0
  19. {gen3schemadev-2.3.3 → gen3schemadev-2.3.5}/src/gen3schemadev/schema/schema_templates/project.yaml +0 -0
  20. {gen3schemadev-2.3.3 → gen3schemadev-2.3.5}/src/gen3schemadev/utils.py +0 -0
  21. {gen3schemadev-2.3.3 → gen3schemadev-2.3.5}/src/gen3schemadev/validators/input_validator.py +0 -0
  22. {gen3schemadev-2.3.3 → gen3schemadev-2.3.5}/src/gen3schemadev/validators/metaschema_validator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Gen3SchemaDev
3
- Version: 2.3.3
3
+ Version: 2.3.5
4
4
  Summary: Tool for data modelling in Gen3
5
5
  License: Apache 2.0
6
6
  License-File: LICENSE
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3
12
12
  Classifier: Programming Language :: Python :: 3.13
13
13
  Classifier: Programming Language :: Python :: 3.14
14
14
  Requires-Dist: check-jsonschema (>=0.34.1,<0.35.0)
15
- Requires-Dist: gen3-validator (>=1.1.1,<2.0.0)
15
+ Requires-Dist: gen3-validator (>=2.0.0,<3.0.0)
16
16
  Requires-Dist: linkml (>=1.9.4,<2.0.0)
17
17
  Requires-Dist: pydantic (>=2.11.9,<3.0.0)
18
18
  Requires-Dist: setuptools (>=70.0)
@@ -24,8 +24,6 @@ Description-Content-Type: text/markdown
24
24
 
25
25
  This repository aims to provide the documentation, learning materials, and software tools to facilitate the creation of a data model in Gen3.
26
26
 
27
- [Github Repo](https://github.com/AustralianBioCommons/gen3schemadev)
28
-
29
27
  ***Pre-Reading**: Please become familiar with some [core data modelling concepts](docs/core_concepts/pre_reading.md) before starting.*
30
28
 
31
29
 
@@ -4,8 +4,6 @@
4
4
 
5
5
  This repository aims to provide the documentation, learning materials, and software tools to facilitate the creation of a data model in Gen3.
6
6
 
7
- [Github Repo](https://github.com/AustralianBioCommons/gen3schemadev)
8
-
9
7
  ***Pre-Reading**: Please become familiar with some [core data modelling concepts](docs/core_concepts/pre_reading.md) before starting.*
10
8
 
11
9
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "Gen3SchemaDev"
3
- version = "2.3.3"
3
+ version = "2.3.5"
4
4
  description = "Tool for data modelling in Gen3"
5
5
  authors = [
6
6
  {name = "JoshuaHarris391",email = "harjo391@gmail.com"}
@@ -10,7 +10,7 @@ readme = "README.md"
10
10
  requires-python = ">=3.12.10,<4.0"
11
11
  dependencies = [
12
12
  "setuptools>=70.0",
13
- "gen3-validator (>=1.1.1,<2.0.0)",
13
+ "gen3-validator (>=2.0.0,<3.0.0)",
14
14
  "linkml (>=1.9.4,<2.0.0)",
15
15
  "check-jsonschema (>=0.34.1, <0.35.0)",
16
16
  "pydantic (>=2.11.9,<3.0.0)"
@@ -307,6 +307,10 @@ def create_link_prop(target_node: str, multiplicity: str) -> dict:
307
307
  """
308
308
  Create a property dictionary for a link to another node.
309
309
 
310
+ Links targeting 'project' use the special 'to_one_project' / 'to_many_project'
311
+ definitions because the project foreign key is identified by 'id' or 'code'
312
+ (foreign_key_project), not the standard 'id' or 'submitter_id' (foreign_key).
313
+
310
314
  Args:
311
315
  target_node: The name of the target node.
312
316
  multiplicity: The multiplicity of the link (e.g., 'one_to_one', 'one_to_many').
@@ -314,9 +318,14 @@ def create_link_prop(target_node: str, multiplicity: str) -> dict:
314
318
  Returns:
315
319
  A dictionary representing the link property for the schema.
316
320
  """
321
+ formatted = format_multiplicity(multiplicity)
322
+ if target_node == "project":
323
+ ref = f"_definitions.yaml#/{formatted}_project"
324
+ else:
325
+ ref = f"_definitions.yaml#/{formatted}"
317
326
  link_prop = {
318
327
  link_suffix(target_node): {
319
- "$ref": f"_definitions.yaml#/{format_multiplicity(multiplicity)}"
328
+ "$ref": ref
320
329
  }
321
330
  }
322
331
  return link_prop
@@ -17,6 +17,7 @@ class RuleValidator:
17
17
  self.type_array_needs_items()
18
18
  self.core_metadata_required_link()
19
19
  self.data_file_props_need_data_props()
20
+ self.project_must_require_code()
20
21
 
21
22
  def _get_links(self):
22
23
  links = self.schema.get("links", [])
@@ -239,6 +240,22 @@ class RuleValidator:
239
240
  return True
240
241
 
241
242
 
243
+ def project_must_require_code(self):
244
+ """If the schema is for the project node (id: project),
245
+ then 'code' must be in the required list. Gen3 uses 'code'
246
+ as the unique project identifier.
247
+ """
248
+ if self.schema.get('id', '') != 'project':
249
+ return True
250
+
251
+ required = self.schema.get('required', [])
252
+ if 'code' not in required:
253
+ raise ValueError(
254
+ f"Schema 'project' must include 'code' in the 'required' list. "
255
+ f"Please add 'code' to the 'required' section."
256
+ )
257
+ return True
258
+
242
259
  def core_metadata_required_link(self):
243
260
  """Core metadata collection schema needs at least one required link
244
261
  """
File without changes