@ovok/core 0.4.41 → 0.4.42

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,6 +1,10 @@
1
1
  import { Bundle, BundleEntry, Observation } from "@medplum/fhirtypes";
2
2
  export declare const MAX_OBSERVATION_BUNDLE_BYTES = 900000;
3
3
  export declare const MAX_CONDITIONAL_OBSERVATION_ENTRIES = 8;
4
+ /**
5
+ * Points every observation after the first at the first, as the first `hasMember` (where readers look). A link to its
6
+ * own `id`, as ECG segments carry, is dropped: the server replaces that id on create.
7
+ */
4
8
  export declare const linkObservationMembers: (observations: Observation[]) => Observation[];
5
9
  export declare const splitObservationBundleEntries: (bundle: Bundle) => BundleEntry[][] | undefined;
6
10
  export declare const executeObservationBundle: (bundle: Bundle, executeBatch: (bundle: Bundle) => Promise<Bundle>) => Promise<Bundle>;
@@ -4,12 +4,17 @@ exports.packObservationGroups = exports.executeObservationBundle = exports.split
4
4
  const offline_1 = require("../offline");
5
5
  exports.MAX_OBSERVATION_BUNDLE_BYTES = 900000;
6
6
  exports.MAX_CONDITIONAL_OBSERVATION_ENTRIES = 8;
7
+ /**
8
+ * Points every observation after the first at the first, as the first `hasMember` (where readers look). A link to its
9
+ * own `id`, as ECG segments carry, is dropped: the server replaces that id on create.
10
+ */
7
11
  const linkObservationMembers = (observations) => {
8
12
  const main = observations[0];
9
13
  if (!main) {
10
14
  return observations;
11
15
  }
12
16
  const mainReference = `urn:uuid:${(0, offline_1.stableMeasurementId)(main)}`;
17
+ const ownReference = main.id ? `Observation/${main.id}` : undefined;
13
18
  return observations.map((observation, index) => {
14
19
  var _a;
15
20
  return index === 0
@@ -17,8 +22,8 @@ const linkObservationMembers = (observations) => {
17
22
  : {
18
23
  ...observation,
19
24
  hasMember: [
20
- ...((_a = observation.hasMember) !== null && _a !== void 0 ? _a : []),
21
25
  { reference: mainReference },
26
+ ...((_a = observation.hasMember) !== null && _a !== void 0 ? _a : []).filter((member) => member.reference !== mainReference && member.reference !== ownReference),
22
27
  ],
23
28
  };
24
29
  });
@@ -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.41",
51
+ version: "0.4.42",
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.41",
3
+ "version": "0.4.42",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",