Skip to content

Commit e037a28

Browse files
committed
feat: add FAGERSTRÖM_NICOTINE_DEPENDENCE
1 parent 500aca2 commit e037a28

1 file changed

Lines changed: 161 additions & 0 deletions

File tree

  • packages/instrument-library/src/forms/FAGERSTRÖM_NICOTINE_DEPENDENCE
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
import { defineInstrument } from '/runtime/v1/@opendatacapture/runtime-core';
2+
import { sum } from '/runtime/v1/lodash-es@4.x';
3+
import { z } from '/runtime/v1/zod@3.23.x';
4+
5+
const yesNoOptions = {
6+
en: {
7+
1: 'Yes',
8+
0: 'No'
9+
},
10+
fr: {
11+
1: 'Oui',
12+
0: 'Non'
13+
}
14+
};
15+
16+
export default defineInstrument({
17+
kind: 'FORM',
18+
language: ['en', 'fr'],
19+
internal: {
20+
name: 'FAGERSTRÖM_NICOTINE_DEPENDENCE',
21+
edition: 1
22+
},
23+
tags: {
24+
en: ['smoking', 'addiction', 'nicotine'],
25+
fr: ['fumer', 'dépendance', 'nicotine']
26+
},
27+
details: {
28+
description: {
29+
en: 'The Fagerström Test for Nicotine Dependence is a standard instrument for assessing the intensity of physical addiction to nicotine. The test was designed to provide an ordinal measure of nicotine dependence related to cigarette smoking. It contains six items that evaluate the quantity of cigarette consumption, the compulsion to use, and dependence.',
30+
fr: "Le test de Fagerström pour la dépendance à la nicotine est un instrument standard pour évaluer l'intensité de la dépendance physique à la nicotine. Le test a été conçu pour fournir une mesure ordinale de la dépendance à la nicotine liée au tabagisme. Il contient six items qui évaluent la quantité de cigarettes consommées, la compulsion à consommer et la dépendance."
31+
},
32+
estimatedDuration: 5,
33+
instructions: {
34+
en: ['Please respond to every question'],
35+
fr: ['Veuillez répondre à toutes les questions']
36+
},
37+
license: 'PUBLIC-DOMAIN',
38+
title: {
39+
en: 'Fagerström Nicotine Dependence (FTND)',
40+
fr: 'Fagerström test de dépendance à la nicotine (FTND)'
41+
}
42+
},
43+
44+
content: {
45+
smokeTime: {
46+
disableAutoPrefix: true,
47+
kind: 'number',
48+
label: {
49+
en: '1. How soon after waking do you smoke your first cigarette?',
50+
fr: '1. Combien de temps après le réveil fumez-vous votre première cigarette?'
51+
},
52+
options: {
53+
en: {
54+
3: 'Within 5 minutes',
55+
2: '6-30 minutes',
56+
1: '31-60 minutes',
57+
0: 'More than 60 minutes'
58+
},
59+
fr: {
60+
3: 'Dans les 5 minutes',
61+
2: '6 à 30 minutes',
62+
1: '31 à 60 minutes ',
63+
0: 'Plus de 60 minutes'
64+
}
65+
},
66+
variant: 'radio'
67+
},
68+
difficultToRefrainSmoking: {
69+
disableAutoPrefix: true,
70+
kind: 'number',
71+
label: {
72+
en: '2. Do you find it difficult to refrain from smoking in places where it is forbidden? e.g., Church, Library, etc.',
73+
fr: "2. Trouvez-vous qu'il est difficile de vous abstenir de fumer dans les endroits où c'est interdit, tels le métro, le cinéma, l'hôpital, les restaurants?"
74+
},
75+
options: yesNoOptions,
76+
variant: 'radio'
77+
},
78+
cigaretteHateToGiveup: {
79+
disableAutoPrefix: true,
80+
kind: 'number',
81+
label: {
82+
en: '3. Which cigarette would you hate to give up?',
83+
fr: '3. À quelle cigarette renonceriez-vous le plus difficilement?'
84+
},
85+
options: {
86+
en: {
87+
1: 'The first in the morning',
88+
0: 'Any other'
89+
},
90+
fr: {
91+
1: 'La première du matin',
92+
0: 'À une autre'
93+
}
94+
},
95+
variant: 'radio'
96+
},
97+
cigaretteAmount: {
98+
disableAutoPrefix: true,
99+
kind: 'number',
100+
label: {
101+
en: '4. How many cigarettes a do you smoke?',
102+
fr: '4. Combien de cigarettes fumez-vous par jour?'
103+
},
104+
options: {
105+
en: {
106+
0: '10 or less',
107+
1: '11 - 20',
108+
2: '21 - 30',
109+
3: '31 or more'
110+
},
111+
fr: {
112+
0: '10 ou moins',
113+
1: '11 à 20',
114+
2: '21 à 30',
115+
3: '31 ou plus 3'
116+
}
117+
},
118+
variant: 'radio'
119+
},
120+
smokeMoreInMorning: {
121+
disableAutoPrefix: true,
122+
kind: 'number',
123+
label: {
124+
en: '5. Do you smoke more frequently in the morning?',
125+
fr: '5. Fumez-vous à intervalles plus rapprochés durant les premières heures de la matinée que durant le reste de la journée?'
126+
},
127+
options: yesNoOptions,
128+
variant: 'radio'
129+
},
130+
smokeWhileSickInBed: {
131+
disableAutoPrefix: true,
132+
kind: 'number',
133+
label: {
134+
en: '6. Do you smoke even if you are sick in bed most of the day?',
135+
fr: '6. Fumez-vous lorsque vous êtes malade au point de devoir rester au lit presque toute la journée?'
136+
},
137+
options: yesNoOptions,
138+
variant: 'radio'
139+
}
140+
},
141+
measures: {
142+
auditCScore: {
143+
kind: 'computed',
144+
label: {
145+
en: 'Total Score:',
146+
fr: 'Score total:'
147+
},
148+
value: (data) => {
149+
return sum(Object.values(data));
150+
}
151+
}
152+
},
153+
validationSchema: z.object({
154+
smokeTime: z.number().int().min(0).max(3),
155+
difficultToRefrainSmoking: z.number().int().min(0).max(1),
156+
cigaretteHateToGiveup: z.number().int().min(0).max(1),
157+
cigaretteAmount: z.number().int().min(0).max(3),
158+
smokeMoreInMorning: z.number().int().min(0).max(1),
159+
smokeWhileSickInBed: z.number().int().min(0).max(1)
160+
})
161+
});

0 commit comments

Comments
 (0)