@ovok/core 0.4.49-dev.528 → 0.4.49-dev.530
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/dist/client/observation/measurement-fields.d.ts +3 -2
- package/dist/client/observation/measurement-fields.js +3 -2
- package/dist/client/observation/services/creator.js +2 -0
- package/dist/client/observation/services/spirometry.d.ts +22 -0
- package/dist/client/observation/services/spirometry.js +96 -0
- package/dist/client/observation/types/ObservationCode.d.ts +18 -0
- package/dist/client/observation/types/ObservationCode.js +18 -0
- package/dist/client/observation/types/measurement/SpirometryMeasurement.d.ts +22 -37
- package/dist/conformance/capability-requirements.js +1 -1
- package/package.json +1 -1
|
@@ -3,8 +3,9 @@ import { MeasurementField } from "./types/service/MeasurementField";
|
|
|
3
3
|
/**
|
|
4
4
|
* For each measurement type the SDK stores, its properties as their Observations store them: the
|
|
5
5
|
* code (LOINC), unit and decimals of each, the main one first. Apps read codes and units here rather
|
|
6
|
-
* than keeping their own table. Lipid panels, respiratory therapy and baby sleep list
|
|
7
|
-
* values are components rather than fixed properties (see `URINE_ANALYTE_DEFINITIONS`
|
|
6
|
+
* than keeping their own table. Lipid panels, spirometry, respiratory therapy and baby sleep list
|
|
7
|
+
* none: their values are components rather than fixed properties (see `URINE_ANALYTE_DEFINITIONS`
|
|
8
|
+
* for urine).
|
|
8
9
|
*/
|
|
9
10
|
export declare const MEASUREMENT_FIELDS: Readonly<Partial<Record<MeasurementTypeKey, readonly MeasurementField[]>>>;
|
|
10
11
|
export type { MeasurementField };
|
|
@@ -6,7 +6,8 @@ const services = creator_1.ObservationServiceCreator.getInstance();
|
|
|
6
6
|
/**
|
|
7
7
|
* For each measurement type the SDK stores, its properties as their Observations store them: the
|
|
8
8
|
* code (LOINC), unit and decimals of each, the main one first. Apps read codes and units here rather
|
|
9
|
-
* than keeping their own table. Lipid panels, respiratory therapy and baby sleep list
|
|
10
|
-
* values are components rather than fixed properties (see `URINE_ANALYTE_DEFINITIONS`
|
|
9
|
+
* than keeping their own table. Lipid panels, spirometry, respiratory therapy and baby sleep list
|
|
10
|
+
* none: their values are components rather than fixed properties (see `URINE_ANALYTE_DEFINITIONS`
|
|
11
|
+
* for urine).
|
|
11
12
|
*/
|
|
12
13
|
exports.MEASUREMENT_FIELDS = Object.fromEntries(services.getTypes().map((type) => [type, services.getService(type).getFields()]));
|
|
@@ -8,6 +8,7 @@ const component_observation_services_1 = require("./component-observation-servic
|
|
|
8
8
|
const ecg_1 = require("./ecg");
|
|
9
9
|
const lipid_panel_1 = require("./lipid-panel");
|
|
10
10
|
const single_value_services_1 = require("./single-value-services");
|
|
11
|
+
const spirometry_1 = require("./spirometry");
|
|
11
12
|
const step_count_1 = require("./step-count");
|
|
12
13
|
const uric_acid_service_1 = require("./uric-acid-service");
|
|
13
14
|
/**
|
|
@@ -25,6 +26,7 @@ class ObservationServiceCreator {
|
|
|
25
26
|
[MeasurementTypes_1.MeasurementTypeKey.urineAnalysis, uricAcid],
|
|
26
27
|
[MeasurementTypes_1.MeasurementTypeKey.uricAcid, uricAcid],
|
|
27
28
|
[MeasurementTypes_1.MeasurementTypeKey.lipidPanel, new lipid_panel_1.LipidPanelService()],
|
|
29
|
+
[MeasurementTypes_1.MeasurementTypeKey.spirometryPanel, new spirometry_1.SpirometryService()],
|
|
28
30
|
[MeasurementTypes_1.MeasurementTypeKey.respiratoryTherapy, (0, component_observation_services_1.respiratoryTherapyService)()],
|
|
29
31
|
[MeasurementTypes_1.MeasurementTypeKey.babySleep, (0, component_observation_services_1.babySleepService)()],
|
|
30
32
|
]);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CodeableConcept, Observation } from "@medplum/fhirtypes";
|
|
2
|
+
import { Measurement, MeasurementTypeKey, SpirometryMeasurement } from "../../../types/MeasurementTypes";
|
|
3
|
+
import { RecordResult, RecordType } from "../types/generate-measurement/HealthConnectTypes";
|
|
4
|
+
import { Sample } from "../types/generate-measurement/Sample";
|
|
5
|
+
import { ObservationFragment } from "../types/generate-observation-body/ObservationFragment";
|
|
6
|
+
import { ObservationValue } from "../types/generate-observation-body/ObservationValue";
|
|
7
|
+
import { ObservationMetadata } from "../types/service/ObservationMetadata";
|
|
8
|
+
import { BaseObservationService } from "./base-observation-service";
|
|
9
|
+
export declare class SpirometryService extends BaseObservationService<SpirometryMeasurement> {
|
|
10
|
+
protected measurementTypeKey: MeasurementTypeKey;
|
|
11
|
+
protected measurementTypeName: string;
|
|
12
|
+
protected observationMetadata: ObservationMetadata<SpirometryMeasurement>[];
|
|
13
|
+
generateObservationFragments(measurement: Measurement): ObservationFragment[];
|
|
14
|
+
getObservationCodes(): CodeableConcept[];
|
|
15
|
+
getAdditionalProperties(measurement: Measurement): Partial<Observation>[];
|
|
16
|
+
generateValues(_measurement: Measurement): ObservationValue[];
|
|
17
|
+
getUnits(): string[];
|
|
18
|
+
getMeasurementDisplay(measurement: Measurement): string;
|
|
19
|
+
getObservationDisplay(observations: Observation[]): string | undefined;
|
|
20
|
+
convertSamplesToMeasurement(_samples: Sample[]): SpirometryMeasurement;
|
|
21
|
+
convertRecordToMeasurement(_record: RecordResult<RecordType>): SpirometryMeasurement;
|
|
22
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SpirometryService = void 0;
|
|
4
|
+
const MeasurementTypes_1 = require("../../../types/MeasurementTypes");
|
|
5
|
+
const fhir_systems_1 = require("../fhir-systems");
|
|
6
|
+
const base_observation_service_1 = require("./base-observation-service");
|
|
7
|
+
const measurement_time_1 = require("./measurement-time");
|
|
8
|
+
const LITRES = "L";
|
|
9
|
+
const LITRES_PER_SECOND = "L/s";
|
|
10
|
+
const PERCENT = "%";
|
|
11
|
+
const COMPONENTS = [
|
|
12
|
+
{ key: "fvc", display: "FVC", code: MeasurementTypes_1.ObservationCode.FVC, unit: LITRES },
|
|
13
|
+
{ key: "fev1", display: "FEV1", code: MeasurementTypes_1.ObservationCode.FEV1, unit: LITRES },
|
|
14
|
+
{ key: "fev0.5", display: "FEV0.5", code: MeasurementTypes_1.ObservationCode.FEV0_5, unit: LITRES },
|
|
15
|
+
{ key: "fev1/fvc", display: "FEV1/FVC", code: MeasurementTypes_1.ObservationCode.FEV1_FVC_RATIO, unit: PERCENT },
|
|
16
|
+
{ key: "pef", display: "PEF", code: MeasurementTypes_1.ObservationCode.PEF, unit: LITRES_PER_SECOND },
|
|
17
|
+
{ key: "fef25", display: "FEF25", code: MeasurementTypes_1.ObservationCode.FEF25, unit: LITRES_PER_SECOND },
|
|
18
|
+
{ key: "fef50", display: "FEF50", code: MeasurementTypes_1.ObservationCode.FEF50, unit: LITRES_PER_SECOND },
|
|
19
|
+
{ key: "fef75", display: "FEF75", code: MeasurementTypes_1.ObservationCode.FEF75, unit: LITRES_PER_SECOND },
|
|
20
|
+
{ key: "fef2575", display: "FEF25-75", code: MeasurementTypes_1.ObservationCode.FEF25_75, unit: LITRES_PER_SECOND },
|
|
21
|
+
];
|
|
22
|
+
const PANEL_CODE = {
|
|
23
|
+
coding: [{
|
|
24
|
+
code: MeasurementTypes_1.ObservationCode.SPIROMETRY_PANEL,
|
|
25
|
+
display: "PhenX - respiratory - spirometry protocol 091601",
|
|
26
|
+
system: fhir_systems_1.LOINC_SYSTEM,
|
|
27
|
+
}],
|
|
28
|
+
};
|
|
29
|
+
class SpirometryService extends base_observation_service_1.BaseObservationService {
|
|
30
|
+
constructor() {
|
|
31
|
+
super(...arguments);
|
|
32
|
+
this.measurementTypeKey = MeasurementTypes_1.MeasurementTypeKey.spirometryPanel;
|
|
33
|
+
this.measurementTypeName = "spirometry";
|
|
34
|
+
this.observationMetadata = [];
|
|
35
|
+
}
|
|
36
|
+
generateObservationFragments(measurement) {
|
|
37
|
+
const spirometry = this.getCastedMeasurement(measurement);
|
|
38
|
+
const components = COMPONENTS.flatMap(({ key, display, code, unit }) => {
|
|
39
|
+
const value = spirometry[key];
|
|
40
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
return [{
|
|
44
|
+
code: { coding: [{ code, display, system: fhir_systems_1.LOINC_SYSTEM }], text: display },
|
|
45
|
+
valueQuantity: { value, unit, code: unit, system: fhir_systems_1.UCUM_SYSTEM },
|
|
46
|
+
}];
|
|
47
|
+
});
|
|
48
|
+
if (components.length === 0) {
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
return [{
|
|
52
|
+
code: PANEL_CODE,
|
|
53
|
+
additionalProperties: {
|
|
54
|
+
effectiveDateTime: (0, measurement_time_1.recordedAtOrNow)(spirometry).toISOString(),
|
|
55
|
+
component: components,
|
|
56
|
+
},
|
|
57
|
+
}];
|
|
58
|
+
}
|
|
59
|
+
getObservationCodes() {
|
|
60
|
+
return [PANEL_CODE];
|
|
61
|
+
}
|
|
62
|
+
getAdditionalProperties(measurement) {
|
|
63
|
+
return [{ effectiveDateTime: (0, measurement_time_1.recordedAtOrNow)(this.getCastedMeasurement(measurement)).toISOString() }];
|
|
64
|
+
}
|
|
65
|
+
generateValues(_measurement) {
|
|
66
|
+
return [];
|
|
67
|
+
}
|
|
68
|
+
getUnits() {
|
|
69
|
+
return [LITRES, LITRES_PER_SECOND, PERCENT];
|
|
70
|
+
}
|
|
71
|
+
getMeasurementDisplay(measurement) {
|
|
72
|
+
const spirometry = this.getCastedMeasurement(measurement);
|
|
73
|
+
return COMPONENTS.flatMap(({ key, display, unit }) => {
|
|
74
|
+
const value = spirometry[key];
|
|
75
|
+
return value === undefined ? [] : [`${display}: ${value} ${unit}`];
|
|
76
|
+
}).join(", ");
|
|
77
|
+
}
|
|
78
|
+
getObservationDisplay(observations) {
|
|
79
|
+
const components = observations.flatMap((observation) => { var _a; return (_a = observation.component) !== null && _a !== void 0 ? _a : []; });
|
|
80
|
+
const values = components.flatMap(({ code, valueQuantity }) => {
|
|
81
|
+
var _a, _b, _c;
|
|
82
|
+
const display = (_a = code.text) !== null && _a !== void 0 ? _a : (_c = (_b = code.coding) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.display;
|
|
83
|
+
return display && typeof (valueQuantity === null || valueQuantity === void 0 ? void 0 : valueQuantity.value) === "number"
|
|
84
|
+
? [`${display}: ${valueQuantity.value} ${valueQuantity.unit}`]
|
|
85
|
+
: [];
|
|
86
|
+
});
|
|
87
|
+
return values.length ? values.join(", ") : undefined;
|
|
88
|
+
}
|
|
89
|
+
convertSamplesToMeasurement(_samples) {
|
|
90
|
+
throw new Error("Spirometry samples are not supported.");
|
|
91
|
+
}
|
|
92
|
+
convertRecordToMeasurement(_record) {
|
|
93
|
+
throw new Error("Spirometry Health Connect records are not supported.");
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.SpirometryService = SpirometryService;
|
|
@@ -44,6 +44,24 @@ export declare enum ObservationCode {
|
|
|
44
44
|
RESPIRATORY_RATE = "9279-1",
|
|
45
45
|
/** Spirometry panel. */
|
|
46
46
|
SPIROMETRY_PANEL = "62639-0",
|
|
47
|
+
/** Forced vital capacity (FVC). */
|
|
48
|
+
FVC = "19870-5",
|
|
49
|
+
/** Forced expiratory volume in 1 second (FEV1). */
|
|
50
|
+
FEV1 = "20150-9",
|
|
51
|
+
/** Forced expiratory volume in 0.5 seconds (FEV0.5). */
|
|
52
|
+
FEV0_5 = "20148-3",
|
|
53
|
+
/** FEV1 to FVC ratio. */
|
|
54
|
+
FEV1_FVC_RATIO = "19926-5",
|
|
55
|
+
/** Peak expiratory flow (PEF). */
|
|
56
|
+
PEF = "33452-4",
|
|
57
|
+
/** Forced expiratory flow at 25% of FVC (FEF25). */
|
|
58
|
+
FEF25 = "65821-1",
|
|
59
|
+
/** Forced expiratory flow at 50% of FVC (FEF50). */
|
|
60
|
+
FEF50 = "65822-9",
|
|
61
|
+
/** Forced expiratory flow at 75% of FVC (FEF75). */
|
|
62
|
+
FEF75 = "65823-7",
|
|
63
|
+
/** Forced expiratory flow between 25% and 75% of FVC (FEF25-75). */
|
|
64
|
+
FEF25_75 = "19927-3",
|
|
47
65
|
/** Heart rate variability. */
|
|
48
66
|
HEART_RATE_VARIABILITY = "80404-7",
|
|
49
67
|
/** VO2 max. */
|
|
@@ -48,6 +48,24 @@ var ObservationCode;
|
|
|
48
48
|
ObservationCode["RESPIRATORY_RATE"] = "9279-1";
|
|
49
49
|
/** Spirometry panel. */
|
|
50
50
|
ObservationCode["SPIROMETRY_PANEL"] = "62639-0";
|
|
51
|
+
/** Forced vital capacity (FVC). */
|
|
52
|
+
ObservationCode["FVC"] = "19870-5";
|
|
53
|
+
/** Forced expiratory volume in 1 second (FEV1). */
|
|
54
|
+
ObservationCode["FEV1"] = "20150-9";
|
|
55
|
+
/** Forced expiratory volume in 0.5 seconds (FEV0.5). */
|
|
56
|
+
ObservationCode["FEV0_5"] = "20148-3";
|
|
57
|
+
/** FEV1 to FVC ratio. */
|
|
58
|
+
ObservationCode["FEV1_FVC_RATIO"] = "19926-5";
|
|
59
|
+
/** Peak expiratory flow (PEF). */
|
|
60
|
+
ObservationCode["PEF"] = "33452-4";
|
|
61
|
+
/** Forced expiratory flow at 25% of FVC (FEF25). */
|
|
62
|
+
ObservationCode["FEF25"] = "65821-1";
|
|
63
|
+
/** Forced expiratory flow at 50% of FVC (FEF50). */
|
|
64
|
+
ObservationCode["FEF50"] = "65822-9";
|
|
65
|
+
/** Forced expiratory flow at 75% of FVC (FEF75). */
|
|
66
|
+
ObservationCode["FEF75"] = "65823-7";
|
|
67
|
+
/** Forced expiratory flow between 25% and 75% of FVC (FEF25-75). */
|
|
68
|
+
ObservationCode["FEF25_75"] = "19927-3";
|
|
51
69
|
/** Heart rate variability. */
|
|
52
70
|
ObservationCode["HEART_RATE_VARIABILITY"] = "80404-7";
|
|
53
71
|
/** VO2 max. */
|
|
@@ -1,44 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MeasurementTypeKey } from "../MeasurementTypeKey";
|
|
2
2
|
import { Measurement } from "./Measurement";
|
|
3
3
|
/**
|
|
4
|
-
* Spirometry measurement
|
|
4
|
+
* Spirometry measurement: volumes in L, flows in L/s and the FEV1/FVC ratio in %.
|
|
5
5
|
*
|
|
6
6
|
* @category measurements
|
|
7
7
|
*/
|
|
8
8
|
export type SpirometryMeasurement = Measurement & {
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
/** Forced
|
|
12
|
-
|
|
13
|
-
/** Forced expiratory volume in
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
"
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
/** Forced expiratory flow at
|
|
22
|
-
|
|
23
|
-
/** Forced expiratory flow at
|
|
24
|
-
|
|
25
|
-
/** Forced expiratory flow
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
|
|
9
|
+
/** Always `spirometryPanel`. */
|
|
10
|
+
measurementTypeKey: MeasurementTypeKey.spirometryPanel;
|
|
11
|
+
/** Forced vital capacity, in L. */
|
|
12
|
+
fvc?: number;
|
|
13
|
+
/** Forced expiratory volume in 1 second, in L. */
|
|
14
|
+
fev1?: number;
|
|
15
|
+
/** Forced expiratory volume in 0.5 seconds, in L. */
|
|
16
|
+
"fev0.5"?: number;
|
|
17
|
+
/** FEV1 to FVC ratio, in %. */
|
|
18
|
+
"fev1/fvc"?: number;
|
|
19
|
+
/** Peak expiratory flow, in L/s. */
|
|
20
|
+
pef?: number;
|
|
21
|
+
/** Forced expiratory flow at 25% of FVC, in L/s. */
|
|
22
|
+
fef25?: number;
|
|
23
|
+
/** Forced expiratory flow at 50% of FVC, in L/s. */
|
|
24
|
+
fef50?: number;
|
|
25
|
+
/** Forced expiratory flow at 75% of FVC, in L/s. */
|
|
26
|
+
fef75?: number;
|
|
27
|
+
/** Forced expiratory flow between 25% and 75% of FVC, in L/s. */
|
|
28
|
+
fef2575?: number;
|
|
29
29
|
};
|
|
30
|
-
/**
|
|
31
|
-
* One coded spirometer value.
|
|
32
|
-
*
|
|
33
|
-
* @category measurements
|
|
34
|
-
*/
|
|
35
|
-
type SpirometerValue = {
|
|
36
|
-
/** Code identifying the value. */
|
|
37
|
-
code: CodeableConcept;
|
|
38
|
-
/** The value. */
|
|
39
|
-
value?: {
|
|
40
|
-
/** Value as a string. */
|
|
41
|
-
string: string;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
export {};
|
|
@@ -26,7 +26,7 @@ exports.OVOK_CORE_REQUIREMENTS = {
|
|
|
26
26
|
description: "The FHIR surface a server must provide for the @ovok/core client library's own methods to function.",
|
|
27
27
|
software: {
|
|
28
28
|
name: "@ovok/core",
|
|
29
|
-
version: "0.4.49-dev.
|
|
29
|
+
version: "0.4.49-dev.530+a261ce3",
|
|
30
30
|
},
|
|
31
31
|
fhirVersion: "4.0.1",
|
|
32
32
|
format: ["json"],
|