Skip to content

Refactors the NLI logic to use chain-of-command - #53

Merged
EddieMachete merged 1 commit into
masterfrom
49-nli-refactor
Feb 25, 2026
Merged

Refactors the NLI logic to use chain-of-command#53
EddieMachete merged 1 commit into
masterfrom
49-nli-refactor

Conversation

@EddieMachete

Copy link
Copy Markdown
Contributor

Closes #49

@EddieMachete
EddieMachete requested a review from Copilot February 25, 2026 19:45
@EddieMachete EddieMachete self-assigned this Feb 25, 2026
@EddieMachete EddieMachete added the enhancement New feature or request label Feb 25, 2026
@EddieMachete
EddieMachete marked this pull request as ready for review February 25, 2026 19:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the Neurological Level of Injury (NLI) calculation module to use a step-based chain-of-command pattern, aligning it with the architectural approach used in other classification modules (motorLevel, sensoryLevel). The refactor maintains complete backward compatibility while enabling step-by-step visualization of the algorithm for clinical education and auditing purposes.

Changes:

  • Refactored neurologicalLevelOfInjury.ts from procedural for-loop to step-based architecture with initializeNLIIteration and checkLevel step handlers
  • Added 900+ lines of comprehensive tests covering step handlers, generator function, and integration scenarios
  • Added extensive documentation with clinical examples, algorithm explanations, and developer guides

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/en.ts Added 9 translation keys for NLI step descriptions and actions, following established naming conventions
src/classification/neurologicalLevelOfInjury/neurologicalLevelOfInjury.ts Refactored from procedural to step-based architecture; preserved existing check functions; added step handlers, generator, and state management
src/classification/neurologicalLevelOfInjury/neurologicalLevelOfInjury.spec.ts Expanded from 150 to 1061 lines; added comprehensive tests for step handlers, generator, and integration scenarios; removed skipped test (xdescribe)
src/classification/neurologicalLevelOfInjury/README.md Added 677-line clinical documentation explaining algorithm, step-by-step logic, bilateral evaluation, and usage examples
docs/neurologicalLevelOfInjury-architecture.md Added 637-line architecture document detailing step definitions, state types, check functions, and implementation guidance

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@EddieMachete
EddieMachete merged commit 6110d1f into master Feb 25, 2026
6 checks passed
@EddieMachete
EddieMachete deleted the 49-nli-refactor branch February 25, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Neurological Level of Injury refactor

2 participants