@d4l/collect-lib 1.24.0 → 1.26.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 +19 -10
- package/dist/index.d.mts +24 -6
- package/dist/index.d.ts +24 -6
- package/dist/index.js +32 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -861,6 +861,7 @@ var SliderStepSizeExtension = "http://fhir.data4life.care/StructureDefinition/sl
|
|
|
861
861
|
var RelativeMinValueExtension = "http://fhir.data4life.care/StructureDefinition/relative-min-value";
|
|
862
862
|
var RelativeMaxValueExtension = "http://fhir.data4life.care/StructureDefinition/relative-max-value";
|
|
863
863
|
var CustomExtensionStudyName = "http://fhir.data4life.care/StructureDefinition/study-name";
|
|
864
|
+
var CustomExtensionContextValue = "http://fhir.data4life.care/StructureDefinition/context-value";
|
|
864
865
|
var CustomExtensionDate = "http://fhir.data4life.care/StructureDefinition/effective-date";
|
|
865
866
|
var MaxValueExtension = "http://hl7.org/fhir/StructureDefinition/maxValue";
|
|
866
867
|
var MinValueExtension = "http://hl7.org/fhir/StructureDefinition/minValue";
|
|
@@ -1116,11 +1117,16 @@ function generateFHIRResponse(id, {
|
|
|
1116
1117
|
questionnaire,
|
|
1117
1118
|
createdAt,
|
|
1118
1119
|
status,
|
|
1119
|
-
answers
|
|
1120
|
+
answers,
|
|
1121
|
+
context
|
|
1120
1122
|
}) {
|
|
1121
1123
|
const extension = [
|
|
1122
1124
|
{ url: CustomExtensionStudyName, valueString: programName },
|
|
1123
|
-
...effectiveDate ? [{ url: CustomExtensionDate, valueDate: effectiveDate }] : []
|
|
1125
|
+
...effectiveDate ? [{ url: CustomExtensionDate, valueDate: effectiveDate }] : [],
|
|
1126
|
+
...context ? Object.entries(context).map(([key, value]) => ({
|
|
1127
|
+
url: CustomExtensionContextValue,
|
|
1128
|
+
valueString: `${key}=${value}`
|
|
1129
|
+
})) : []
|
|
1124
1130
|
];
|
|
1125
1131
|
return {
|
|
1126
1132
|
id,
|
|
@@ -1136,13 +1142,28 @@ function generateFHIRResponse(id, {
|
|
|
1136
1142
|
var toQuestionnaireResponseItem = (answer) => {
|
|
1137
1143
|
const response = answer.response;
|
|
1138
1144
|
if (Array.isArray(response)) {
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1145
|
+
switch (answer.type) {
|
|
1146
|
+
case "multi-select":
|
|
1147
|
+
return {
|
|
1148
|
+
linkId: answer.id,
|
|
1149
|
+
text: answer.text,
|
|
1150
|
+
answer: response.map((r) => ({
|
|
1151
|
+
valueCoding: { system: r.system, code: r.value, display: r == null ? void 0 : r.display }
|
|
1152
|
+
}))
|
|
1153
|
+
};
|
|
1154
|
+
case "list":
|
|
1155
|
+
return {
|
|
1156
|
+
linkId: answer.id,
|
|
1157
|
+
text: answer.text,
|
|
1158
|
+
answer: response.map((r) => ({
|
|
1159
|
+
valueString: r.value
|
|
1160
|
+
}))
|
|
1161
|
+
};
|
|
1162
|
+
default:
|
|
1163
|
+
return {
|
|
1164
|
+
linkId: answer.id
|
|
1165
|
+
};
|
|
1166
|
+
}
|
|
1146
1167
|
}
|
|
1147
1168
|
switch (answer.type) {
|
|
1148
1169
|
case "date":
|
|
@@ -5688,6 +5709,7 @@ export {
|
|
|
5688
5709
|
ConsentGuard,
|
|
5689
5710
|
ConsentNameSystem,
|
|
5690
5711
|
ConsentVersionSystem,
|
|
5712
|
+
CustomExtensionContextValue,
|
|
5691
5713
|
CustomExtensionDate,
|
|
5692
5714
|
CustomExtensionStudyName,
|
|
5693
5715
|
CustomQuestionSystem,
|