@ovok/core 0.4.49-dev.519 → 0.4.49-dev.521

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.
Files changed (37) hide show
  1. package/dist/client/observation/bundle-entry-status.d.ts +3 -0
  2. package/dist/client/observation/bundle-entry-status.js +13 -0
  3. package/dist/client/observation/fhir-systems.d.ts +5 -0
  4. package/dist/client/observation/fhir-systems.js +6 -1
  5. package/dist/client/observation/methods/generateObservationBodiesByMeasurement.js +7 -65
  6. package/dist/client/observation/methods/observationsToMeasurements.js +33 -7
  7. package/dist/client/observation/observation-bundle-utils.d.ts +2 -5
  8. package/dist/client/observation/observation-bundle-utils.js +9 -37
  9. package/dist/client/observation/observation-coding.d.ts +12 -0
  10. package/dist/client/observation/observation-coding.js +69 -0
  11. package/dist/client/observation/observation-groups.d.ts +12 -0
  12. package/dist/client/observation/observation-groups.js +51 -0
  13. package/dist/client/observation/series.d.ts +1 -1
  14. package/dist/client/observation/series.js +4 -2
  15. package/dist/client/observation/services/base-observation-service.d.ts +1 -1
  16. package/dist/client/observation/services/base-observation-service.js +6 -12
  17. package/dist/client/observation/services/blood-pressure.d.ts +2 -0
  18. package/dist/client/observation/services/blood-pressure.js +9 -5
  19. package/dist/client/observation/services/ecg-observation-fragments.d.ts +4 -0
  20. package/dist/client/observation/services/ecg-observation-fragments.js +30 -37
  21. package/dist/client/observation/services/ecg.d.ts +3 -1
  22. package/dist/client/observation/services/ecg.js +19 -19
  23. package/dist/client/observation/services/uric-acid-service.js +2 -12
  24. package/dist/client/observation/services/urine-analyte-values.d.ts +4 -0
  25. package/dist/client/observation/services/urine-analyte-values.js +27 -0
  26. package/dist/client/observation/types/UrineAnalytes.d.ts +15 -0
  27. package/dist/client/observation/types/UrineAnalytes.js +17 -9
  28. package/dist/client/observation/utils/getDeviceObject.js +15 -32
  29. package/dist/client/offline/offline-measurement-queue.js +2 -8
  30. package/dist/client/ovok-client.d.ts +1 -0
  31. package/dist/client/ovok-client.js +11 -6
  32. package/dist/conformance/capability-requirements.js +1 -1
  33. package/dist/next/resources/measurements/measurements-resource.d.ts +11 -2
  34. package/dist/next/resources/measurements/measurements-resource.js +31 -6
  35. package/dist/next/resources/measurements/observation-builder.js +12 -6
  36. package/dist/next/resources/measurements/save-error.js +3 -4
  37. package/package.json +1 -1
@@ -2,18 +2,24 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildObservations = buildObservations;
4
4
  const fhir_systems_1 = require("../../../client/observation/fhir-systems");
5
+ const observation_coding_1 = require("../../../client/observation/observation-coding");
5
6
  const creator_1 = require("../../../client/observation/services/creator");
6
7
  const getDeviceObject_1 = require("../../../client/observation/utils/getDeviceObject");
7
8
  /** One measurement's Observations about `subject`, a reference such as `Patient/1`. */
8
9
  function buildObservations(params, subject) {
9
- const service = creator_1.ObservationServiceCreator.getInstance().getService(params.measurement.measurementTypeKey);
10
+ const measurement = timedMeasurement(params.measurement, params.effectiveDateTime);
11
+ const service = creator_1.ObservationServiceCreator.getInstance().getService(measurement.measurementTypeKey);
10
12
  const device = (0, getDeviceObject_1.getDeviceObject)(params.device);
11
- const observations = fragmentsOf(service, params.measurement)
12
- .map((fragment) => observationOf(fragment, subject, device))
13
+ const readingFields = (0, observation_coding_1.readingStatusAndCategory)(measurement.measurementTypeKey);
14
+ const observations = fragmentsOf(service, measurement)
15
+ .map((fragment) => observationOf(fragment, subject, device, readingFields))
13
16
  .filter(hasValue)
14
17
  .map((observation) => datedAt(observation, params.effectiveDateTime));
15
- return params.sourceId ? namedAfterSource(observations, subject, params.sourceId) : observations;
18
+ const withUser = (0, observation_coding_1.withDeviceUser)(observations, measurement.memorySlot);
19
+ return params.sourceId ? namedAfterSource(withUser, subject, params.sourceId) : withUser;
16
20
  }
21
+ /** The caller's time stands in for a measurement that carries none, so every observation of it shares one time. */
22
+ const timedMeasurement = (measurement, effectiveDateTime) => measurement.recordedAt || !effectiveDateTime ? measurement : { ...measurement, recordedAt: effectiveDateTime };
17
23
  /** Services without fragments describe their observations as parallel code, value and property lists. */
18
24
  const fragmentsOf = (service, measurement) => { var _a, _b; return (_b = (_a = service.generateObservationFragments) === null || _a === void 0 ? void 0 : _a.call(service, measurement)) !== null && _b !== void 0 ? _b : codeValueFragments(service, measurement); };
19
25
  const codeValueFragments = (service, measurement) => {
@@ -25,9 +31,9 @@ const codeValueFragments = (service, measurement) => {
25
31
  additionalProperties: additionalProperties[index],
26
32
  }));
27
33
  };
28
- const observationOf = (fragment, subject, device) => ({
34
+ const observationOf = (fragment, subject, device, readingFields) => ({
29
35
  resourceType: "Observation",
30
- status: "registered",
36
+ ...readingFields,
31
37
  subject: { reference: subject },
32
38
  device,
33
39
  ...fragment.value,
@@ -2,15 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isBundle = void 0;
4
4
  exports.saveErrorFrom = saveErrorFrom;
5
+ const bundle_entry_status_1 = require("../../../client/observation/bundle-entry-status");
5
6
  const ovok_errors_1 = require("../../errors/ovok-errors");
6
- const FAILED_STATUS = /^[45]/;
7
7
  const isBundle = (value) => typeof value === "object" && value !== null && value.resourceType === "Bundle";
8
8
  exports.isBundle = isBundle;
9
9
  /** A save's response that refused or left out an observation; a refused one gives its own status. */
10
10
  function saveErrorFrom(response) {
11
- var _a;
12
- const statuses = ((_a = response.entry) !== null && _a !== void 0 ? _a : []).map((entry) => { var _a, _b; return (_b = (_a = entry.response) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : ""; });
13
- const refused = statuses.find((status) => FAILED_STATUS.test(status));
11
+ var _a, _b, _c;
12
+ const refused = (_c = (_b = ((_a = response.entry) !== null && _a !== void 0 ? _a : []).find(bundle_entry_status_1.isFailedEntry)) === null || _b === void 0 ? void 0 : _b.response) === null || _c === void 0 ? void 0 : _c.status;
14
13
  const message = refused
15
14
  ? `The server refused an observation of the reading: ${refused}.`
16
15
  : "The server's response left out an observation of the reading.";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ovok/core",
3
- "version": "0.4.49-dev.519+0c31ad9",
3
+ "version": "0.4.49-dev.521+9475981",
4
4
  "private": false,
5
5
  "main": "dist/next/index.js",
6
6
  "types": "dist/next/index.d.ts",