Skip to content

Commit 0426937

Browse files
authored
Merge pull request #1111 from joshunrau/dev
Dev
2 parents a20593a + 734d975 commit 0426937

File tree

37 files changed

+1998
-911
lines changed

37 files changed

+1998
-911
lines changed

apps/api/src/demo/demo.service.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import { LoggingService, PrismaService } from '@douglasneuroinformatics/libnest'
33
import { faker } from '@faker-js/faker';
44
import { Injectable } from '@nestjs/common';
55
import { DEMO_GROUPS, DEMO_USERS } from '@opendatacapture/demo';
6-
import enhancedDemographicsQuestionnaire from '@opendatacapture/instrument-library/forms/enhanced-demographics-questionnaire.js';
7-
import generalConsentForm from '@opendatacapture/instrument-library/forms/general-consent-form.js';
8-
import happinessQuestionnaire from '@opendatacapture/instrument-library/forms/happiness-questionnaire.js';
9-
import patientHealthQuestionnaire9 from '@opendatacapture/instrument-library/forms/patient-health-questionnaire-9.js';
10-
import breakoutTask from '@opendatacapture/instrument-library/interactive/breakout-task.js';
11-
import happinessQuestionnaireWithConsent from '@opendatacapture/instrument-library/series/happiness-questionnaire-with-consent.js';
6+
import enhancedDemographicsQuestionnaire from '@opendatacapture/instrument-library/forms/DNP_ENHANCED_DEMOGRAPHICS_QUESTIONNAIRE.js';
7+
import generalConsentForm from '@opendatacapture/instrument-library/forms/DNP_GENERAL_CONSENT_FORM.js';
8+
import happinessQuestionnaire from '@opendatacapture/instrument-library/forms/DNP_HAPPINESS_QUESTIONNAIRE.js';
9+
import patientHealthQuestionnaire9 from '@opendatacapture/instrument-library/forms/PHQ_9.js';
10+
import breakoutTask from '@opendatacapture/instrument-library/interactive/DNP_BREAKOUT_TASK.js';
11+
import happinessQuestionnaireWithConsent from '@opendatacapture/instrument-library/series/DNP_HAPPINESS_QUESTIONNAIRE_WITH_CONSENT.js';
1212
import type { FormInstrument } from '@opendatacapture/runtime-core';
1313
import type { Json, Language, WithID } from '@opendatacapture/schemas/core';
1414
import type { Group } from '@opendatacapture/schemas/group';

apps/playground/src/instruments/examples/interactive/Interactive-With-CSS/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default defineInstrument({
3737
},
3838
details: {
3939
description: '<PLACEHOLDER>',
40-
license: 'UNLICENSED',
40+
license: 'Apache-2.0',
4141
title: '<PLACEHOLDER>'
4242
},
4343
measures: {},

apps/playground/src/instruments/examples/interactive/Multilingual-Interactive/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default defineInstrument({
5454
en: '<PLACEHOLDER>',
5555
fr: '<PLACEHOLDER>'
5656
},
57-
license: 'UNLICENSED',
57+
license: 'Apache-2.0',
5858
title: {
5959
en: '<PLACEHOLDER>',
6060
fr: '<PLACEHOLDER>'

apps/playground/src/instruments/templates/form/Multilingual-Form/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default defineInstrument({
2828
en: '<PLACEHOLDER>',
2929
fr: '<PLACEHOLDER>'
3030
},
31-
license: 'UNLICENSED',
31+
license: 'Apache-2.0',
3232
title: {
3333
en: '<PLACEHOLDER>',
3434
fr: '<PLACEHOLDER>'

apps/playground/src/instruments/templates/form/Unilingual-Form/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default defineInstrument({
1818
content: {},
1919
details: {
2020
description: '<PLACEHOLDER>',
21-
license: 'UNLICENSED',
21+
license: 'Apache-2.0',
2222
title: '<PLACEHOLDER>'
2323
},
2424
measures: {},

apps/playground/src/instruments/templates/interactive/Interactive-Instrument/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default defineInstrument({
2727
},
2828
details: {
2929
description: '<PLACEHOLDER>',
30-
license: 'UNLICENSED',
30+
license: 'Apache-2.0',
3131
title: '<PLACEHOLDER>'
3232
},
3333
measures: {},

eslint.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,11 @@ export default config(
3232
rules: {
3333
'jsx-a11y/media-has-caption': 'off'
3434
}
35+
},
36+
{
37+
files: ['packages/instrument-library/**/*'],
38+
rules: {
39+
'perfectionist/sort-objects': 'off'
40+
}
3541
}
3642
);

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,6 @@
9797
"@mdx-js/react>@types/react": "18.x"
9898
}
9999
}
100-
}
100+
},
101+
"__isODCRepo": true
101102
}
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
import { defineInstrument } from '/runtime/v1/@opendatacapture/runtime-core';
2+
import { sum } from '/runtime/v1/[email protected]';
3+
import { z } from '/runtime/v1/[email protected]';
4+
5+
const likertScaleOptions = {
6+
en: {
7+
0: 'Never',
8+
1: 'Rarely',
9+
2: 'Sometimes',
10+
3: 'Often',
11+
4: 'Very Often'
12+
},
13+
fr: {
14+
0: 'Jamais',
15+
1: 'Rarement',
16+
2: 'Parfois',
17+
3: 'Souvent',
18+
4: 'Très Souvent'
19+
}
20+
};
21+
22+
const $LikertScaleValidation = z.number().int().min(0).max(4);
23+
24+
export default defineInstrument({
25+
content: {
26+
selfReportADHD: {
27+
items: {
28+
difficultyConcentrating: {
29+
label: {
30+
en: 'How often do you have difficulty concentrating on what people are saying to you even when they are speaking to you directly?',
31+
fr: "À quelle fréquence avez-vous des difficultés à vous concentrer sur ce que les gens vous disent, même lorsqu'ils vous parlent directement?"
32+
}
33+
},
34+
restlessInappropriately: {
35+
label: {
36+
en: 'How often do you leave your seat in meetings or other situations in which you are expected to remain seated?',
37+
fr: "À quelle fréquence vous levez-vous pendant des réunions ou d'autres situations dans lesquelles vous êtes censé rester assis?"
38+
}
39+
},
40+
difficultyRelaxing: {
41+
label: {
42+
en: 'How often do you have difficulty unwinding and relaxing when you have time to yourself?',
43+
fr: 'À quelle fréquence avez-vous des difficultés à vous détendre et à vous relaxer pendant votre temps libre?'
44+
}
45+
},
46+
sentenceCompletion: {
47+
label: {
48+
en: "When you're in a conversation, how often do you find yourself finishing the sentences of the people you are talking to before they can finish them themselves?",
49+
fr: "À quelle fréquence vous surprenez-vous terminant les phrases des autres dans une discussion avant qu'ils aient pu le faire eux-mêmes?"
50+
}
51+
},
52+
procrastination: {
53+
label: {
54+
en: 'How often do you put things off until the last minute?',
55+
fr: "À quelle fréquence mettez-vous les choses de côté jusqu'à la dernière minute?"
56+
}
57+
},
58+
relyOnOthers: {
59+
label: {
60+
en: 'How often do you depend on others to keep your life in order and attend to details?',
61+
fr: "À quelle fréquence dépendez-vous des autres pour garder votre vie en ordre et s'occuper des détails?"
62+
}
63+
}
64+
},
65+
kind: 'number-record',
66+
label: {
67+
en: 'Check the box that best describes how you have felt and conducted yourself over the past 6 months.',
68+
fr: 'Cochez la case qui décrit le mieux la manière dont vous vous êtes senti et comporté au cours des six derniers mois.'
69+
},
70+
options: likertScaleOptions,
71+
variant: 'likert'
72+
}
73+
},
74+
details: {
75+
description: {
76+
en: [
77+
'The Adult ADHD Self-Report Scale (ASRS v1.1) and scoring system were developed in conjunction with',
78+
'the World Health Organization (WHO) and the Workgroup on Adult ADHD to help healthcare',
79+
'professionals to screen their patients for adult ADHD. Insights gained through this screening may suggest',
80+
'the need for a more in-depth clinician interview. The questions in the ASRS v1.1 are consistent with',
81+
'DSM-IV criteria and address the manifestations of ADHD symptoms in adults. The content of the',
82+
'questionnaire also reflects the importance that DSM-IV places on symptoms, impairments, and history for',
83+
'a correct diagnosis.'
84+
].join(' '),
85+
fr: [
86+
"L'échelle d'auto-évaluation du TDAH de l'adulte (ASRS v1.1) et le système de notation ont été élaborés en collaboration",
87+
"avec l'Organisation mondiale de la santé (OMS) et le groupe de travail sur le TDAH de l'adulte afin d'aider les",
88+
"professionnels de la santé à dépister le TDAH de l'adulte chez leurs patients. Les informations obtenues grâce à",
89+
"ce dépistage peuvent suggérer la nécessité d'un entretien plus approfondi avec le clinicien. Les questions",
90+
"de l'ASRS v1.1 sont conformes aux critères du DSM-IV et portent sur les manifestations des symptômes du TDAH",
91+
"chez l'adulte. Le contenu du questionnaire reflète également l'importance que le DSM-IV accorde aux",
92+
'symptômes, aux déficiences et faux antécédents pour un diagnostic correct.'
93+
].join(' ')
94+
},
95+
estimatedDuration: 1,
96+
instructions: {
97+
en: ['This is a self-rated instrument, please answer all questions.'],
98+
fr: ["Il s'agit d'un instrument d'auto-évaluation, veuillez répondre à toutes les questions."]
99+
},
100+
license: 'CC-BY-4.0',
101+
referenceUrl: 'http://www.hcp.med.harvard.edu/ncs/asrs.php',
102+
title: {
103+
en: 'Adult ADHD Self-Report Screening Scale for DSM-5 (ASRS-5) v1.1',
104+
fr: "Échelle d'auto-évaluation du dépistage du TDAH chez l'adulte pour le DSM-5 (ASRS-5) v1.1"
105+
}
106+
},
107+
internal: {
108+
edition: 1,
109+
name: 'ADHD_ASRS_1.1'
110+
},
111+
kind: 'FORM',
112+
language: ['en', 'fr'],
113+
measures: {
114+
difficultyConcentrating: {
115+
kind: 'computed',
116+
label: { en: 'Result difficulty concentrating', fr: 'Résultat difficulté de concentration' },
117+
value: (data) => data.selfReportADHD.difficultyConcentrating
118+
},
119+
difficultyRelaxing: {
120+
kind: 'computed',
121+
label: { en: 'Result difficulty relaxing', fr: 'Résultat difficulté de détente' },
122+
value: (data) => data.selfReportADHD.difficultyRelaxing
123+
},
124+
procrastination: {
125+
kind: 'computed',
126+
label: { en: 'Result procrastination', fr: 'Résultat procrastination' },
127+
value: (data) => data.selfReportADHD.procrastination
128+
},
129+
relyOnOthers: {
130+
kind: 'computed',
131+
label: { en: 'Result relying on others', fr: 'Résultat dépendant des autres' },
132+
value: (data) => data.selfReportADHD.relyOnOthers
133+
},
134+
restlessInappropriately: {
135+
kind: 'computed',
136+
label: { en: 'Result inappropriate restlessness', fr: 'Résultat agitation inappropriée' },
137+
value: (data) => data.selfReportADHD.restlessInappropriately
138+
},
139+
sentenceCompletion: {
140+
kind: 'computed',
141+
label: { en: 'Result inappropriate sentence completion', fr: 'Résultat achèvement inapproprié de la phrase' },
142+
value: (data) => data.selfReportADHD.sentenceCompletion
143+
},
144+
totalScore: {
145+
kind: 'computed',
146+
label: { en: 'Total ADHD Score', fr: 'Score total de TDAH' },
147+
value: (data) => {
148+
return sum(Object.values(data.selfReportADHD));
149+
}
150+
}
151+
},
152+
tags: {
153+
en: ['ADHD', 'ADD'],
154+
fr: ['TDAH', 'TDA']
155+
},
156+
validationSchema: z.object({
157+
selfReportADHD: z.object({
158+
difficultyConcentrating: $LikertScaleValidation,
159+
difficultyRelaxing: $LikertScaleValidation,
160+
procrastination: $LikertScaleValidation,
161+
relyOnOthers: $LikertScaleValidation,
162+
restlessInappropriately: $LikertScaleValidation,
163+
sentenceCompletion: $LikertScaleValidation
164+
})
165+
})
166+
});
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
import { defineInstrument } from '/runtime/v1/@opendatacapture/runtime-core';
2+
import { sum } from '/runtime/v1/[email protected]';
3+
import { z } from '/runtime/v1/[email protected]';
4+
5+
export default defineInstrument({
6+
kind: 'FORM',
7+
language: ['en', 'fr'],
8+
internal: {
9+
name: 'AUDIT_C',
10+
edition: 1
11+
},
12+
tags: {
13+
en: ['Alcohol', 'Health', 'Disorder'],
14+
fr: ['Alcool', 'Santé', 'Troubles']
15+
},
16+
clientDetails: {
17+
title: {
18+
en: 'Alcohol Use (AUDIT-C)',
19+
fr: "Consommation d'alcool (AUDIT-C)"
20+
}
21+
},
22+
details: {
23+
description: {
24+
en: 'The Alcohol Use Disorders Identification Test (AUDIT-C) is an alcohol screen that can help identify patients who are hazardous drinkers or have active alcohol use disorders (including alcohol abuse or dependence).',
25+
fr: "Le test d'identification des troubles liés à la consommation d'alcool (AUDIT-C) est un test de dépistage de l'alcool qui permet d'identifier les patients qui sont des buveurs dangereux ou qui présentent des troubles liés à la consommation d'alcool (y compris l'abus d'alcool ou la dépendance)."
26+
},
27+
estimatedDuration: 2,
28+
instructions: {
29+
en: ['Please respond to every question'],
30+
fr: ['Veuillez répondre à toutes les questions']
31+
},
32+
license: 'PUBLIC-DOMAIN',
33+
title: {
34+
en: 'Alcohol Use Disorders Identification Test (AUDIT-C)',
35+
fr: "Test d'identification des troubles liés à l'utilisation de l'alcool (AUDIT-C)"
36+
}
37+
},
38+
content: {
39+
drinkingFrequency: {
40+
kind: 'number',
41+
label: {
42+
en: '1. How often do you have a drink containing alcohol?',
43+
fr: "1. A quelle fréquence vous arrive-t-il de consommer des boissons contenant de l'alcool?"
44+
},
45+
options: {
46+
en: {
47+
0: 'Never',
48+
1: 'Monthly or Less',
49+
2: '2 to 4 times a month',
50+
3: '2 to 3 times a week',
51+
4: '4 or more times a week'
52+
},
53+
fr: {
54+
0: 'Jamais',
55+
1: 'Une fois par mois ou moins',
56+
2: '2 à 4 fois par mois',
57+
3: '2 à 3 fois par semaine',
58+
4: '4 fois ou plus par semaine'
59+
}
60+
},
61+
variant: 'radio'
62+
},
63+
typicalDrinkQuantity: {
64+
kind: 'number',
65+
label: {
66+
en: '2. How many drinks containing alcohol do you have on a typical day when you are drinking?',
67+
fr: "2. Combien de verres standards buvez-vous au cours d'une journée ordinaire où vous buvez de l'alcool?"
68+
},
69+
options: {
70+
en: {
71+
0: '1 or 2',
72+
1: '3 or 4',
73+
2: '5 or 6',
74+
3: '7 to 9',
75+
4: '10 or more'
76+
},
77+
fr: {
78+
0: '1 ou 2',
79+
1: '3 ou 4',
80+
2: '5 ou 6',
81+
3: '7 ou 9',
82+
4: '10 ou plus'
83+
}
84+
},
85+
variant: 'radio'
86+
},
87+
bingeDrinkingFrequency: {
88+
kind: 'number',
89+
label: {
90+
en: '3. How often do you have six or more drinks on one occasion?',
91+
fr: "3. Au cours d'une même occasion, à quelle fréquence vous arrive-t-il de boire six verres standard ou plus?"
92+
},
93+
options: {
94+
en: {
95+
0: 'Never',
96+
1: 'Less than monthly',
97+
2: 'Monthly',
98+
3: 'Weekly',
99+
4: 'Daily or almost daily'
100+
},
101+
fr: {
102+
0: 'Jamais',
103+
1: "Moins d'une fois par mois",
104+
2: 'Une fois par mois',
105+
3: 'Une fois par semaine',
106+
4: 'Chaque jour ou presque'
107+
}
108+
},
109+
variant: 'radio'
110+
}
111+
},
112+
measures: {
113+
auditCScore: {
114+
kind: 'computed',
115+
label: {
116+
en: 'Total Score',
117+
fr: 'Score total'
118+
},
119+
value: (data) => {
120+
return sum(Object.values(data));
121+
}
122+
}
123+
},
124+
validationSchema: z.object({
125+
drinkingFrequency: z.number().int().min(0).max(4),
126+
typicalDrinkQuantity: z.number().int().min(0).max(4),
127+
bingeDrinkingFrequency: z.number().int().min(0).max(4)
128+
})
129+
});

0 commit comments

Comments
 (0)