-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(calcs): start back, visa, zarit
- Loading branch information
Showing
58 changed files
with
1,160 additions
and
1,586 deletions.
There are no files selected for viewing
This file contains 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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
17 changes: 17 additions & 0 deletions
17
src/scores/start_back_screening_tool/definition/start_back_output.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { z } from 'zod' | ||
import { ScoreOutputSchemaType } from '../../../types' | ||
|
||
export const START_BACK_OUTPUT = { | ||
START_BACK_TOTAL: { | ||
label: { en: 'Total score', nl: 'Totale score' }, | ||
type: z.number(), | ||
}, | ||
START_BACK_SUBSCALE: { | ||
label: { en: 'Subscale score', nl: 'Sub uitslag (Q5-9)' }, | ||
type: z.number(), | ||
}, | ||
START_BACK_RISK_CLASSIFICATION: { | ||
label: { en: 'Risk classification', nl: 'Risicoprofiel' }, | ||
type: z.string(), | ||
}, | ||
} satisfies ScoreOutputSchemaType |
27 changes: 27 additions & 0 deletions
27
src/scores/start_back_screening_tool/helpers/classifyRisk/classifyRisk.test.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { classifyRisk, RiskClassification } from './classifyRisk' | ||
describe('Classify risk', function () { | ||
describe('when total score and subscale score are not missing', function () { | ||
describe('when total score <= 3', function () { | ||
it('should return low risk', function () { | ||
const outcome = classifyRisk({ totalScore: 0, subscaleScore: 0 }) | ||
expect(outcome).toEqual(RiskClassification.LOW_RISK) | ||
}) | ||
}) | ||
|
||
describe('when total score >= 4', function () { | ||
describe('and when subscale score <= 3', function () { | ||
it('should return medium risk', function () { | ||
const outcome = classifyRisk({ totalScore: 4, subscaleScore: 0 }) | ||
expect(outcome).toEqual(RiskClassification.MEDIUM_RISK) | ||
}) | ||
}) | ||
|
||
describe('and when subscale score >= 4', function () { | ||
it('should return medium risk', function () { | ||
const outcome = classifyRisk({ totalScore: 4, subscaleScore: 4 }) | ||
expect(outcome).toEqual(RiskClassification.HIGH_RISK) | ||
}) | ||
}) | ||
}) | ||
}) | ||
}) |
29 changes: 29 additions & 0 deletions
29
src/scores/start_back_screening_tool/helpers/classifyRisk/classifyRisk.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
export enum RiskClassification { | ||
LOW_RISK = 'Low risk', | ||
MEDIUM_RISK = 'Medium risk', | ||
HIGH_RISK = 'High risk', | ||
} | ||
|
||
export const classifyRisk = ({ | ||
totalScore, | ||
subscaleScore, | ||
}: { | ||
totalScore: number | ||
subscaleScore: number | ||
}): RiskClassification => { | ||
const TOTAL_SCORE_CUT_OFF = 3 | ||
const SUBSCALE_SCORE_CUT_OFF = 3 | ||
|
||
if (totalScore <= TOTAL_SCORE_CUT_OFF) { | ||
return RiskClassification.LOW_RISK | ||
} | ||
|
||
if ( | ||
totalScore > TOTAL_SCORE_CUT_OFF && | ||
subscaleScore <= SUBSCALE_SCORE_CUT_OFF | ||
) { | ||
return RiskClassification.MEDIUM_RISK | ||
} | ||
|
||
return RiskClassification.HIGH_RISK | ||
} |
Oops, something went wrong.