feat(fma): /fma-body organ search + zoom + clinical NARS reasoning#60
Conversation
Adds two things the operator asked for on the /fma-body full-body viewer:
1. Search + zoom. cockpit_bake now emits fma_body.mesh.nodes.json — a
row→{fma, name, tissue} index for the 768 FMA nodes that actually carry
geometry in the mesh (name = deepest segment of the part_of distinguished
name). FmaBody.tsx reads it, groups vertices by node_row into per-node
centroids client-side, and a search box lerps the camera to the picked
organ's centroid. No mesh-byte change — the index rides alongside.
2. Clinical NARS reasoning panel. New /api/clinical/reason endpoint
(crates/cockpit-server/src/clinical.rs) compiles a
{organ, condition, medication, labs} scenario into a small clinical graph
of (subject -rel-> object, NarsTruth) statements from a hand-authored rule
KB (condition→effects, drug→properties, (effect×property)→risk,
lab→effect), then runs 2-hop NARS deduction A→B, B→C ⊢ A→C through the
REAL planner algebra (lance_graph_planner::nars::truth::TruthValue::
deduction, f=f1·f2 c=f1·f2·c1·c2) — the same bridge graph_engine uses.
e.g. cirrhotic liver + acetaminophen chains acetaminophen → hepatically
_metabolized → drug_accumulation_toxicity. Returns inferences (truth_f/
truth_c) + a plain-language summary. FmaBody ships a SCENARIOS mock set so
the panel is clickable for demo; an in-view disclaimer marks it a NARS
illustration over a tiny rule KB, NOT medical advice.
Additive only: new endpoint, new viewer state, new bake artifact — no
existing route, mesh, or page touched. Frontend (tsc+vite) builds green; the
wire contract (summary / inferences[source,target,truth_f,truth_c,
inference_type,via] / disclaimer) is matched on both ends. clinical.rs carries
a unit test for the cirrhosis→accumulation chain.
NOTE: cockpit-server could not be compiled in this environment —
lance-graph-ogar is absent from the local lance-graph checkout, so the whole
workspace manifest fails to load. clinical.rs is rustfmt-validated and its
logic hand-traced; the route + module are wired in main.rs. Backend
verification is CI/redeploy-gated.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GJ4NVBSjq1w5h7RmTbVafb
Two architecture notes the operator requested alongside the V3 convergence: - V3_SOA_WIRING.md — how the canonical NodeGuid's (part_of:is_a) tile is laid into the SoA columns (key = part_of high byte / is_a low byte, cascading HEEL→HIP→TWIG), the Located-vs-Cascade classid dispatch, and what "guid-shaped AST" means for rails-style programs eventually running off the key — prerender / route / group from the key with zero value decode. 8 claims tagged CONJECTURE. - OGAR_CONSUMER_INTEGRATION.md — what each consumer must do to upgrade to the (part_of:is_a) addressing and what the new data-representation + AST superpowers are (key-only SoA scan, prefix-routable subtree selection, the 89-130× key-vs-value scan measured in soa_scan). 4 claims tagged CONJECTURE; surfaces that osint-bake still uses the 7-group NodeGuid v2 API (new_v2/.leaf()/.family_v2()) not present in the 6-group canonical_node.rs — flagged as an I-LEGACY-API-FEATURE-GATED follow-up. Docs only; no code touched. Speculative claims are CONJECTURE-marked rather than asserted as shipped behavior. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GJ4NVBSjq1w5h7RmTbVafb
|
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 (7)
📝 WalkthroughWalkthroughAdds a NARS clinical deduction backend ( ChangesNode Search Index + Clinical Reasoning Feature
V3 SoA Wiring and OGAR Consumer Integration Docs
Sequence Diagram(s)sequenceDiagram
actor User
participant FmaBody as FmaBody (React)
participant CockpitServer as Cockpit Server
participant clinical_reason_handler
User->>FmaBody: Select organ (pick)
FmaBody->>FmaBody: Set stRef.focus → rowCentroid[node]
FmaBody->>FmaBody: Lerp OrbitControls target + camera
User->>FmaBody: Select scenario + click Run
FmaBody->>CockpitServer: POST /api/clinical/reason {organ, condition, medication, labs}
CockpitServer->>clinical_reason_handler: Deserialize ClinicalScenario
clinical_reason_handler->>clinical_reason_handler: reason() — rule KB + 2-hop NARS deduction
clinical_reason_handler-->>FmaBody: {inferences[], summary, engine, disclaimer}
FmaBody-->>User: Render summaries + filtered inferences panel
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 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 |
Builds on the merged
/fma-bodyplateau (#59). Two commits, additive only — no existing route, mesh, or page touched. Adds the two things the operator asked for on the full-body viewer (search-to-zoom + clinical NARS reasoning), plus the two requested architecture docs.1 ·
/fma-bodysearch + zoom + clinical NARS panel (b309cb56)Search → zoom
cockpit_bakenow emitsfma_body.mesh.nodes.json— arow → {fma, name, tissue}index for the 768 FMA nodes that actually carry geometry in the mesh (name= deepest segment of thepart_ofdistinguished name, e.g.FMA10014 → "ninth thoracic vertebra").FmaBody.tsxreads it, groups vertices by the per-vertexnode_rowinto client-side centroids, and a search box lerps the camera onto the picked organ. No mesh-byte change — the index rides alongside (the only bake write-path edit is an iteration-style fix that emits identical bytes).Clinical NARS reasoning
New
POST /api/clinical/reason(crates/cockpit-server/src/clinical.rs) compiles a{organ, condition, medication, labs}scenario into a small clinical graph of(subject —rel→ object, NarsTruth)statements from a hand-authored rule KB (condition→effects, drug→properties, (effect×property)→risk, lab→effect), then runs 2-hop NARS deductionA→B, B→C ⊢ A→Cthrough the real planner algebra —lance_graph_planner::nars::truth::TruthValue::deduction(f = f1·f2,c = f1·f2·c1·c2), the same bridgegraph_engine::nars_deductionuses.FmaBody.tsxships aSCENARIOSmock set (cirrhotic liver + acetaminophen, CKD + NSAID, etc.) so the panel is clickable for demo, renders the summary + derived deductions (truth_f/truth_c), and shows an in-view disclaimer: a NARS illustration over a tiny rule KB, not medical advice.fma/src/bin/cockpit_bake.rs,cockpit/public/fma_body.mesh.nodes.jsoncockpit/src/FmaBody.tsxTruthValue::deduction) + unit testcrates/cockpit-server/src/clinical.rsmod clinical;+ one routecrates/cockpit-server/src/main.rs2 · V3
(part_of:is_a)SoA wiring + OGAR consumer integration docs (0242f7af)fma/docs/V3_SOA_WIRING.md— how the canonicalNodeGuid's(part_of:is_a)tile lays into the SoA columns (high byte =part_of/where, low byte =is_a/what, cascading HEEL→HIP→TWIG), the Located-vs-Cascadeclassiddispatch, and what "guid-shaped AST" means for rails-style programs eventually running off the key (prerender / route / group with zero value decode).fma/docs/OGAR_CONSUMER_INTEGRATION.md— per-consumer upgrade path to the(part_of:is_a)addressing + the new data-representation/AST superpowers (key-only SoA scan, prefix-routable subtree selection, the 89–130× key-vs-value scan fromsoa_scan). Surfaces thatosint-bakestill uses the 7-groupNodeGuidv2 API (new_v2/.leaf()/.family_v2()) absent from the 6-groupcanonical_node.rs— flagged as anI-LEGACY-API-FEATURE-GATEDfollow-up.Speculative claims in both docs are CONJECTURE-tagged rather than asserted as shipped behavior.
Verification — and one honest gap
Verified locally:
cargo clippyclean on the touched bins (cockpit_bake/converge/graph/soa_scan). Theanchor(3)/mesh(1) warnings are byte-identical onorigin/main— pre-existing, out of scope.tsc + vitebuild green (102 modules).summary/inferences[source, target, truth_f, truth_c, inference_type, via]/disclaimer;FmaBodyreads exactly those and filtersinference_type === 'Deduction'.clinical.rscarries a unit test for the cirrhosis→accumulation chain.Could NOT verify (env gap, pre-existing):
cockpit-serverdoes not compile in this environment —lance-graph-ogaris absent from the locallance-graphcheckout, so the whole workspace manifest fails to load.clinical.rsis rustfmt-validated and its logic hand-traced; the route + module are wired. Backend compile + the NARS panel going live are CI / cockpit-redeploy-gated — the frontend and the bake artifact are fully verified, the backend is not.🤖 Generated with Claude Code
https://claude.ai/code/session_01GJ4NVBSjq1w5h7RmTbVafb
Generated by Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Documentation