Add minischema/profile mechanism and new field types (ontology, quantity, relative_quantity)#13
Open
stevevanhooser wants to merge 1 commit into
Open
Conversation
Replace the per-kind treatment schemas (treatment_drug, virus_injection) with a single generic treatment document whose manipulation field's shape is delegated to a named profile (minischema). This removes schema-file proliferation for the treatment family while preserving rigor via ontology-anchored profiles and keeping search tractable via canonical units, promoted fields, and profile_id references. Meta-schema changes: - Add ontology, quantity, relative_quantity to the type enum. - Add _shape_from_minischema (boolean) on structure fields; when true, the nested _fields is not required. New: profile_meta.json validates profile files; type-specific _constraints rules (canonical_unit + canonical_unit_label on quantity; add reference on relative_quantity; descendant_of permitted on ontology). New: schemas/V_beta/profiles/virus_injection.json canonical profile. treatment.json rewritten as a generic document with a single manipulation field that delegates its shape via _shape_from_minischema. Version bumped to 2.0.0. Retired: treatment_drug.json, virus_injection.json. stimulus_bath intentionally retained (it's a stimulus approach, not a treatment). Tests: tests/test_minischema.py covers new types, _shape_from_minischema conditional, profile validation, canonical profile contents, and regression over all existing V_beta schemas against the updated meta-schema. 28 new tests, all passing. Follow-on work (drug_treatment profile, mammalian stereotaxic profile, cross-profile canonical-unit registry) captured in Ideas.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a new minischema (profile) mechanism for V_beta schemas, enabling reusable schema fragments that define the shape of structure fields at runtime. It also adds three new field types (
ontology,quantity,relative_quantity) to support richer semantic and measurement data. The treatment family is consolidated from three separate schemas into a single generictreatmentschema that delegates itsmanipulationfield shape to profiles.Key Changes
New meta-schema:
profile_meta.jsonvalidates profile (minischema) files with type-specific constraint rules:quantityfields requirecanonical_unitandcanonical_unit_labelrelative_quantityfields additionally require areferenceanchorontologyfields forbidcanonical_unitUpdated meta-schema:
did_schema_meta.jsonnow:ontology,quantity,relative_quantity_shape_from_minischema: trueon structure fields to delegate shape to profiles_fieldspresence when shape is not delegatedNew canonical profile:
profiles/virus_injection.jsondemonstrates the profile mechanism with:Treatment consolidation:
treatment_drug.jsonandvirus_injection.jsonschemastreatment.jsonto use_shape_from_minischema: trueon themanipulationfieldtreatment._class_versionto 2.0.0 (breaking change)base/schema.jsontobase.jsonComprehensive test suite:
tests/test_minischema.pyvalidates:Documentation updates:
V_beta_SPEC.mdandV_beta_notes.mddocument the new types, profile mechanism, and consolidation rationaleImplementation Details
schemas/V_beta/profiles/with their own versioning and maturity levels_shape_from_minischemaflag allows structure fields to omit inline_fieldswhen shape is supplied at runtime via a document's_minischemakeycanonical_unit_label) plussource_valueandsource_unitfor provenanceextendsfield enables profile composition (e.g., organism-specific or route-specific virus injection profiles)https://claude.ai/code/session_011acLkncHaNtT8YnEeVjWAA