ADR-018 — OrgUnit Demand Scope
ADR-018 — OrgUnit Demand Scope
Sección titulada «ADR-018 — OrgUnit Demand Scope»Accepted
Context
Sección titulada «Context»The OrgUnit tree has four levels: CLINIC (L0) → DEPARTMENT (L1) → SERVICE (L2) → UNIT (L3). The existing rule restricts Positions exclusively to UNIT nodes (leaves). Management roles — department heads, service coordinators — operate at L1/L2, hold real contracted hours, and appear in the payroll. This created pressure to relax the constraint and allow Positions on non-leaf nodes.
The evaluated alternative was removing the constraint from the domain model to enable Positions on DEPARTMENT and SERVICE nodes. Rejected: it violates SRP (each node type has one function), complicates coverage rollup reasoning (a node that both aggregates and produces demand breaks the upward-accumulation invariant), and requires unnecessary migrations and backend changes.
Decision
Sección titulada «Decision»The UNIT-only constraint on Positions remains intact in the backend and domain. Representing management roles at L1/L2 is a presentation concern, not a domain concern. The Angular OrgChart component will detect and render “management UNITs” — leaf nodes that hold a single management Position — differently, using data already available in the API response. No new fields, migrations, or business-rule changes are required.
Consequences
Sección titulada «Consequences»Backend, domain model, and existing tests are unaffected. Presentation flexibility is owned entirely by the Angular layer. The coverage rollup invariant holds ([[adr-020-coverage-dashboard-strategy|ADR-020]]): only UNIT nodes produce demand; all ancestor nodes aggregate only. The distinction between an operational UNIT and a management UNIT is expressed in the template, not the schema — presentation can be iterated without touching migrations or API contracts.