@ovok/core 0.4.39 → 0.4.40
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 +10 -0
- package/dist/client/observation/measurement-fields.js +12 -0
- package/dist/client/observation/services/base-observation-service.d.ts +2 -0
- package/dist/client/observation/services/base-observation-service.js +9 -0
- package/dist/client/observation/services/creator.d.ts +2 -0
- package/dist/client/observation/services/creator.js +4 -0
- package/dist/client/observation/types/IObservationService.d.ts +3 -0
- package/dist/client/observation/types/service/MeasurementField.d.ts +11 -0
- package/dist/client/observation/types/service/MeasurementField.js +2 -0
- package/dist/conformance/capability-requirements.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MeasurementTypeKey } from "../../types";
|
|
2
|
+
import { MeasurementField } from "./types/service/MeasurementField";
|
|
3
|
+
/**
|
|
4
|
+
* For each measurement type the SDK stores, its properties as their Observations store them: the
|
|
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 none: their
|
|
7
|
+
* values are components rather than fixed properties (see `URINE_ANALYTE_DEFINITIONS` for urine).
|
|
8
|
+
*/
|
|
9
|
+
export declare const MEASUREMENT_FIELDS: Readonly<Partial<Record<MeasurementTypeKey, readonly MeasurementField[]>>>;
|
|
10
|
+
export type { MeasurementField };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MEASUREMENT_FIELDS = void 0;
|
|
4
|
+
const creator_1 = require("./services/creator");
|
|
5
|
+
const services = creator_1.ObservationServiceCreator.getInstance();
|
|
6
|
+
/**
|
|
7
|
+
* For each measurement type the SDK stores, its properties as their Observations store them: the
|
|
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 none: their
|
|
10
|
+
* values are components rather than fixed properties (see `URINE_ANALYTE_DEFINITIONS` for urine).
|
|
11
|
+
*/
|
|
12
|
+
exports.MEASUREMENT_FIELDS = Object.fromEntries(services.getTypes().map((type) => [type, services.getService(type).getFields()]));
|
|
@@ -5,6 +5,7 @@ import { Sample } from "../types/generate-measurement/Sample";
|
|
|
5
5
|
import { ObservationValue } from "../types/generate-observation-body/ObservationValue";
|
|
6
6
|
import { IObservationService } from "../types/IObservationService";
|
|
7
7
|
import { Measurement } from "../types/measurement/Measurement";
|
|
8
|
+
import { MeasurementField } from "../types/service/MeasurementField";
|
|
8
9
|
import { ObservationMetadata } from "../types/service/ObservationMetadata";
|
|
9
10
|
export declare abstract class BaseObservationService<T extends Measurement> implements IObservationService {
|
|
10
11
|
protected abstract observationMetadata: ObservationMetadata<T>[];
|
|
@@ -12,6 +13,7 @@ export declare abstract class BaseObservationService<T extends Measurement> impl
|
|
|
12
13
|
protected abstract measurementTypeName: string;
|
|
13
14
|
abstract convertSamplesToMeasurement(samples: Sample[]): T;
|
|
14
15
|
abstract convertRecordToMeasurement(record: RecordResult<RecordType>): T;
|
|
16
|
+
getFields(): MeasurementField[];
|
|
15
17
|
protected getCastedMeasurement(measurement: Measurement): T;
|
|
16
18
|
generateValues(measurement: Measurement): ObservationValue[];
|
|
17
19
|
getObservationCodes(): CodeableConcept[];
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.BaseObservationService = void 0;
|
|
4
4
|
const fhir_systems_1 = require("../fhir-systems");
|
|
5
5
|
class BaseObservationService {
|
|
6
|
+
getFields() {
|
|
7
|
+
return this.observationMetadata.map(({ valueKey, primaryCode, unit, toFixed, display }) => ({
|
|
8
|
+
key: String(valueKey),
|
|
9
|
+
code: primaryCode,
|
|
10
|
+
unit,
|
|
11
|
+
decimals: toFixed,
|
|
12
|
+
display,
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
6
15
|
getCastedMeasurement(measurement) {
|
|
7
16
|
if (measurement.measurementTypeKey !== this.measurementTypeKey) {
|
|
8
17
|
throw new Error(`Measurement is not a ${this.measurementTypeName} measurement`);
|
|
@@ -5,5 +5,7 @@ export declare class ObservationServiceCreator {
|
|
|
5
5
|
private readonly services;
|
|
6
6
|
private constructor();
|
|
7
7
|
static getInstance(): ObservationServiceCreator;
|
|
8
|
+
/** The measurement types the SDK turns into Observations. */
|
|
9
|
+
getTypes(): MeasurementTypeKey[];
|
|
8
10
|
getService(type: MeasurementTypeKey): IObservationService;
|
|
9
11
|
}
|
|
@@ -32,6 +32,10 @@ class ObservationServiceCreator {
|
|
|
32
32
|
}
|
|
33
33
|
return ObservationServiceCreator.instance;
|
|
34
34
|
}
|
|
35
|
+
/** The measurement types the SDK turns into Observations. */
|
|
36
|
+
getTypes() {
|
|
37
|
+
return [...this.services.keys()];
|
|
38
|
+
}
|
|
35
39
|
getService(type) {
|
|
36
40
|
const service = this.services.get(type);
|
|
37
41
|
if (!service) {
|
|
@@ -4,12 +4,15 @@ import { Sample } from "./generate-measurement/Sample";
|
|
|
4
4
|
import { ObservationFragment } from "./generate-observation-body/ObservationFragment";
|
|
5
5
|
import { ObservationValue } from "./generate-observation-body/ObservationValue";
|
|
6
6
|
import { Measurement } from "./measurement/Measurement";
|
|
7
|
+
import { MeasurementField } from "./service/MeasurementField";
|
|
7
8
|
export interface IObservationService {
|
|
8
9
|
generateValues: (measurement: Measurement) => ObservationValue[];
|
|
9
10
|
generateObservationFragments?: (measurement: Measurement) => ObservationFragment[];
|
|
10
11
|
getObservationCodes: () => CodeableConcept[];
|
|
11
12
|
getAdditionalProperties: (measurement: Measurement) => Partial<Observation>[];
|
|
12
13
|
getUnits: () => string[];
|
|
14
|
+
/** The measurement's properties as their Observations store them; the first is the main one. */
|
|
15
|
+
getFields: () => MeasurementField[];
|
|
13
16
|
getMeasurementDisplay: (measurement: Measurement) => string;
|
|
14
17
|
getObservationDisplay: (observations: Observation[]) => string | undefined;
|
|
15
18
|
convertSamplesToMeasurement: (samples: Sample[]) => Measurement;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** One property of a measurement, as its Observation stores it. */
|
|
2
|
+
export type MeasurementField = {
|
|
3
|
+
/** The property on the measurement: `systolic`, `bloodGlucose`, … */
|
|
4
|
+
key: string;
|
|
5
|
+
/** The code (LOINC) of the Observation that carries it. */
|
|
6
|
+
code: string;
|
|
7
|
+
unit: string;
|
|
8
|
+
/** The decimal places the SDK keeps when it writes the value. */
|
|
9
|
+
decimals: number;
|
|
10
|
+
display: string;
|
|
11
|
+
};
|
|
@@ -48,7 +48,7 @@ exports.OVOK_CORE_REQUIREMENTS = {
|
|
|
48
48
|
description: "The FHIR surface a server must provide for the @ovok/core client library's own methods to function.",
|
|
49
49
|
software: {
|
|
50
50
|
name: "@ovok/core",
|
|
51
|
-
version: "0.4.
|
|
51
|
+
version: "0.4.40",
|
|
52
52
|
},
|
|
53
53
|
fhirVersion: "4.0.1",
|
|
54
54
|
format: ["json"],
|
package/dist/index.d.ts
CHANGED
|
@@ -940,6 +940,7 @@ export * from "./hooks";
|
|
|
940
940
|
export * from "./utils";
|
|
941
941
|
export * from "./client/observation/services";
|
|
942
942
|
export * from "./client/observation/methods";
|
|
943
|
+
export * from "./client/observation/measurement-fields";
|
|
943
944
|
export { saveMeasurement } from "./client/observation/methods/saveMeasurement";
|
|
944
945
|
export * from "./conformance/capability-requirements";
|
|
945
946
|
export * from "./conformance/api-requirements";
|
package/dist/index.js
CHANGED
|
@@ -58,6 +58,7 @@ __exportStar(require("./hooks"), exports);
|
|
|
58
58
|
__exportStar(require("./utils"), exports);
|
|
59
59
|
__exportStar(require("./client/observation/services"), exports);
|
|
60
60
|
__exportStar(require("./client/observation/methods"), exports);
|
|
61
|
+
__exportStar(require("./client/observation/measurement-fields"), exports);
|
|
61
62
|
var saveMeasurement_1 = require("./client/observation/methods/saveMeasurement");
|
|
62
63
|
Object.defineProperty(exports, "saveMeasurement", { enumerable: true, get: function () { return saveMeasurement_1.saveMeasurement; } });
|
|
63
64
|
__exportStar(require("./conformance/capability-requirements"), exports);
|