@ovok/core 0.4.16 → 0.4.18

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.
@@ -1,15 +1,13 @@
1
- import { ProfileResource } from "@medplum/core";
2
- import { Project, Reference } from "@medplum/fhirtypes";
3
1
  export type AuthResponse = {
4
2
  accessToken: string;
5
3
  refreshToken: string;
6
4
  expiresIn: number;
7
5
  profile: {
8
- reference: Reference<ProfileResource>;
6
+ reference: string;
9
7
  display: string;
10
8
  };
11
9
  project: {
12
- reference: Reference<Project>;
10
+ reference: string;
13
11
  display: string;
14
12
  };
15
13
  };
@@ -15,5 +15,7 @@ async function getLatestObservationsByCodes(params) {
15
15
  patient: `Patient/${patientId}`,
16
16
  ...(params.date ? { date: `ge${params.date}` } : {}),
17
17
  });
18
- return this.get(`/fhir/Observation/$lastn?${urlParams.toString()}`);
18
+ return this.get(`/fhir/Observation/$lastn?${urlParams.toString()}`, {
19
+ cache: "no-cache",
20
+ });
19
21
  }
@@ -13,6 +13,21 @@ const valueOf = (observation) => {
13
13
  const value = (_a = observation.valueQuantity) === null || _a === void 0 ? void 0 : _a.value;
14
14
  return typeof value === "number" ? value : undefined;
15
15
  };
16
+ const irregularHeartbeatOf = (observations) => {
17
+ var _a, _b, _c;
18
+ const rhythm = observations.find((observation) => {
19
+ var _a, _b;
20
+ return (_b = (_a = observation.code) === null || _a === void 0 ? void 0 : _a.coding) === null || _b === void 0 ? void 0 : _b.some((coding) => coding.system === types_1.PulseRhythmCoding.system &&
21
+ coding.code === types_1.PulseRhythmCoding.observation);
22
+ });
23
+ const result = (_c = (_b = (_a = rhythm === null || rhythm === void 0 ? void 0 : rhythm.valueCodeableConcept) === null || _a === void 0 ? void 0 : _a.coding) === null || _b === void 0 ? void 0 : _b.find((coding) => coding.system === types_1.PulseRhythmCoding.system)) === null || _c === void 0 ? void 0 : _c.code;
24
+ if (result === types_1.PulseRhythmCoding.irregular ||
25
+ result === types_1.PulseRhythmCoding.irregularlyIrregular ||
26
+ result === types_1.PulseRhythmCoding.regularlyIrregular) {
27
+ return true;
28
+ }
29
+ return result === types_1.PulseRhythmCoding.regular ? false : undefined;
30
+ };
16
31
  const recordedAtOf = (observation) => {
17
32
  var _a, _b;
18
33
  const value = (_a = observation.effectiveDateTime) !== null && _a !== void 0 ? _a : (_b = observation.effectivePeriod) === null || _b === void 0 ? void 0 : _b.start;
@@ -263,6 +278,7 @@ const inverseGroup = (type, observations) => {
263
278
  diastolic: value(types_1.ObservationCode.DIASTOLIC_BLOOD_PRESSURE),
264
279
  meanArterialPressure: value(types_1.ObservationCode.MEAN_BLOOD_PRESSURE),
265
280
  heartRate: value(types_1.ObservationCode.BLOOD_PRESSURE_HEART_RATE),
281
+ irregularHeartbeat: irregularHeartbeatOf(observations),
266
282
  };
267
283
  case types_1.MeasurementTypeKey.bloodGlucose:
268
284
  return { ...measurement, measurementTypeKey: type, bloodGlucose: value(types_1.ObservationCode.BLOOD_GLUCOSE) };
@@ -395,7 +411,7 @@ const inverseGroup = (type, observations) => {
395
411
  }
396
412
  };
397
413
  const codesForType = {
398
- [types_1.MeasurementTypeKey.bloodPressure]: [types_1.ObservationCode.SYSTOLIC_BLOOD_PRESSURE, types_1.ObservationCode.DIASTOLIC_BLOOD_PRESSURE, types_1.ObservationCode.MEAN_BLOOD_PRESSURE, types_1.ObservationCode.BLOOD_PRESSURE_HEART_RATE],
414
+ [types_1.MeasurementTypeKey.bloodPressure]: [types_1.ObservationCode.SYSTOLIC_BLOOD_PRESSURE, types_1.ObservationCode.DIASTOLIC_BLOOD_PRESSURE, types_1.ObservationCode.MEAN_BLOOD_PRESSURE, types_1.ObservationCode.BLOOD_PRESSURE_HEART_RATE, types_1.PulseRhythmCoding.observation],
399
415
  [types_1.MeasurementTypeKey.bloodGlucose]: [types_1.ObservationCode.BLOOD_GLUCOSE],
400
416
  [types_1.MeasurementTypeKey.bodyWeight]: [types_1.ObservationCode.BODY_WEIGHT],
401
417
  [types_1.MeasurementTypeKey.temperature]: [types_1.ObservationCode.BODY_TEMPERATURE],
@@ -1,13 +1,17 @@
1
- import { Observation } from "@medplum/fhirtypes";
1
+ import { CodeableConcept, Observation } from "@medplum/fhirtypes";
2
2
  import { BloodPressureMeasurement, Measurement, MeasurementTypeKey } from "../../../types";
3
3
  import { RecordResult, RecordType } from "../types/generate-measurement/HealthConnectTypes";
4
4
  import { Sample } from "../types/generate-measurement/Sample";
5
+ import { ObservationValue } from "../types/generate-observation-body/ObservationValue";
5
6
  import { ObservationMetadata } from "../types/service/ObservationMetadata";
6
7
  import { BaseObservationService } from "./base-observation-service";
7
8
  export declare class BloodPressureService extends BaseObservationService<BloodPressureMeasurement> {
8
9
  protected measurementTypeKey: MeasurementTypeKey;
9
10
  protected measurementTypeName: string;
10
11
  protected observationMetadata: ObservationMetadata<BloodPressureMeasurement>[];
12
+ getObservationCodes(): CodeableConcept[];
13
+ generateValues(measurement: Measurement): ObservationValue[];
14
+ getAdditionalProperties(measurement: Measurement): Partial<Observation>[];
11
15
  getMeasurementDisplay(measurement: Measurement): string;
12
16
  getObservationDisplay(observations: Observation[]): string | undefined;
13
17
  convertSamplesToMeasurement(samples: Sample[]): BloodPressureMeasurement;
@@ -46,6 +46,48 @@ class BloodPressureService extends base_observation_service_1.BaseObservationSer
46
46
  },
47
47
  ];
48
48
  }
49
+ getObservationCodes() {
50
+ return [
51
+ ...super.getObservationCodes(),
52
+ {
53
+ coding: [{
54
+ code: types_1.PulseRhythmCoding.observation,
55
+ display: "Pulse rhythm",
56
+ system: types_1.PulseRhythmCoding.system,
57
+ }],
58
+ text: "Pulse rhythm",
59
+ },
60
+ ];
61
+ }
62
+ generateValues(measurement) {
63
+ const castedMeasurement = this.getCastedMeasurement(measurement);
64
+ const rhythmCode = castedMeasurement.irregularHeartbeat === undefined
65
+ ? undefined
66
+ : castedMeasurement.irregularHeartbeat
67
+ ? types_1.PulseRhythmCoding.irregular
68
+ : types_1.PulseRhythmCoding.regular;
69
+ return [
70
+ ...super.generateValues(measurement),
71
+ rhythmCode
72
+ ? {
73
+ valueCodeableConcept: {
74
+ coding: [{
75
+ code: rhythmCode,
76
+ system: types_1.PulseRhythmCoding.system,
77
+ }],
78
+ },
79
+ }
80
+ : {},
81
+ ];
82
+ }
83
+ getAdditionalProperties(measurement) {
84
+ var _a;
85
+ const properties = super.getAdditionalProperties(measurement);
86
+ return [
87
+ ...properties,
88
+ { effectiveDateTime: (_a = properties[0]) === null || _a === void 0 ? void 0 : _a.effectiveDateTime },
89
+ ];
90
+ }
49
91
  getMeasurementDisplay(measurement) {
50
92
  const castedMeasurement = this.getCastedMeasurement(measurement);
51
93
  return `${castedMeasurement.systolic}/${castedMeasurement.diastolic}`;
@@ -48,3 +48,12 @@ export declare enum ObservationCode {
48
48
  RESPIRATORY_THERAPY = "respiratory-therapy",
49
49
  BABY_SLEEP = "baby-sleep"
50
50
  }
51
+ /** SNOMED CT concepts used to represent the result of a blood-pressure rhythm check. */
52
+ export declare const PulseRhythmCoding: {
53
+ readonly system: "http://snomed.info/sct";
54
+ readonly observation: "364095004";
55
+ readonly regular: "271636001";
56
+ readonly irregular: "61086009";
57
+ readonly irregularlyIrregular: "271637005";
58
+ readonly regularlyIrregular: "271638000";
59
+ };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ObservationCode = void 0;
3
+ exports.PulseRhythmCoding = exports.ObservationCode = void 0;
4
4
  var ObservationCode;
5
5
  (function (ObservationCode) {
6
6
  ObservationCode["BLOOD_PRESSURE_HEART_RATE"] = "8885-6";
@@ -52,3 +52,12 @@ var ObservationCode;
52
52
  ObservationCode["RESPIRATORY_THERAPY"] = "respiratory-therapy";
53
53
  ObservationCode["BABY_SLEEP"] = "baby-sleep";
54
54
  })(ObservationCode || (exports.ObservationCode = ObservationCode = {}));
55
+ /** SNOMED CT concepts used to represent the result of a blood-pressure rhythm check. */
56
+ exports.PulseRhythmCoding = {
57
+ system: "http://snomed.info/sct",
58
+ observation: "364095004",
59
+ regular: "271636001",
60
+ irregular: "61086009",
61
+ irregularlyIrregular: "271637005",
62
+ regularlyIrregular: "271638000",
63
+ };
@@ -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.16",
51
+ version: "0.4.18",
52
52
  },
53
53
  fhirVersion: "4.0.1",
54
54
  format: ["json"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ovok/core",
3
- "version": "0.4.16",
3
+ "version": "0.4.18",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",