Skip to content

Commit

Permalink
alcol
Browse files Browse the repository at this point in the history
  • Loading branch information
nickxbs committed Aug 22, 2024
1 parent afbd691 commit 4dd27ee
Show file tree
Hide file tree
Showing 15 changed files with 67 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cSpell.words": [
"alcool",
"Basals",
"Biexp",
"Exp",
"carb",
"carbrate",
"cgmsim",
Expand Down
2 changes: 1 addition & 1 deletion src/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export type NSTreatmentParsed = {
/**
* Represents a treatment delta with additional minutes ago information.
*/
export type TreatmentBiexpParam = {
export type TreatmentExpParam = {
units: number;
minutesAgo: number;
duration: number;
Expand Down
16 changes: 8 additions & 8 deletions src/alcohol.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TreatmentBiexpParam, NSTreatmentParsed, GenderType } from './Types';
import { getTreatmentBiexpParam } from './drug';
import logger, { getBiexpTreatmentActivity, roundTo8Decimals } from './utils';
import { TreatmentExpParam, NSTreatmentParsed, GenderType } from './Types';
import { getTreatmentExpParam } from './drug';
import logger, { getExpTreatmentActivity, roundTo8Decimals } from './utils';

function getAlcoholActivity(
gender: 'Male' | 'Female',
Expand All @@ -18,19 +18,19 @@ function getAlcoholActivity(
const unitsWeighted = units * (80 / weightKg);
if (washoutDuration < minutesAgo) {
return (
getBiexpTreatmentActivity({
getExpTreatmentActivity({
peak,
duration,
minutesAgo: minutesAgo - washoutDuration,
units: unitsWeighted,
}) / 0.35
}) * 3
);
}
return 0;
}

const computeAlcoholActivity = (
treatments: TreatmentBiexpParam[],
treatments: TreatmentExpParam[],
weight: number,
gender: GenderType,
) => {
Expand Down Expand Up @@ -60,13 +60,13 @@ export default function (
gender: GenderType,
): number {
//Find Alcohol in treatments
const lastALC = getTreatmentBiexpParam(treatments, weight, 'ALC');
const lastALC = getTreatmentExpParam(treatments, weight, 'ALC');
const activityALC =
lastALC.length > 0 ? computeAlcoholActivity(lastALC, weight, gender) : 0;
logger.debug('these are the last ALC: %o', { lastALC, activityALC });

//Find Beer in treatments
const lastBEER = getTreatmentBiexpParam(treatments, weight, 'BEER');
const lastBEER = getTreatmentExpParam(treatments, weight, 'BEER');
const activityBEER =
lastBEER.length > 0 ? computeAlcoholActivity(lastBEER, weight, gender) : 0;
logger.debug('these are the last BEER: %o', { lastBEER, activityBEER });
Expand Down
20 changes: 10 additions & 10 deletions src/basal.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
import { TreatmentBiexpParam, NSTreatmentParsed } from './Types';
import { getTreatmentBiexpParam } from './drug';
import logger, { getBiexpTreatmentActivity, roundTo8Decimals } from './utils';
import { TreatmentExpParam, NSTreatmentParsed } from './Types';
import { getTreatmentExpParam } from './drug';
import logger, { getExpTreatmentActivity, roundTo8Decimals } from './utils';

const computeBasalActivity = (treatments: TreatmentBiexpParam[]) => {
const computeBasalActivity = (treatments: TreatmentExpParam[]) => {
// expressed U/min !!!
return treatments
.map(getBiexpTreatmentActivity)
.map(getExpTreatmentActivity)
.reduce((tot, activity) => tot + activity, 0);
};

export default function (
treatments: NSTreatmentParsed[],
weight: number,
): number {
const lastGLA = getTreatmentBiexpParam(treatments, weight, 'GLA');
const lastGLA = getTreatmentExpParam(treatments, weight, 'GLA');
const activityGLA = lastGLA.length ? computeBasalActivity(lastGLA) : 0;
logger.debug('these are the last GLA: %o', { lastGLA, activityGLA });

const lastDET = getTreatmentBiexpParam(treatments, weight, 'DET');
const lastDET = getTreatmentExpParam(treatments, weight, 'DET');
const activityDET = lastDET.length ? computeBasalActivity(lastDET) : 0;
logger.debug('these are the last DET: %o', { lastDET, activityDET });

const lastTOU = getTreatmentBiexpParam(treatments, weight, 'TOU');
const lastTOU = getTreatmentExpParam(treatments, weight, 'TOU');
const activityTOU = lastTOU.length ? computeBasalActivity(lastTOU) : 0;
logger.debug('these are the last TOU: %o', { lastTOU, activityTOU });

const lastDEG = getTreatmentBiexpParam(treatments, weight, 'DEG');
const lastDEG = getTreatmentExpParam(treatments, weight, 'DEG');
const activityDEG = lastDEG.length ? computeBasalActivity(lastDEG) : 0;
logger.debug('these are the last DEG: %o', { lastDEG, activityDEG });

const lastNPH = getTreatmentBiexpParam(treatments, weight, 'NPH');
const lastNPH = getTreatmentExpParam(treatments, weight, 'NPH');
const activityNPH = lastNPH.length ? computeBasalActivity(lastNPH) : 0;

Check warning on line 33 in src/basal.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
logger.debug('these are the last NPH: %o', { lastNPH, activityNPH });

Expand Down
4 changes: 2 additions & 2 deletions src/bolus.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logger, {
getDeltaMinutes,
getBiexpTreatmentActivity,
getExpTreatmentActivity,
roundTo8Decimals,
} from './utils';
import { NSTreatment, isMealBolusTreatment } from './Types';
Expand All @@ -27,7 +27,7 @@ export default (

const insulinsBolusAct = insulin?.map((entry) => {

Check warning on line 28 in src/bolus.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
const units = entry.insulin;
return getBiexpTreatmentActivity({
return getExpTreatmentActivity({
peak,
duration,
minutesAgo: entry.minutesAgo,
Expand Down
12 changes: 6 additions & 6 deletions src/cortisone.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { TreatmentBiexpParam, NSTreatment, NSTreatmentParsed } from './Types';
import { getTreatmentBiexpParam } from './drug';
import logger, { getBiexpTreatmentActivity, roundTo8Decimals } from './utils';
import { TreatmentExpParam, NSTreatment, NSTreatmentParsed } from './Types';
import { getTreatmentExpParam } from './drug';
import logger, { getExpTreatmentActivity, roundTo8Decimals } from './utils';

const computeCortisoneActivity = (treatments: TreatmentBiexpParam[]) => {
const computeCortisoneActivity = (treatments: TreatmentExpParam[]) => {
// expressed U/min !!!
return treatments
.map(getBiexpTreatmentActivity)
.map(getExpTreatmentActivity)
.reduce((tot, activity) => tot + activity, 0);
};

Expand All @@ -14,7 +14,7 @@ export default function (
weight: number,
): number {
//Find Cortisone boluses
const lastCOR = getTreatmentBiexpParam(treatments, weight, 'COR');
const lastCOR = getTreatmentExpParam(treatments, weight, 'COR');
const activityCOR =
lastCOR.length > 0 ? computeCortisoneActivity(lastCOR) : 0;
logger.debug('these are the last COR: %o', { lastCOR, activityCOR });
Expand Down
6 changes: 3 additions & 3 deletions src/drug.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
NSTreatment,
NSTreatmentParsed,
TreatmentBiexpParam,
TreatmentExpParam,
isAnnouncementTreatment,
} from './Types';
import logger, { getDeltaMinutes } from './utils';
Expand Down Expand Up @@ -74,11 +74,11 @@ export const drugs = {
},
};

export const getTreatmentBiexpParam = (
export const getTreatmentExpParam = (
treatments: NSTreatmentParsed[],
weight: number,
drug: keyof typeof drugs,
): TreatmentBiexpParam[] => {
): TreatmentExpParam[] => {
const currentDrug = drugs[drug];
return treatments
.filter((e) => currentDrug.names.some((n) => n === e.drug))
Expand Down
4 changes: 2 additions & 2 deletions src/pump.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import logger, { getDeltaMinutes, getBiexpTreatmentActivity } from './utils';
import logger, { getDeltaMinutes, getExpTreatmentActivity } from './utils';
import * as moment from 'moment';
import { NSProfile, NSTreatment } from './Types';
import { TypeDateISO } from './TypeDateISO';
Expand Down Expand Up @@ -202,7 +202,7 @@ export default function (
const pumpBasalAct = basalAsBoluses.reduce(
(tot, entry) =>
tot +
getBiexpTreatmentActivity({
getExpTreatmentActivity({
peak,
duration,
minutesAgo: entry.minutesAgo,
Expand Down
6 changes: 3 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
Entry,
Note,
SimulationResult,
TreatmentBiexpParam,
TreatmentExpParam,
} from './Types';
import { load } from 'ts-dotenv';
import pinoPretty from 'pino-pretty';
Expand Down Expand Up @@ -58,12 +58,12 @@ export function removeTrailingSlash(str) {
return str.endsWith('/') ? str.slice(0, -1) : str;
}

export function getBiexpTreatmentActivity({
export function getExpTreatmentActivity({
peak,
duration,
minutesAgo,
units,
}: TreatmentBiexpParam) {
}: TreatmentExpParam) {
const tau = (peak * (1 - peak / duration)) / (1 - (2 * peak) / duration);
const a = (2 * tau) / duration;
const S = 1 / (1 - a + (1 + a) * Math.exp(-duration / tau));
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions test/cortisone.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { treatments } from './inputTest';
import computeCortisone from '../src/cortisone';
import { NSTreatment, TreatmentBiexpParam } from '../src/Types';
import { NSTreatment, TreatmentExpParam } from '../src/Types';
import moment = require('moment');
import { diffOptions, getPngSnapshot } from './inputTest';
import { drugs, transformNoteTreatmentsDrug } from '../src/drug';
import cortisone from '../src/cortisone';
import { getBiexpTreatmentActivity } from '../src/utils';
import { getExpTreatmentActivity } from '../src/utils';
const { toMatchImageSnapshot } = require('jest-image-snapshot');

describe('test cortisone', () => {
Expand Down
4 changes: 2 additions & 2 deletions test/detemir.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ describe('test detemir', () => {
});

// type MockTreatment = {
// units: TreatmentBiexpParam['units'];
// minutesAgo: TreatmentBiexpParam['minutesAgo'];
// units: TreatmentExpParam['units'];
// minutesAgo: TreatmentExpParam['minutesAgo'];
// };

// const detemir = (weight: number, treatments: MockTreatment[]): number => {
Expand Down
8 changes: 4 additions & 4 deletions test/inputTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import {
PatientInfoCgmsim,
NSTreatment,
Sgv,
TreatmentBiexpParam,
TreatmentExpParam,
} from '../src/Types';
import simulator from '../src/CGMSIMsimulator';
import { getBiexpTreatmentActivity } from '../src/utils';
import { getExpTreatmentActivity } from '../src/utils';
import { TypeDateISO } from '../src/TypeDateISO';
const { output, line } = require('../test/d3/d3Func');

Expand Down Expand Up @@ -381,10 +381,10 @@ export const testGenerator = (
};

export const computeBasalActivityForTest = (
treatments: TreatmentBiexpParam[],
treatments: TreatmentExpParam[],
) => {
// expressed U/min !!!
return treatments
.map(getBiexpTreatmentActivity)
.map(getExpTreatmentActivity)
.reduce((tot, activity) => tot + activity, 0);
};
37 changes: 23 additions & 14 deletions test/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { isHttps, removeTrailingSlash } from '../src/utils';
import * as utils from '../src/utils';
import fetch from 'node-fetch';
import { loadBase, uploadBase, roundTo8Decimals, getBiexpTreatmentActivity, getDeltaMinutes } from '../src/utils';
import {
loadBase,
uploadBase,
roundTo8Decimals,
getExpTreatmentActivity,
getDeltaMinutes,
} from '../src/utils';
import { Entry } from 'src/Types';

jest.mock('node-fetch');
Expand Down Expand Up @@ -141,11 +147,11 @@ describe('uploadBase function', () => {
const nsUrlApi = 'https://nightscout-api.com';
const apiSecret = 'yourApiSecret';
const testData: Entry = {
"sgv": 161,
"direction": "Flat",
"type": "sgv",
"dateString": "2024-01-17T17:05:07.424Z",
"date": 1705511107424,
sgv: 161,
direction: 'Flat',
type: 'sgv',
dateString: '2024-01-17T17:05:07.424Z',
date: 1705511107424,
};

// Mock the fetch function to resolve with a success response
Expand Down Expand Up @@ -194,9 +200,9 @@ describe('roundTo8Decimals function', () => {
});
});

describe('getBiexpTreatmentActivity function', () => {
describe('getExpTreatmentActivity function', () => {
it('should return 0 when activity is less than or equal to 0', () => {
const result = getBiexpTreatmentActivity({
const result = getExpTreatmentActivity({
peak: 10,
duration: 30,
minutesAgo: 20,
Expand All @@ -206,7 +212,7 @@ describe('getBiexpTreatmentActivity function', () => {
});

it('should return 0 when activity is less than or equal to 0', () => {
const result = getBiexpTreatmentActivity({
const result = getExpTreatmentActivity({
peak: 55,
duration: 180,
minutesAgo: 200,
Expand All @@ -216,7 +222,7 @@ describe('getBiexpTreatmentActivity function', () => {
});

it('should adjust activity when minutesAgo is less than 15', () => {
const result = getBiexpTreatmentActivity({
const result = getExpTreatmentActivity({
peak: 10,
duration: 30,
minutesAgo: 10,
Expand All @@ -227,19 +233,22 @@ describe('getBiexpTreatmentActivity function', () => {
});

it('should return normal activity when conditions are met', () => {
const result = getBiexpTreatmentActivity({
const result = getExpTreatmentActivity({
peak: 10,
duration: 30,
minutesAgo: 20,
units: 5,
});
const expectedActivity =
5 * (1 / Math.pow((10 * (1 - 10 / 30)) / (1 - (2 * 10) / 30), 2)) * 20 * (1 - 20 / 30) * Math.exp(-20 / ((10 * (1 - 10 / 30)) / (1 - (2 * 10) / 30)));
5 *
(1 / Math.pow((10 * (1 - 10 / 30)) / (1 - (2 * 10) / 30), 2)) *
20 *
(1 - 20 / 30) *
Math.exp(-20 / ((10 * (1 - 10 / 30)) / (1 - (2 * 10) / 30)));
expect(result).toBe(0.16367332278955893);
});
});


const moment = require('moment');

describe('getDeltaMinutes', () => {
Expand All @@ -254,4 +263,4 @@ describe('getDeltaMinutes', () => {

expect(deltaMinutes).toBeCloseTo(5, 0);
});
});
});

1 comment on commit 4dd27ee

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report

Caution

Test run failed

St.
Category Percentage Covered / Total
🟢 Statements 94.68% 801/846
🟢 Branches 80.51% 223/277
🟢 Functions 92.98% 159/171
🟢 Lines 94.92% 784/826

Test suite run failed

Failed tests: 4/271. Failed suites: 2/19.
  ● simulatorAlcohol test › start from 100 @12:00Z with deg23(-4h) + alc 2U(+1h)

    expect(received).toMatchSnapshot()

    Snapshot name: `simulatorAlcohol test start from 100 @12:00Z with deg23(-4h) + alc 2U(+1h) 2`

    - Snapshot  - 48
    + Received  + 48

    @@ -53,58 +53,58 @@
        0,
        0,
        0,
        0,
        0,
    -   0.00093485,
    -   0.02479308,
    -   0.07807856,
    -   0.14580173,
    -   0.18339223,
    -   0.21770083,
    -   0.24886284,
    -   0.2770093,
    -   0.30226711,
    -   0.32475915,
    -   0.34460437,
    -   0.36191789,
    -   0.37681115,
    -   0.38939197,
    -   0.39976468,
    -   0.40803018,
    -   0.41428607,
    -   0.41862674,
    -   0.42114343,
    -   0.42192436,
    -   0.42105477,
    -   0.41861705,
    -   0.41469079,
    -   0.40935287,
    -   0.40267753,
    -   0.39473645,
    -   0.38559885,
    -   0.37533149,
    -   0.36399883,
    -   0.35166303,
    -   0.33838404,
    -   0.32421966,
    -   0.30922563,
    -   0.29345565,
    -   0.27696144,
    -   0.25979285,
    -   0.24199785,
    -   0.22362263,
    -   0.20471166,
    -   0.18530767,
    -   0.1654518,
    -   0.14518357,
    -   0.12454099,
    -   0.10356054,
    -   0.08227728,
    -   0.06072485,
    -   0.03893554,
    -   0.01694032,
    +   0.00098159,
    +   0.02603274,
    +   0.08198249,
    +   0.15309182,
    +   0.19256185,
    +   0.22858587,
    +   0.26130598,
    +   0.29085976,
    +   0.31738047,
    +   0.34099711,
    +   0.36183458,
    +   0.38001378,
    +   0.39565171,
    +   0.40886157,
    +   0.41975291,
    +   0.42843169,
    +   0.43500038,
    +   0.43955808,
    +   0.4422006,
    +   0.44302058,
    +   0.44210751,
    +   0.4395479,
    +   0.43542533,
    +   0.42982051,
    +   0.4228114,
    +   0.41447328,
    +   0.40487879,
    +   0.39409807,
    +   0.38219877,
    +   0.36924618,
    +   0.35530324,
    +   0.34043065,
    +   0.32468691,
    +   0.30812843,
    +   0.29080951,
    +   0.27278249,
    +   0.25409774,
    +   0.23480377,
    +   0.21494724,
    +   0.19457305,
    +   0.17372439,
    +   0.15244275,
    +   0.13076804,
    +   0.10873857,
    +   0.08639115,
    +   0.0637611,
    +   0.04088232,
    +   0.01778733,
        0,
        0,
        0,
        0,
        0,

      48 |
      49 |     expect(result.sgvS).toMatchSnapshot();
    > 50 |     expect(result.alcoholActivity).toMatchSnapshot();
         |                                    ^
      51 |     const png = await getPngSnapshot(
      52 |       {
      53 |         type: 'multiple',

      at next (test/simulatorAlcohol.test.ts:50:36)
      at node_modules/tslib/tslib.js:169:75
      at Object.__awaiter (node_modules/tslib/tslib.js:165:16)
      at Object.<anonymous> (test/simulatorAlcohol.test.ts:26:75)

  ● simulatorAlcohol test › start from 100 @12:00Z with deg22(-6h) + alc 1U(+1h) + alc 4U(+2h)

    expect(received).toMatchSnapshot()

    Snapshot name: `simulatorAlcohol test start from 100 @12:00Z with deg22(-6h) + alc 1U(+1h) + alc 4U(+2h) 1`

    - Snapshot  - 109
    + Received  + 109

    @@ -92,30 +92,27 @@
        141,
        140,
        139,
        138,
        137,
    -   136,
    -   134,
    -   132,
    -   130,
    -   128,
    -   126,
    -   124,
    -   122,
    -   120,
    -   118,
    -   116,
    -   114,
    -   112,
    -   110,
    -   108,
    -   106,
    +   135,
    +   133,
    +   131,
    +   129,
    +   127,
    +   125,
    +   123,
    +   121,
    +   119,
    +   117,
    +   115,
    +   113,
    +   111,
    +   109,
    +   107,
        105,
    -   104,
        103,
    -   102,
        101,
        100,
        99,
        98,
        97,
    @@ -123,51 +120,57 @@
        95,
        94,
        93,
        92,
        91,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
        90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    -   90,
    +   89,
    +   88,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   87,
    +   88,
    +   89,
        90,
        91,
        92,
        93,
        94,
    @@ -234,57 +237,54 @@
        155,
        156,
        157,
        158,
        159,
    -   160,
    -   161,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    -   162,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
    +   159,
      ]

      135 |     });
      136 |
    > 137 |     expect(result.sgvS).toMatchSnapshot();
          |                         ^
      138 |     expect(result.alcoholActivity).toMatchSnapshot();
      139 |
      140 |     const png = await getPngSnapshot(

      at next (test/simulatorAlcohol.test.ts:137:25)
      at node_modules/tslib/tslib.js:169:75
      at Object.__awaiter (node_modules/tslib/tslib.js:165:16)
      at Object.<anonymous> (test/simulatorAlcohol.test.ts:109:89)

  ● simulatorAlcohol test › start from 100 @12:00Z with deg22(-6h) + alc 1U(+1h) + alc 4U(+2h)

    expect(received).toMatchSnapshot()

    Snapshot name: `simulatorAlcohol test start from 100 @12:00Z with deg22(-6h) + alc 1U(+1h) + alc 4U(+2h) 2`

    - Snapshot  - 93
    + Received  + 93

    @@ -37,103 +37,103 @@
        0,
        0,
        0,
        0,
        0,
    -   0.00011738,
    -   0.01019407,
    -   0.03519992,
    -   0.07057856,
    -   0.08957141,
    -   0.10691521,
    -   0.12267787,
    -   0.13692515,
    -   0.14972075,
    -   0.16112634,
    -   0.17120161,
    -   0.18000437,
    -   0.18759054,
    -   0.19401423,
    -   0.19932783,
    -   0.20358196,
    -   0.20682564,
    -   0.20910624,
    -   0.21046956,
    -   0.21095989,
    -   0.21062002,
    -   0.20949131,
    -   0.20761372,
    -   0.20502584,
    -   0.20176496,
    -   0.19786706,
    -   0.19336688,
    -   0.18829797,
    -   0.18269267,
    -   0.1765822,
    -   0.16999666,
    -   0.16296509,
    -   0.15551547,
    -   0.14767476,
    -   0.13946894,
    -   0.13092305,
    -   0.12206118,
    -   0.11290654,
    -   0.10348144,
    -   0.09380736,
    -   0.08390497,
    -   0.07379411,
    -   0.06349388,
    -   0.05302261,
    -   0.0423979,
    -   0.05060563,
    -   0.10488502,
    -   0.20018531,
    -   0.25774233,
    -   0.3115092,
    -   0.36043471,
    -   0.40471975,
    -   0.44455885,
    -   0.48014037,
    -   0.5116467,
    -   0.53925435,
    -   0.56313419,
    -   0.58345155,
    -   0.60036641,
    -   0.61403352,
    -   0.62460256,
    -   0.63221831,
    -   0.63702072,
    -   0.63914511,
    -   0.63872226,
    -   0.63587856,
    -   0.63073612,
    -   0.62341291,
    -   0.61402286,
    -   0.60267598,
    -   0.58947847,
    -   0.57453284,
    -   0.55793801,
    -   0.53978941,
    -   0.52017908,
    -   0.49919579,
    -   0.4769251,
    -   0.45344948,
    -   0.4288484,
    -   0.40319838,
    -   0.37657315,
    -   0.34904367,
    -   0.32067823,
    -   0.29154254,
    -   0.2616998,
    -   0.23121078,
    -   0.20013388,
    -   0.16852522,
    -   0.13643868,
    -   0.10392603,
    -   0.0710369,
    -   0.03781895,
    -   0.00431784,
    +   0.00012325,
    +   0.01070377,
    +   0.03695991,
    +   0.07410749,
    +   0.09404998,
    +   0.11226097,
    +   0.12881176,
    +   0.14377141,
    +   0.15720679,
    +   0.16918265,
    +   0.1797617,
    +   0.18900459,
    +   0.19697006,
    +   0.20371495,
    +   0.20929422,
    +   0.21376106,
    +   0.21716693,
    +   0.21956155,
    +   0.22099304,
    +   0.22150788,
    +   0.22115102,
    +   0.21996587,
    +   0.2179944,
    +   0.21527714,
    +   0.21185321,
    +   0.20776041,
    +   0.20303523,
    +   0.19771287,
    +   0.1918273,
    +   0.18541131,
    +   0.17849649,
    +   0.17111334,
    +   0.16329124,
    +   0.15505849,
    +   0.14644239,
    +   0.1374692,
    +   0.12816424,
    +   0.11855187,
    +   0.10865551,
    +   0.09849773,
    +   0.08810022,
    +   0.07748382,
    +   0.06666857,
    +   0.05567374,
    +   0.0445178,
    +   0.05313591,
    +   0.11012927,
    +   0.21019458,
    +   0.27062944,
    +   0.32708466,
    +   0.37845645,
    +   0.42495573,
    +   0.46678679,
    +   0.50414739,
    +   0.53722904,
    +   0.56621707,
    +   0.5912909,
    +   0.61262413,
    +   0.63038473,
    +   0.64473519,
    +   0.65583269,
    +   0.66382923,
    +   0.66887176,
    +   0.67110237,
    +   0.67065837,
    +   0.66767249,
    +   0.66227293,
    +   0.65458356,
    +   0.64472401,
    +   0.63280978,
    +   0.61895239,
    +   0.60325948,
    +   0.58583491,
    +   0.56677888,
    +   0.54618804,
    +   0.52415558,
    +   0.50077136,
    +   0.47612196,
    +   0.45029082,
    +   0.4233583,
    +   0.39540181,
    +   0.36649585,
    +   0.33671214,
    +   0.30611967,
    +   0.27478479,
    +   0.24277132,
    +   0.21014058,
    +   0.17695148,
    +   0.14326062,
    +   0.10912233,
    +   0.07458875,
    +   0.0397099,
    +   0.00453373,
        0,
        0,
        0,
        0,
        0,

      136 |
      137 |     expect(result.sgvS).toMatchSnapshot();
    > 138 |     expect(result.alcoholActivity).toMatchSnapshot();
          |                                    ^
      139 |
      140 |     const png = await getPngSnapshot(
      141 |       {

      at next (test/simulatorAlcohol.test.ts:138:36)
      at node_modules/tslib/tslib.js:169:75
      at Object.__awaiter (node_modules/tslib/tslib.js:165:16)
      at Object.<anonymous> (test/simulatorAlcohol.test.ts:109:89)


  ● test alcohol › weight:80 Male alc:1 minutesAgo:300

    expect(received).toMatchSnapshot()

    Snapshot name: `test alcohol weight:80 Male alc:1 minutesAgo:300 1`

    Snapshot: 0.1671779
    Received: 0.1755368

      21 |       'Male',
      22 |     );
    > 23 |     expect(alcoolActivity).toMatchSnapshot();
         |                            ^
      24 |   });
      25 |   test('weight:80 Male alc:2 minutesAgo:180 should be 0', () => {
      26 |     const weight = 80;

      at Object.<anonymous> (test/alcool.test.ts:23:28)

  ● test alcohol › weight:80 Male alc:1 all

    expect(received).toMatchSnapshot()

    Snapshot name: `test alcohol weight:80 Male alc:1 all 1`

    Snapshot: 34.09717062
    Received: 35.80202921000001

      58 |       alcoholArr.push(_alcoolActivity > 0 ? _alcoolActivity : 0);
      59 |     }
    > 60 |     expect(alcoolActivity).toMatchSnapshot();
         |                            ^
      61 |     expect(alcoholArr).toMatchSnapshot();
      62 |     const png = await getPngSnapshot(
      63 |       {

      at next (test/alcool.test.ts:60:28)
      at node_modules/tslib/tslib.js:169:75
      at Object.__awaiter (node_modules/tslib/tslib.js:165:16)
      at Object.<anonymous> (test/alcool.test.ts:40:47)

  ● test alcohol › weight:80 Male alc:1 all

    expect(received).toMatchSnapshot()

    Snapshot name: `test alcohol weight:80 Male alc:1 all 2`

    - Snapshot  - 240
    + Received  + 240

    @@ -140,250 +140,250 @@
        0,
        0,
        0,
        0,
        0,
    -   0.00002765,
    -   0.00057538,
    -   0.00181238,
    -   0.00372269,
    -   0.00629052,
    -   0.00950026,
    -   0.01333644,
    -   0.0177838,
    -   0.02282721,
    -   0.02845172,
    -   0.03464254,
    -   0.04138505,
    -   0.04866478,
    -   0.05646743,
    -   0.06477884,
    -   0.07223941,
    -   0.0763592,
    -   0.08040778,
    -   0.08438573,
    -   0.08829364,
    -   0.0921321,
    -   0.09590167,
    -   0.09960293,
    -   0.10323646,
    -   0.10680282,
    -   0.11030258,
    -   0.11373629,
    -   0.11710451,
    -   0.12040779,
    -   0.12364668,
    -   0.12682173,
    -   0.12993348,
    -   0.13298247,
    -   0.13596923,
    -   0.1388943,
    -   0.1417582,
    -   0.14456146,
    -   0.1473046,
    -   0.14998814,
    -   0.15261259,
    -   0.15517847,
    -   0.15768628,
    -   0.16013653,
    -   0.16252971,
    -   0.16486634,
    -   0.1671469,
    -   0.16937188,
    -   0.17154178,
    -   0.17365708,
    -   0.17571826,
    -   0.17772581,
    -   0.17968019,
    -   0.18158188,
    -   0.18343135,
    -   0.18522907,
    -   0.18697551,
    -   0.18867111,
    -   0.19031635,
    -   0.19191168,
    -   0.19345754,
    -   0.19495438,
    -   0.19640266,
    -   0.19780282,
    -   0.19915529,
    -   0.20046052,
    -   0.20171893,
    -   0.20293096,
    -   0.20409703,
    -   0.20521759,
    -   0.20629303,
    -   0.20732379,
    -   0.20831029,
    -   0.20925293,
    -   0.21015214,
    -   0.21100831,
    -   0.21182186,
    -   0.21259318,
    -   0.21332269,
    -   0.21401077,
    -   0.21465783,
    -   0.21526425,
    -   0.21583043,
    -   0.21635676,
    -   0.21684361,
    -   0.21729138,
    -   0.21770044,
    -   0.21807116,
    -   0.21840394,
    -   0.21869912,
    -   0.2189571,
    -   0.21917823,
    -   0.21936287,
    -   0.2195114,
    -   0.21962416,
    -   0.21970153,
    -   0.21974384,
    -   0.21975146,
    -   0.21972474,
    -   0.21966402,
    -   0.21956964,
    -   0.21944196,
    -   0.21928131,
    -   0.21908803,
    -   0.21886245,
    -   0.21860492,
    -   0.21831575,
    -   0.21799529,
    -   0.21764385,
    -   0.21726177,
    -   0.21684935,
    -   0.21640693,
    -   0.21593483,
    -   0.21543335,
    -   0.21490281,
    -   0.21434352,
    -   0.21375579,
    -   0.21313993,
    -   0.21249625,
    -   0.21182503,
    -   0.2111266,
    -   0.21040124,
    -   0.20964925,
    -   0.20887092,
    -   0.20806655,
    -   0.20723643,
    -   0.20638085,
    -   0.20550008,
    -   0.20459442,
    -   0.20366415,
    -   0.20270955,
    -   0.20173089,
    -   0.20072845,
    -   0.19970251,
    -   0.19865333,
    -   0.1975812,
    -   0.19648637,
    -   0.19536911,
    -   0.19422969,
    -   0.19306837,
    -   0.19188541,
    -   0.19068107,
    -   0.18945561,
    -   0.18820927,
    -   0.18694232,
    -   0.18565501,
    -   0.18434758,
    -   0.18302028,
    -   0.18167337,
    -   0.18030707,
    -   0.17892165,
    -   0.17751732,
    -   0.17609435,
    -   0.17465295,
    -   0.17319338,
    -   0.17171585,
    -   0.17022061,
    -   0.16870789,
    -   0.1671779,
    -   0.16563088,
    -   0.16406706,
    -   0.16248666,
    -   0.1608899,
    -   0.15927699,
    -   0.15764817,
    -   0.15600364,
    -   0.15434362,
    -   0.15266833,
    -   0.15097797,
    -   0.14927276,
    -   0.14755291,
    -   0.14581862,
    -   0.1440701,
    -   0.14230756,
    -   0.14053119,
    -   0.13874121,
    -   0.1369378,
    -   0.13512116,
    -   0.1332915,
    -   0.13144901,
    -   0.12959388,
    -   0.1277263,
    -   0.12584647,
    -   0.12395458,
    -   0.1220508,
    -   0.12013534,
    -   0.11820837,
    -   0.11627007,
    -   0.11432064,
    -   0.11236025,
    -   0.11038907,
    -   0.1084073,
    -   0.1064151,
    -   0.10441265,
    -   0.10240012,
    -   0.10037769,
    -   0.09834552,
    -   0.0963038,
    -   0.09425268,
    -   0.09219233,
    -   0.09012292,
    -   0.08804461,
    -   0.08595757,
    -   0.08386196,
    -   0.08175794,
    -   0.07964566,
    -   0.0775253,
    -   0.07539699,
    -   0.07326091,
    -   0.0711172,
    -   0.06896601,
    -   0.06680751,
    -   0.06464183,
    -   0.06246914,
    -   0.06028957,
    -   0.05810327,
    -   0.0559104,
    -   0.05371109,
    -   0.05150549,
    -   0.04929374,
    -   0.04707598,
    -   0.04485235,
    -   0.042623,
    -   0.04038805,
    -   0.03814765,
    -   0.03590193,
    -   0.03365102,
    -   0.03139507,
    -   0.02913419,
    -   0.02686853,
    -   0.02459821,
    -   0.02232335,
    -   0.0200441,
    -   0.01776057,
    -   0.0154729,
    -   0.01318119,
    -   0.01088559,
    -   0.00858621,
    -   0.00628317,
    -   0.0039766,
    -   0.0016666,
    +   0.00002904,
    +   0.00060415,
    +   0.001903,
    +   0.00390883,
    +   0.00660505,
    +   0.00997527,
    +   0.01400327,
    +   0.01867299,
    +   0.02396857,
    +   0.0298743,
    +   0.03637467,
    +   0.0434543,
    +   0.05109802,
    +   0.0592908,
    +   0.06801779,
    +   0.07585138,
    +   0.08017716,
    +   0.08442817,
    +   0.08860502,
    +   0.09270833,
    +   0.0967387,
    +   0.10069675,
    +   0.10458308,
    +   0.10839829,
    +   0.11214297,
    +   0.11581771,
    +   0.1194231,
    +   0.12295973,
    +   0.12642818,
    +   0.12982901,
    +   0.13316282,
    +   0.13643016,
    +   0.1396316,
    +   0.1427677,
    +   0.14583902,
    +   0.14884611,
    +   0.15178954,
    +   0.15466983,
    +   0.15748755,
    +   0.16024322,
    +   0.16293739,
    +   0.16557059,
    +   0.16814335,
    +   0.1706562,
    +   0.17310966,
    +   0.17550424,
    +   0.17784048,
    +   0.18011887,
    +   0.18233993,
    +   0.18450418,
    +   0.1866121,
    +   0.1886642,
    +   0.19066097,
    +   0.19260292,
    +   0.19449053,
    +   0.19632428,
    +   0.19810467,
    +   0.19983217,
    +   0.20150726,
    +   0.20313041,
    +   0.2047021,
    +   0.2062228,
    +   0.20769296,
    +   0.20911306,
    +   0.21048354,
    +   0.21180487,
    +   0.21307751,
    +   0.21430189,
    +   0.21547846,
    +   0.21660768,
    +   0.21768998,
    +   0.2187258,
    +   0.21971558,
    +   0.22065974,
    +   0.22155872,
    +   0.22241295,
    +   0.22322284,
    +   0.22398882,
    +   0.22471131,
    +   0.22539072,
    +   0.22602746,
    +   0.22662195,
    +   0.22717459,
    +   0.22768579,
    +   0.22815595,
    +   0.22858546,
    +   0.22897472,
    +   0.22932413,
    +   0.22963408,
    +   0.22990495,
    +   0.23013714,
    +   0.23033101,
    +   0.23048697,
    +   0.23060537,
    +   0.2306866,
    +   0.23073103,
    +   0.23073904,
    +   0.23071098,
    +   0.23064722,
    +   0.23054813,
    +   0.23041406,
    +   0.23024538,
    +   0.23004243,
    +   0.22980558,
    +   0.22953516,
    +   0.22923154,
    +   0.22889505,
    +   0.22852605,
    +   0.22812485,
    +   0.22769182,
    +   0.22722728,
    +   0.22673157,
    +   0.22620501,
    +   0.22564795,
    +   0.22506069,
    +   0.22444358,
    +   0.22379693,
    +   0.22312106,
    +   0.22241629,
    +   0.22168293,
    +   0.2209213,
    +   0.22013171,
    +   0.21931447,
    +   0.21846988,
    +   0.21759825,
    +   0.21669989,
    +   0.21577509,
    +   0.21482414,
    +   0.21384736,
    +   0.21284502,
    +   0.21181743,
    +   0.21076487,
    +   0.20968763,
    +   0.208586,
    +   0.20746026,
    +   0.20631069,
    +   0.20513757,
    +   0.20394118,
    +   0.20272179,
    +   0.20147968,
    +   0.20021512,
    +   0.19892839,
    +   0.19761973,
    +   0.19628944,
    +   0.19493776,
    +   0.19356496,
    +   0.1921713,
    +   0.19075703,
    +   0.18932243,
    +   0.18786773,
    +   0.18639319,
    +   0.18489907,
    +   0.1833856,
    +   0.18185305,
    +   0.18030165,
    +   0.17873164,
    +   0.17714328,
    +   0.1755368,
    +   0.17391243,
    +   0.17227042,
    +   0.17061099,
    +   0.16893439,
    +   0.16724084,
    +   0.16553058,
    +   0.16380382,
    +   0.1620608,
    +   0.16030174,
    +   0.15852687,
    +   0.1567364,
    +   0.15493056,
    +   0.15310955,
    +   0.15127361,
    +   0.14942294,
    +   0.14755775,
    +   0.14567827,
    +   0.14378469,
    +   0.14187722,
    +   0.13995608,
    +   0.13802146,
    +   0.13607357,
    +   0.13411262,
    +   0.1321388,
    +   0.13015231,
    +   0.12815334,
    +   0.12614211,
    +   0.12411879,
    +   0.12208358,
    +   0.12003667,
    +   0.11797826,
    +   0.11590853,
    +   0.11382766,
    +   0.11173585,
    +   0.10963328,
    +   0.10752013,
    +   0.10539657,
    +   0.1032628,
    +   0.10111899,
    +   0.09896531,
    +   0.09680194,
    +   0.09462906,
    +   0.09244684,
    +   0.09025545,
    +   0.08805506,
    +   0.08584583,
    +   0.08362795,
    +   0.08140156,
    +   0.07916684,
    +   0.07692395,
    +   0.07467306,
    +   0.07241431,
    +   0.07014788,
    +   0.06787393,
    +   0.06559259,
    +   0.06330405,
    +   0.06100844,
    +   0.05870592,
    +   0.05639664,
    +   0.05408076,
    +   0.05175842,
    +   0.04942978,
    +   0.04709497,
    +   0.04475415,
    +   0.04240745,
    +   0.04005503,
    +   0.03769703,
    +   0.03533358,
    +   0.03296482,
    +   0.0305909,
    +   0.02821195,
    +   0.02582812,
    +   0.02343952,
    +   0.02104631,
    +   0.0186486,
    +   0.01624654,
    +   0.01384025,
    +   0.01142987,
    +   0.00901552,
    +   0.00659733,
    +   0.00417543,
    +   0.00174993,
        0,
        0,
        0,
        0,
        0,

      59 |     }
      60 |     expect(alcoolActivity).toMatchSnapshot();
    > 61 |     expect(alcoholArr).toMatchSnapshot();
         |                        ^
      62 |     const png = await getPngSnapshot(
      63 |       {
      64 |         type: 'single',

      at next (test/alcool.test.ts:61:24)
      at node_modules/tslib/tslib.js:169:75
      at Object.__awaiter (node_modules/tslib/tslib.js:165:16)
      at Object.<anonymous> (test/alcool.test.ts:40:47)

Report generated by 🧪jest coverage report action from 4dd27ee

Please sign in to comment.