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