Conversation
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.
Fixes #1780
Fixes #905
As a draft since I still need to review, this is written by Claude.
Plan: Node-ID Consistency Validation via Schema Metadata
Add a
node_id_relationtrait to Julia schema table types, auto-generate it into Python schema classes, and implement validation in NodeModel that checks node_id consistency across tables.Classification
"equal""subset""partition"Partition (static + time pairs): Pump, Outlet, PidControl, LevelBoundary, FlowBoundary, FlowDemand, LevelDemand, UserDemand, TabulatedRatingCurve, Basin
Equal (default): Basin profile/state/concentration/concentration_external/concentration_state, LevelBoundary/FlowBoundary/UserDemand concentration, DiscreteControl variable/condition/logic, ContinuousControl variable/function, ManningResistance static, LinearResistance static
Subset: Basin subgrid/subgrid_time/area, FlowBoundary area, Observation time
Changes Made
Julia — Single Source of Truth (config.jl)
node_id_relation(::Type{<:Table})function with a default of:equal:partitionoverloads for all Static/Time pairs (Pump, Outlet, LevelBoundary, FlowBoundary, TabulatedRatingCurve, PidControl, UserDemand, LevelDemand, FlowDemand):subsetoverloads for Basin.Static, Basin.Time (Basin forcing is optional per-node), Basin.Subgrid, Basin.SubgridTime, and Observation.Timenode_id_relationCodegen (gen_python.jl, schemas.py.jinja)
get_models()now includesnode_id_relationper table typeGenerated (schemas.py)
Non-codegen schemas (area.py)
Validation logic (node.py)
"equal"tables: node_ids must match exactly"subset"tables: node_ids must be a subset"partition"tables: must be pairwise disjoint and their union must equal the full setWired into model validation (model.py)
Tests (test_validation.py)
Design Note
Basin.Static/Time are
:subsetrather than:partitionbecause Basin forcing is optional per-node (Julia usesis_complete=false, defaulting to NaN). The disjointness between Basin static and time is still validated by Julia core at runtime.