@hedia/recommendation-screen 1.3.2 → 1.4.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/package.json +1 -1
- package/src/RecommendationScreen.jsx +2 -2
- package/src/RecommendationScreen.tsx +3 -9
- package/src/utils/RecommendationUtils.d.ts +0 -2
- package/src/utils/RecommendationUtils.js +1 -5
- package/src/utils/RecommendationUtils.ts +0 -5
- package/src/utils/Validations.js +3 -1
- package/src/utils/Validations.ts +3 -1
package/package.json
CHANGED
|
@@ -53,7 +53,7 @@ class RecommendationScreen extends react_1.default.Component {
|
|
|
53
53
|
super(props);
|
|
54
54
|
this.hasError = false;
|
|
55
55
|
this.recalculateInsulin = (calculatorParams) => {
|
|
56
|
-
const { bolus } = Calculator.calculateRecommendation(
|
|
56
|
+
const { bolus } = Calculator.calculateRecommendation(calculatorParams);
|
|
57
57
|
this.setState({
|
|
58
58
|
insulinRecommendation: Utils_1.Utils.roundValue(bolus, this.props.injectionMethod),
|
|
59
59
|
enteredInsulin: undefined,
|
|
@@ -137,7 +137,7 @@ class RecommendationScreen extends react_1.default.Component {
|
|
|
137
137
|
Validations_1.validateParams(props);
|
|
138
138
|
i18nUtils_1.changeLanguage(props.language);
|
|
139
139
|
const { recentBoluses } = props.calculatorParams;
|
|
140
|
-
const { bolus, carbRecommendation, activityReduction, wasLimited, activeInsulin, } = Calculator.calculateRecommendation(
|
|
140
|
+
const { bolus, carbRecommendation, activityReduction, wasLimited, activeInsulin, } = Calculator.calculateRecommendation(props.calculatorParams);
|
|
141
141
|
this.suggestedCarbs = carbRecommendation;
|
|
142
142
|
this.state = {
|
|
143
143
|
remeasureTime: this.getBGLevelRemeasurementReminder(),
|
|
@@ -24,13 +24,7 @@ import RecommendationModal from "./components/RecommendationModal";
|
|
|
24
24
|
import { changeLanguage, i18n } from "./locale/i18nUtils";
|
|
25
25
|
import { IActivityDisplayProps, logbookEntry } from "./types/types";
|
|
26
26
|
import { AttentionMessage } from "./utils/AttentionMessages";
|
|
27
|
-
import {
|
|
28
|
-
assignTargetBGL,
|
|
29
|
-
getAttentionMessage,
|
|
30
|
-
getBGLevel,
|
|
31
|
-
getLimitationMessage,
|
|
32
|
-
getReminder,
|
|
33
|
-
} from "./utils/RecommendationUtils";
|
|
27
|
+
import { getAttentionMessage, getBGLevel, getLimitationMessage, getReminder } from "./utils/RecommendationUtils";
|
|
34
28
|
import { Utils } from "./utils/Utils";
|
|
35
29
|
import { validateParams } from "./utils/Validations";
|
|
36
30
|
|
|
@@ -98,7 +92,7 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
98
92
|
activityReduction,
|
|
99
93
|
wasLimited,
|
|
100
94
|
activeInsulin,
|
|
101
|
-
} = Calculator.calculateRecommendation(
|
|
95
|
+
} = Calculator.calculateRecommendation(props.calculatorParams);
|
|
102
96
|
|
|
103
97
|
this.suggestedCarbs = carbRecommendation;
|
|
104
98
|
|
|
@@ -130,7 +124,7 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
130
124
|
}
|
|
131
125
|
|
|
132
126
|
public recalculateInsulin = (calculatorParams: Calculator.IRecommendationParams): void => {
|
|
133
|
-
const { bolus } = Calculator.calculateRecommendation(
|
|
127
|
+
const { bolus } = Calculator.calculateRecommendation(calculatorParams);
|
|
134
128
|
this.setState({
|
|
135
129
|
insulinRecommendation: Utils.roundValue(bolus, this.props.injectionMethod),
|
|
136
130
|
enteredInsulin: undefined,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { IRecommendationParams } from "@hedia/recommendation-calculator";
|
|
2
1
|
import { IActivityParams } from "@hedia/recommendation-calculator/src/RecommendationCalculator";
|
|
3
2
|
import { BgLevel } from "../types/enum";
|
|
4
3
|
import { logbookEntry } from "../types/types";
|
|
@@ -9,4 +8,3 @@ export declare function getAttentionMessage(bgLevel: BgLevel, activity: IActivit
|
|
|
9
8
|
export declare function isSevereHyperglycemia(latestLogbookFrom6Hours: logbookEntry): boolean;
|
|
10
9
|
export declare function isActivityWithin15Minutes(activity: IActivityParams): boolean;
|
|
11
10
|
export declare function getLimitationMessage(wasLimited: boolean, activityReduction: number): Messages;
|
|
12
|
-
export declare function assignTargetBGL(calculatorParams: IRecommendationParams): IRecommendationParams;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.getLimitationMessage = exports.isActivityWithin15Minutes = exports.isSevereHyperglycemia = exports.getAttentionMessage = exports.getReminder = exports.getBGLevel = void 0;
|
|
7
7
|
const moment_1 = __importDefault(require("moment"));
|
|
8
8
|
const enum_1 = require("../types/enum");
|
|
9
9
|
const AttentionMessages_1 = require("./AttentionMessages");
|
|
@@ -105,7 +105,3 @@ function getLimitationMessage(wasLimited, activityReduction) {
|
|
|
105
105
|
return wasLimited ? message : undefined;
|
|
106
106
|
}
|
|
107
107
|
exports.getLimitationMessage = getLimitationMessage;
|
|
108
|
-
function assignTargetBGL(calculatorParams) {
|
|
109
|
-
return { ...calculatorParams, currentBGL: calculatorParams.currentBGL ?? calculatorParams.targetBGL };
|
|
110
|
-
}
|
|
111
|
-
exports.assignTargetBGL = assignTargetBGL;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { IRecommendationParams } from "@hedia/recommendation-calculator";
|
|
2
1
|
import { IActivityParams } from "@hedia/recommendation-calculator/src/RecommendationCalculator";
|
|
3
2
|
import moment from "moment";
|
|
4
3
|
import { BgLevel, RecommendationReminders } from "../types/enum";
|
|
@@ -114,7 +113,3 @@ export function getLimitationMessage(wasLimited: boolean, activityReduction: num
|
|
|
114
113
|
: Messages.RecommendationWasLimited();
|
|
115
114
|
return wasLimited ? message : undefined;
|
|
116
115
|
}
|
|
117
|
-
|
|
118
|
-
export function assignTargetBGL(calculatorParams: IRecommendationParams): IRecommendationParams {
|
|
119
|
-
return { ...calculatorParams, currentBGL: calculatorParams.currentBGL ?? calculatorParams.targetBGL };
|
|
120
|
-
}
|
package/src/utils/Validations.js
CHANGED
|
@@ -16,7 +16,9 @@ function validateParams(props) {
|
|
|
16
16
|
checkInjectionMethod(props.injectionMethod);
|
|
17
17
|
checkUserReminder(props.userReminder);
|
|
18
18
|
checkLanguage(props.language);
|
|
19
|
-
|
|
19
|
+
if (props.calculatorParams.activity) {
|
|
20
|
+
checkActivityType(props.activityDisplayProps.activityType);
|
|
21
|
+
}
|
|
20
22
|
}
|
|
21
23
|
exports.validateParams = validateParams;
|
|
22
24
|
function checkLanguage(language) {
|
package/src/utils/Validations.ts
CHANGED
|
@@ -51,7 +51,9 @@ export function validateParams(props: IRecommendationProps): void {
|
|
|
51
51
|
checkInjectionMethod(props.injectionMethod);
|
|
52
52
|
checkUserReminder(props.userReminder);
|
|
53
53
|
checkLanguage(props.language);
|
|
54
|
-
|
|
54
|
+
if (props.calculatorParams.activity) {
|
|
55
|
+
checkActivityType(props.activityDisplayProps.activityType);
|
|
56
|
+
}
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
export function checkLanguage(language: Language): void {
|