@ovok/native 1.17.0-dev.2260 → 1.17.0-dev.2262
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/lib/commonjs/modules/next/bluetooth/adapters/chosen-patient.js +12 -5
- package/lib/commonjs/modules/next/bluetooth/adapters/chosen-patient.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/adapters/ovok-reading-sink.js +27 -119
- package/lib/commonjs/modules/next/bluetooth/adapters/ovok-reading-sink.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/adapters/reading-measurements.js +118 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/reading-measurements.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/series-saving.js +14 -8
- package/lib/commonjs/modules/next/bluetooth/adapters/series-saving.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/index.js +9 -1
- package/lib/commonjs/modules/next/bluetooth/index.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/web/index.js +9 -1
- package/lib/commonjs/modules/next/bluetooth/web/index.js.map +1 -1
- package/lib/module/modules/next/bluetooth/adapters/chosen-patient.js +11 -5
- package/lib/module/modules/next/bluetooth/adapters/chosen-patient.js.map +1 -1
- package/lib/module/modules/next/bluetooth/adapters/ovok-reading-sink.js +28 -120
- package/lib/module/modules/next/bluetooth/adapters/ovok-reading-sink.js.map +1 -1
- package/lib/module/modules/next/bluetooth/adapters/reading-measurements.js +115 -0
- package/lib/module/modules/next/bluetooth/adapters/reading-measurements.js.map +1 -0
- package/lib/module/modules/next/bluetooth/adapters/series-saving.js +13 -8
- package/lib/module/modules/next/bluetooth/adapters/series-saving.js.map +1 -1
- package/lib/module/modules/next/bluetooth/index.js +1 -0
- package/lib/module/modules/next/bluetooth/index.js.map +1 -1
- package/lib/module/modules/next/bluetooth/web/index.js +1 -0
- package/lib/module/modules/next/bluetooth/web/index.js.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/chosen-patient.d.ts +13 -5
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/chosen-patient.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ovok-reading-sink.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ovok-reading-sink.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/reading-measurements.d.ts +7 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/reading-measurements.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/series-saving.d.ts +3 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/series-saving.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/chosen-patient.d.ts +13 -5
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/chosen-patient.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/ovok-reading-sink.d.ts +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/ovok-reading-sink.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/reading-measurements.d.ts +7 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/reading-measurements.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/series-saving.d.ts +3 -1
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/series-saving.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/web/index.d.ts +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/web/index.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,121 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { MeasurementTypeKey } from "@ovok/core/next";
|
|
4
3
|
import { DeviceError } from "../core/errors.js";
|
|
5
|
-
import { chosenPatientOf } from "./chosen-patient.js";
|
|
6
|
-
import { ecgMeasurements } from "./ecg-measurements.js";
|
|
4
|
+
import { chosenPatientOf, HOLD } from "./chosen-patient.js";
|
|
7
5
|
import { replaceLiveRecordings } from "./live-supersession.js";
|
|
6
|
+
import { MEASUREMENTS } from "./reading-measurements.js";
|
|
8
7
|
import { sourceIdsOf } from "./reading-source-id.js";
|
|
9
|
-
import {
|
|
10
|
-
import { isSeriesReading, saveSeries } from "./series-saving.js";
|
|
11
|
-
import { urineAnalysis } from "./urine-measurements.js";
|
|
12
|
-
const flagSet = (reading, code) => reading.deviceFlags.some(flag => flag.code === code && flag.raw !== 0) ? true : undefined;
|
|
13
|
-
const bloodPressure = reading => ({
|
|
14
|
-
measurementTypeKey: MeasurementTypeKey.bloodPressure,
|
|
15
|
-
systolic: ovokValueOf(reading, "systolic"),
|
|
16
|
-
diastolic: ovokValueOf(reading, "diastolic"),
|
|
17
|
-
meanArterialPressure: ovokValueOf(reading, "mean_arterial_pressure"),
|
|
18
|
-
heartRate: valueOf(reading, "pulse_rate"),
|
|
19
|
-
irregularHeartbeat: flagSet(reading, "irregular_pulse"),
|
|
20
|
-
recordedAt: reading.takenAt ?? undefined
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
/** A reading without its main value, or with it in an unconvertible unit, cannot be saved. */
|
|
24
|
-
const bloodGlucose = reading => {
|
|
25
|
-
const bloodGlucoseValue = ovokValueOf(reading, "blood_glucose");
|
|
26
|
-
return bloodGlucoseValue === undefined ? undefined : {
|
|
27
|
-
measurementTypeKey: MeasurementTypeKey.bloodGlucose,
|
|
28
|
-
bloodGlucose: bloodGlucoseValue,
|
|
29
|
-
recordedAt: reading.takenAt ?? undefined
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
const bodyWeight = reading => {
|
|
33
|
-
const weight = ovokValueOf(reading, "body_weight");
|
|
34
|
-
return weight === undefined ? undefined : {
|
|
35
|
-
measurementTypeKey: MeasurementTypeKey.bodyWeight,
|
|
36
|
-
bodyWeight: weight,
|
|
37
|
-
recordedAt: reading.takenAt ?? undefined
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
const bodyTemperature = reading => {
|
|
41
|
-
const temperature = ovokValueOf(reading, "body_temperature");
|
|
42
|
-
return temperature === undefined ? undefined : {
|
|
43
|
-
measurementTypeKey: MeasurementTypeKey.temperature,
|
|
44
|
-
bodyTemp: temperature,
|
|
45
|
-
recordedAt: reading.takenAt ?? undefined
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
const pulseOximetry = reading => ({
|
|
49
|
-
measurementTypeKey: MeasurementTypeKey.bloodOxygenPulseRate,
|
|
50
|
-
bloodOxygen: valueOf(reading, "spo2"),
|
|
51
|
-
pulseRate: valueOf(reading, "pulse_rate"),
|
|
52
|
-
perfusionIndex: valueOf(reading, "perfusion_index"),
|
|
53
|
-
recordedAt: reading.takenAt ?? undefined
|
|
54
|
-
});
|
|
55
|
-
const heartRate = reading => ({
|
|
56
|
-
measurementTypeKey: MeasurementTypeKey.heartRate,
|
|
57
|
-
heartRate: valueOf(reading, "heart_rate"),
|
|
58
|
-
recordedAt: reading.takenAt ?? undefined
|
|
59
|
-
});
|
|
60
|
-
const respiratoryRate = reading => ({
|
|
61
|
-
measurementTypeKey: MeasurementTypeKey.respiratoryRate,
|
|
62
|
-
respiratoryRate: valueOf(reading, "respiration_rate"),
|
|
63
|
-
recordedAt: reading.takenAt ?? undefined
|
|
64
|
-
});
|
|
65
|
-
const LIPID_METRICS = ["blood_cholesterol", "hdl_cholesterol", "ldl_cholesterol", "triglycerides"];
|
|
66
|
-
const LIPID_UNITS = ["mg/dL", "mmol/L"];
|
|
67
|
-
const isLipidUnit = unit => LIPID_UNITS.some(lipidUnit => lipidUnit === unit);
|
|
68
|
-
|
|
69
|
-
/** Ovok keeps a panel in one unit, so a reading whose values use two units, or a unit it has no codes for, cannot be saved. */
|
|
70
|
-
const lipidPanel = reading => {
|
|
71
|
-
const units = new Set(LIPID_METRICS.flatMap(metric => reading.values[metric]?.unit ?? []));
|
|
72
|
-
const [unit] = units;
|
|
73
|
-
return units.size === 1 && isLipidUnit(unit) ? {
|
|
74
|
-
measurementTypeKey: MeasurementTypeKey.lipidPanel,
|
|
75
|
-
totalCholesterol: valueOf(reading, "blood_cholesterol"),
|
|
76
|
-
hdlCholesterol: valueOf(reading, "hdl_cholesterol"),
|
|
77
|
-
ldlCholesterol: valueOf(reading, "ldl_cholesterol"),
|
|
78
|
-
triglycerides: valueOf(reading, "triglycerides"),
|
|
79
|
-
unit,
|
|
80
|
-
recordedAt: reading.takenAt ?? undefined
|
|
81
|
-
} : undefined;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
/** A spirometry test without any value in Ovok's units cannot be saved. */
|
|
85
|
-
const spirometry = reading => {
|
|
86
|
-
const values = {
|
|
87
|
-
fvc: ovokValueOf(reading, "fvc"),
|
|
88
|
-
fev1: ovokValueOf(reading, "fev1"),
|
|
89
|
-
"fev1/fvc": ovokValueOf(reading, "fev1_fvc_ratio"),
|
|
90
|
-
pef: ovokValueOf(reading, "pef"),
|
|
91
|
-
fef2575: ovokValueOf(reading, "fef25_75")
|
|
92
|
-
};
|
|
93
|
-
return Object.values(values).some(value => value !== undefined) ? {
|
|
94
|
-
measurementTypeKey: MeasurementTypeKey.spirometryPanel,
|
|
95
|
-
...values,
|
|
96
|
-
recordedAt: reading.takenAt ?? undefined
|
|
97
|
-
} : undefined;
|
|
98
|
-
};
|
|
99
|
-
const single = measure => reading => {
|
|
100
|
-
const measurement = measure(reading);
|
|
101
|
-
return measurement ? [measurement] : [];
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
/** How each reading type becomes Ovok measurements, one for most and one per channel for an ECG; a type missing here cannot be saved yet. */
|
|
105
|
-
const MEASUREMENTS = {
|
|
106
|
-
blood_pressure: single(bloodPressure),
|
|
107
|
-
blood_glucose: single(bloodGlucose),
|
|
108
|
-
blood_cholesterol: single(lipidPanel),
|
|
109
|
-
ecg: ecgMeasurements,
|
|
110
|
-
heart_rate: single(heartRate),
|
|
111
|
-
oxygen_saturation: single(pulseOximetry),
|
|
112
|
-
respiration_rate: single(respiratoryRate),
|
|
113
|
-
spirometry: single(spirometry),
|
|
114
|
-
temperature: single(bodyTemperature),
|
|
115
|
-
triglycerides: single(lipidPanel),
|
|
116
|
-
urine_test: single(urineAnalysis),
|
|
117
|
-
weight: single(bodyWeight)
|
|
118
|
-
};
|
|
8
|
+
import { holdSeries, isSeriesReading, saveSeries } from "./series-saving.js";
|
|
119
9
|
const deviceOf = (reading, device) => ({
|
|
120
10
|
id: reading.source.address,
|
|
121
11
|
name: device.model.id,
|
|
@@ -138,14 +28,17 @@ const unsupported = what => new DeviceError("unsupported", `Ovok cannot save ${w
|
|
|
138
28
|
/** Live numbers are saved as series and a live ECG as a recording; any other live trace has no place in Ovok yet. */
|
|
139
29
|
const isUnsavableLive = reading => reading.live !== undefined && reading.series === undefined && reading.type !== "ecg";
|
|
140
30
|
const hasValues = reading => Object.keys(reading.values).length > 0;
|
|
141
|
-
|
|
31
|
+
|
|
32
|
+
/** Stores one measurement's observations: saves them, or holds them. */
|
|
33
|
+
|
|
34
|
+
const storeMeasurements = async (store, reading, device, patientId) => {
|
|
142
35
|
const measurements = MEASUREMENTS[reading.type]?.(reading) ?? [];
|
|
143
36
|
if (measurements.length === 0) {
|
|
144
37
|
throw unsupported(`a ${reading.type} reading of this shape`);
|
|
145
38
|
}
|
|
146
39
|
const results = [];
|
|
147
40
|
for (const [index, measurement] of measurements.entries()) {
|
|
148
|
-
results.push(await
|
|
41
|
+
results.push(await store({
|
|
149
42
|
measurement,
|
|
150
43
|
...sourceIdsOf(reading, device.sn, index),
|
|
151
44
|
effectiveDateTime: reading.takenAt ?? undefined,
|
|
@@ -169,9 +62,21 @@ const receiptOf = results => {
|
|
|
169
62
|
};
|
|
170
63
|
};
|
|
171
64
|
|
|
65
|
+
/** Keeps a reading on the device for the guest, until `ovok.outbox.assign` names the patient; its live recordings stay. */
|
|
66
|
+
const holdReading = async (client, reading, device) => {
|
|
67
|
+
const results = [];
|
|
68
|
+
if (isSeriesReading(reading)) {
|
|
69
|
+
results.push(await holdSeries(client, reading, device));
|
|
70
|
+
}
|
|
71
|
+
if (!isSeriesReading(reading) || hasValues(reading)) {
|
|
72
|
+
results.push(...(await storeMeasurements(params => client.measurements.hold(params), reading, device, undefined)));
|
|
73
|
+
}
|
|
74
|
+
return results;
|
|
75
|
+
};
|
|
76
|
+
|
|
172
77
|
/**
|
|
173
78
|
* Saves readings through the Ovok measurements API, queueing them offline: for the signed-in account, or for the
|
|
174
|
-
* patient `savesFor` names
|
|
79
|
+
* patient `savesFor` names, or holds them when it returns `HOLD`. A reading with a series also saves it; a stored record then removes the live recordings it
|
|
175
80
|
* replaces, once it is saved.
|
|
176
81
|
*/
|
|
177
82
|
const ovokReadingSink = (client, savesFor) => ({
|
|
@@ -179,16 +84,19 @@ const ovokReadingSink = (client, savesFor) => ({
|
|
|
179
84
|
if (isUnsavableLive(reading)) {
|
|
180
85
|
throw unsupported(`a live ${reading.live?.metric} recording`);
|
|
181
86
|
}
|
|
182
|
-
const
|
|
87
|
+
const chosen = chosenPatientOf(savesFor, reading, device);
|
|
183
88
|
const target = deviceOf(reading, device);
|
|
89
|
+
if (chosen === HOLD) {
|
|
90
|
+
return receiptOf(await holdReading(client, reading, target));
|
|
91
|
+
}
|
|
184
92
|
const results = [];
|
|
185
93
|
if (isSeriesReading(reading)) {
|
|
186
|
-
results.push(await saveSeries(client, reading, target,
|
|
94
|
+
results.push(await saveSeries(client, reading, target, chosen));
|
|
187
95
|
}
|
|
188
96
|
if (!isSeriesReading(reading) || hasValues(reading)) {
|
|
189
|
-
results.push(...(await
|
|
97
|
+
results.push(...(await storeMeasurements(params => client.measurements.save(params), reading, target, chosen)));
|
|
190
98
|
}
|
|
191
|
-
await replaceLiveRecordings(client, reading,
|
|
99
|
+
await replaceLiveRecordings(client, reading, chosen);
|
|
192
100
|
return receiptOf(results);
|
|
193
101
|
}
|
|
194
102
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["DeviceError","chosenPatientOf","HOLD","replaceLiveRecordings","MEASUREMENTS","sourceIdsOf","holdSeries","isSeriesReading","saveSeries","deviceOf","reading","device","id","source","address","name","model","localName","manufacturerData","manufacturerName","identity","manufacturer","undefined","sn","serial","variant","vendor","batteryPercentage","battery","percent","unsupported","what","isUnsavableLive","live","series","type","hasValues","Object","keys","values","length","storeMeasurements","store","patientId","measurements","results","index","measurement","entries","push","effectiveDateTime","takenAt","receiptOf","queueIds","flatMap","result","status","queueId","holdReading","client","params","hold","ovokReadingSink","savesFor","save","metric","chosen","target"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/ovok-reading-sink.ts"],"mappings":";;AAGA,SAASA,WAAW,QAAQ,mBAAgB;AAK5C,SAASC,eAAe,EAAEC,IAAI,QAAkB,qBAAkB;AAClE,SAASC,qBAAqB,QAA4B,wBAAqB;AAC/E,SAASC,YAAY,QAAQ,2BAAwB;AACrD,SAASC,WAAW,QAAQ,wBAAqB;AACjD,SAASC,UAAU,EAAEC,eAAe,EAAqBC,UAAU,QAAQ,oBAAiB;AAE5F,MAAMC,QAAQ,GAAGA,CAACC,OAAgB,EAAEC,MAAsB,MAAyB;EACjFC,EAAE,EAAEF,OAAO,CAACG,MAAM,CAACC,OAAO;EAC1BC,IAAI,EAAEJ,MAAM,CAACK,KAAK,CAACJ,EAAE;EACrBK,SAAS,EAAEN,MAAM,CAACI,IAAI;EACtBG,gBAAgB,EAAE,EAAE;EACpBC,gBA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|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { MeasurementTypeKey } from "@ovok/core/next";
|
|
4
|
+
import { ecgMeasurements } from "./ecg-measurements.js";
|
|
5
|
+
import { ovokValueOf, valueOf } from "./reading-values.js";
|
|
6
|
+
import { urineAnalysis } from "./urine-measurements.js";
|
|
7
|
+
const flagSet = (reading, code) => reading.deviceFlags.some(flag => flag.code === code && flag.raw !== 0) ? true : undefined;
|
|
8
|
+
const bloodPressure = reading => ({
|
|
9
|
+
measurementTypeKey: MeasurementTypeKey.bloodPressure,
|
|
10
|
+
systolic: ovokValueOf(reading, "systolic"),
|
|
11
|
+
diastolic: ovokValueOf(reading, "diastolic"),
|
|
12
|
+
meanArterialPressure: ovokValueOf(reading, "mean_arterial_pressure"),
|
|
13
|
+
heartRate: valueOf(reading, "pulse_rate"),
|
|
14
|
+
irregularHeartbeat: flagSet(reading, "irregular_pulse"),
|
|
15
|
+
recordedAt: reading.takenAt ?? undefined
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
/** A reading without its main value, or with it in an unconvertible unit, cannot be saved. */
|
|
19
|
+
const bloodGlucose = reading => {
|
|
20
|
+
const bloodGlucoseValue = ovokValueOf(reading, "blood_glucose");
|
|
21
|
+
return bloodGlucoseValue === undefined ? undefined : {
|
|
22
|
+
measurementTypeKey: MeasurementTypeKey.bloodGlucose,
|
|
23
|
+
bloodGlucose: bloodGlucoseValue,
|
|
24
|
+
recordedAt: reading.takenAt ?? undefined
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
const bodyWeight = reading => {
|
|
28
|
+
const weight = ovokValueOf(reading, "body_weight");
|
|
29
|
+
return weight === undefined ? undefined : {
|
|
30
|
+
measurementTypeKey: MeasurementTypeKey.bodyWeight,
|
|
31
|
+
bodyWeight: weight,
|
|
32
|
+
recordedAt: reading.takenAt ?? undefined
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
const bodyTemperature = reading => {
|
|
36
|
+
const temperature = ovokValueOf(reading, "body_temperature");
|
|
37
|
+
return temperature === undefined ? undefined : {
|
|
38
|
+
measurementTypeKey: MeasurementTypeKey.temperature,
|
|
39
|
+
bodyTemp: temperature,
|
|
40
|
+
recordedAt: reading.takenAt ?? undefined
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
const pulseOximetry = reading => ({
|
|
44
|
+
measurementTypeKey: MeasurementTypeKey.bloodOxygenPulseRate,
|
|
45
|
+
bloodOxygen: valueOf(reading, "spo2"),
|
|
46
|
+
pulseRate: valueOf(reading, "pulse_rate"),
|
|
47
|
+
perfusionIndex: valueOf(reading, "perfusion_index"),
|
|
48
|
+
recordedAt: reading.takenAt ?? undefined
|
|
49
|
+
});
|
|
50
|
+
const heartRate = reading => ({
|
|
51
|
+
measurementTypeKey: MeasurementTypeKey.heartRate,
|
|
52
|
+
heartRate: valueOf(reading, "heart_rate"),
|
|
53
|
+
recordedAt: reading.takenAt ?? undefined
|
|
54
|
+
});
|
|
55
|
+
const respiratoryRate = reading => ({
|
|
56
|
+
measurementTypeKey: MeasurementTypeKey.respiratoryRate,
|
|
57
|
+
respiratoryRate: valueOf(reading, "respiration_rate"),
|
|
58
|
+
recordedAt: reading.takenAt ?? undefined
|
|
59
|
+
});
|
|
60
|
+
const LIPID_METRICS = ["blood_cholesterol", "hdl_cholesterol", "ldl_cholesterol", "triglycerides"];
|
|
61
|
+
const LIPID_UNITS = ["mg/dL", "mmol/L"];
|
|
62
|
+
const isLipidUnit = unit => LIPID_UNITS.some(lipidUnit => lipidUnit === unit);
|
|
63
|
+
|
|
64
|
+
/** Ovok keeps a panel in one unit, so a reading whose values use two units, or a unit it has no codes for, cannot be saved. */
|
|
65
|
+
const lipidPanel = reading => {
|
|
66
|
+
const units = new Set(LIPID_METRICS.flatMap(metric => reading.values[metric]?.unit ?? []));
|
|
67
|
+
const [unit] = units;
|
|
68
|
+
return units.size === 1 && isLipidUnit(unit) ? {
|
|
69
|
+
measurementTypeKey: MeasurementTypeKey.lipidPanel,
|
|
70
|
+
totalCholesterol: valueOf(reading, "blood_cholesterol"),
|
|
71
|
+
hdlCholesterol: valueOf(reading, "hdl_cholesterol"),
|
|
72
|
+
ldlCholesterol: valueOf(reading, "ldl_cholesterol"),
|
|
73
|
+
triglycerides: valueOf(reading, "triglycerides"),
|
|
74
|
+
unit,
|
|
75
|
+
recordedAt: reading.takenAt ?? undefined
|
|
76
|
+
} : undefined;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/** A spirometry test without any value in Ovok's units cannot be saved. */
|
|
80
|
+
const spirometry = reading => {
|
|
81
|
+
const values = {
|
|
82
|
+
fvc: ovokValueOf(reading, "fvc"),
|
|
83
|
+
fev1: ovokValueOf(reading, "fev1"),
|
|
84
|
+
"fev1/fvc": ovokValueOf(reading, "fev1_fvc_ratio"),
|
|
85
|
+
pef: ovokValueOf(reading, "pef"),
|
|
86
|
+
fef2575: ovokValueOf(reading, "fef25_75")
|
|
87
|
+
};
|
|
88
|
+
return Object.values(values).some(value => value !== undefined) ? {
|
|
89
|
+
measurementTypeKey: MeasurementTypeKey.spirometryPanel,
|
|
90
|
+
...values,
|
|
91
|
+
recordedAt: reading.takenAt ?? undefined
|
|
92
|
+
} : undefined;
|
|
93
|
+
};
|
|
94
|
+
const single = measure => reading => {
|
|
95
|
+
const measurement = measure(reading);
|
|
96
|
+
return measurement ? [measurement] : [];
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/** How each reading type becomes Ovok measurements, one for most and one per channel for an ECG; a type missing here cannot be saved yet. */
|
|
100
|
+
const MEASUREMENTS = {
|
|
101
|
+
blood_pressure: single(bloodPressure),
|
|
102
|
+
blood_glucose: single(bloodGlucose),
|
|
103
|
+
blood_cholesterol: single(lipidPanel),
|
|
104
|
+
ecg: ecgMeasurements,
|
|
105
|
+
heart_rate: single(heartRate),
|
|
106
|
+
oxygen_saturation: single(pulseOximetry),
|
|
107
|
+
respiration_rate: single(respiratoryRate),
|
|
108
|
+
spirometry: single(spirometry),
|
|
109
|
+
temperature: single(bodyTemperature),
|
|
110
|
+
triglycerides: single(lipidPanel),
|
|
111
|
+
urine_test: single(urineAnalysis),
|
|
112
|
+
weight: single(bodyWeight)
|
|
113
|
+
};
|
|
114
|
+
export { MEASUREMENTS };
|
|
115
|
+
//# sourceMappingURL=reading-measurements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","ecgMeasurements","ovokValueOf","valueOf","urineAnalysis","flagSet","reading","code","deviceFlags","some","flag","raw","undefined","bloodPressure","measurementTypeKey","systolic","diastolic","meanArterialPressure","heartRate","irregularHeartbeat","recordedAt","takenAt","bloodGlucose","bloodGlucoseValue","bodyWeight","weight","bodyTemperature","temperature","bodyTemp","pulseOximetry","bloodOxygenPulseRate","bloodOxygen","pulseRate","perfusionIndex","respiratoryRate","LIPID_METRICS","LIPID_UNITS","isLipidUnit","unit","lipidUnit","lipidPanel","units","Set","flatMap","metric","values","size","totalCholesterol","hdlCholesterol","ldlCholesterol","triglycerides","spirometry","fvc","fev1","pef","fef2575","Object","value","spirometryPanel","single","measure","measurement","MEASUREMENTS","blood_pressure","blood_glucose","blood_cholesterol","ecg","heart_rate","oxygen_saturation","respiration_rate","urine_test"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/reading-measurements.ts"],"mappings":";;AAAA,SAQEA,kBAAkB,QAIb,iBAAiB;AAKxB,SAASC,eAAe,QAAQ,uBAAoB;AACpD,SAASC,WAAW,EAAEC,OAAO,QAAQ,qBAAkB;AACvD,SAASC,aAAa,QAAQ,yBAAsB;AAEpD,MAAMC,OAAO,GAAGA,CAACC,OAAgB,EAAEC,IAAY,KAC7CD,OAAO,CAACE,WAAW,CAACC,IAAI,CAAEC,IAAI,IAAKA,IAAI,CAACH,IAAI,KAAKA,IAAI,IAAIG,IAAI,CAACC,GAAG,KAAK,CAAC,CAAC,GAAG,IAAI,GAAGC,SAAS;AAE7F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EAAU,CAAC,GAC/GA,SAAS;AACf,CAAC;AAED,MAAM+C,MAAM,GACTC,OAAsD,IACtDtD,OAAgB,IAAoB;EACnC,MAAMuD,WAAW,GAAGD,OAAO,CAACtD,OAAO,CAAC;EAEpC,OAAOuD,WAAW,GAAG,CAACA,WAAW,CAAC,GAAG,EAAE;AACzC,CAAC;;AAEH;AACA,MAAMC,YAA4F,GAAG;EACnGC,cAAc,EAAEJ,MAAM,CAAC9C,aAAa,CAAC;EACrCmD,aAAa,EAAEL,MAAM,CAACrC,YAAY,CAAC;EACnC2C,iBAAiB,EAAEN,MAAM,CAACnB,UAAU,CAAC;EACrC0B,GAAG,EAAEjE,eAAe;EACpBkE,UAAU,EAAER,MAAM,CAACzC,SAAS,CAAC;EAC7BkD,iBAAiB,EAAET,MAAM,CAAC9B,aAAa,CAAC;EACxCwC,gBAAgB,EAAEV,MAAM,CAACzB,eAAe,CAAC;EACzCiB,UAAU,EAAEQ,MAAM,CAACR,UAAU,CAAC;EAC9BxB,WAAW,EAAEgC,MAAM,CAACjC,eAAe,CAAC;EACpCwB,aAAa,EAAES,MAAM,CAACnB,UAAU,CAAC;EACjC8B,UAAU,EAAEX,MAAM,CAACvD,aAAa,CAAC;EACjCqB,MAAM,EAAEkC,MAAM,CAACnC,UAAU;AAC3B,CAAC;AAED,SAASsC,YAAY","ignoreList":[]}
|
|
@@ -64,11 +64,8 @@ const seriesObservationsOf = (field, {
|
|
|
64
64
|
...rest
|
|
65
65
|
});
|
|
66
66
|
|
|
67
|
-
/**
|
|
68
|
-
|
|
69
|
-
* saved for `patientId` when given, otherwise for the signed-in patient or the guest.
|
|
70
|
-
*/
|
|
71
|
-
const saveSeries = async (client, reading, device, patientId) => {
|
|
67
|
+
/** The observations of a reading's series, in Ovok's unit, under a stable id, for `patientId`. */
|
|
68
|
+
const seriesObservationsFor = async (client, reading, device, patientId) => {
|
|
72
69
|
const {
|
|
73
70
|
series
|
|
74
71
|
} = reading;
|
|
@@ -77,7 +74,7 @@ const saveSeries = async (client, reading, device, patientId) => {
|
|
|
77
74
|
if (!field || !toOvokUnit) {
|
|
78
75
|
throw unsupported(`${series.metric} in ${series.unit}`);
|
|
79
76
|
}
|
|
80
|
-
|
|
77
|
+
return seriesObservationsOf(field, {
|
|
81
78
|
...series,
|
|
82
79
|
values: series.values.map(value => value === null ? null : toOvokUnit(value))
|
|
83
80
|
}, {
|
|
@@ -85,7 +82,15 @@ const saveSeries = async (client, reading, device, patientId) => {
|
|
|
85
82
|
...sourceIdsOf(reading, device.sn),
|
|
86
83
|
device
|
|
87
84
|
});
|
|
88
|
-
return client.measurements.saveObservations(observations);
|
|
89
85
|
};
|
|
90
|
-
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Saves a series, in Ovok's unit, under a stable id; saving a longer version of it writes over the earlier one. It is
|
|
89
|
+
* saved for `patientId` when given, otherwise for the signed-in patient or the guest.
|
|
90
|
+
*/
|
|
91
|
+
const saveSeries = async (client, reading, device, patientId) => client.measurements.saveObservations(await seriesObservationsFor(client, reading, device, patientId));
|
|
92
|
+
|
|
93
|
+
/** Keeps a series on the device, naming the guest, until `ovok.outbox.assign` names the patient. */
|
|
94
|
+
const holdSeries = async (client, reading, device) => client.measurements.holdObservations(await seriesObservationsFor(client, reading, device, GUEST_PATIENT_ID));
|
|
95
|
+
export { holdSeries, isSeriesReading, ownPatientId, saveSeries, seriesFieldOf, seriesObservationsOf };
|
|
91
96
|
//# sourceMappingURL=series-saving.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["GUEST_PATIENT_ID","MeasurementTypeKey","seriesObservations","DeviceError","sourceIdsOf","TO_OVOK_UNIT","SERIES_FIELDS","heart_rate","type","heartRate","property","pulse_rate","bloodOxygenPulseRate","spo2","respiration_rate","respiratoryRate","body_temperature","temperature","unsupported","what","isSeriesReading","reading","series","undefined","seriesFieldOf","metric","ownPatientId","session","reference","current","profile","slice","indexOf","seriesObservationsOf","field","start","intervalMs","values","rest","measurementTypeKey","periodMs","
|
|
1
|
+
{"version":3,"names":["GUEST_PATIENT_ID","MeasurementTypeKey","seriesObservations","DeviceError","sourceIdsOf","TO_OVOK_UNIT","SERIES_FIELDS","heart_rate","type","heartRate","property","pulse_rate","bloodOxygenPulseRate","spo2","respiration_rate","respiratoryRate","body_temperature","temperature","unsupported","what","isSeriesReading","reading","series","undefined","seriesFieldOf","metric","ownPatientId","session","reference","current","profile","slice","indexOf","seriesObservationsOf","field","start","intervalMs","values","rest","measurementTypeKey","periodMs","seriesObservationsFor","client","device","patientId","toOvokUnit","unit","map","value","sn","saveSeries","measurements","saveObservations","holdSeries","holdObservations"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/series-saving.ts"],"mappings":";;AAAA,SAEEA,gBAAgB,EAChBC,kBAAkB,EAGlBC,kBAAkB,QAEb,iBAAiB;AAExB,SAASC,WAAW,QAAQ,mBAAgB;AAI5C,SAASC,WAAW,QAAQ,wBAAqB;AACjD,SAASC,YAAY,QAAQ,qBAAkB;;AAI/C;;AAGA;;AAGA;;AAGA,MAAMC,aAAuD,GAAG;EAC9DC,UAAU,EAAE;IAAEC,IAAI,EAAEP,kBAAkB,CAACQ,SAAS;IAAEC,QAAQ,EAAE;EAAY,CAAC;EACzEC,UAAU,EAAE;IAAEH,IAAI,EAAEP,kBAAkB,CAACW,oBAAoB;IAAEF,QAAQ,EAAE;EAAY,CAAC;EACpFG,IAAI,EAAE;IAAEL,IAAI,EAAEP,kBAAkB,CAACW,oBAAoB;IAAEF,QAAQ,EAAE;EAAc,CAAC;EAChFI,gBAAgB,EAAE;IAAEN,IAAI,EAAEP,kBAAkB,CAACc,eAAe;IAAEL,QAAQ,EAAE;EAAkB,CAAC;EAC3FM,gBAAgB,EAAE;IAAER,IAAI,EAAEP,kBAAkB,CAACgB,WAAW;IAAEP,QAAQ,EAAE;EAAW;AACjF,CAAC;AAED,MAAMQ,WAAW,GAAIC,IAAY,IAAkB,IAAIhB,WAAW,CAAC,aAAa,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,OAAOH,MAAM,CAACwB,IAAI,EAAE,CAAC;EACzD;EAEA,OAAOb,oBAAoB,CACzBC,KAAK,EACL;IAAE,GAAGZ,MAAM;IAAEe,MAAM,EAAEf,MAAM,CAACe,MAAM,CAACU,GAAG,CAAEC,KAAK,IAAMA,KAAK,KAAK,IAAI,GAAG,IAAI,GAAGH,UAAU,CAACG,KAAK,CAAE;EAAE,CAAC,EAChG;IAAEJ,SAAS,EAAEA,SAAS,KAAK,MAAMlB,YAAY,CAACgB,MAAM,CAAC,CAAC;IAAE,GAAGtC,WAAW,CAACiB,OAAO,EAAEsB,MAAM,CAACM,EAAE,CAAC;IAAEN;EAAO,CACrG,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMO,UAAU,GAAG,MAAAA,CACjBR,MAAoB,EACpBrB,OAAsB,EACtBsB,MAAyB,EACzBC,SAAkB,KAElBF,MAAM,CAACS,YAAY,CAACC,gBAAgB,CAAC,MAAMX,qBAAqB,CAACC,MAAM,EAAErB,OAAO,EAAEsB,MAAM,EAAEC,SAAS,CAAC,CAAC;;AAEvG;AACA,MAAMS,UAAU,GAAG,MAAAA,CAAOX,MAAoB,EAAErB,OAAsB,EAAEsB,MAAyB,KAC/FD,MAAM,CAACS,YAAY,CAACG,gBAAgB,CAAC,MAAMb,qBAAqB,CAACC,MAAM,EAAErB,OAAO,EAAEsB,MAAM,EAAE3C,gBAAgB,CAAC,CAAC;AAE9G,SAASqD,UAAU,EAAEjC,eAAe,EAAEM,YAAY,EAAEwB,UAAU,EAAE1B,aAAa,EAAES,oBAAoB","ignoreList":[]}
|
|
@@ -12,4 +12,5 @@ export { blePlxCentral } from "./adapters/ble-plx-central.js";
|
|
|
12
12
|
export { osBluetoothPermissions } from "./adapters/os-permissions.js";
|
|
13
13
|
export { reactNativeLifecycle } from "./adapters/react-native-lifecycle.js";
|
|
14
14
|
export { createBluetooth } from "./create-bluetooth.js";
|
|
15
|
+
export { HOLD } from "./adapters/chosen-patient.js";
|
|
15
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["androidForegroundService","blePlxCentral","osBluetoothPermissions","reactNativeLifecycle","createBluetooth"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,aAAU;AACxB,SAASA,wBAAwB,QAAQ,0CAAuC;AAEhF,SAASC,aAAa,QAAQ,+BAA4B;AAC1D,SAASC,sBAAsB,QAAQ,8BAA2B;AAClE,SAASC,oBAAoB,QAAQ,sCAAmC;AACxE,SAASC,eAAe,QAAQ,uBAAoB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["androidForegroundService","blePlxCentral","osBluetoothPermissions","reactNativeLifecycle","createBluetooth","HOLD"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,aAAU;AACxB,SAASA,wBAAwB,QAAQ,0CAAuC;AAEhF,SAASC,aAAa,QAAQ,+BAA4B;AAC1D,SAASC,sBAAsB,QAAQ,8BAA2B;AAClE,SAASC,oBAAoB,QAAQ,sCAAmC;AACxE,SAASC,eAAe,QAAQ,uBAAoB;AACpD,SAASC,IAAI,QAAQ,8BAA2B","ignoreList":[]}
|
|
@@ -9,4 +9,5 @@
|
|
|
9
9
|
export * from "../shared.js";
|
|
10
10
|
export { webBluetoothCentral } from "../adapters/web-bluetooth-central.js";
|
|
11
11
|
export { createWebBluetooth } from "./create-web-bluetooth.js";
|
|
12
|
+
export { HOLD } from "../adapters/chosen-patient.js";
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["webBluetoothCentral","createWebBluetooth"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/web/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,cAAW;AACzB,SAASA,mBAAmB,QAAQ,sCAAmC;AAEvE,SAASC,kBAAkB,QAAQ,2BAAwB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["webBluetoothCentral","createWebBluetooth","HOLD"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/web/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,cAAW;AACzB,SAASA,mBAAmB,QAAQ,sCAAmC;AAEvE,SAASC,kBAAkB,QAAQ,2BAAwB;AAC3D,SAASC,IAAI,QAAQ,+BAA4B","ignoreList":[]}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
+
import { DeviceSnapshot } from "../core/device-snapshot";
|
|
2
|
+
import { Reading } from "../core/reading";
|
|
3
|
+
/**
|
|
4
|
+
* What `savesFor` returns to keep a reading on the device, unsent, until `ovok.outbox.assign` names who was measured:
|
|
5
|
+
* for a shared monitor set to ask each time.
|
|
6
|
+
*/
|
|
7
|
+
declare const HOLD: unique symbol;
|
|
1
8
|
/**
|
|
2
9
|
* Names the patient a reading is saved for, when the person measuring isn't the patient (a clinician): read at every
|
|
3
|
-
* save, so it follows whoever is chosen now. `
|
|
10
|
+
* save, so it follows whoever is chosen now. `HOLD` keeps the reading until a patient is assigned, and `undefined`
|
|
11
|
+
* means nobody is chosen, so the reading is not saved.
|
|
4
12
|
*/
|
|
5
|
-
type SavesFor = () => string | undefined;
|
|
6
|
-
/** The patient `savesFor` names, or `undefined` for the signed-in patient or guest; throws when nobody is chosen. */
|
|
7
|
-
declare const chosenPatientOf: (savesFor: SavesFor | undefined) => string | undefined;
|
|
8
|
-
export { chosenPatientOf };
|
|
13
|
+
type SavesFor = (reading: Reading, device: DeviceSnapshot) => string | typeof HOLD | undefined;
|
|
14
|
+
/** The patient `savesFor` names, `HOLD`, or `undefined` for the signed-in patient or guest; throws when nobody is chosen. */
|
|
15
|
+
declare const chosenPatientOf: (savesFor: SavesFor | undefined, reading: Reading, device: DeviceSnapshot) => string | typeof HOLD | undefined;
|
|
16
|
+
export { chosenPatientOf, HOLD };
|
|
9
17
|
export type { SavesFor };
|
|
10
18
|
//# sourceMappingURL=chosen-patient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chosen-patient.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/chosen-patient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chosen-patient.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/chosen-patient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C;;;GAGG;AACH,QAAA,MAAM,IAAI,eAAsB,CAAC;AAEjC;;;;GAIG;AACH,KAAK,QAAQ,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,KAAK,MAAM,GAAG,OAAO,IAAI,GAAG,SAAS,CAAC;AAE/F,6HAA6H;AAC7H,QAAA,MAAM,eAAe,GAAI,UAAU,QAAQ,GAAG,SAAS,EAAE,SAAS,OAAO,EAAE,QAAQ,cAAc,KAAG,MAAM,GAAG,OAAO,IAAI,GAAG,SAY1H,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;AACjC,YAAY,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -5,7 +5,7 @@ import { SupersessionClient } from "./live-supersession";
|
|
|
5
5
|
type OvokSinkClient = SupersessionClient;
|
|
6
6
|
/**
|
|
7
7
|
* Saves readings through the Ovok measurements API, queueing them offline: for the signed-in account, or for the
|
|
8
|
-
* patient `savesFor` names
|
|
8
|
+
* patient `savesFor` names, or holds them when it returns `HOLD`. A reading with a series also saves it; a stored record then removes the live recordings it
|
|
9
9
|
* replaces, once it is saved.
|
|
10
10
|
*/
|
|
11
11
|
declare const ovokReadingSink: (client: OvokSinkClient, savesFor?: SavesFor) => ReadingSink;
|
package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ovok-reading-sink.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ovok-reading-sink.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/ovok-reading-sink.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ovok-reading-sink.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/ovok-reading-sink.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAyB,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAyB,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAiBhF,uHAAuH;AACvH,KAAK,cAAc,GAAG,kBAAkB,CAAC;AA+DzC;;;;GAIG;AACH,QAAA,MAAM,eAAe,GAAI,QAAQ,cAAc,EAAE,WAAW,QAAQ,KAAG,WA2BrE,CAAC;AAEH,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,YAAY,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Measurement } from "@ovok/core/next";
|
|
2
|
+
import { MeasurementType } from "../core/measurement-type";
|
|
3
|
+
import { Reading } from "../core/reading";
|
|
4
|
+
/** How each reading type becomes Ovok measurements, one for most and one per channel for an ECG; a type missing here cannot be saved yet. */
|
|
5
|
+
declare const MEASUREMENTS: Partial<Record<MeasurementType, (reading: Reading) => readonly Measurement[]>>;
|
|
6
|
+
export { MEASUREMENTS };
|
|
7
|
+
//# sourceMappingURL=reading-measurements.d.ts.map
|
package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/reading-measurements.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reading-measurements.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/reading-measurements.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,WAAW,EAKZ,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,eAAe,EAAc,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AA8G1C,6IAA6I;AAC7I,QAAA,MAAM,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,SAAS,WAAW,EAAE,CAAC,CAahG,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -26,6 +26,8 @@ declare const seriesObservationsOf: (field: SeriesField, { start, intervalMs, va
|
|
|
26
26
|
* saved for `patientId` when given, otherwise for the signed-in patient or the guest.
|
|
27
27
|
*/
|
|
28
28
|
declare const saveSeries: (client: SeriesClient, reading: SeriesReading, device: MeasurementDevice, patientId?: string) => Promise<SaveObservationsResult>;
|
|
29
|
-
|
|
29
|
+
/** Keeps a series on the device, naming the guest, until `ovok.outbox.assign` names the patient. */
|
|
30
|
+
declare const holdSeries: (client: SeriesClient, reading: SeriesReading, device: MeasurementDevice) => Promise<SaveObservationsResult>;
|
|
31
|
+
export { holdSeries, isSeriesReading, ownPatientId, saveSeries, seriesFieldOf, seriesObservationsOf };
|
|
30
32
|
export type { MeasurementDevice, SeriesClient };
|
|
31
33
|
//# sourceMappingURL=series-saving.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"series-saving.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/series-saving.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EAEvB,kBAAkB,EAClB,IAAI,EACJ,sBAAsB,EAEtB,uBAAuB,EACxB,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAKlD,KAAK,iBAAiB,GAAG,WAAW,CAAC,uBAA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AAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,oBAAoB,EAAE,CAAC;AACtG,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -11,6 +11,7 @@ export { blePlxCentral } from "./adapters/ble-plx-central";
|
|
|
11
11
|
export { osBluetoothPermissions } from "./adapters/os-permissions";
|
|
12
12
|
export { reactNativeLifecycle } from "./adapters/react-native-lifecycle";
|
|
13
13
|
export { createBluetooth } from "./create-bluetooth";
|
|
14
|
+
export { HOLD } from "./adapters/chosen-patient";
|
|
14
15
|
export type { SavesFor } from "./adapters/chosen-patient";
|
|
15
16
|
export type { CreateBluetoothOptions } from "./create-bluetooth";
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/next/bluetooth/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,YAAY,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC7G,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,YAAY,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/next/bluetooth/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,YAAY,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC7G,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,YAAY,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -8,6 +8,7 @@ export * from "../shared";
|
|
|
8
8
|
export { webBluetoothCentral } from "../adapters/web-bluetooth-central";
|
|
9
9
|
export type { WebBluetooth } from "../adapters/web-bluetooth-central";
|
|
10
10
|
export { createWebBluetooth } from "./create-web-bluetooth";
|
|
11
|
+
export { HOLD } from "../adapters/chosen-patient";
|
|
11
12
|
export type { SavesFor } from "../adapters/chosen-patient";
|
|
12
13
|
export type { CreateWebBluetoothOptions } from "./create-web-bluetooth";
|
|
13
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/web/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,YAAY,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,YAAY,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,YAAY,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/web/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,YAAY,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,YAAY,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,YAAY,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
+
import { DeviceSnapshot } from "../core/device-snapshot";
|
|
2
|
+
import { Reading } from "../core/reading";
|
|
3
|
+
/**
|
|
4
|
+
* What `savesFor` returns to keep a reading on the device, unsent, until `ovok.outbox.assign` names who was measured:
|
|
5
|
+
* for a shared monitor set to ask each time.
|
|
6
|
+
*/
|
|
7
|
+
declare const HOLD: unique symbol;
|
|
1
8
|
/**
|
|
2
9
|
* Names the patient a reading is saved for, when the person measuring isn't the patient (a clinician): read at every
|
|
3
|
-
* save, so it follows whoever is chosen now. `
|
|
10
|
+
* save, so it follows whoever is chosen now. `HOLD` keeps the reading until a patient is assigned, and `undefined`
|
|
11
|
+
* means nobody is chosen, so the reading is not saved.
|
|
4
12
|
*/
|
|
5
|
-
type SavesFor = () => string | undefined;
|
|
6
|
-
/** The patient `savesFor` names, or `undefined` for the signed-in patient or guest; throws when nobody is chosen. */
|
|
7
|
-
declare const chosenPatientOf: (savesFor: SavesFor | undefined) => string | undefined;
|
|
8
|
-
export { chosenPatientOf };
|
|
13
|
+
type SavesFor = (reading: Reading, device: DeviceSnapshot) => string | typeof HOLD | undefined;
|
|
14
|
+
/** The patient `savesFor` names, `HOLD`, or `undefined` for the signed-in patient or guest; throws when nobody is chosen. */
|
|
15
|
+
declare const chosenPatientOf: (savesFor: SavesFor | undefined, reading: Reading, device: DeviceSnapshot) => string | typeof HOLD | undefined;
|
|
16
|
+
export { chosenPatientOf, HOLD };
|
|
9
17
|
export type { SavesFor };
|
|
10
18
|
//# sourceMappingURL=chosen-patient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chosen-patient.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/chosen-patient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chosen-patient.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/chosen-patient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C;;;GAGG;AACH,QAAA,MAAM,IAAI,eAAsB,CAAC;AAEjC;;;;GAIG;AACH,KAAK,QAAQ,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,KAAK,MAAM,GAAG,OAAO,IAAI,GAAG,SAAS,CAAC;AAE/F,6HAA6H;AAC7H,QAAA,MAAM,eAAe,GAAI,UAAU,QAAQ,GAAG,SAAS,EAAE,SAAS,OAAO,EAAE,QAAQ,cAAc,KAAG,MAAM,GAAG,OAAO,IAAI,GAAG,SAY1H,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;AACjC,YAAY,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -5,7 +5,7 @@ import { SupersessionClient } from "./live-supersession";
|
|
|
5
5
|
type OvokSinkClient = SupersessionClient;
|
|
6
6
|
/**
|
|
7
7
|
* Saves readings through the Ovok measurements API, queueing them offline: for the signed-in account, or for the
|
|
8
|
-
* patient `savesFor` names
|
|
8
|
+
* patient `savesFor` names, or holds them when it returns `HOLD`. A reading with a series also saves it; a stored record then removes the live recordings it
|
|
9
9
|
* replaces, once it is saved.
|
|
10
10
|
*/
|
|
11
11
|
declare const ovokReadingSink: (client: OvokSinkClient, savesFor?: SavesFor) => ReadingSink;
|