Pathology Workflow Editor Reuse
What the pathology editor reuses from worklist-editor and its non-modification boundary.
What this folder reuses from
worklist-editor, what it adds, and the explicit non-modification boundary.
Reuse Principle
worklist-editor is not forked. It is composed. We import:
- 5 hooks (no copies, no wrappers — direct imports)
- 1 type module (
types/index.ts) - 2 components (
DepartmentSelector,NodeConfigDrawer)
If the upstream worklist-editor changes (new prop, new behaviour), this editor inherits the change for free.
What We Reuse
| Upstream symbol | Imported as | Used in | Rationale |
|---|---|---|---|
useDepartmentSelection |
useDepartmentSelection |
pathology-workflow-editor/index.tsx |
Same clinic/sub-clinic picker |
useWorkflowManagement |
useWorkflowManagement |
same | Loads workflow_templates rows for pathology dept |
useRoleWorklistConfig |
useRoleWorklistConfig |
same | Per-role visibility (Pathologist sees Sign-out, Tech sees Slide Prep) |
useWorkflowGraph |
useWorkflowGraph |
same | Builds parent-child graph from edges for canvas |
useQuickSetup |
useQuickSetup |
same | “Generate standard pathology presets” button |
WorkflowNode type |
WorkflowNode |
types/index.ts (extended) |
We extend with pathologyMeta |
WorkflowEdge type |
WorkflowEdge |
same | Unchanged |
| `` | `` | top of editor page | Same UX as worklist-editor |
| `` | `` | right-side drawer | We pass extraTabs={PATHOLOGY_PANELS} |
All imports route through:
import {
useDepartmentSelection,
useWorkflowManagement,
useRoleWorklistConfig,
useWorkflowGraph,
useQuickSetup,
} from '@/common/components/medical/builder/worklist-editor/hooks';
(We rely on the existing folder; no barrel changes needed.)
What We Add (Pathology-Specific)
web/src/common/components/medical/builder/pathology-workflow-editor/
├── index.tsx ← page shell
├── types/
│ └── index.ts ← PathologyNodeType enum, PathologyWorkflowNode interface
├── defaults/
│ └── pathology-default-workflow.ts ← seed nodes + edges
├── nodes/
│ ├── PathologyRegisterNode.tsx
│ ├── PathologyGrossingNode.tsx
│ ├── PathologySlidePrepNode.tsx
│ ├── PathologySlideScanNode.tsx
│ ├── PathologySignoutNode.tsx
│ ├── PathologyReleaseNode.tsx
│ └── index.ts ← PATHOLOGY_NODE_REGISTRY
├── panels/
│ ├── SpecimenConfigPanel.tsx
│ ├── PriorityRulesPanel.tsx
│ ├── TurnaroundPanel.tsx
│ ├── SignoutRulesPanel.tsx
│ └── index.ts ← PATHOLOGY_PANELS, extraTabs builder
└── components/
├── PathologyNodeCanvas.tsx ← canvas of pathology nodes (visual)
└── PathologyStateFooter.tsx ← sticky transition footer (the "Foote")
What We Do NOT Modify
worklist-editor/index.tsx— untouchedworklist-editor/components/*— untouchedworklist-editor/hooks/*— untouchedworklist-editor/types/*— untouched (we extend in our own types file)main-flow-editor/components/workflow/types.ts(BlockEnum) — untouched (the deep-mock direction would add to it later; for the demo mock the pathology node types are local to this folder)packages/medical-kit/src/medical-worklist/defaults/pathology-*.json— untouched (the editor reads them as the seed source)
If the demo proves the value, the next step is upstreaming pathology node types into BlockEnum so they’re first-class in main-flow-editor too. That’s tracked in integration-guide.md under “Promotion to First-Class”.
Drawer Extension Pattern
NodeConfigDrawer accepts an extraTabs prop (added as part of this work — see the type extension in panels/index.ts). The pathology editor passes:
<NodeConfigDrawer
open={drawerOpen}
editingNode={editingNode}
workflowNodes={workflowNodes}
selectedRole={selectedRole}
customConfigs={customConfigs}
queueConfigs={queueConfigs}
onSave={handleSaveNodeConfig}
onSwitchToActionTab={handleSwitchToActionTab}
onPreviewNode={handlePreviewNode}
extraTabs={getPathologyTabs(editingNode)} // ← pathology-only injection
/>
getPathologyTabs(nodeId) returns the 3-4 pathology panels relevant to the node type. For non-pathology nodes (if the user opens this editor on a clinic dept that mixes node types), extraTabs returns [] and the drawer renders unchanged.
NOTE on
NodeConfigDrawer: at the time of writing,NodeConfigDrawerdoes not yet exposeextraTabs. The clean upstream change is a 5-line additive prop. Until that lands, the pathology editor renders its own drawer (PathologyConfigDrawer.tsx— a thin copy ofNodeConfigDrawerwith the extra tabs hardcoded). When the upstream prop lands, deletePathologyConfigDrawer.tsxand switch to ``.
This keeps the change additive — a TODO sticker, not a fork.