osint/fma: hydrate the bake from the real FMA heart subtree, not a fixture#51
Conversation
…xture The /fma render surface was hydrated from a hand-authored fixture (data/fma-heart.fixture.ttl, 4 chambers x 3 wall layers). Replace it with a real subtree extracted from fma.owl (FMA v5.0.0, the 266 MB UW Structural Informatics Group FMA, CC BY 3.0, now mirrored on the q2 fma-ontology-5.0.0 release; SHA-256 59465eb5...79979e44). tools/extract_fma_heart.py streams the OWL (ET.iterparse, memory-bounded — only the label / part / superclass maps are retained, not the ~1.5M-triple graph), walks the regional_part / constitutional_part partonomy from FMA:Heart with a per-parent fan-out cap (root exempt). That keeps the slice a balanced cross-section — all 22 major heart subdivisions (the four chamber cavities, the four valves, the three cardiac septa, both coronary arteries, the wall's endo/epi/myocardium, the fibrous skeleton, ...) with their real sub-parts — instead of draining into FMA's ~40-branch coronary arterial tree. It emits the line-Turtle subset fma_ttl::parse already hydrates; the generic hydrate_fma walk is unchanged (the partonomy IS the key, derived, not hardcoded to "heart"). The fixture's "four myocardia all share one Cardiac-muscle-tissue type" was an invention — real FMA gives region-specific myocardium classes. Rewrite the dual-membership proof to pick the strongest real cross-cutter in the slice (the ceiling type that is the is-a target of the most structures) and its deepest member, instead of a hardcoded label that no longer exists. On the real data it surfaces "Cavity proper of inflow part of right atrium" at a 4-tier-deep part-of address (HEEL[01:01] HIP[02:06] TWIG[03:01] LEAF[04:01]), is-a "Subdivision of cavity of cardiac chamber" — a global type shared by 7 cavity structures across all four chambers. The dual membership is now proven on real anatomy. Verified: - byte-deterministic bake (re-run -> identical fma.soa; 6603 bytes, 125 nodes = 80 part-of + 45 ceiling types, 156 edges) - fma_ttl unit tests pass; clippy clean on the bake (the 3 -D warnings are the pre-existing aiwar-ingest lib dep, not these files) - cockpit FmaGraph.tsx doc updated to the real cross-cutting example; tsc clean - isolated to the osint-bake leaf crate + cockpit vite app; nothing in the quarto-core / pampa / wasm chain is touched The 266 MB OWL is NOT committed; the production hydrator remains the spine's lance_graph_ontology::hydrate_fma over the full fma.owl. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TzqvDqbFRzyx17EkLKBoZF
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughRemoves the hand-authored ChangesFMA Heart Extraction and Dual-Membership Proof Update
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What
The
/fmacockpit view was hydrated from a hand-authored fixture (data/fma-heart.fixture.ttl— 4 chambers × 3 wall layers, with an invented shared tissue type). This replaces it with a real subtree extracted fromfma.owl(FMA v5.0.0, the 266 MB UW Structural Informatics Group FMA, CC BY 3.0, now mirrored on the q2fma-ontology-5.0.0release; SHA-25659465eb5…79979e44).The generic
hydrate_fmawalk is unchanged — the partonomy is still derived into the 8:8[container:identity]HHTL cascade, never hardcoded to "heart". Only the data source and the proof changed.The extractor —
tools/extract_fma_heart.pyStreams the OWL (
ET.iterparse, memory-bounded — only label / part / superclass maps are retained, not the ~1.5M-triple graph) and walks theregional_part/constitutional_partpartonomy fromFMA:Heart. The key tuning is a per-parent fan-out cap (root exempt): without it, FMA's ~40-branch coronary arterial tree drained the whole node budget and left the left side of the heart a leaf stub. With it, the slice is a balanced cross-section — all 22 major heart subdivisions (the four chamber cavities, the four valves, the three cardiac septa, both coronary arteries, the wall's endo/epi/myocardium, the fibrous skeleton, …) each with their real sub-parts. It emits the line-Turtle subsetfma_ttl::parsealready hydrates.The proof had to change (the fixture lied)
The fixture's "four myocardia all share one Cardiac muscle tissue type" was an invention — real FMA gives region-specific myocardium classes (
Myocardium of region of ventricle, …). The hardcodedposition(|x| x.label == "Myocardium of left ventricle")no longer exists in the slice.The proof is now adaptive: it picks the strongest real cross-cutter (the ceiling type that is the
is-atarget of the most structures) and its deepest member. On the real data:A genuine 4-tier-deep part-of address and a global type shared by 7 cavity structures across all four chambers — dual membership proven on real anatomy.
Verification
fma.soa; 6603 bytes, 125 nodes = 80 part-of + 45 ceiling types, 156 edges)cargo run -p osint-bake --bin fmabinary and inspected the proof output (above)fma_ttlunit tests pass; clippy clean on the bake (the 3-D warningsare the pre-existingaiwar-ingestlib dep, not these files)FmaGraph.tsxdoc updated to the real cross-cutting example; tsc clean. The decoder is generic over node count, so no decoder change was needed — browser render not exercised here.osint-bakeleaf crate + thecockpitvite app; nothing in thequarto-core/pampa/wasmchain is touched.Not in this PR
The 266 MB
fma.owlis not committed; the production hydrator remains the spine'slance_graph_ontology::hydrate_fmaover the full file. This light bake exists so/fmarenders without the lance/datafusion closure.🤖 Generated with Claude Code
https://claude.ai/code/session_01TzqvDqbFRzyx17EkLKBoZF
Generated by Claude Code
Summary by CodeRabbit
New Features
Bug Fixes