@ovok/core 0.2.55 → 0.2.57

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.
@@ -25,6 +25,14 @@ class BloodPressureService extends base_observation_service_1.BaseObservationSer
25
25
  valueKey: "diastolic",
26
26
  toFixed: 0,
27
27
  },
28
+ {
29
+ primaryCode: types_1.ObservationCode.MEAN_BLOOD_PRESSURE,
30
+ additionalCodes: [],
31
+ display: "Mean Arterial Pressure",
32
+ unit: "mmHg",
33
+ valueKey: "meanArterialPressure",
34
+ toFixed: 0,
35
+ },
28
36
  {
29
37
  primaryCode: types_1.ObservationCode.BLOOD_PRESSURE_HEART_RATE,
30
38
  additionalCodes: [
@@ -11,6 +11,7 @@ export declare enum ObservationCode {
11
11
  OXYGEN_SATURATION_HEART_RATE = "8889-8",
12
12
  DIASTOLIC_BLOOD_PRESSURE = "8462-4",
13
13
  SYSTOLIC_BLOOD_PRESSURE = "8480-6",
14
+ MEAN_BLOOD_PRESSURE = "8478-0",
14
15
  OXYGEN_SATURATION = "2708-6",
15
16
  OXYGEN_SATURATION_GRAPH = "2708",
16
17
  BODY_TEMPERATURE = "8310-5",
@@ -15,6 +15,7 @@ var ObservationCode;
15
15
  ObservationCode["OXYGEN_SATURATION_HEART_RATE"] = "8889-8";
16
16
  ObservationCode["DIASTOLIC_BLOOD_PRESSURE"] = "8462-4";
17
17
  ObservationCode["SYSTOLIC_BLOOD_PRESSURE"] = "8480-6";
18
+ ObservationCode["MEAN_BLOOD_PRESSURE"] = "8478-0";
18
19
  ObservationCode["OXYGEN_SATURATION"] = "2708-6";
19
20
  ObservationCode["OXYGEN_SATURATION_GRAPH"] = "2708";
20
21
  ObservationCode["BODY_TEMPERATURE"] = "8310-5";
@@ -5,6 +5,8 @@ export type BloodPressureMeasurement = Measurement & {
5
5
  measurementTypeKey: MeasurementTypeKey.bloodPressure;
6
6
  diastolic?: number;
7
7
  systolic?: number;
8
+ /** Mean arterial pressure, in mmHg. Reported by the device rather than derived. */
9
+ meanArterialPressure?: number;
8
10
  heartRate?: number;
9
11
  status?: BloodPressureStates;
10
12
  };
@@ -4,4 +4,11 @@ export type MeasurementDevice = {
4
4
  manufacturerData: string;
5
5
  sn: string;
6
6
  id: string;
7
+ /**
8
+ * Remaining charge, 0 to 100.
9
+ *
10
+ * Device state rather than a patient observation, so it travels with the device on an
11
+ * observation instead of becoming a measurement of its own.
12
+ */
13
+ batteryPercentage?: number;
7
14
  };
@@ -1,6 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getDeviceObject = void 0;
4
+ const EXTENSION_BASE_URL = "http://ovok.com/fhir/StructureDefinition";
5
+ const LOCAL_NAME_URL = `${EXTENSION_BASE_URL}/device-local-name`;
6
+ const MANUFACTURER_DATA_URL = `${EXTENSION_BASE_URL}/device-manufacturer-data`;
7
+ const SERIAL_NUMBER_URL = `${EXTENSION_BASE_URL}/device-serial-number`;
8
+ const BATTERY_PERCENTAGE_URL = `${EXTENSION_BASE_URL}/device-battery-percentage`;
9
+ /**
10
+ * The battery extension is omitted rather than defaulted when the device did not report
11
+ * one, because a placeholder charge level would read as a real reading.
12
+ */
13
+ const getBatteryExtension = (batteryPercentage) => {
14
+ if (batteryPercentage === undefined) {
15
+ return [];
16
+ }
17
+ return [
18
+ {
19
+ url: BATTERY_PERCENTAGE_URL,
20
+ valueInteger: batteryPercentage,
21
+ },
22
+ ];
23
+ };
4
24
  const getDeviceObject = (measurementDevice) => {
5
25
  var _a, _b;
6
26
  if (!measurementDevice) {
@@ -17,17 +37,18 @@ const getDeviceObject = (measurementDevice) => {
17
37
  display: (_b = measurementDevice.name) !== null && _b !== void 0 ? _b : "no-name",
18
38
  extension: [
19
39
  {
20
- url: "http://ovok.com/fhir/StructureDefinition/device-local-name",
40
+ url: LOCAL_NAME_URL,
21
41
  valueString: measurementDevice.localName || "no-local-name",
22
42
  },
23
43
  {
24
- url: "http://ovok.com/fhir/StructureDefinition/device-manufacturer-data",
44
+ url: MANUFACTURER_DATA_URL,
25
45
  valueString: measurementDevice.manufacturerData || "no-manufacturer-data",
26
46
  },
27
47
  {
28
- url: "http://ovok.com/fhir/StructureDefinition/device-serial-number",
48
+ url: SERIAL_NUMBER_URL,
29
49
  valueString: measurementDevice.sn || "no-serial-number",
30
50
  },
51
+ ...getBatteryExtension(measurementDevice.batteryPercentage),
31
52
  ],
32
53
  };
33
54
  };
@@ -0,0 +1,31 @@
1
+ import { CapabilityStatement } from "@medplum/fhirtypes";
2
+ /**
3
+ * What a server must support for `@ovok/core` to work.
4
+ *
5
+ * `kind: requirements` rather than `capability`, and the distinction is the
6
+ * whole point. A `capability` statement would describe what this SDK CAN
7
+ * issue — and since `OvokClient extends MedplumClient` with no narrowing, the
8
+ * honest answer to that is "every interaction Medplum has", which tells a
9
+ * consumer nothing. `requirements` inverts it: here is the surface this
10
+ * library itself depends on, so pointing it at a server becomes a checkable
11
+ * proposition rather than a hope.
12
+ *
13
+ * Scope is therefore the SDK's OWN methods. Generic CRUD reached through the
14
+ * inherited Medplum client is the consuming application's business: that
15
+ * application knows which resources it touches, and this library does not
16
+ * require them.
17
+ *
18
+ * `implementation` is absent deliberately — FHIR forbids it for any kind but
19
+ * `instance`, and a client library has no endpoint to describe anyway. It
20
+ * cannot serve this at `/metadata`; it is published as a static artifact and
21
+ * exported so a consumer can compare it against a server's own statement.
22
+ *
23
+ * NOT DESCRIBED HERE, because a CapabilityStatement structurally cannot:
24
+ * seven of the SDK's ten HTTP call sites are ordinary REST, not FHIR —
25
+ * `POST /ai/session`, `POST /ai/fhir/search`, `POST /bots?identifier=`, and
26
+ * the auth surface (register, change-password, reset-password, Apple and
27
+ * Google sign-in, account deletion). Those are OpenAPI's job and are
28
+ * documented there. A conformance resource pretending to carry them would be
29
+ * readable by no FHIR client and no OpenAPI tool.
30
+ */
31
+ export declare const OVOK_CORE_REQUIREMENTS: CapabilityStatement;
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OVOK_CORE_REQUIREMENTS = void 0;
4
+ /**
5
+ * What a server must support for `@ovok/core` to work.
6
+ *
7
+ * `kind: requirements` rather than `capability`, and the distinction is the
8
+ * whole point. A `capability` statement would describe what this SDK CAN
9
+ * issue — and since `OvokClient extends MedplumClient` with no narrowing, the
10
+ * honest answer to that is "every interaction Medplum has", which tells a
11
+ * consumer nothing. `requirements` inverts it: here is the surface this
12
+ * library itself depends on, so pointing it at a server becomes a checkable
13
+ * proposition rather than a hope.
14
+ *
15
+ * Scope is therefore the SDK's OWN methods. Generic CRUD reached through the
16
+ * inherited Medplum client is the consuming application's business: that
17
+ * application knows which resources it touches, and this library does not
18
+ * require them.
19
+ *
20
+ * `implementation` is absent deliberately — FHIR forbids it for any kind but
21
+ * `instance`, and a client library has no endpoint to describe anyway. It
22
+ * cannot serve this at `/metadata`; it is published as a static artifact and
23
+ * exported so a consumer can compare it against a server's own statement.
24
+ *
25
+ * NOT DESCRIBED HERE, because a CapabilityStatement structurally cannot:
26
+ * seven of the SDK's ten HTTP call sites are ordinary REST, not FHIR —
27
+ * `POST /ai/session`, `POST /ai/fhir/search`, `POST /bots?identifier=`, and
28
+ * the auth surface (register, change-password, reset-password, Apple and
29
+ * Google sign-in, account deletion). Those are OpenAPI's job and are
30
+ * documented there. A conformance resource pretending to carry them would be
31
+ * readable by no FHIR client and no OpenAPI tool.
32
+ */
33
+ exports.OVOK_CORE_REQUIREMENTS = {
34
+ resourceType: "CapabilityStatement",
35
+ id: "ovok-core-requirements",
36
+ url: "https://fhir.ovok.com/fhir/CapabilityStatement/ovok-core-requirements",
37
+ name: "OvokCoreClientRequirements",
38
+ title: "@ovok/core — server requirements",
39
+ status: "active",
40
+ /*
41
+ * The date this STATEMENT was last revised, which FHIR requires and which
42
+ * is not "now" — a statement that restamped itself on every read would
43
+ * report change where there is none. Bump it with `software.version` when
44
+ * the declared surface actually moves.
45
+ */
46
+ date: "2026-09-19",
47
+ kind: "requirements",
48
+ description: "The FHIR surface a server must provide for the @ovok/core client library's own methods to function.",
49
+ software: {
50
+ name: "@ovok/core",
51
+ version: "0.2.56",
52
+ },
53
+ fhirVersion: "4.0.1",
54
+ format: ["json"],
55
+ rest: [
56
+ {
57
+ mode: "client",
58
+ documentation: "Issued by the SDK's own methods. Interactions a consuming application makes through the inherited Medplum client are not this library's requirement.",
59
+ interaction: [
60
+ {
61
+ code: "transaction",
62
+ /*
63
+ * `createQuestionnaireResponseWithObservations` posts a
64
+ * `Bundle type=transaction` carrying the QuestionnaireResponse and
65
+ * its Observations together. Atomicity is why it is a transaction
66
+ * and not a batch: a response saved without its observations is a
67
+ * record that reads as complete and is not.
68
+ */
69
+ documentation: "createQuestionnaireResponseWithObservations submits one transaction Bundle so the response and its observations land together or not at all.",
70
+ },
71
+ ],
72
+ resource: [
73
+ {
74
+ type: "Observation",
75
+ interaction: [{ code: "create" }],
76
+ operation: [
77
+ {
78
+ name: "lastn",
79
+ /*
80
+ * Ovok's own canonical, not HL7's. The server operation
81
+ * diverges on every parameter — `patient` as a string rather
82
+ * than `subject` as a Reference, `max` as a string rather than
83
+ * an integer, one comma-separated `code` rather than a
84
+ * repeating one, and no category grouping at all.
85
+ */
86
+ definition: "https://fhir.ovok.com/fhir/OperationDefinition/observation-lastn",
87
+ documentation: "getLatestObservationsByCodes reads the most recent Observations per code for one patient.",
88
+ },
89
+ ],
90
+ },
91
+ {
92
+ type: "QuestionnaireResponse",
93
+ interaction: [{ code: "create" }],
94
+ documentation: "Created as an entry of the transaction Bundle above, never on its own by this library.",
95
+ },
96
+ ],
97
+ },
98
+ ],
99
+ };
package/dist/index.d.ts CHANGED
@@ -926,3 +926,4 @@ export { OvokClient } from "./client/ovok-client";
926
926
  export * from "./hooks";
927
927
  export * from "./utils";
928
928
  export * from "./client/observation/services";
929
+ export * from "./conformance/capability-requirements";
package/dist/index.js CHANGED
@@ -47,3 +47,4 @@ Object.defineProperty(exports, "OvokClient", { enumerable: true, get: function (
47
47
  __exportStar(require("./hooks"), exports);
48
48
  __exportStar(require("./utils"), exports);
49
49
  __exportStar(require("./client/observation/services"), exports);
50
+ __exportStar(require("./conformance/capability-requirements"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ovok/core",
3
- "version": "0.2.55",
3
+ "version": "0.2.57",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",