@welshare/questionnaire 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +151 -0
- package/dist/esm/components/bmi-form.d.ts +68 -0
- package/dist/esm/components/bmi-form.d.ts.map +1 -0
- package/dist/esm/components/bmi-form.js +138 -0
- package/dist/esm/components/question-renderer.d.ts +6 -1
- package/dist/esm/components/question-renderer.d.ts.map +1 -1
- package/dist/esm/components/question-renderer.js +25 -14
- package/dist/esm/components/questions/decimal-question.d.ts +8 -1
- package/dist/esm/components/questions/decimal-question.d.ts.map +1 -1
- package/dist/esm/components/questions/decimal-question.js +19 -1
- package/dist/esm/components/questions/multiple-choice-question.d.ts.map +1 -1
- package/dist/esm/components/questions/multiple-choice-question.js +2 -2
- package/dist/esm/contexts/questionnaire-context.d.ts.map +1 -1
- package/dist/esm/contexts/questionnaire-context.js +3 -2
- package/dist/esm/index.d.ts +6 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +5 -1
- package/dist/esm/lib/bmi-helpers.d.ts +50 -0
- package/dist/esm/lib/bmi-helpers.d.ts.map +1 -0
- package/dist/esm/lib/bmi-helpers.js +69 -0
- package/dist/esm/lib/constants.d.ts +94 -0
- package/dist/esm/lib/constants.d.ts.map +1 -0
- package/dist/esm/lib/constants.js +93 -0
- package/dist/esm/lib/questionnaire-utils.d.ts +21 -1
- package/dist/esm/lib/questionnaire-utils.d.ts.map +1 -1
- package/dist/esm/lib/questionnaire-utils.js +85 -4
- package/dist/esm/types/fhir.d.ts +1 -0
- package/dist/esm/types/fhir.d.ts.map +1 -1
- package/dist/esm/types/index.d.ts +25 -0
- package/dist/esm/types/index.d.ts.map +1 -1
- package/dist/styles.css +108 -0
- package/package.json +17 -6
- package/dist/node_modules/@welshare/questionnaire/.tshy/build.json +0 -8
- package/dist/node_modules/@welshare/questionnaire/.tshy/esm.json +0 -16
- package/dist/node_modules/@welshare/questionnaire/LICENSE +0 -7
- package/dist/node_modules/@welshare/questionnaire/README.md +0 -173
- package/dist/node_modules/@welshare/questionnaire/dist/esm/components/debug-section.d.ts +0 -44
- package/dist/node_modules/@welshare/questionnaire/dist/esm/components/debug-section.d.ts.map +0 -1
- package/dist/node_modules/@welshare/questionnaire/dist/esm/components/debug-section.js +0 -28
- package/dist/node_modules/@welshare/questionnaire/dist/esm/components/question-renderer.d.ts +0 -80
- package/dist/node_modules/@welshare/questionnaire/dist/esm/components/question-renderer.d.ts.map +0 -1
- package/dist/node_modules/@welshare/questionnaire/dist/esm/components/question-renderer.js +0 -183
- package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/boolean-question.d.ts +0 -15
- package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/boolean-question.d.ts.map +0 -1
- package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/boolean-question.js +0 -19
- package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/choice-question.d.ts +0 -19
- package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/choice-question.d.ts.map +0 -1
- package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/choice-question.js +0 -23
- package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/decimal-question.d.ts +0 -12
- package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/decimal-question.d.ts.map +0 -1
- package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/decimal-question.js +0 -7
- package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/integer-question.d.ts +0 -18
- package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/integer-question.d.ts.map +0 -1
- package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/integer-question.js +0 -24
- package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/multiple-choice-question.d.ts +0 -20
- package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/multiple-choice-question.d.ts.map +0 -1
- package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/multiple-choice-question.js +0 -39
- package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/string-question.d.ts +0 -12
- package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/string-question.d.ts.map +0 -1
- package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/string-question.js +0 -7
- package/dist/node_modules/@welshare/questionnaire/dist/esm/contexts/questionnaire-context.d.ts +0 -41
- package/dist/node_modules/@welshare/questionnaire/dist/esm/contexts/questionnaire-context.d.ts.map +0 -1
- package/dist/node_modules/@welshare/questionnaire/dist/esm/contexts/questionnaire-context.js +0 -350
- package/dist/node_modules/@welshare/questionnaire/dist/esm/index.d.ts +0 -7
- package/dist/node_modules/@welshare/questionnaire/dist/esm/index.d.ts.map +0 -1
- package/dist/node_modules/@welshare/questionnaire/dist/esm/index.js +0 -6
- package/dist/node_modules/@welshare/questionnaire/dist/esm/lib/questionnaire-utils.d.ts +0 -33
- package/dist/node_modules/@welshare/questionnaire/dist/esm/lib/questionnaire-utils.d.ts.map +0 -1
- package/dist/node_modules/@welshare/questionnaire/dist/esm/lib/questionnaire-utils.js +0 -99
- package/dist/node_modules/@welshare/questionnaire/dist/esm/package.json +0 -3
- package/dist/node_modules/@welshare/questionnaire/dist/esm/types/fhir.d.ts +0 -117
- package/dist/node_modules/@welshare/questionnaire/dist/esm/types/fhir.d.ts.map +0 -1
- package/dist/node_modules/@welshare/questionnaire/dist/esm/types/fhir.js +0 -3
- package/dist/node_modules/@welshare/questionnaire/dist/esm/types/index.d.ts +0 -51
- package/dist/node_modules/@welshare/questionnaire/dist/esm/types/index.d.ts.map +0 -1
- package/dist/node_modules/@welshare/questionnaire/dist/esm/types/index.js +0 -1
- package/dist/node_modules/@welshare/questionnaire/dist/styles.css +0 -467
- package/dist/node_modules/@welshare/questionnaire/dist/tokens.css +0 -130
- package/dist/node_modules/@welshare/questionnaire/package.json +0 -85
- package/dist/node_modules/@welshare/questionnaire/src/components/debug-section.tsx +0 -116
- package/dist/node_modules/@welshare/questionnaire/src/components/question-renderer.tsx +0 -391
- package/dist/node_modules/@welshare/questionnaire/src/components/questionnaire-styles.css +0 -467
- package/dist/node_modules/@welshare/questionnaire/src/components/questionnaire-tokens.css +0 -130
- package/dist/node_modules/@welshare/questionnaire/src/components/questions/boolean-question.tsx +0 -72
- package/dist/node_modules/@welshare/questionnaire/src/components/questions/choice-question.tsx +0 -68
- package/dist/node_modules/@welshare/questionnaire/src/components/questions/decimal-question.tsx +0 -32
- package/dist/node_modules/@welshare/questionnaire/src/components/questions/integer-question.tsx +0 -87
- package/dist/node_modules/@welshare/questionnaire/src/components/questions/multiple-choice-question.tsx +0 -119
- package/dist/node_modules/@welshare/questionnaire/src/components/questions/string-question.tsx +0 -31
- package/dist/node_modules/@welshare/questionnaire/src/contexts/questionnaire-context.tsx +0 -499
- package/dist/node_modules/@welshare/questionnaire/src/index.ts +0 -41
- package/dist/node_modules/@welshare/questionnaire/src/lib/__tests__/questionnaire-utils.test.ts +0 -578
- package/dist/node_modules/@welshare/questionnaire/src/lib/questionnaire-utils.ts +0 -122
- package/dist/node_modules/@welshare/questionnaire/src/types/fhir.ts +0 -126
- package/dist/node_modules/@welshare/questionnaire/src/types/index.ts +0 -44
- package/dist/node_modules/@welshare/questionnaire/tsconfig.json +0 -16
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
export { QuestionRenderer } from "./components/question-renderer.js";
|
|
2
2
|
export type { QuestionRendererProps } from "./components/question-renderer.js";
|
|
3
|
+
export { BmiForm } from "./components/bmi-form.js";
|
|
4
|
+
export type { BmiFormProps } from "./components/bmi-form.js";
|
|
3
5
|
export { QuestionnaireProvider, useQuestionnaire, type QuestionnaireContextType, type QuestionnaireProviderProps, } from "./contexts/questionnaire-context.js";
|
|
4
6
|
export type { Coding, Extension, Questionnaire, QuestionnaireItem, QuestionnaireItemAnswerOption, QuestionnaireResponse, QuestionnaireResponseAnswer, QuestionnaireResponseItem, } from "./types/fhir.js";
|
|
5
|
-
export type { RadioInputProps, CheckboxInputProps, } from "./types/index.js";
|
|
6
|
-
export { calculateProgress, findQuestionnaireItem, getAllQuestionsFromPage, getExclusiveOptionCode, getVisiblePages, hasAnswerValue, isQuestionHidden, } from "./lib/questionnaire-utils.js";
|
|
7
|
+
export type { RadioInputProps, CheckboxInputProps, InputHelperConfig, HelperTriggerProps, } from "./types/index.js";
|
|
8
|
+
export { calculateProgress, findQuestionnaireItem, getAllQuestionsFromPage, getExclusiveOptionCode, getInputHelper, getVisiblePages, hasAnswerValue, isQuestionHidden, } from "./lib/questionnaire-utils.js";
|
|
9
|
+
export { calculateBmi } from "./lib/bmi-helpers.js";
|
|
10
|
+
export { FHIR_EXTENSIONS, WELSHARE_EXTENSIONS, WELSHARE_CODE_SYSTEMS, FHIR_CODE_SYSTEMS, } from "./lib/constants.js";
|
|
7
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,YAAY,EACV,qBAAqB,EACtB,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,YAAY,EACV,qBAAqB,EACtB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAG7D,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,GAChC,MAAM,qCAAqC,CAAC;AAG7C,YAAY,EACV,MAAM,EACN,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,6BAA6B,EAC7B,qBAAqB,EACrB,2BAA2B,EAC3B,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EACV,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,cAAc,EACd,eAAe,EACf,cAAc,EACd,gBAAgB,GACjB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,YAAY,EACb,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
// Components
|
|
2
2
|
export { QuestionRenderer } from "./components/question-renderer.js";
|
|
3
|
+
export { BmiForm } from "./components/bmi-form.js";
|
|
3
4
|
// Contexts
|
|
4
5
|
export { QuestionnaireProvider, useQuestionnaire, } from "./contexts/questionnaire-context.js";
|
|
5
6
|
// Utils
|
|
6
|
-
export { calculateProgress, findQuestionnaireItem, getAllQuestionsFromPage, getExclusiveOptionCode, getVisiblePages, hasAnswerValue, isQuestionHidden, } from "./lib/questionnaire-utils.js";
|
|
7
|
+
export { calculateProgress, findQuestionnaireItem, getAllQuestionsFromPage, getExclusiveOptionCode, getInputHelper, getVisiblePages, hasAnswerValue, isQuestionHidden, } from "./lib/questionnaire-utils.js";
|
|
8
|
+
export { calculateBmi } from "./lib/bmi-helpers.js";
|
|
9
|
+
// Constants
|
|
10
|
+
export { FHIR_EXTENSIONS, WELSHARE_EXTENSIONS, WELSHARE_CODE_SYSTEMS, FHIR_CODE_SYSTEMS, } from "./lib/constants.js";
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BMI and unit conversion helpers
|
|
3
|
+
*
|
|
4
|
+
* All calculations follow clinical standards where metric (cm, kg) is the canonical unit system.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Conversion constants
|
|
8
|
+
*/
|
|
9
|
+
export declare const CM_PER_INCH = 2.54;
|
|
10
|
+
export declare const INCHES_PER_FOOT = 12;
|
|
11
|
+
export declare const KG_PER_LB = 0.45359237;
|
|
12
|
+
/**
|
|
13
|
+
* Convert centimeters to inches
|
|
14
|
+
*/
|
|
15
|
+
export declare function cmToInches(cm: number): number;
|
|
16
|
+
/**
|
|
17
|
+
* Convert inches to centimeters
|
|
18
|
+
*/
|
|
19
|
+
export declare function inchesToCm(inches: number): number;
|
|
20
|
+
/**
|
|
21
|
+
* Convert feet and inches to centimeters
|
|
22
|
+
*/
|
|
23
|
+
export declare function feetAndInchesToCm(feet: number, inches: number): number;
|
|
24
|
+
/**
|
|
25
|
+
* Convert centimeters to feet and inches
|
|
26
|
+
* @returns Object with feet (whole number) and inches (decimal)
|
|
27
|
+
*/
|
|
28
|
+
export declare function cmToFeetAndInches(cm: number): {
|
|
29
|
+
feet: number;
|
|
30
|
+
inches: number;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Convert kilograms to pounds
|
|
34
|
+
*/
|
|
35
|
+
export declare function kgToLbs(kg: number): number;
|
|
36
|
+
/**
|
|
37
|
+
* Convert pounds to kilograms
|
|
38
|
+
*/
|
|
39
|
+
export declare function lbsToKg(lbs: number): number;
|
|
40
|
+
/**
|
|
41
|
+
* Calculate BMI from metric values
|
|
42
|
+
*
|
|
43
|
+
* BMI = weight (kg) / (height (m))²
|
|
44
|
+
*
|
|
45
|
+
* @param heightCm - Height in centimeters
|
|
46
|
+
* @param weightKg - Weight in kilograms
|
|
47
|
+
* @returns BMI rounded to 1 decimal place, or 0 if inputs are invalid
|
|
48
|
+
*/
|
|
49
|
+
export declare function calculateBmi(heightCm: number, weightKg: number): number;
|
|
50
|
+
//# sourceMappingURL=bmi-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bmi-helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/bmi-helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,WAAW,OAAO,CAAC;AAChC,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,SAAS,aAAa,CAAC;AAEpC;;GAEG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAGtE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAK9E;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE1C;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOvE"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BMI and unit conversion helpers
|
|
3
|
+
*
|
|
4
|
+
* All calculations follow clinical standards where metric (cm, kg) is the canonical unit system.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Conversion constants
|
|
8
|
+
*/
|
|
9
|
+
export const CM_PER_INCH = 2.54;
|
|
10
|
+
export const INCHES_PER_FOOT = 12;
|
|
11
|
+
export const KG_PER_LB = 0.45359237;
|
|
12
|
+
/**
|
|
13
|
+
* Convert centimeters to inches
|
|
14
|
+
*/
|
|
15
|
+
export function cmToInches(cm) {
|
|
16
|
+
return cm / CM_PER_INCH;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Convert inches to centimeters
|
|
20
|
+
*/
|
|
21
|
+
export function inchesToCm(inches) {
|
|
22
|
+
return inches * CM_PER_INCH;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Convert feet and inches to centimeters
|
|
26
|
+
*/
|
|
27
|
+
export function feetAndInchesToCm(feet, inches) {
|
|
28
|
+
const totalInches = feet * INCHES_PER_FOOT + inches;
|
|
29
|
+
return inchesToCm(totalInches);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Convert centimeters to feet and inches
|
|
33
|
+
* @returns Object with feet (whole number) and inches (decimal)
|
|
34
|
+
*/
|
|
35
|
+
export function cmToFeetAndInches(cm) {
|
|
36
|
+
const totalInches = cmToInches(cm);
|
|
37
|
+
const feet = Math.floor(totalInches / INCHES_PER_FOOT);
|
|
38
|
+
const inches = Math.round((totalInches % INCHES_PER_FOOT) * 10) / 10;
|
|
39
|
+
return { feet, inches };
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Convert kilograms to pounds
|
|
43
|
+
*/
|
|
44
|
+
export function kgToLbs(kg) {
|
|
45
|
+
return kg / KG_PER_LB;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Convert pounds to kilograms
|
|
49
|
+
*/
|
|
50
|
+
export function lbsToKg(lbs) {
|
|
51
|
+
return lbs * KG_PER_LB;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Calculate BMI from metric values
|
|
55
|
+
*
|
|
56
|
+
* BMI = weight (kg) / (height (m))²
|
|
57
|
+
*
|
|
58
|
+
* @param heightCm - Height in centimeters
|
|
59
|
+
* @param weightKg - Weight in kilograms
|
|
60
|
+
* @returns BMI rounded to 1 decimal place, or 0 if inputs are invalid
|
|
61
|
+
*/
|
|
62
|
+
export function calculateBmi(heightCm, weightKg) {
|
|
63
|
+
if (!heightCm || !weightKg || heightCm <= 0 || weightKg <= 0) {
|
|
64
|
+
return 0;
|
|
65
|
+
}
|
|
66
|
+
const heightInMeters = heightCm / 100;
|
|
67
|
+
const bmi = weightKg / (heightInMeters * heightInMeters);
|
|
68
|
+
return Math.round(bmi * 10) / 10;
|
|
69
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FHIR Extension URLs
|
|
3
|
+
* Standard HL7 FHIR extension URLs used in questionnaires
|
|
4
|
+
*/
|
|
5
|
+
export declare const FHIR_EXTENSIONS: {
|
|
6
|
+
/**
|
|
7
|
+
* Standard FHIR extension for marking questionnaire items as hidden
|
|
8
|
+
* Used for auto-populated fields that shouldn't be displayed to users
|
|
9
|
+
* @see http://hl7.org/fhir/StructureDefinition/questionnaire-hidden
|
|
10
|
+
*/
|
|
11
|
+
readonly QUESTIONNAIRE_HIDDEN: "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden";
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Welshare Custom Extension URLs
|
|
15
|
+
* Custom FHIR extensions defined by Welshare for enhanced questionnaire functionality
|
|
16
|
+
* These extensions are hosted at codes.welshare.app/StructureDefinition
|
|
17
|
+
*/
|
|
18
|
+
export declare const WELSHARE_EXTENSIONS: {
|
|
19
|
+
/**
|
|
20
|
+
* Extension for marking an answer option as mutually exclusive with other options
|
|
21
|
+
* When this option is selected, all other options are deselected
|
|
22
|
+
* Value: valueString containing the code of the exclusive option
|
|
23
|
+
* @example
|
|
24
|
+
* ```json
|
|
25
|
+
* {
|
|
26
|
+
* "url": "http://codes.welshare.app/StructureDefinition/questionnaire-exclusive-option",
|
|
27
|
+
* "valueString": "none-of-the-above"
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
readonly EXCLUSIVE_OPTION: "http://codes.welshare.app/StructureDefinition/questionnaire-exclusive-option";
|
|
32
|
+
/**
|
|
33
|
+
* Extension for configuring input helper widgets on questions
|
|
34
|
+
* Provides additional UI controls to help users enter values
|
|
35
|
+
* Value: valueCodeableConcept with coding from WELSHARE_CODE_SYSTEMS.INPUT_HELPER_TYPE
|
|
36
|
+
* @example
|
|
37
|
+
* ```json
|
|
38
|
+
* {
|
|
39
|
+
* "url": "http://codes.welshare.app/StructureDefinition/questionnaire-inputHelper",
|
|
40
|
+
* "valueCodeableConcept": {
|
|
41
|
+
* "coding": [{
|
|
42
|
+
* "system": "http://codes.welshare.app/input-helper-type",
|
|
43
|
+
* "code": "bmi-calculator",
|
|
44
|
+
* "display": "BMI Calculator"
|
|
45
|
+
* }]
|
|
46
|
+
* }
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
readonly INPUT_HELPER: "http://codes.welshare.app/StructureDefinition/questionnaire-inputHelper";
|
|
51
|
+
/**
|
|
52
|
+
* Extension for configuring slider controls on numeric questions (integer/decimal)
|
|
53
|
+
* Allows defining min/max values, step size, and unit labels
|
|
54
|
+
* Value: complex extension with nested extensions for minValue, maxValue, step, unit
|
|
55
|
+
* @example
|
|
56
|
+
* ```json
|
|
57
|
+
* {
|
|
58
|
+
* "url": "http://codes.welshare.app/StructureDefinition/questionnaire-slider-control",
|
|
59
|
+
* "extension": [
|
|
60
|
+
* { "url": "minValue", "valueInteger": 0 },
|
|
61
|
+
* { "url": "maxValue", "valueInteger": 100 },
|
|
62
|
+
* { "url": "step", "valueInteger": 1 },
|
|
63
|
+
* { "url": "unit", "valueString": "%" }
|
|
64
|
+
* ]
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
readonly SLIDER_CONTROL: "http://codes.welshare.app/StructureDefinition/questionnaire-slider-control";
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Welshare Code Systems
|
|
72
|
+
* Custom code systems used within Welshare extensions
|
|
73
|
+
*/
|
|
74
|
+
export declare const WELSHARE_CODE_SYSTEMS: {
|
|
75
|
+
/**
|
|
76
|
+
* Code system for input helper types
|
|
77
|
+
* Used within the INPUT_HELPER extension to specify the type of helper widget
|
|
78
|
+
* Common codes: "bmi-calculator", "date-picker", etc.
|
|
79
|
+
*/
|
|
80
|
+
readonly INPUT_HELPER_TYPE: "http://codes.welshare.app/input-helper-type";
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Standard FHIR Code Systems
|
|
84
|
+
* Common external code systems used in questionnaires
|
|
85
|
+
*/
|
|
86
|
+
export declare const FHIR_CODE_SYSTEMS: {
|
|
87
|
+
/**
|
|
88
|
+
* Logical Observation Identifiers Names and Codes
|
|
89
|
+
* Standard code system for clinical observations and measurements
|
|
90
|
+
* @see https://loinc.org
|
|
91
|
+
*/
|
|
92
|
+
readonly LOINC: "http://loinc.org";
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,eAAe;IAC1B;;;;OAIG;;CAEK,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;IAC9B;;;;;;;;;;;OAWG;;IAGH;;;;;;;;;;;;;;;;;OAiBG;;IAGH;;;;;;;;;;;;;;;;OAgBG;;CAEK,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,qBAAqB;IAChC;;;;OAIG;;CAEK,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,iBAAiB;IAC5B;;;;OAIG;;CAEK,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FHIR Extension URLs
|
|
3
|
+
* Standard HL7 FHIR extension URLs used in questionnaires
|
|
4
|
+
*/
|
|
5
|
+
export const FHIR_EXTENSIONS = {
|
|
6
|
+
/**
|
|
7
|
+
* Standard FHIR extension for marking questionnaire items as hidden
|
|
8
|
+
* Used for auto-populated fields that shouldn't be displayed to users
|
|
9
|
+
* @see http://hl7.org/fhir/StructureDefinition/questionnaire-hidden
|
|
10
|
+
*/
|
|
11
|
+
QUESTIONNAIRE_HIDDEN: "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden",
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Welshare Custom Extension URLs
|
|
15
|
+
* Custom FHIR extensions defined by Welshare for enhanced questionnaire functionality
|
|
16
|
+
* These extensions are hosted at codes.welshare.app/StructureDefinition
|
|
17
|
+
*/
|
|
18
|
+
export const WELSHARE_EXTENSIONS = {
|
|
19
|
+
/**
|
|
20
|
+
* Extension for marking an answer option as mutually exclusive with other options
|
|
21
|
+
* When this option is selected, all other options are deselected
|
|
22
|
+
* Value: valueString containing the code of the exclusive option
|
|
23
|
+
* @example
|
|
24
|
+
* ```json
|
|
25
|
+
* {
|
|
26
|
+
* "url": "http://codes.welshare.app/StructureDefinition/questionnaire-exclusive-option",
|
|
27
|
+
* "valueString": "none-of-the-above"
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
EXCLUSIVE_OPTION: "http://codes.welshare.app/StructureDefinition/questionnaire-exclusive-option",
|
|
32
|
+
/**
|
|
33
|
+
* Extension for configuring input helper widgets on questions
|
|
34
|
+
* Provides additional UI controls to help users enter values
|
|
35
|
+
* Value: valueCodeableConcept with coding from WELSHARE_CODE_SYSTEMS.INPUT_HELPER_TYPE
|
|
36
|
+
* @example
|
|
37
|
+
* ```json
|
|
38
|
+
* {
|
|
39
|
+
* "url": "http://codes.welshare.app/StructureDefinition/questionnaire-inputHelper",
|
|
40
|
+
* "valueCodeableConcept": {
|
|
41
|
+
* "coding": [{
|
|
42
|
+
* "system": "http://codes.welshare.app/input-helper-type",
|
|
43
|
+
* "code": "bmi-calculator",
|
|
44
|
+
* "display": "BMI Calculator"
|
|
45
|
+
* }]
|
|
46
|
+
* }
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
INPUT_HELPER: "http://codes.welshare.app/StructureDefinition/questionnaire-inputHelper",
|
|
51
|
+
/**
|
|
52
|
+
* Extension for configuring slider controls on numeric questions (integer/decimal)
|
|
53
|
+
* Allows defining min/max values, step size, and unit labels
|
|
54
|
+
* Value: complex extension with nested extensions for minValue, maxValue, step, unit
|
|
55
|
+
* @example
|
|
56
|
+
* ```json
|
|
57
|
+
* {
|
|
58
|
+
* "url": "http://codes.welshare.app/StructureDefinition/questionnaire-slider-control",
|
|
59
|
+
* "extension": [
|
|
60
|
+
* { "url": "minValue", "valueInteger": 0 },
|
|
61
|
+
* { "url": "maxValue", "valueInteger": 100 },
|
|
62
|
+
* { "url": "step", "valueInteger": 1 },
|
|
63
|
+
* { "url": "unit", "valueString": "%" }
|
|
64
|
+
* ]
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
SLIDER_CONTROL: "http://codes.welshare.app/StructureDefinition/questionnaire-slider-control",
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Welshare Code Systems
|
|
72
|
+
* Custom code systems used within Welshare extensions
|
|
73
|
+
*/
|
|
74
|
+
export const WELSHARE_CODE_SYSTEMS = {
|
|
75
|
+
/**
|
|
76
|
+
* Code system for input helper types
|
|
77
|
+
* Used within the INPUT_HELPER extension to specify the type of helper widget
|
|
78
|
+
* Common codes: "bmi-calculator", "date-picker", etc.
|
|
79
|
+
*/
|
|
80
|
+
INPUT_HELPER_TYPE: "http://codes.welshare.app/input-helper-type",
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Standard FHIR Code Systems
|
|
84
|
+
* Common external code systems used in questionnaires
|
|
85
|
+
*/
|
|
86
|
+
export const FHIR_CODE_SYSTEMS = {
|
|
87
|
+
/**
|
|
88
|
+
* Logical Observation Identifiers Names and Codes
|
|
89
|
+
* Standard code system for clinical observations and measurements
|
|
90
|
+
* @see https://loinc.org
|
|
91
|
+
*/
|
|
92
|
+
LOINC: "http://loinc.org",
|
|
93
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Questionnaire, QuestionnaireItem } from "../types/fhir.js";
|
|
1
|
+
import type { Questionnaire, QuestionnaireItem, QuestionnaireResponseAnswer } from "../types/fhir.js";
|
|
2
2
|
/**
|
|
3
3
|
* Get visible pages from a questionnaire (excludes hidden groups)
|
|
4
4
|
*/
|
|
@@ -30,4 +30,24 @@ export declare const isQuestionHidden: (item: QuestionnaireItem) => boolean;
|
|
|
30
30
|
* Get the exclusive option code from a question item (if any)
|
|
31
31
|
*/
|
|
32
32
|
export declare const getExclusiveOptionCode: (item: QuestionnaireItem) => string | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Input helper configuration extracted from extension
|
|
35
|
+
*/
|
|
36
|
+
export interface InputHelperConfig {
|
|
37
|
+
type: string;
|
|
38
|
+
display?: string;
|
|
39
|
+
description?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Extract input helper configuration from a question item
|
|
43
|
+
* Returns null if no helper extension is present
|
|
44
|
+
*/
|
|
45
|
+
export declare const getInputHelper: (item: QuestionnaireItem) => InputHelperConfig | null;
|
|
46
|
+
/**
|
|
47
|
+
* Check if a question should be enabled based on its enableWhen conditions
|
|
48
|
+
* @param item The questionnaire item to check
|
|
49
|
+
* @param getAnswer Function to retrieve an answer by linkId
|
|
50
|
+
* @returns true if the question should be enabled, false otherwise
|
|
51
|
+
*/
|
|
52
|
+
export declare const isQuestionEnabled: (item: QuestionnaireItem, getAnswer: (linkId: string) => QuestionnaireResponseAnswer | undefined) => boolean;
|
|
33
53
|
//# sourceMappingURL=questionnaire-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"questionnaire-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/questionnaire-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
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
|
|
1
|
+
import { FHIR_EXTENSIONS, WELSHARE_EXTENSIONS } from "./constants.js";
|
|
1
2
|
/**
|
|
2
3
|
* Get visible pages from a questionnaire (excludes hidden groups)
|
|
3
4
|
*/
|
|
@@ -6,7 +7,7 @@ export const getVisiblePages = (questionnaire) => {
|
|
|
6
7
|
return [];
|
|
7
8
|
return questionnaire.item.filter((item) => {
|
|
8
9
|
// Check if hidden
|
|
9
|
-
const isHidden = item.extension?.some((ext) => ext.url ===
|
|
10
|
+
const isHidden = item.extension?.some((ext) => ext.url === FHIR_EXTENSIONS.QUESTIONNAIRE_HIDDEN &&
|
|
10
11
|
ext.valueBoolean === true);
|
|
11
12
|
// Only include visible group items
|
|
12
13
|
return item.type === "group" && !isHidden;
|
|
@@ -87,13 +88,93 @@ export const hasAnswerValue = (answer) => {
|
|
|
87
88
|
* Check if a question item should be hidden based on extensions
|
|
88
89
|
*/
|
|
89
90
|
export const isQuestionHidden = (item) => {
|
|
90
|
-
return item.extension?.some((ext) => ext.url ===
|
|
91
|
-
ext.valueBoolean === true) ?? false;
|
|
91
|
+
return (item.extension?.some((ext) => ext.url === FHIR_EXTENSIONS.QUESTIONNAIRE_HIDDEN &&
|
|
92
|
+
ext.valueBoolean === true) ?? false);
|
|
92
93
|
};
|
|
93
94
|
/**
|
|
94
95
|
* Get the exclusive option code from a question item (if any)
|
|
95
96
|
*/
|
|
96
97
|
export const getExclusiveOptionCode = (item) => {
|
|
97
|
-
const exclusiveExt = item.extension?.find((ext) => ext.url ===
|
|
98
|
+
const exclusiveExt = item.extension?.find((ext) => ext.url === WELSHARE_EXTENSIONS.EXCLUSIVE_OPTION);
|
|
98
99
|
return exclusiveExt?.valueString;
|
|
99
100
|
};
|
|
101
|
+
/**
|
|
102
|
+
* Extract input helper configuration from a question item
|
|
103
|
+
* Returns null if no helper extension is present
|
|
104
|
+
*/
|
|
105
|
+
export const getInputHelper = (item) => {
|
|
106
|
+
const ext = item.extension?.find((e) => e.url === WELSHARE_EXTENSIONS.INPUT_HELPER);
|
|
107
|
+
if (!ext?.valueCodeableConcept?.coding?.[0])
|
|
108
|
+
return null;
|
|
109
|
+
const coding = ext.valueCodeableConcept.coding[0];
|
|
110
|
+
return {
|
|
111
|
+
type: coding.code ?? "",
|
|
112
|
+
display: coding.display,
|
|
113
|
+
description: ext.valueCodeableConcept?.text,
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Check if a question should be enabled based on its enableWhen conditions
|
|
118
|
+
* @param item The questionnaire item to check
|
|
119
|
+
* @param getAnswer Function to retrieve an answer by linkId
|
|
120
|
+
* @returns true if the question should be enabled, false otherwise
|
|
121
|
+
*/
|
|
122
|
+
export const isQuestionEnabled = (item, getAnswer) => {
|
|
123
|
+
// If no enableWhen conditions, question is enabled
|
|
124
|
+
if (!item.enableWhen || item.enableWhen.length === 0) {
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
// enableBehavior defaults to 'all' if not specified
|
|
128
|
+
const enableBehavior = item.enableBehavior || "all";
|
|
129
|
+
const conditionResults = item.enableWhen.map((condition) => {
|
|
130
|
+
const referencedAnswer = getAnswer(condition.question);
|
|
131
|
+
// If no answer exists for the referenced question, condition fails
|
|
132
|
+
if (!referencedAnswer) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
// Handle different operators
|
|
136
|
+
switch (condition.operator) {
|
|
137
|
+
case "=":
|
|
138
|
+
case "equals":
|
|
139
|
+
// Check different answer types
|
|
140
|
+
if (condition.answerCoding && referencedAnswer.valueCoding) {
|
|
141
|
+
return (condition.answerCoding.system ===
|
|
142
|
+
referencedAnswer.valueCoding.system &&
|
|
143
|
+
condition.answerCoding.code === referencedAnswer.valueCoding.code);
|
|
144
|
+
}
|
|
145
|
+
if (condition.answerBoolean !== undefined) {
|
|
146
|
+
return condition.answerBoolean === referencedAnswer.valueBoolean;
|
|
147
|
+
}
|
|
148
|
+
if (condition.answerInteger !== undefined) {
|
|
149
|
+
return condition.answerInteger === referencedAnswer.valueInteger;
|
|
150
|
+
}
|
|
151
|
+
if (condition.answerDecimal !== undefined) {
|
|
152
|
+
return condition.answerDecimal === referencedAnswer.valueDecimal;
|
|
153
|
+
}
|
|
154
|
+
if (condition.answerString !== undefined) {
|
|
155
|
+
return condition.answerString === referencedAnswer.valueString;
|
|
156
|
+
}
|
|
157
|
+
if (condition.answerDate !== undefined) {
|
|
158
|
+
return condition.answerDate === referencedAnswer.valueDate;
|
|
159
|
+
}
|
|
160
|
+
if (condition.answerDateTime !== undefined) {
|
|
161
|
+
return condition.answerDateTime === referencedAnswer.valueDateTime;
|
|
162
|
+
}
|
|
163
|
+
if (condition.answerTime !== undefined) {
|
|
164
|
+
return condition.answerTime === referencedAnswer.valueTime;
|
|
165
|
+
}
|
|
166
|
+
return false;
|
|
167
|
+
default:
|
|
168
|
+
// Unsupported operator - treat as false for safety
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
// Apply enableBehavior logic
|
|
173
|
+
if (enableBehavior === "all") {
|
|
174
|
+
return conditionResults.every((result) => result === true);
|
|
175
|
+
}
|
|
176
|
+
else if (enableBehavior === "any") {
|
|
177
|
+
return conditionResults.some((result) => result === true);
|
|
178
|
+
}
|
|
179
|
+
return false;
|
|
180
|
+
};
|
package/dist/esm/types/fhir.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fhir.d.ts","sourceRoot":"","sources":["../../../src/types/fhir.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,MAAM,GAAG;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;I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aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,IAAI,CAAC,EAAE,yBAAyB,EAAE,CAAC;CACpC,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,2BAA2B,EAAE,CAAC;IACvC,IAAI,CAAC,EAAE,yBAAyB,EAAE,CAAC;CACpC,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,YAAY,EAAE,uBAAuB,CAAC;IACtC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,aAAa,GAAG,WAAW,GAAG,SAAS,GAAG,kBAAkB,GAAG,SAAS,CAAC;IACjF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,yBAAyB,EAAE,CAAC;CACpC,CAAA"}
|
|
@@ -48,4 +48,29 @@ export interface CheckboxInputProps {
|
|
|
48
48
|
/** The index of this option in the list */
|
|
49
49
|
index: number;
|
|
50
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Configuration for an input helper extracted from FHIR extension
|
|
53
|
+
*/
|
|
54
|
+
export interface InputHelperConfig {
|
|
55
|
+
/** Helper type identifier (e.g., "bmi-calculator") */
|
|
56
|
+
type: string;
|
|
57
|
+
/** Display name for the helper */
|
|
58
|
+
display?: string;
|
|
59
|
+
/** Description/tooltip text */
|
|
60
|
+
description?: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Props passed to the renderHelperTrigger callback
|
|
64
|
+
* @template T - The type of value this helper works with (e.g., number, string, etc.)
|
|
65
|
+
*/
|
|
66
|
+
export interface HelperTriggerProps<T = string | number> {
|
|
67
|
+
/** The helper configuration from the extension */
|
|
68
|
+
helper: InputHelperConfig;
|
|
69
|
+
/** The linkId of the question item */
|
|
70
|
+
linkId: string;
|
|
71
|
+
/** Current value of the field (if any) */
|
|
72
|
+
currentValue?: T;
|
|
73
|
+
/** Callback to update the field with the helper result */
|
|
74
|
+
onValueSelected: (value: T) => void;
|
|
75
|
+
}
|
|
51
76
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,WAAW,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnE,iDAAiD;IACjD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gDAAgD;IAChD,OAAO,EAAE,OAAO,CAAC;IACjB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;CACf;AAGD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,gCAAgC;IACh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