@hedia/types 2.1.20 → 2.1.22
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/.github/workflows/publish-alpha.yaml +24 -0
- package/dist/types/activity/activity.d.ts +10 -0
- package/dist/types/activity/activity.js +3 -0
- package/dist/types/activity/activity.js.map +1 -1
- package/dist/types/boluscalculator/boluscalculator.d.ts +36 -0
- package/dist/types/boluscalculator/boluscalculator.js +5 -0
- package/dist/types/boluscalculator/boluscalculator.js.map +1 -1
- package/dist/types/enums.d.ts +11 -0
- package/dist/types/enums.js +11 -0
- package/dist/types/enums.js.map +1 -1
- package/dist/types/logbook/logbook.d.ts +85 -0
- package/dist/types/logbook/logbook.js +1 -0
- package/dist/types/logbook/logbook.js.map +1 -1
- package/dist/types/usersettings/usersettings.d.ts +4 -0
- package/dist/types/usersettings/usersettings.js +4 -0
- package/dist/types/usersettings/usersettings.js.map +1 -1
- package/package.json +1 -1
- package/types/activity/activity.ts +11 -1
- package/types/boluscalculator/boluscalculator.ts +37 -0
- package/types/enums.ts +11 -0
- package/types/logbook/logbook.ts +86 -1
- package/types/usersettings/usersettings.ts +4 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: Publish alpha
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
|
|
8
|
+
env:
|
|
9
|
+
SSH_PRIVATE_KEY: ${{ secrets.HEDIA_BOT_PRIVATE_SSH_KEY }}
|
|
10
|
+
NPM_TOKEN: ${{ secrets.HEDIA_BOT_NPM_TOKEN }}
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
publish:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v1
|
|
17
|
+
- uses: actions/setup-node@v1
|
|
18
|
+
with:
|
|
19
|
+
node-version: 10
|
|
20
|
+
- run: npm install
|
|
21
|
+
- run: npm test
|
|
22
|
+
- uses: JS-DevTools/npm-publish@v1
|
|
23
|
+
with:
|
|
24
|
+
token: ${{ env.NPM_TOKEN }}
|
|
@@ -11,8 +11,15 @@ export declare namespace Activity {
|
|
|
11
11
|
uuidOld?: IActivityEntry["uuid"];
|
|
12
12
|
overwrittenByUUID?: IActivityEntry["uuid"];
|
|
13
13
|
}
|
|
14
|
+
/** Type that represents the user’s settings related to physical activity. */
|
|
14
15
|
export type ActivitySettings = ActivityReductionSettings & ActivityTarget;
|
|
16
|
+
/** Represents a set of insulin reduction fraction settings that can vary by the duration of the activity. */
|
|
15
17
|
export type ActivityReductionIntervals = ActivityReductionSettings[keyof ActivityReductionSettings];
|
|
18
|
+
/**
|
|
19
|
+
* Represents whether the reduction fraction is a number or it is null.
|
|
20
|
+
* Only for the settings of hard physical activities over 45 minutes the value is null.
|
|
21
|
+
* A null value represents that it is not supported by HDA.
|
|
22
|
+
*/
|
|
16
23
|
export type ReductionType = ActivityReductionIntervals[keyof ActivityReductionIntervals];
|
|
17
24
|
type ActivityIntensityKeys = keyof typeof Enums.ActivityIntensity;
|
|
18
25
|
type ActivityReductionKeys = keyof typeof Enums.ActivityReductionIntervals;
|
|
@@ -33,16 +40,19 @@ export declare namespace Activity {
|
|
|
33
40
|
export {};
|
|
34
41
|
}
|
|
35
42
|
namespace Enums {
|
|
43
|
+
/** Enum that represents a set of insulin reduction fraction settings that can vary by the duration of the activity */
|
|
36
44
|
enum ActivityReductionIntervals {
|
|
37
45
|
fromZero = "fromZero",
|
|
38
46
|
fromThirty = "fromThirty",
|
|
39
47
|
fromFortysix = "fromFortysix"
|
|
40
48
|
}
|
|
49
|
+
/** Enum used to indicate the category or intensity of a physical activity. */
|
|
41
50
|
enum ActivityIntensity {
|
|
42
51
|
light = "light",
|
|
43
52
|
moderate = "moderate",
|
|
44
53
|
hard = "hard"
|
|
45
54
|
}
|
|
55
|
+
/** Enum used to indicate the type of physical activity performed by the user. */
|
|
46
56
|
enum ActivityEnum {
|
|
47
57
|
Run = "Run",
|
|
48
58
|
Walk = "Walk",
|
|
@@ -5,18 +5,21 @@ var Activity;
|
|
|
5
5
|
(function (Activity) {
|
|
6
6
|
let Enums;
|
|
7
7
|
(function (Enums) {
|
|
8
|
+
/** Enum that represents a set of insulin reduction fraction settings that can vary by the duration of the activity */
|
|
8
9
|
let ActivityReductionIntervals;
|
|
9
10
|
(function (ActivityReductionIntervals) {
|
|
10
11
|
ActivityReductionIntervals["fromZero"] = "fromZero";
|
|
11
12
|
ActivityReductionIntervals["fromThirty"] = "fromThirty";
|
|
12
13
|
ActivityReductionIntervals["fromFortysix"] = "fromFortysix";
|
|
13
14
|
})(ActivityReductionIntervals = Enums.ActivityReductionIntervals || (Enums.ActivityReductionIntervals = {}));
|
|
15
|
+
/** Enum used to indicate the category or intensity of a physical activity. */
|
|
14
16
|
let ActivityIntensity;
|
|
15
17
|
(function (ActivityIntensity) {
|
|
16
18
|
ActivityIntensity["light"] = "light";
|
|
17
19
|
ActivityIntensity["moderate"] = "moderate";
|
|
18
20
|
ActivityIntensity["hard"] = "hard";
|
|
19
21
|
})(ActivityIntensity = Enums.ActivityIntensity || (Enums.ActivityIntensity = {}));
|
|
22
|
+
/** Enum used to indicate the type of physical activity performed by the user. */
|
|
20
23
|
let ActivityEnum;
|
|
21
24
|
(function (ActivityEnum) {
|
|
22
25
|
ActivityEnum["Run"] = "Run";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity.js","sourceRoot":"","sources":["../../../types/activity/activity.ts"],"names":[],"mappings":";;;AAAA,IAAiB,QAAQ,
|
|
1
|
+
{"version":3,"file":"activity.js","sourceRoot":"","sources":["../../../types/activity/activity.ts"],"names":[],"mappings":";;;AAAA,IAAiB,QAAQ,CAyExB;AAzED,WAAiB,QAAQ;IAiDxB,IAAiB,KAAK,CAuBrB;IAvBD,WAAiB,KAAK;QACrB,sHAAsH;QACtH,IAAY,0BAIX;QAJD,WAAY,0BAA0B;YACrC,mDAAqB,CAAA;YACrB,uDAAyB,CAAA;YACzB,2DAA6B,CAAA;QAC9B,CAAC,EAJW,0BAA0B,GAA1B,gCAA0B,KAA1B,gCAA0B,QAIrC;QAED,8EAA8E;QAC9E,IAAY,iBAIX;QAJD,WAAY,iBAAiB;YAC5B,oCAAe,CAAA;YACf,0CAAqB,CAAA;YACrB,kCAAa,CAAA;QACd,CAAC,EAJW,iBAAiB,GAAjB,uBAAiB,KAAjB,uBAAiB,QAI5B;QAED,iFAAiF;QACjF,IAAY,YAMX;QAND,WAAY,YAAY;YACvB,2BAAW,CAAA;YACX,6BAAa,CAAA;YACb,mCAAmB,CAAA;YACnB,6BAAa,CAAA;YACb,+BAAe,CAAA;QAChB,CAAC,EANW,YAAY,GAAZ,kBAAY,KAAZ,kBAAY,QAMvB;IACF,CAAC,EAvBgB,KAAK,GAAL,cAAK,KAAL,cAAK,QAuBrB;AACF,CAAC,EAzEgB,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAyExB"}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { Activity } from "../activity/activity";
|
|
2
2
|
export declare namespace BolusCalculator {
|
|
3
3
|
namespace Constants {
|
|
4
|
+
/** The maximum amount of insulin that may be recommended to the user. */
|
|
4
5
|
const SAFETY_INSULIN_LIMIT = 50;
|
|
6
|
+
/** The maximum duration in minutes of a physical activity. */
|
|
5
7
|
const SAFETY_ACTIVITY_LIMIT = 60;
|
|
8
|
+
/** The maximum reduction factor for a physical activity */
|
|
6
9
|
const REDUCTION_MAX = 1;
|
|
10
|
+
/** The minimum reduction factor for a physical activity */
|
|
7
11
|
const REDUCTION_MIN = 0;
|
|
8
12
|
}
|
|
9
13
|
namespace Enums {
|
|
14
|
+
/** Enum for differentiating between types of errors. */
|
|
10
15
|
enum ActivityErrors {
|
|
11
16
|
OutOfRange = "Out of range",
|
|
12
17
|
InvalidInterval = "Invalid activity settings interval",
|
|
@@ -14,30 +19,61 @@ export declare namespace BolusCalculator {
|
|
|
14
19
|
}
|
|
15
20
|
}
|
|
16
21
|
namespace Types {
|
|
22
|
+
/** Represents a single bolus of fast-acting insulin that has been administered within the past 4 hours. */
|
|
17
23
|
interface IRecentBolus {
|
|
24
|
+
/** The number of seconds that has passed since the bolus in question was administered. */
|
|
18
25
|
secondsPassed: number;
|
|
26
|
+
/** The amount of insulin that was administered with the bolus in question. */
|
|
19
27
|
insulinDose: number;
|
|
20
28
|
}
|
|
29
|
+
/** Details about a physical activity. */
|
|
21
30
|
interface IActivityParams {
|
|
31
|
+
/** The duration of the physical activity in minutes. */
|
|
22
32
|
activityDuration: number;
|
|
33
|
+
/** The intensity of the activity */
|
|
23
34
|
activityIntensity: Activity.Enums.ActivityIntensity;
|
|
35
|
+
/** The user’s current settings for physical activity */
|
|
24
36
|
activitySettings: Activity.Types.ActivitySettings;
|
|
37
|
+
/** Start date and time for the activity */
|
|
25
38
|
activityDate: Date;
|
|
26
39
|
}
|
|
40
|
+
/** IRecommendationParams contains data that is used to calculate a recommendation. */
|
|
27
41
|
interface IRecommendationParams {
|
|
42
|
+
/** The user’s current blood glucose level in mmol/L */
|
|
28
43
|
currentBGL: number | null;
|
|
44
|
+
/** The blood glucose level in mmol/L that the user should ideally have at this time of day according to their settings/preferences. */
|
|
29
45
|
targetBGL: number;
|
|
46
|
+
/** The user’s current insulin sensitivity in (mmol/L)/IU according to their settings/preferences. */
|
|
30
47
|
insulinSensitivity: number;
|
|
48
|
+
/** The amount of carbohydrates in grams that the user has entered that they are going to eat. */
|
|
31
49
|
carbohydrates: number;
|
|
50
|
+
/** The user’s current insulin-to-carbs ratio in g/IU according to their settings/preferences. */
|
|
32
51
|
carbohydrateRatio: number;
|
|
52
|
+
/** A possibly empty array of IRecentBolus objects. */
|
|
33
53
|
recentBoluses: Array<IRecentBolus>;
|
|
54
|
+
/** Information about the activity that the user is doing including their activity settings */
|
|
34
55
|
activity: IActivityParams | null;
|
|
35
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* The result of a recommendation calculation is returned by the calculateRecommendation() function as an object that implements this interface.
|
|
59
|
+
* Note that only one of bolus and carbRecommendation may be positive. If one is non-zero then the other must be zero.
|
|
60
|
+
*/
|
|
36
61
|
interface IRecommendationResult {
|
|
62
|
+
/** The recommended amount of insulin measured in units. */
|
|
37
63
|
bolus: number;
|
|
64
|
+
/**
|
|
65
|
+
* Indicates whether or not the insulin recommendation (given in the bolus property) was capped because the underlying recommendation exceeded the safety limit.
|
|
66
|
+
* If it is true then we know that the recommendation would have been higher and can show and appropriate message to the user.
|
|
67
|
+
*/
|
|
38
68
|
wasLimited: boolean;
|
|
69
|
+
/** The number of carbs that the user is recommended to eat */
|
|
39
70
|
carbRecommendation: number;
|
|
71
|
+
/**
|
|
72
|
+
* Indicates how much the insulin recommendation was reduced due to physical activity.
|
|
73
|
+
* A value of 0.75 would indicate that the recommended insulin was reduced by 25%.
|
|
74
|
+
*/
|
|
40
75
|
activityReduction: number | null;
|
|
76
|
+
/** The estimated amount of active insulin (IOB) in IU. */
|
|
41
77
|
activeInsulin: number;
|
|
42
78
|
}
|
|
43
79
|
}
|
|
@@ -5,13 +5,18 @@ var BolusCalculator;
|
|
|
5
5
|
(function (BolusCalculator) {
|
|
6
6
|
let Constants;
|
|
7
7
|
(function (Constants) {
|
|
8
|
+
/** The maximum amount of insulin that may be recommended to the user. */
|
|
8
9
|
Constants.SAFETY_INSULIN_LIMIT = 50;
|
|
10
|
+
/** The maximum duration in minutes of a physical activity. */
|
|
9
11
|
Constants.SAFETY_ACTIVITY_LIMIT = 60;
|
|
12
|
+
/** The maximum reduction factor for a physical activity */
|
|
10
13
|
Constants.REDUCTION_MAX = 1;
|
|
14
|
+
/** The minimum reduction factor for a physical activity */
|
|
11
15
|
Constants.REDUCTION_MIN = 0;
|
|
12
16
|
})(Constants = BolusCalculator.Constants || (BolusCalculator.Constants = {}));
|
|
13
17
|
let Enums;
|
|
14
18
|
(function (Enums) {
|
|
19
|
+
/** Enum for differentiating between types of errors. */
|
|
15
20
|
let ActivityErrors;
|
|
16
21
|
(function (ActivityErrors) {
|
|
17
22
|
ActivityErrors["OutOfRange"] = "Out of range";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boluscalculator.js","sourceRoot":"","sources":["../../../types/boluscalculator/boluscalculator.ts"],"names":[],"mappings":";;;AAEA,IAAiB,eAAe,
|
|
1
|
+
{"version":3,"file":"boluscalculator.js","sourceRoot":"","sources":["../../../types/boluscalculator/boluscalculator.ts"],"names":[],"mappings":";;;AAEA,IAAiB,eAAe,CAmF/B;AAnFD,WAAiB,eAAe;IAC/B,IAAiB,SAAS,CASzB;IATD,WAAiB,SAAS;QACzB,yEAAyE;QAC5D,8BAAoB,GAAG,EAAE,CAAC;QACvC,8DAA8D;QACjD,+BAAqB,GAAG,EAAE,CAAC;QACxC,2DAA2D;QAC9C,uBAAa,GAAG,CAAC,CAAC;QAC/B,2DAA2D;QAC9C,uBAAa,GAAG,CAAC,CAAC;IAChC,CAAC,EATgB,SAAS,GAAT,yBAAS,KAAT,yBAAS,QASzB;IAED,IAAiB,KAAK,CAOrB;IAPD,WAAiB,KAAK;QACrB,wDAAwD;QACxD,IAAY,cAIX;QAJD,WAAY,cAAc;YACzB,6CAA2B,CAAA;YAC3B,wEAAsD,CAAA;YACtD,iEAA+C,CAAA;QAChD,CAAC,EAJW,cAAc,GAAd,oBAAc,KAAd,oBAAc,QAIzB;IACF,CAAC,EAPgB,KAAK,GAAL,qBAAK,KAAL,qBAAK,QAOrB;AAgEF,CAAC,EAnFgB,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAmF/B"}
|
package/dist/types/enums.d.ts
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
+
/** Represents a unit for measuring blood glucose levels. */
|
|
1
2
|
export declare enum BloodGlucoseUnit {
|
|
2
3
|
MMOL_L = "mmol/l",
|
|
3
4
|
MG_DL = "mg/dl"
|
|
4
5
|
}
|
|
6
|
+
/** Represents a unit for measuring blood ketone levels. */
|
|
5
7
|
export declare enum BloodKetonesUnit {
|
|
6
8
|
MMOL_L = "mmol/l",
|
|
7
9
|
MG_DL = "mg/dl"
|
|
8
10
|
}
|
|
11
|
+
/** Represents a unit for measuring insulin intake */
|
|
9
12
|
export declare enum InsulinUnit {
|
|
10
13
|
IU = "IU"
|
|
11
14
|
}
|
|
15
|
+
/** Represents a language that the app can be displayed in. */
|
|
12
16
|
export declare enum Languages {
|
|
13
17
|
da = "Dansk",
|
|
14
18
|
en = "English",
|
|
@@ -17,12 +21,14 @@ export declare enum Languages {
|
|
|
17
21
|
fr = "Fran\u00E7ais",
|
|
18
22
|
it = "Italiano"
|
|
19
23
|
}
|
|
24
|
+
/** Enum containing constants for seconds, minutes, hours, or days in milliseconds */
|
|
20
25
|
export declare enum Milliseconds {
|
|
21
26
|
Second = 1000,
|
|
22
27
|
Minute = 60000,
|
|
23
28
|
Hour = 3600000,
|
|
24
29
|
Day = 86400000
|
|
25
30
|
}
|
|
31
|
+
/** Enum containing the possible ketone levels of the user */
|
|
26
32
|
export declare enum KetoneLevels {
|
|
27
33
|
Negative = 0,
|
|
28
34
|
Normal = 1,
|
|
@@ -30,6 +36,11 @@ export declare enum KetoneLevels {
|
|
|
30
36
|
Moderate = 3,
|
|
31
37
|
High = 4
|
|
32
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Enum containing constants for displaying colour indicators regarding the blood ketone levels of the user.
|
|
41
|
+
* Blood ketones ranges and the color scheme can be found at:
|
|
42
|
+
* https://hedia.atlassian.net/wiki/spaces/QMS/pages/827785277/QF-73-3-1+Ketones+and+current+functions+in+HDA#4.0-Ketone-procedure-in-HDA
|
|
43
|
+
*/
|
|
33
44
|
export declare enum KetoneColours {
|
|
34
45
|
None = "rgb(15,18,49)",
|
|
35
46
|
Negative = "rgb(222,194,145)",
|
package/dist/types/enums.js
CHANGED
|
@@ -6,20 +6,24 @@ var Units;
|
|
|
6
6
|
Units["MMOL_L"] = "mmol/l";
|
|
7
7
|
Units["MG_DL"] = "mg/dl";
|
|
8
8
|
})(Units || (Units = {}));
|
|
9
|
+
/** Represents a unit for measuring blood glucose levels. */
|
|
9
10
|
var BloodGlucoseUnit;
|
|
10
11
|
(function (BloodGlucoseUnit) {
|
|
11
12
|
BloodGlucoseUnit["MMOL_L"] = "mmol/l";
|
|
12
13
|
BloodGlucoseUnit["MG_DL"] = "mg/dl";
|
|
13
14
|
})(BloodGlucoseUnit = exports.BloodGlucoseUnit || (exports.BloodGlucoseUnit = {}));
|
|
15
|
+
/** Represents a unit for measuring blood ketone levels. */
|
|
14
16
|
var BloodKetonesUnit;
|
|
15
17
|
(function (BloodKetonesUnit) {
|
|
16
18
|
BloodKetonesUnit["MMOL_L"] = "mmol/l";
|
|
17
19
|
BloodKetonesUnit["MG_DL"] = "mg/dl";
|
|
18
20
|
})(BloodKetonesUnit = exports.BloodKetonesUnit || (exports.BloodKetonesUnit = {}));
|
|
21
|
+
/** Represents a unit for measuring insulin intake */
|
|
19
22
|
var InsulinUnit;
|
|
20
23
|
(function (InsulinUnit) {
|
|
21
24
|
InsulinUnit["IU"] = "IU";
|
|
22
25
|
})(InsulinUnit = exports.InsulinUnit || (exports.InsulinUnit = {}));
|
|
26
|
+
/** Represents a language that the app can be displayed in. */
|
|
23
27
|
var Languages;
|
|
24
28
|
(function (Languages) {
|
|
25
29
|
Languages["da"] = "Dansk";
|
|
@@ -29,6 +33,7 @@ var Languages;
|
|
|
29
33
|
Languages["fr"] = "Fran\u00E7ais";
|
|
30
34
|
Languages["it"] = "Italiano";
|
|
31
35
|
})(Languages = exports.Languages || (exports.Languages = {}));
|
|
36
|
+
/** Enum containing constants for seconds, minutes, hours, or days in milliseconds */
|
|
32
37
|
var Milliseconds;
|
|
33
38
|
(function (Milliseconds) {
|
|
34
39
|
Milliseconds[Milliseconds["Second"] = 1000] = "Second";
|
|
@@ -36,6 +41,7 @@ var Milliseconds;
|
|
|
36
41
|
Milliseconds[Milliseconds["Hour"] = 3600000] = "Hour";
|
|
37
42
|
Milliseconds[Milliseconds["Day"] = 86400000] = "Day";
|
|
38
43
|
})(Milliseconds = exports.Milliseconds || (exports.Milliseconds = {}));
|
|
44
|
+
/** Enum containing the possible ketone levels of the user */
|
|
39
45
|
var KetoneLevels;
|
|
40
46
|
(function (KetoneLevels) {
|
|
41
47
|
KetoneLevels[KetoneLevels["Negative"] = 0] = "Negative";
|
|
@@ -44,6 +50,11 @@ var KetoneLevels;
|
|
|
44
50
|
KetoneLevels[KetoneLevels["Moderate"] = 3] = "Moderate";
|
|
45
51
|
KetoneLevels[KetoneLevels["High"] = 4] = "High";
|
|
46
52
|
})(KetoneLevels = exports.KetoneLevels || (exports.KetoneLevels = {}));
|
|
53
|
+
/**
|
|
54
|
+
* Enum containing constants for displaying colour indicators regarding the blood ketone levels of the user.
|
|
55
|
+
* Blood ketones ranges and the color scheme can be found at:
|
|
56
|
+
* https://hedia.atlassian.net/wiki/spaces/QMS/pages/827785277/QF-73-3-1+Ketones+and+current+functions+in+HDA#4.0-Ketone-procedure-in-HDA
|
|
57
|
+
*/
|
|
47
58
|
var KetoneColours;
|
|
48
59
|
(function (KetoneColours) {
|
|
49
60
|
KetoneColours["None"] = "rgb(15,18,49)";
|
package/dist/types/enums.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../../types/enums.ts"],"names":[],"mappings":";;;AAAA,IAAK,KAGJ;AAHD,WAAK,KAAK;IACT,0BAAiB,CAAA;IACjB,wBAAe,CAAA;AAChB,CAAC,EAHI,KAAK,KAAL,KAAK,QAGT;AAED,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC3B,qCAAqB,CAAA;IACrB,mCAAmB,CAAA;AACpB,CAAC,EAHW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAG3B;AAED,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC3B,qCAAqB,CAAA;IACrB,mCAAmB,CAAA;AACpB,CAAC,EAHW,gBAAgB,GAAhB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;IACH,kCAAa,CAAA;IAEb;;;OAGG;IACH,gCAAW,CAAA;IAEX;;;OAGG;IACH,oCAAe,CAAA;AAChB,CAAC,EApDW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAoD5B"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare namespace Logbook {
|
|
2
2
|
namespace Enums {
|
|
3
|
+
/** Used to differentiate the different moods that users can select. */
|
|
3
4
|
enum MoodEnum {
|
|
4
5
|
Sad = 1,
|
|
5
6
|
SemiSad = 2,
|
|
@@ -10,25 +11,109 @@ export declare namespace Logbook {
|
|
|
10
11
|
}
|
|
11
12
|
namespace Types {
|
|
12
13
|
interface ILogbookEntry {
|
|
14
|
+
/** Unique id for each logbook*/
|
|
13
15
|
uuid: string;
|
|
16
|
+
/**
|
|
17
|
+
* The timestamp at which this logbook entry should be displayed in to the user.
|
|
18
|
+
* This may differ from client_timestamp if the user created the logbook entry manually after the fact
|
|
19
|
+
* or they edited the entry timestamp of the logbook entry after it was first created.
|
|
20
|
+
*/
|
|
14
21
|
entry_timestamp: string;
|
|
22
|
+
/**
|
|
23
|
+
* The timestamp at which this logbook entry was saved in the server's database.
|
|
24
|
+
* This can be expected to be the time of the first syncrhonization after the logbook entry was created on the client.
|
|
25
|
+
*/
|
|
15
26
|
server_timestamp: Date | null;
|
|
27
|
+
/**
|
|
28
|
+
* The timestamp at which the logbook entry was created on the client.
|
|
29
|
+
* This may differ from entry_timestamp if the user created the logbook entry manually after the fact
|
|
30
|
+
* or they edited the entry timestamp of the logbook entry after it was first created.
|
|
31
|
+
*/
|
|
16
32
|
client_timestamp: string;
|
|
33
|
+
/**
|
|
34
|
+
* When the user makes changes to an existing logbook entry, the changes will be saved as a completely new logbook entry.
|
|
35
|
+
* For the old entry, this field will then be updated with the uuid of the new version of the logbook entry.
|
|
36
|
+
* The value is null by default (that is if the entry hasn't been replaced with a newer version).
|
|
37
|
+
* Logbook entries that don't contain null in this field are considered outdated and should gerenerally be excluded when computing statistics and the like.
|
|
38
|
+
*/
|
|
17
39
|
overwritten_by_id: string | null;
|
|
40
|
+
/**
|
|
41
|
+
* The uuid of the settings object that was used on the client when the logbook entry was created.
|
|
42
|
+
* Note that if the user updates their settings later this field will not be updated.
|
|
43
|
+
* This allows us to exactly which settings were used to make an old insulin calculation
|
|
44
|
+
*/
|
|
18
45
|
settings_uuid: string;
|
|
46
|
+
/** The version of the app that was used to create the logbook entry. e.g. "2.7.3" */
|
|
19
47
|
client_version: string;
|
|
48
|
+
/** For keeping track of which version of the server that was used when the logbook entry was synchronized and saved to the database. */
|
|
20
49
|
server_version: number | null;
|
|
50
|
+
/**
|
|
51
|
+
* For keeping track of which os and os version the app was running on when the logbook entry was created.
|
|
52
|
+
* For android this is the API level, e.g. "android 28" or "android 24".
|
|
53
|
+
* For iOS this is the version of the os, e.g. "ios 13.3.1" or "ios 13.5.1"
|
|
54
|
+
*/
|
|
21
55
|
device_and_os: string;
|
|
56
|
+
/**
|
|
57
|
+
* The exact result of the insulin recommendation calculation without rounding.
|
|
58
|
+
* Should be 0 if the user made a calculation and didn't get a recommendation
|
|
59
|
+
* (because it was recommended that they should eat additional carbohydrates instead).
|
|
60
|
+
*/
|
|
22
61
|
insulin_suggested_units: number | null;
|
|
62
|
+
/**
|
|
63
|
+
* The value in the insulin field when the logbook entry was saved.
|
|
64
|
+
* By default the value in the insulin field is the suggested amount of insulin that has been rounded based on the user's injection method,
|
|
65
|
+
* so most often that is the value that will be saved in this field.
|
|
66
|
+
* If the user has changed the value of the field, then that is of course the value that will be saved here.
|
|
67
|
+
*/
|
|
23
68
|
insulin_entered_units: number | null;
|
|
69
|
+
/**
|
|
70
|
+
* The amount of extra carbohydrates that was recommended to the user if they made a calculation.
|
|
71
|
+
* If they were recommended to take insulin instead this should be 0.
|
|
72
|
+
* Should be <null> if they did not get a recommendation at all (e.g. because they made a manual entry instead
|
|
73
|
+
*/
|
|
24
74
|
carbohydrates_suggested_grams: number | null;
|
|
75
|
+
/**
|
|
76
|
+
* The total amount (sum) of carbohydrates that the user ingested for this logbook entry including from the food database,
|
|
77
|
+
* manual entry of carbohydrates, and additional carbohdyrates that they are eating.
|
|
78
|
+
*/
|
|
25
79
|
carbohydrates_entered_grams: number | null;
|
|
80
|
+
/**
|
|
81
|
+
* The amount of carbohydrates that was entered in the “additional carbohydrates” field on the recommendation screen if the user got a carbohydrate recommendation.
|
|
82
|
+
* The field defaults to the carbohydrates_suggested_grams, so those should be identical unless the user modified the value.
|
|
83
|
+
*/
|
|
26
84
|
carbohydrates_modified_suggested_grams: number | null;
|
|
85
|
+
/**
|
|
86
|
+
* The user's blood glucose level in mmol/L (millimolar) for the logbook entry.
|
|
87
|
+
* Should be <null> if the user didn't actually enter their BGL for the logbook entry.
|
|
88
|
+
*/
|
|
27
89
|
blood_glucose_millimolar: number | null;
|
|
90
|
+
/**
|
|
91
|
+
* The user's blood ketones level in mmol/L (millimolar) for the logbook entry.
|
|
92
|
+
* Should be <null> if the user didn't actually enter their BGL for the logbook entry.
|
|
93
|
+
*/
|
|
28
94
|
blood_ketones_millimolar: number | null;
|
|
95
|
+
/**
|
|
96
|
+
* The mood the the user selected with the logbook entry from 1 (sad) to 5 (happy).
|
|
97
|
+
* Should be <null> if the user didn't select a mood.
|
|
98
|
+
*/
|
|
29
99
|
mood: Enums.MoodEnum | null;
|
|
100
|
+
/**
|
|
101
|
+
* The uuid of the event (physical activity) that was associated with the logbook entry.
|
|
102
|
+
* Should be <null> if no event is associated with the logbook entry.
|
|
103
|
+
*/
|
|
30
104
|
event_uuid: string | null;
|
|
105
|
+
/**
|
|
106
|
+
* We never actually delete logbook entries, but this field indicates if a logbook entry shoulb be considered removed by the user.
|
|
107
|
+
* The value is <null> by default.
|
|
108
|
+
* If an entry is removed then this field is updated with the timestamp when it was removed.
|
|
109
|
+
*/
|
|
31
110
|
is_deleted: Date | null;
|
|
111
|
+
/**
|
|
112
|
+
* Indicates the timezone of the client device at the time when the logbook entry was created as an offset from UTC.
|
|
113
|
+
* Example values: "+01:00", "-05:00", "+05:30", "+08:00".
|
|
114
|
+
* Can be used in combination with entry_timestamp and client_timestamp (which are both in UTC)
|
|
115
|
+
* to determine what time those timestamps represented in the users local time.
|
|
116
|
+
*/
|
|
32
117
|
utc_timezone_offset: string | null;
|
|
33
118
|
smart_pen_sync_timestamp?: string;
|
|
34
119
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logbook.js","sourceRoot":"","sources":["../../../types/logbook/logbook.ts"],"names":[],"mappings":";;;AAAA,IAAiB,OAAO,
|
|
1
|
+
{"version":3,"file":"logbook.js","sourceRoot":"","sources":["../../../types/logbook/logbook.ts"],"names":[],"mappings":";;;AAAA,IAAiB,OAAO,CA2IvB;AA3ID,WAAiB,OAAO;IACvB,IAAiB,KAAK,CASrB;IATD,WAAiB,KAAK;QACrB,uEAAuE;QACvE,IAAY,QAMX;QAND,WAAY,QAAQ;YACnB,qCAAO,CAAA;YACP,6CAAW,CAAA;YACX,6CAAW,CAAA;YACX,iDAAa,CAAA;YACb,yCAAS,CAAA;QACV,CAAC,EANW,QAAQ,GAAR,cAAQ,KAAR,cAAQ,QAMnB;IACF,CAAC,EATgB,KAAK,GAAL,aAAK,KAAL,aAAK,QASrB;AAiIF,CAAC,EA3IgB,OAAO,GAAP,eAAO,KAAP,eAAO,QA2IvB"}
|
|
@@ -89,6 +89,10 @@ export declare namespace UserSettings {
|
|
|
89
89
|
Male = "Male",
|
|
90
90
|
Female = "Female"
|
|
91
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* String enum for differentiating between different methods by which someone can inject insulin into the body.
|
|
94
|
+
* Mainly used to determine how insulin amounts should be rounded.
|
|
95
|
+
*/
|
|
92
96
|
enum InjectionMethod {
|
|
93
97
|
PenHalf = "Pen-half",
|
|
94
98
|
PenWhole = "Pen-whole",
|
|
@@ -39,6 +39,10 @@ var UserSettings;
|
|
|
39
39
|
Gender["Male"] = "Male";
|
|
40
40
|
Gender["Female"] = "Female";
|
|
41
41
|
})(Gender = Enums.Gender || (Enums.Gender = {}));
|
|
42
|
+
/**
|
|
43
|
+
* String enum for differentiating between different methods by which someone can inject insulin into the body.
|
|
44
|
+
* Mainly used to determine how insulin amounts should be rounded.
|
|
45
|
+
*/
|
|
42
46
|
let InjectionMethod;
|
|
43
47
|
(function (InjectionMethod) {
|
|
44
48
|
InjectionMethod["PenHalf"] = "Pen-half";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usersettings.js","sourceRoot":"","sources":["../../../types/usersettings/usersettings.ts"],"names":[],"mappings":";;;AAGA,IAAiB,YAAY,
|
|
1
|
+
{"version":3,"file":"usersettings.js","sourceRoot":"","sources":["../../../types/usersettings/usersettings.ts"],"names":[],"mappings":";;;AAGA,IAAiB,YAAY,CA+G5B;AA/GD,WAAiB,YAAY;IAmE5B,IAAiB,KAAK,CA2CrB;IA3CD,WAAiB,KAAK;QACrB,IAAY,KAGX;QAHD,WAAY,KAAK;YAChB,4BAAmB,CAAA;YACnB,gCAAuB,CAAA;QACxB,CAAC,EAHW,KAAK,GAAL,WAAK,KAAL,WAAK,QAGhB;QAED,IAAY,iBAOX;QAPD,WAAY,iBAAiB;YAC5B,4CAAuB,CAAA;YACvB,oCAAe,CAAA;YACf,wCAAmB,CAAA;YACnB,sCAAiB,CAAA;YACjB,oCAAe,CAAA;YACf,kCAAa,CAAA;QACd,CAAC,EAPW,iBAAiB,GAAjB,uBAAiB,KAAjB,uBAAiB,QAO5B;QACD,IAAY,iBAQX;QARD,WAAY,iBAAiB;YAC5B,sCAAiB,CAAA;YACjB,0CAAqB,CAAA;YACrB,sCAAiB,CAAA;YACjB,wCAAmB,CAAA;YACnB,wCAAmB,CAAA;YACnB,oCAAe,CAAA;YACf,kCAAa,CAAA;QACd,CAAC,EARW,iBAAiB,GAAjB,uBAAiB,KAAjB,uBAAiB,QAQ5B;QAED,IAAY,YAGX;QAHD,WAAY,YAAY;YACvB,iDAAS,CAAA;YACT,iDAAS,CAAA;QACV,CAAC,EAHW,YAAY,GAAZ,kBAAY,KAAZ,kBAAY,QAGvB;QAED,IAAY,MAGX;QAHD,WAAY,MAAM;YACjB,uBAAa,CAAA;YACb,2BAAiB,CAAA;QAClB,CAAC,EAHW,MAAM,GAAN,YAAM,KAAN,YAAM,QAGjB;QAED;;;WAGG;QACH,IAAY,eAIX;QAJD,WAAY,eAAe;YAC1B,uCAAoB,CAAA;YACpB,yCAAsB,CAAA;YACtB,gCAAa,CAAA;QACd,CAAC,EAJW,eAAe,GAAf,qBAAe,KAAf,qBAAe,QAI1B;IACF,CAAC,EA3CgB,KAAK,GAAL,kBAAK,KAAL,kBAAK,QA2CrB;AACF,CAAC,EA/GgB,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QA+G5B"}
|
package/package.json
CHANGED
|
@@ -12,8 +12,15 @@ export namespace Activity {
|
|
|
12
12
|
overwrittenByUUID?: IActivityEntry["uuid"];
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
/** Type that represents the user’s settings related to physical activity. */
|
|
15
16
|
export type ActivitySettings = ActivityReductionSettings & ActivityTarget;
|
|
17
|
+
/** Represents a set of insulin reduction fraction settings that can vary by the duration of the activity. */
|
|
16
18
|
export type ActivityReductionIntervals = ActivityReductionSettings[keyof ActivityReductionSettings];
|
|
19
|
+
/**
|
|
20
|
+
* Represents whether the reduction fraction is a number or it is null.
|
|
21
|
+
* Only for the settings of hard physical activities over 45 minutes the value is null.
|
|
22
|
+
* A null value represents that it is not supported by HDA.
|
|
23
|
+
*/
|
|
17
24
|
export type ReductionType = ActivityReductionIntervals[keyof ActivityReductionIntervals];
|
|
18
25
|
|
|
19
26
|
type ActivityIntensityKeys = keyof typeof Enums.ActivityIntensity;
|
|
@@ -34,25 +41,28 @@ export namespace Activity {
|
|
|
34
41
|
type ActivityReductionSettingsIntervals<
|
|
35
42
|
K extends ActivityIntensityKeys,
|
|
36
43
|
T extends ActivityIntensityKeys,
|
|
37
|
-
U extends ActivityReductionKeys
|
|
44
|
+
U extends ActivityReductionKeys,
|
|
38
45
|
> = {
|
|
39
46
|
[key in ActivityReductionKeys]: K extends T ? (key extends U ? null | number : number) : number;
|
|
40
47
|
};
|
|
41
48
|
}
|
|
42
49
|
|
|
43
50
|
export namespace Enums {
|
|
51
|
+
/** Enum that represents a set of insulin reduction fraction settings that can vary by the duration of the activity */
|
|
44
52
|
export enum ActivityReductionIntervals {
|
|
45
53
|
fromZero = `fromZero`,
|
|
46
54
|
fromThirty = `fromThirty`,
|
|
47
55
|
fromFortysix = `fromFortysix`,
|
|
48
56
|
}
|
|
49
57
|
|
|
58
|
+
/** Enum used to indicate the category or intensity of a physical activity. */
|
|
50
59
|
export enum ActivityIntensity {
|
|
51
60
|
light = `light`,
|
|
52
61
|
moderate = `moderate`,
|
|
53
62
|
hard = `hard`,
|
|
54
63
|
}
|
|
55
64
|
|
|
65
|
+
/** Enum used to indicate the type of physical activity performed by the user. */
|
|
56
66
|
export enum ActivityEnum {
|
|
57
67
|
Run = `Run`,
|
|
58
68
|
Walk = `Walk`,
|
|
@@ -2,13 +2,18 @@ import { Activity } from "../activity/activity";
|
|
|
2
2
|
|
|
3
3
|
export namespace BolusCalculator {
|
|
4
4
|
export namespace Constants {
|
|
5
|
+
/** The maximum amount of insulin that may be recommended to the user. */
|
|
5
6
|
export const SAFETY_INSULIN_LIMIT = 50;
|
|
7
|
+
/** The maximum duration in minutes of a physical activity. */
|
|
6
8
|
export const SAFETY_ACTIVITY_LIMIT = 60;
|
|
9
|
+
/** The maximum reduction factor for a physical activity */
|
|
7
10
|
export const REDUCTION_MAX = 1;
|
|
11
|
+
/** The minimum reduction factor for a physical activity */
|
|
8
12
|
export const REDUCTION_MIN = 0;
|
|
9
13
|
}
|
|
10
14
|
|
|
11
15
|
export namespace Enums {
|
|
16
|
+
/** Enum for differentiating between types of errors. */
|
|
12
17
|
export enum ActivityErrors {
|
|
13
18
|
OutOfRange = `Out of range`,
|
|
14
19
|
InvalidInterval = `Invalid activity settings interval`,
|
|
@@ -17,32 +22,64 @@ export namespace BolusCalculator {
|
|
|
17
22
|
}
|
|
18
23
|
|
|
19
24
|
export namespace Types {
|
|
25
|
+
/** Represents a single bolus of fast-acting insulin that has been administered within the past 4 hours. */
|
|
20
26
|
export interface IRecentBolus {
|
|
27
|
+
/** The number of seconds that has passed since the bolus in question was administered. */
|
|
21
28
|
secondsPassed: number;
|
|
29
|
+
/** The amount of insulin that was administered with the bolus in question. */
|
|
22
30
|
insulinDose: number;
|
|
23
31
|
}
|
|
32
|
+
|
|
33
|
+
/** Details about a physical activity. */
|
|
24
34
|
export interface IActivityParams {
|
|
35
|
+
/** The duration of the physical activity in minutes. */
|
|
25
36
|
activityDuration: number;
|
|
37
|
+
/** The intensity of the activity */
|
|
26
38
|
activityIntensity: Activity.Enums.ActivityIntensity;
|
|
39
|
+
/** The user’s current settings for physical activity */
|
|
27
40
|
activitySettings: Activity.Types.ActivitySettings;
|
|
41
|
+
/** Start date and time for the activity */
|
|
28
42
|
activityDate: Date;
|
|
29
43
|
}
|
|
30
44
|
|
|
45
|
+
/** IRecommendationParams contains data that is used to calculate a recommendation. */
|
|
31
46
|
export interface IRecommendationParams {
|
|
47
|
+
/** The user’s current blood glucose level in mmol/L */
|
|
32
48
|
currentBGL: number | null;
|
|
49
|
+
/** The blood glucose level in mmol/L that the user should ideally have at this time of day according to their settings/preferences. */
|
|
33
50
|
targetBGL: number;
|
|
51
|
+
/** The user’s current insulin sensitivity in (mmol/L)/IU according to their settings/preferences. */
|
|
34
52
|
insulinSensitivity: number;
|
|
53
|
+
/** The amount of carbohydrates in grams that the user has entered that they are going to eat. */
|
|
35
54
|
carbohydrates: number;
|
|
55
|
+
/** The user’s current insulin-to-carbs ratio in g/IU according to their settings/preferences. */
|
|
36
56
|
carbohydrateRatio: number;
|
|
57
|
+
/** A possibly empty array of IRecentBolus objects. */
|
|
37
58
|
recentBoluses: Array<IRecentBolus>;
|
|
59
|
+
/** Information about the activity that the user is doing including their activity settings */
|
|
38
60
|
activity: IActivityParams | null;
|
|
39
61
|
}
|
|
40
62
|
|
|
63
|
+
/**
|
|
64
|
+
* The result of a recommendation calculation is returned by the calculateRecommendation() function as an object that implements this interface.
|
|
65
|
+
* Note that only one of bolus and carbRecommendation may be positive. If one is non-zero then the other must be zero.
|
|
66
|
+
*/
|
|
41
67
|
export interface IRecommendationResult {
|
|
68
|
+
/** The recommended amount of insulin measured in units. */
|
|
42
69
|
bolus: number;
|
|
70
|
+
/**
|
|
71
|
+
* Indicates whether or not the insulin recommendation (given in the bolus property) was capped because the underlying recommendation exceeded the safety limit.
|
|
72
|
+
* If it is true then we know that the recommendation would have been higher and can show and appropriate message to the user.
|
|
73
|
+
*/
|
|
43
74
|
wasLimited: boolean;
|
|
75
|
+
/** The number of carbs that the user is recommended to eat */
|
|
44
76
|
carbRecommendation: number;
|
|
77
|
+
/**
|
|
78
|
+
* Indicates how much the insulin recommendation was reduced due to physical activity.
|
|
79
|
+
* A value of 0.75 would indicate that the recommended insulin was reduced by 25%.
|
|
80
|
+
*/
|
|
45
81
|
activityReduction: number | null;
|
|
82
|
+
/** The estimated amount of active insulin (IOB) in IU. */
|
|
46
83
|
activeInsulin: number;
|
|
47
84
|
}
|
|
48
85
|
}
|
package/types/enums.ts
CHANGED
|
@@ -3,20 +3,24 @@ enum Units {
|
|
|
3
3
|
MG_DL = "mg/dl",
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
+
/** Represents a unit for measuring blood glucose levels. */
|
|
6
7
|
export enum BloodGlucoseUnit {
|
|
7
8
|
MMOL_L = Units.MMOL_L,
|
|
8
9
|
MG_DL = Units.MG_DL,
|
|
9
10
|
}
|
|
10
11
|
|
|
12
|
+
/** Represents a unit for measuring blood ketone levels. */
|
|
11
13
|
export enum BloodKetonesUnit {
|
|
12
14
|
MMOL_L = Units.MMOL_L,
|
|
13
15
|
MG_DL = Units.MG_DL,
|
|
14
16
|
}
|
|
15
17
|
|
|
18
|
+
/** Represents a unit for measuring insulin intake */
|
|
16
19
|
export enum InsulinUnit {
|
|
17
20
|
IU = `IU`,
|
|
18
21
|
}
|
|
19
22
|
|
|
23
|
+
/** Represents a language that the app can be displayed in. */
|
|
20
24
|
export enum Languages {
|
|
21
25
|
da = `Dansk`,
|
|
22
26
|
en = `English`,
|
|
@@ -26,6 +30,7 @@ export enum Languages {
|
|
|
26
30
|
it = `Italiano`,
|
|
27
31
|
}
|
|
28
32
|
|
|
33
|
+
/** Enum containing constants for seconds, minutes, hours, or days in milliseconds */
|
|
29
34
|
export enum Milliseconds {
|
|
30
35
|
Second = 1000,
|
|
31
36
|
Minute = 60000,
|
|
@@ -33,6 +38,7 @@ export enum Milliseconds {
|
|
|
33
38
|
Day = 86400000,
|
|
34
39
|
}
|
|
35
40
|
|
|
41
|
+
/** Enum containing the possible ketone levels of the user */
|
|
36
42
|
export enum KetoneLevels {
|
|
37
43
|
Negative,
|
|
38
44
|
Normal,
|
|
@@ -41,6 +47,11 @@ export enum KetoneLevels {
|
|
|
41
47
|
High,
|
|
42
48
|
}
|
|
43
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Enum containing constants for displaying colour indicators regarding the blood ketone levels of the user.
|
|
52
|
+
* Blood ketones ranges and the color scheme can be found at:
|
|
53
|
+
* https://hedia.atlassian.net/wiki/spaces/QMS/pages/827785277/QF-73-3-1+Ketones+and+current+functions+in+HDA#4.0-Ketone-procedure-in-HDA
|
|
54
|
+
*/
|
|
44
55
|
export enum KetoneColours {
|
|
45
56
|
None = `rgb(15,18,49)`,
|
|
46
57
|
Negative = `rgb(222,194,145)`,
|
package/types/logbook/logbook.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export namespace Logbook {
|
|
2
2
|
export namespace Enums {
|
|
3
|
+
/** Used to differentiate the different moods that users can select. */
|
|
3
4
|
export enum MoodEnum {
|
|
4
5
|
Sad = 1,
|
|
5
6
|
SemiSad = 2,
|
|
@@ -11,25 +12,109 @@ export namespace Logbook {
|
|
|
11
12
|
|
|
12
13
|
export namespace Types {
|
|
13
14
|
export interface ILogbookEntry {
|
|
15
|
+
/** Unique id for each logbook*/
|
|
14
16
|
uuid: string;
|
|
17
|
+
/**
|
|
18
|
+
* The timestamp at which this logbook entry should be displayed in to the user.
|
|
19
|
+
* This may differ from client_timestamp if the user created the logbook entry manually after the fact
|
|
20
|
+
* or they edited the entry timestamp of the logbook entry after it was first created.
|
|
21
|
+
*/
|
|
15
22
|
entry_timestamp: string; // The date where the entry appears when the user look at their logbook in the app
|
|
23
|
+
/**
|
|
24
|
+
* The timestamp at which this logbook entry was saved in the server's database.
|
|
25
|
+
* This can be expected to be the time of the first syncrhonization after the logbook entry was created on the client.
|
|
26
|
+
*/
|
|
16
27
|
server_timestamp: Date | null;
|
|
17
|
-
|
|
28
|
+
/**
|
|
29
|
+
* The timestamp at which the logbook entry was created on the client.
|
|
30
|
+
* This may differ from entry_timestamp if the user created the logbook entry manually after the fact
|
|
31
|
+
* or they edited the entry timestamp of the logbook entry after it was first created.
|
|
32
|
+
*/
|
|
33
|
+
client_timestamp: string;
|
|
34
|
+
/**
|
|
35
|
+
* When the user makes changes to an existing logbook entry, the changes will be saved as a completely new logbook entry.
|
|
36
|
+
* For the old entry, this field will then be updated with the uuid of the new version of the logbook entry.
|
|
37
|
+
* The value is null by default (that is if the entry hasn't been replaced with a newer version).
|
|
38
|
+
* Logbook entries that don't contain null in this field are considered outdated and should gerenerally be excluded when computing statistics and the like.
|
|
39
|
+
*/
|
|
18
40
|
overwritten_by_id: string | null;
|
|
41
|
+
/**
|
|
42
|
+
* The uuid of the settings object that was used on the client when the logbook entry was created.
|
|
43
|
+
* Note that if the user updates their settings later this field will not be updated.
|
|
44
|
+
* This allows us to exactly which settings were used to make an old insulin calculation
|
|
45
|
+
*/
|
|
19
46
|
settings_uuid: string;
|
|
47
|
+
/** The version of the app that was used to create the logbook entry. e.g. "2.7.3" */
|
|
20
48
|
client_version: string;
|
|
49
|
+
/** For keeping track of which version of the server that was used when the logbook entry was synchronized and saved to the database. */
|
|
21
50
|
server_version: number | null;
|
|
51
|
+
/**
|
|
52
|
+
* For keeping track of which os and os version the app was running on when the logbook entry was created.
|
|
53
|
+
* For android this is the API level, e.g. "android 28" or "android 24".
|
|
54
|
+
* For iOS this is the version of the os, e.g. "ios 13.3.1" or "ios 13.5.1"
|
|
55
|
+
*/
|
|
22
56
|
device_and_os: string;
|
|
57
|
+
/**
|
|
58
|
+
* The exact result of the insulin recommendation calculation without rounding.
|
|
59
|
+
* Should be 0 if the user made a calculation and didn't get a recommendation
|
|
60
|
+
* (because it was recommended that they should eat additional carbohydrates instead).
|
|
61
|
+
*/
|
|
23
62
|
insulin_suggested_units: number | null;
|
|
63
|
+
/**
|
|
64
|
+
* The value in the insulin field when the logbook entry was saved.
|
|
65
|
+
* By default the value in the insulin field is the suggested amount of insulin that has been rounded based on the user's injection method,
|
|
66
|
+
* so most often that is the value that will be saved in this field.
|
|
67
|
+
* If the user has changed the value of the field, then that is of course the value that will be saved here.
|
|
68
|
+
*/
|
|
24
69
|
insulin_entered_units: number | null;
|
|
70
|
+
/**
|
|
71
|
+
* The amount of extra carbohydrates that was recommended to the user if they made a calculation.
|
|
72
|
+
* If they were recommended to take insulin instead this should be 0.
|
|
73
|
+
* Should be <null> if they did not get a recommendation at all (e.g. because they made a manual entry instead
|
|
74
|
+
*/
|
|
25
75
|
carbohydrates_suggested_grams: number | null;
|
|
76
|
+
/**
|
|
77
|
+
* The total amount (sum) of carbohydrates that the user ingested for this logbook entry including from the food database,
|
|
78
|
+
* manual entry of carbohydrates, and additional carbohdyrates that they are eating.
|
|
79
|
+
*/
|
|
26
80
|
carbohydrates_entered_grams: number | null;
|
|
81
|
+
/**
|
|
82
|
+
* The amount of carbohydrates that was entered in the “additional carbohydrates” field on the recommendation screen if the user got a carbohydrate recommendation.
|
|
83
|
+
* The field defaults to the carbohydrates_suggested_grams, so those should be identical unless the user modified the value.
|
|
84
|
+
*/
|
|
27
85
|
carbohydrates_modified_suggested_grams: number | null;
|
|
86
|
+
/**
|
|
87
|
+
* The user's blood glucose level in mmol/L (millimolar) for the logbook entry.
|
|
88
|
+
* Should be <null> if the user didn't actually enter their BGL for the logbook entry.
|
|
89
|
+
*/
|
|
28
90
|
blood_glucose_millimolar: number | null;
|
|
91
|
+
/**
|
|
92
|
+
* The user's blood ketones level in mmol/L (millimolar) for the logbook entry.
|
|
93
|
+
* Should be <null> if the user didn't actually enter their BGL for the logbook entry.
|
|
94
|
+
*/
|
|
29
95
|
blood_ketones_millimolar: number | null;
|
|
96
|
+
/**
|
|
97
|
+
* The mood the the user selected with the logbook entry from 1 (sad) to 5 (happy).
|
|
98
|
+
* Should be <null> if the user didn't select a mood.
|
|
99
|
+
*/
|
|
30
100
|
mood: Enums.MoodEnum | null;
|
|
101
|
+
/**
|
|
102
|
+
* The uuid of the event (physical activity) that was associated with the logbook entry.
|
|
103
|
+
* Should be <null> if no event is associated with the logbook entry.
|
|
104
|
+
*/
|
|
31
105
|
event_uuid: string | null;
|
|
106
|
+
/**
|
|
107
|
+
* We never actually delete logbook entries, but this field indicates if a logbook entry shoulb be considered removed by the user.
|
|
108
|
+
* The value is <null> by default.
|
|
109
|
+
* If an entry is removed then this field is updated with the timestamp when it was removed.
|
|
110
|
+
*/
|
|
32
111
|
is_deleted: Date | null;
|
|
112
|
+
/**
|
|
113
|
+
* Indicates the timezone of the client device at the time when the logbook entry was created as an offset from UTC.
|
|
114
|
+
* Example values: "+01:00", "-05:00", "+05:30", "+08:00".
|
|
115
|
+
* Can be used in combination with entry_timestamp and client_timestamp (which are both in UTC)
|
|
116
|
+
* to determine what time those timestamps represented in the users local time.
|
|
117
|
+
*/
|
|
33
118
|
utc_timezone_offset: string | null;
|
|
34
119
|
smart_pen_sync_timestamp?: string;
|
|
35
120
|
}
|
|
@@ -102,6 +102,10 @@ export namespace UserSettings {
|
|
|
102
102
|
Female = `Female`,
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
/**
|
|
106
|
+
* String enum for differentiating between different methods by which someone can inject insulin into the body.
|
|
107
|
+
* Mainly used to determine how insulin amounts should be rounded.
|
|
108
|
+
*/
|
|
105
109
|
export enum InjectionMethod {
|
|
106
110
|
PenHalf = `Pen-half`,
|
|
107
111
|
PenWhole = `Pen-whole`,
|