@d4l/collect-lib 1.24.0 → 1.25.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/dist/index.mjs CHANGED
@@ -1136,13 +1136,28 @@ function generateFHIRResponse(id, {
1136
1136
  var toQuestionnaireResponseItem = (answer) => {
1137
1137
  const response = answer.response;
1138
1138
  if (Array.isArray(response)) {
1139
- return {
1140
- linkId: answer.id,
1141
- text: answer.text,
1142
- answer: response.map((r) => ({
1143
- valueCoding: { system: r.system, code: r.value, display: r == null ? void 0 : r.display }
1144
- }))
1145
- };
1139
+ switch (answer.type) {
1140
+ case "multi-select":
1141
+ return {
1142
+ linkId: answer.id,
1143
+ text: answer.text,
1144
+ answer: response.map((r) => ({
1145
+ valueCoding: { system: r.system, code: r.value, display: r == null ? void 0 : r.display }
1146
+ }))
1147
+ };
1148
+ case "list":
1149
+ return {
1150
+ linkId: answer.id,
1151
+ text: answer.text,
1152
+ answer: response.map((r) => ({
1153
+ valueString: r.value
1154
+ }))
1155
+ };
1156
+ default:
1157
+ return {
1158
+ linkId: answer.id
1159
+ };
1160
+ }
1146
1161
  }
1147
1162
  switch (answer.type) {
1148
1163
  case "date":