Refactors the NLI logic to use chain-of-command - #53
Merged
Conversation
Contributor
There was a problem hiding this comment.
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.tsfrom procedural for-loop to step-based architecture withinitializeNLIIterationandcheckLevelstep 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #49