Skip to content

Commit 59e64ef

Browse files
committed
feat(calc): moca
1 parent 81f4922 commit 59e64ef

File tree

16 files changed

+308
-472
lines changed

16 files changed

+308
-472
lines changed

src/scores/library.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ import { koos_ps } from './koos_ps/koos_ps'
7474
// import { mini_best_test } from './mini_best_test/mini_best_test'
7575
import { mfis } from './mfis/mfis'
7676
// import { mmse } from './mmse/mmse'
77-
// import { moca } from './moca/moca'
77+
import { moca } from './moca/moca'
7878
import { modified_caregiver_strain_index } from './modified_caregiver_strain_index/modified_caregiver_strain_index'
7979
import { mpi } from './mpi/mpi'
8080
import { msq } from './msq/msq'
@@ -221,7 +221,7 @@ export const ScoreLibrary = createScoreLibrary({
221221
mfis,
222222
mlks,
223223
// mmse,
224-
// moca,
224+
moca,
225225
modified_caregiver_strain_index,
226226
mpi,
227227
msq,
File renamed without changes.

src/scores/moca/definition/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export * from './moca_scales'
2+
export * from './moca_output'
3+
export * from './moca_inputs'
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
import { z } from 'zod'
2+
import { type ScoreInputSchemaType } from '../../../types'
3+
export const MOCA_INPUTS = {
4+
ALTERNATING_TRAIL_MARKING: {
5+
type: z.union([z.literal(0), z.literal(1)]).optional(),
6+
},
7+
VISUOCONSTRUCTIONAL_SKILLS_CUBE: {
8+
type: z.union([z.literal(0), z.literal(1)]).optional(),
9+
},
10+
VISUOCONSTRUCTIONAL_SKILLS_CLOCK: {
11+
type: z
12+
.array(z.union([z.literal(0), z.literal(1), z.literal(2)]))
13+
.optional(),
14+
uiOptions: {
15+
options: [
16+
{ value: 0, label: { en: 'Contour' } },
17+
{ value: 1, label: { en: 'Numbers' } },
18+
{ value: 2, label: { en: 'Hands' } },
19+
],
20+
},
21+
},
22+
NAMING: {
23+
type: z
24+
.array(z.union([z.literal(0), z.literal(1), z.literal(2)]))
25+
.optional(),
26+
uiOptions: {
27+
options: [
28+
{ value: 0, label: { en: 'Lion' } },
29+
{ value: 1, label: { en: 'Rhino' } },
30+
{ value: 2, label: { en: 'Camel' } },
31+
],
32+
},
33+
},
34+
FORWARD_DIGIT_SPAN: {
35+
type: z.union([z.literal(0), z.literal(1)]).optional(),
36+
},
37+
BACKWARD_DIGIT_SPAN: {
38+
type: z.union([z.literal(0), z.literal(1)]).optional(),
39+
},
40+
VIGILANCE: {
41+
type: z.union([z.literal(0), z.literal(1)]).optional(),
42+
},
43+
SERIAL_7S: {
44+
type: z
45+
.union([z.literal(0), z.literal(1), z.literal(2), z.literal(3)])
46+
.optional(),
47+
},
48+
SENTENCE_REPETITION: {
49+
type: z.union([z.literal(0), z.literal(1), z.literal(2)]).optional(),
50+
},
51+
VERBAL_FLUENCY: {
52+
type: z.union([z.literal(0), z.literal(1)]).optional(),
53+
},
54+
ABSTRACTION: {
55+
type: z.union([z.literal(0), z.literal(1), z.literal(2)]).optional(),
56+
},
57+
DELAYED_RECALL: {
58+
type: z
59+
.array(
60+
z.union([
61+
z.literal(0),
62+
z.literal(1),
63+
z.literal(2),
64+
z.literal(3),
65+
z.literal(4),
66+
]),
67+
)
68+
.optional(),
69+
uiOptions: {
70+
options: [
71+
{ value: 0, label: { en: 'Face' } },
72+
{ value: 1, label: { en: 'Velvet' } },
73+
{ value: 2, label: { en: 'Church' } },
74+
{ value: 3, label: { en: 'Daisy' } },
75+
{ value: 4, label: { en: 'Red' } },
76+
],
77+
},
78+
},
79+
ORIENTATION: {
80+
type: z
81+
.array(
82+
z.union([
83+
z.literal(0),
84+
z.literal(1),
85+
z.literal(2),
86+
z.literal(3),
87+
z.literal(4),
88+
z.literal(5),
89+
]),
90+
)
91+
.optional(),
92+
uiOptions: {
93+
options: [
94+
{ value: 0, label: { en: 'Date' } },
95+
{ value: 1, label: { en: 'Month' } },
96+
{ value: 2, label: { en: 'Year' } },
97+
{ value: 3, label: { en: 'Day' } },
98+
{ value: 4, label: { en: 'Location' } },
99+
{ value: 5, label: { en: 'Place' } },
100+
],
101+
},
102+
},
103+
} satisfies ScoreInputSchemaType
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { z } from 'zod'
2+
import { type ScoreOutputSchemaType } from '../../../types'
3+
4+
export const MOCA_OUTPUT = {
5+
TOTAL: {
6+
label: { en: 'Total score' },
7+
type: z.number(),
8+
},
9+
VISUOSPATIAL_EXECUTIVE: {
10+
label: { en: 'Visuospatial / executive' },
11+
type: z.number(),
12+
},
13+
NAMING: {
14+
label: { en: 'Naming' },
15+
type: z.number(),
16+
},
17+
ATTENTION: {
18+
label: { en: 'Attention' },
19+
type: z.number(),
20+
},
21+
LANGUAGE: {
22+
label: { en: 'Language' },
23+
type: z.number(),
24+
},
25+
ABSTRACTION: {
26+
label: { en: 'Abstraction' },
27+
type: z.number(),
28+
},
29+
DELAYED_RECALL: {
30+
label: { en: 'Delayed recall' },
31+
type: z.number(),
32+
},
33+
ORIENTATION: {
34+
label: { en: 'Orientation' },
35+
type: z.number(),
36+
},
37+
} satisfies ScoreOutputSchemaType
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
export type ScaleType =
2+
| 'VISUOSPATIAL_EXECUTIVE'
3+
| 'NAMING'
4+
| 'ATTENTION'
5+
| 'LANGUAGE'
6+
| 'ABSTRACTION'
7+
| 'DELAYED_RECALL'
8+
| 'ORIENTATION'
9+
10+
export const MOCA_SCALES: Record<ScaleType, string[]> = {
11+
VISUOSPATIAL_EXECUTIVE: [
12+
'ALTERNATING_TRAIL_MARKING',
13+
'VISUOCONSTRUCTIONAL_SKILLS_CUBE',
14+
'VISUOCONSTRUCTIONAL_SKILLS_CLOCK',
15+
],
16+
NAMING: ['NAMING'],
17+
ATTENTION: [
18+
'FORWARD_DIGIT_SPAN',
19+
'BACKWARD_DIGIT_SPAN',
20+
'VIGILANCE',
21+
'SERIAL_7S',
22+
],
23+
LANGUAGE: ['SENTENCE_REPETITION', 'VERBAL_FLUENCY'],
24+
ABSTRACTION: ['ABSTRACTION'],
25+
DELAYED_RECALL: ['DELAYED_RECALL'],
26+
ORIENTATION: ['ORIENTATION'],
27+
}

0 commit comments

Comments
 (0)