tools: add gidopensees .mat/.cnd schema parser#2
Merged
Conversation
Deliverables
- tools/gidopensees_import/schema_model.py — Pydantic v2 IR models
(DependencyAction, DependencyRule, FieldSpec, EntrySpec, BookSpec, CatalogSpec)
- tools/gidopensees_import/parse_schemas.py — line-by-line state-machine parser +
CLI (python -m tools.gidopensees_import.parse_schemas --mat … --cnd … --out …)
- tools/gidopensees_import/schemas.json — committed output of the parser run
against gidopensees@HEAD (918 KB, regenerable; checked in for diffable reviews)
- tests/tools/test_parse_schemas.py — 42 passing tests (unit + snapshot +
integration); integration tests auto-skip when gidopensees repo is absent
Parser features
- Handles CRLF/LF, blank lines, leading whitespace; UTF-8 with latin-1 fallback
- QUESTION types: CB (combo), UNITS, MAT (material ref), SCALAR, TUPLE
- VALUE: strips #WIDTH#(N) hint into width_hint field; preserves #N# prefix raw
- DEPENDENCIES: supports single group per line, multiple space-separated groups
per line, RESTORE/HIDE/SET actions, literal and #CURRENT# targets
- TKWIDGET attribution: follows most recent QUESTION; falls back to entry-level
- TITLE: directives stored as section_title on subsequent fields
- STATE: HIDDEN / DISABLED preserved on fields
- END_CONDITION (no space) and END CONDITION (with space) both handled
- Fails loudly with ParseError(path, lineno, message) on malformed input
Verified counts against real gidopensees files
- .mat: 14 books, 58 materials
- .cnd: 6 books, 39 conditions
- Steel02: fields include Steel_grade, Yield_Stress_Fy, Strain-hardening_ratio_b,
Parameter_R0, Parameter_cR1, Parameter_cR2; Formulation has 3 dependency rules
- Concrete04_(Popovics_concrete): book = Uniaxial_Concrete_Materials
Manual Verification checklist (for reviewer)
- [ ] Open tools/gidopensees_import/schemas.json; spot-check Steel02 fields
against OpenSees.mat lines 523-594 — field names, options, defaults.
- [ ] Spot-check Concrete04_(Popovics_concrete) in schemas.json against
OpenSees.mat lines 901-958.
- [ ] Confirm mat_books[0].entries count == 10 (Standard_Uniaxial_Materials book).
- [ ] Confirm schemas.json contains exactly 58 mat entries in total.
- [ ] Confirm no src/, tests/unit/, or pyproject.toml files were modified.
- [ ] Run: python -m tools.gidopensees_import.parse_schemas --mat … --cnd … --out /tmp/test.json
and diff against tools/gidopensees_import/schemas.json — must be identical.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Deliverables
against gidopensees@HEAD (918 KB, regenerable; checked in for diffable reviews)
integration); integration tests auto-skip when gidopensees repo is absent
Parser features
Verified counts against real gidopensees files
Manual Verification checklist (for reviewer)
Summary
Linked issue
Closes #
Type of change
Architectural checklist
from PySide6incore/orservices/import openseespyincore/orviews/Testing