Skip to content

Commit 8873b7e

Browse files
committed
fix: remove impactOnFunctioning from PHQ-9 total score
1 parent 6f287e7 commit 8873b7e

File tree

1 file changed

+14
-12
lines changed
  • packages/instrument-library/src/forms/patient-health-questionnaire-9

1 file changed

+14
-12
lines changed

packages/instrument-library/src/forms/patient-health-questionnaire-9/index.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
/* eslint-disable perfectionist/sort-objects */
22

33
import { defineInstrument } from '/runtime/v1/@opendatacapture/runtime-core';
4-
import { sum } from '/runtime/v1/[email protected]';
4+
import { omit, sum } from '/runtime/v1/[email protected]';
55
import { z } from '/runtime/v1/[email protected]';
66

7+
const $Response = z.number().int().min(0).max(3);
8+
79
export default defineInstrument({
810
kind: 'FORM',
911
language: ['en', 'fr'],
@@ -216,21 +218,21 @@ export default defineInstrument({
216218
totalScore: {
217219
kind: 'computed',
218220
label: { en: 'Total Score', fr: 'Score total' },
219-
value: ({ questions }) => sum(Object.values(questions))
221+
value: ({ questions }) => sum(Object.values(omit(questions, 'impactOnFunctioning')))
220222
}
221223
},
222224
validationSchema: z.object({
223225
questions: z.object({
224-
interestPleasure: z.number().int().min(0).max(3),
225-
feelingDown: z.number().int().min(0).max(3),
226-
sleepIssues: z.number().int().min(0).max(3),
227-
energyLevel: z.number().int().min(0).max(3),
228-
appetiteChanges: z.number().int().min(0).max(3),
229-
selfWorth: z.number().int().min(0).max(3),
230-
concentrationIssues: z.number().int().min(0).max(3),
231-
psychomotorChanges: z.number().int().min(0).max(3),
232-
suicidalThoughts: z.number().int().min(0).max(3)
226+
interestPleasure: $Response,
227+
feelingDown: $Response,
228+
sleepIssues: $Response,
229+
energyLevel: $Response,
230+
appetiteChanges: $Response,
231+
selfWorth: $Response,
232+
concentrationIssues: $Response,
233+
psychomotorChanges: $Response,
234+
suicidalThoughts: $Response
233235
}),
234-
impactOnFunctioning: z.number().int().min(0).max(3).optional()
236+
impactOnFunctioning: $Response.optional()
235237
})
236238
});

0 commit comments

Comments
 (0)