@quesmed/types-rn 2.5.63 → 2.5.65
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/package.json
CHANGED
package/utils/commonFunctions.js
CHANGED
|
@@ -109,14 +109,19 @@ function formatPrescribeAnswer(baseAnswer) {
|
|
|
109
109
|
}
|
|
110
110
|
obj.duration.value = [...durationMatches].filter((x) => !!x).join(',');
|
|
111
111
|
const orgFrequencyValue = obj.frequency.value.toLowerCase();
|
|
112
|
+
const timesPerDay = obj.frequency.value.includes('times per day') ||
|
|
113
|
+
obj.frequency.value.includes('times a day');
|
|
114
|
+
// remove whitespace for processing
|
|
112
115
|
obj.frequency.value = orgFrequencyValue.replace(/\s/g, '');
|
|
116
|
+
const freqWordsToInt = (0, wordsToNumber_1.wordsToNumber)(orgFrequencyValue, true);
|
|
113
117
|
const frequencyIncHourly = obj.frequency.value.includes('hour');
|
|
114
|
-
const
|
|
118
|
+
const textToInt = parseInt(obj.frequency.value);
|
|
115
119
|
if (obj.frequency.value === 'once-off') {
|
|
116
120
|
obj.frequency.value = 'stat';
|
|
117
121
|
}
|
|
118
122
|
else if (obj.frequency.value.includes('once') ||
|
|
119
|
-
(frequencyIncHourly &&
|
|
123
|
+
(frequencyIncHourly && textToInt === 24) ||
|
|
124
|
+
(timesPerDay && freqWordsToInt === 1)) {
|
|
120
125
|
obj.frequency.value = 'od';
|
|
121
126
|
}
|
|
122
127
|
else if (obj.frequency.value.includes('nightly') ||
|
|
@@ -124,14 +129,17 @@ function formatPrescribeAnswer(baseAnswer) {
|
|
|
124
129
|
obj.frequency.value = 'od';
|
|
125
130
|
}
|
|
126
131
|
else if (obj.frequency.value.includes('twice') ||
|
|
127
|
-
(frequencyIncHourly &&
|
|
132
|
+
(frequencyIncHourly && textToInt === 12) ||
|
|
133
|
+
(timesPerDay && freqWordsToInt === 2)) {
|
|
128
134
|
obj.frequency.value = 'bd';
|
|
129
135
|
}
|
|
130
136
|
else if (obj.frequency.value.includes('trice') ||
|
|
131
|
-
(frequencyIncHourly &&
|
|
137
|
+
(frequencyIncHourly && textToInt === 8) ||
|
|
138
|
+
(timesPerDay && freqWordsToInt === 3)) {
|
|
132
139
|
obj.frequency.value = 'tds';
|
|
133
140
|
}
|
|
134
|
-
else if (frequencyIncHourly &&
|
|
141
|
+
else if ((frequencyIncHourly && textToInt === 6) ||
|
|
142
|
+
(timesPerDay && freqWordsToInt === 4)) {
|
|
135
143
|
obj.frequency.value = 'qds';
|
|
136
144
|
}
|
|
137
145
|
else if (!ACCEPTED_FREQ.includes(obj.frequency.value)) {
|