@d4l/collect-lib 1.23.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":
@@ -5588,6 +5603,10 @@ function ULIDtoUUID(ulid, opts) {
5588
5603
  return uuid2;
5589
5604
  }
5590
5605
 
5606
+ // src/helper/question.ts
5607
+ var OTHER_ANSWER_CODE = "#other";
5608
+ var getFollowUpQuestionLinkId = (linkId) => `${linkId}${OTHER_ANSWER_CODE}`;
5609
+
5591
5610
  // src/configuration/apis.ts
5592
5611
  var API_TARGET_MAP = {
5593
5612
  DEXCOM: {
@@ -5747,6 +5766,7 @@ export {
5747
5766
  MeasurementTypeSystem,
5748
5767
  MinLengthExtension,
5749
5768
  MinValueExtension,
5769
+ OTHER_ANSWER_CODE,
5750
5770
  ObservationTypeSystem,
5751
5771
  Offset,
5752
5772
  PAMSCardioVascularActivityAnnotation,
@@ -5804,6 +5824,7 @@ export {
5804
5824
  generateStepGuard,
5805
5825
  generateUrn,
5806
5826
  get,
5827
+ getFollowUpQuestionLinkId,
5807
5828
  getLanguageOfPassPhrase,
5808
5829
  getMovellaAnnotation,
5809
5830
  getText,