@peopl-health/nexus 6.0.27 → 6.0.28
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { firstOf } = require('../utils/coercionUtils');
|
|
1
|
+
const { firstOf, strList } = require('../utils/coercionUtils');
|
|
2
2
|
|
|
3
3
|
// Explicit fields because the tables are 245 and 101 columns wide; `symptoms` here is the link field, not the table.
|
|
4
4
|
const TRIAGE_FIELDS = [
|
|
@@ -9,6 +9,7 @@ const TRIAGE_FIELDS = [
|
|
|
9
9
|
'recommendations', 'other_symptoms', 'other_pain_text', 'symptoms_change',
|
|
10
10
|
'nutri_risk_level', 'satisfaction_level',
|
|
11
11
|
'has_pain', 'pain_frequency', 'pain_intensity', 'pain_interference', 'most_important_pain',
|
|
12
|
+
'symptom_name_multiselect', 'symptom_name (from pain_multiselect)',
|
|
12
13
|
// DEPRECATED: ~10 KB of prompt context per triage, superseded by `symptoms`. Remove with the response field once unread.
|
|
13
14
|
'full_symptoms_metadata',
|
|
14
15
|
];
|
|
@@ -42,6 +43,11 @@ const listOrNull = (value) => {
|
|
|
42
43
|
return items.length ? items : null;
|
|
43
44
|
};
|
|
44
45
|
|
|
46
|
+
const namesOrNull = (value) => {
|
|
47
|
+
const names = strList(value);
|
|
48
|
+
return names.length ? names : null;
|
|
49
|
+
};
|
|
50
|
+
|
|
45
51
|
// A yes/no question answers with the string "no", which plain truthiness would read as true.
|
|
46
52
|
const booleanOrNull = (value) => {
|
|
47
53
|
const first = firstOf(value);
|
|
@@ -103,12 +109,14 @@ const buildTriageRecord = (row, symptomRows = []) => ({
|
|
|
103
109
|
symptomsChange: listOrNull(row.symptoms_change),
|
|
104
110
|
nutriRiskLevel: textOrNull(row.nutri_risk_level),
|
|
105
111
|
satisfactionLevel: textOrNull(row.satisfaction_level),
|
|
112
|
+
checkboxSymptoms: namesOrNull(row.symptom_name_multiselect),
|
|
106
113
|
pain: {
|
|
107
114
|
hasPain: booleanOrNull(row.has_pain),
|
|
108
115
|
frequency: textOrNull(row.pain_frequency),
|
|
109
116
|
intensity: textOrNull(row.pain_intensity),
|
|
110
117
|
interference: textOrNull(row.pain_interference),
|
|
111
118
|
mostImportant: textOrNull(row.most_important_pain),
|
|
119
|
+
types: namesOrNull(row['symptom_name (from pain_multiselect)']),
|
|
112
120
|
},
|
|
113
121
|
symptoms: symptomRows.map(buildSymptom),
|
|
114
122
|
full_symptoms_metadata: row?.full_symptoms_metadata || null,
|