Skip to content

Relecov schema and schema generation - Patch changes#844

Merged
ESapenaVentura merged 10 commits into
BU-ISCIII:developfrom
ESapenaVentura:esv_schema_patch
Dec 22, 2025
Merged

Relecov schema and schema generation - Patch changes#844
ESapenaVentura merged 10 commits into
BU-ISCIII:developfrom
ESapenaVentura:esv_schema_patch

Conversation

@ESapenaVentura

@ESapenaVentura ESapenaVentura commented Dec 15, 2025

Copy link
Copy Markdown
Member

PR Checklist

  • This comment contains a description of changes (with reason).
  • Make sure your code lints (black and flake8).
  • CHANGELOG.md is updated.
  • README.md is updated (including new tool citations and authors/contributors).

Changes

Described more thoroughly here: #835 . AI below:

  • Upgraded the build_schema.py module so that it fixes typos on the fly.
    • Now description always ends in . (Unless finished in a )) and has no spaces at the beginning or the end
    • Now examples are the same type as the field
  • Upgraded the build_schema.py module to reference enums in $defs and move them to the end.
  • Update the schema excel file to add the identifiers_org_prefix keyword in options
  • Updated template in repository to 3.2.4

@ESapenaVentura ESapenaVentura self-assigned this Dec 15, 2025
@ESapenaVentura ESapenaVentura changed the title Schema patches Relecov schema and schema generation - Patch changes Dec 15, 2025
Comment thread relecov_tools/build_schema.py Outdated
else enum_list
def resolve_enum_ref(ref: str, enum_defs: dict) -> list[str]:
property_id = ref.split("/")[-1]
values = enum_defs[property_id]["enum"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You declare enum_defs = json_schema.get("$defs", {}).get("enums", {}) before, leaving the possibility of this variable to be an empty dict. In that case this line would crash without option to track the original error. I'd suggest adding a try/except clause either here or in the definition of enum_defs

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Many thanks :) I've updated it so that this exception is caught by property, so if multiple property enums are missing from defs (maybe in the future we add something that deletes some by accident) it spits the error like this (Example for missing "organism" enums):

...
Enter a note about changes made to the schema: asads
Error finding enum for property 'organism'; not found in $defs
Metadata lab template successfuly created in: 
...

Right now it does continue generating the template and finishes somewhat successfully (No enums for those properties, though), I could raise an error and exit or leave it like that. What do you prefer?

@Shettland Shettland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ESapenaVentura ESapenaVentura merged commit 783f862 into BU-ISCIII:develop Dec 22, 2025
19 checks passed
@ESapenaVentura ESapenaVentura deleted the esv_schema_patch branch December 22, 2025 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants