phenoml 17.2.0 → 17.4.0

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 (51) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/fhir2Omop/client/Client.d.ts +18 -21
  3. package/dist/cjs/api/resources/fhir2Omop/client/Client.js +20 -21
  4. package/dist/cjs/api/resources/fhir2Omop/errors/ServiceUnavailableError.d.ts +5 -0
  5. package/dist/cjs/api/resources/fhir2Omop/errors/ServiceUnavailableError.js +54 -0
  6. package/dist/cjs/api/resources/fhir2Omop/errors/index.d.ts +1 -0
  7. package/dist/cjs/api/resources/fhir2Omop/errors/index.js +1 -0
  8. package/dist/cjs/api/resources/fhir2Omop/types/ConditionOccurrenceRow.d.ts +1 -0
  9. package/dist/cjs/api/resources/fhir2Omop/types/CreateOmopResponse.d.ts +10 -10
  10. package/dist/cjs/api/resources/fhir2Omop/types/DrugExposureRow.d.ts +1 -0
  11. package/dist/cjs/api/resources/fhir2Omop/types/MappingEntry.d.ts +35 -0
  12. package/dist/cjs/api/resources/fhir2Omop/types/MeasurementRow.d.ts +3 -0
  13. package/dist/cjs/api/resources/fhir2Omop/types/ObservationRow.d.ts +1 -0
  14. package/dist/cjs/api/resources/fhir2Omop/types/ProcedureOccurrenceRow.d.ts +1 -0
  15. package/dist/cjs/api/resources/fhir2Omop/types/Summary.d.ts +17 -0
  16. package/dist/cjs/api/resources/fhir2Omop/types/index.d.ts +2 -2
  17. package/dist/cjs/api/resources/fhir2Omop/types/index.js +2 -2
  18. package/dist/cjs/core/fetcher/signals.js +9 -1
  19. package/dist/cjs/version.d.ts +1 -1
  20. package/dist/cjs/version.js +1 -1
  21. package/dist/esm/BaseClient.mjs +2 -2
  22. package/dist/esm/api/resources/fhir2Omop/client/Client.d.mts +18 -21
  23. package/dist/esm/api/resources/fhir2Omop/client/Client.mjs +20 -21
  24. package/dist/esm/api/resources/fhir2Omop/errors/ServiceUnavailableError.d.mts +5 -0
  25. package/dist/esm/api/resources/fhir2Omop/errors/ServiceUnavailableError.mjs +17 -0
  26. package/dist/esm/api/resources/fhir2Omop/errors/index.d.mts +1 -0
  27. package/dist/esm/api/resources/fhir2Omop/errors/index.mjs +1 -0
  28. package/dist/esm/api/resources/fhir2Omop/types/ConditionOccurrenceRow.d.mts +1 -0
  29. package/dist/esm/api/resources/fhir2Omop/types/CreateOmopResponse.d.mts +10 -10
  30. package/dist/esm/api/resources/fhir2Omop/types/DrugExposureRow.d.mts +1 -0
  31. package/dist/esm/api/resources/fhir2Omop/types/MappingEntry.d.mts +35 -0
  32. package/dist/esm/api/resources/fhir2Omop/types/MeasurementRow.d.mts +3 -0
  33. package/dist/esm/api/resources/fhir2Omop/types/ObservationRow.d.mts +1 -0
  34. package/dist/esm/api/resources/fhir2Omop/types/ProcedureOccurrenceRow.d.mts +1 -0
  35. package/dist/esm/api/resources/fhir2Omop/types/Summary.d.mts +17 -0
  36. package/dist/esm/api/resources/fhir2Omop/types/index.d.mts +2 -2
  37. package/dist/esm/api/resources/fhir2Omop/types/index.mjs +2 -2
  38. package/dist/esm/core/fetcher/signals.mjs +9 -1
  39. package/dist/esm/version.d.mts +1 -1
  40. package/dist/esm/version.mjs +1 -1
  41. package/openapi/openapi.json +82 -185
  42. package/package.json +1 -1
  43. package/reference.md +18 -22
  44. package/dist/cjs/api/resources/fhir2Omop/types/MappingReportEntry.d.ts +0 -32
  45. package/dist/cjs/api/resources/fhir2Omop/types/ScanSummary.d.ts +0 -41
  46. package/dist/esm/api/resources/fhir2Omop/types/MappingReportEntry.d.mts +0 -32
  47. package/dist/esm/api/resources/fhir2Omop/types/ScanSummary.d.mts +0 -41
  48. /package/dist/cjs/api/resources/fhir2Omop/types/{MappingReportEntry.js → MappingEntry.js} +0 -0
  49. /package/dist/cjs/api/resources/fhir2Omop/types/{ScanSummary.js → Summary.js} +0 -0
  50. /package/dist/esm/api/resources/fhir2Omop/types/{MappingReportEntry.mjs → MappingEntry.mjs} +0 -0
  51. /package/dist/esm/api/resources/fhir2Omop/types/{ScanSummary.mjs → Summary.mjs} +0 -0
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
43
43
  const headers = (0, headers_js_1.mergeHeaders)({
44
44
  "X-Fern-Language": "JavaScript",
45
45
  "X-Fern-SDK-Name": "phenoml",
46
- "X-Fern-SDK-Version": "17.2.0",
47
- "User-Agent": "phenoml/17.2.0",
46
+ "X-Fern-SDK-Version": "17.4.0",
47
+ "User-Agent": "phenoml/17.4.0",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -11,30 +11,26 @@ export declare class Fhir2OmopClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<Fhir2OmopClient.Options>;
12
12
  constructor(options?: Fhir2OmopClient.Options);
13
13
  /**
14
- * Shapes a FHIR R4 resource or Bundle into OMOP Common Data Model v5.4 rows
14
+ * Maps a FHIR R4 resource or Bundle into OMOP Common Data Model v5.4 rows
15
15
  * (person, visit_occurrence, condition_occurrence, drug_exposure,
16
16
  * procedure_occurrence, measurement, observation).
17
17
  *
18
- * **Two resolution modes, reported in `mode`.** `mode` reflects which
19
- * resolver is wired, not the path an individual coding took. With a
20
- * concept-resolver configured (the default), `mode` is `"resolved"` and the
21
- * resource's primary clinical coding is resolved to a real OMOP `concept_id`;
22
- * with no resolver configured, `mode` is `"structural"` and every clinical
23
- * and source `concept_id` is `0`. In `"resolved"` mode individual codings can
24
- * still land at `concept_id` `0` without changing the mode: a coding the
25
- * service finds no match for is `UNMAPPED`, and a coding that fell back to the
26
- * structural tier (the resolver was briefly unavailable, or the resource was
27
- * text-only) is surfaced in `scan_summary` (`concept_resolver_note`,
28
- * `construe_resolutions`). A `concept_id` of `0` is "no matching concept" per
29
- * OMOP semantics, deliberately not omitted. Only the primary clinical coding
30
- * is resolved — `gender`/`race`/`ethnicity`/`visit`/`value`/`unit`
31
- * `concept_id`s are always `0`.
18
+ * Each resource's primary clinical coding is resolved to a standard OMOP
19
+ * `concept_id`. Alongside the OMOP rows grouped by table (`tables`), the
20
+ * response carries `mappings` (how each source coding resolved, linked back
21
+ * to the row it produced), `dropped` (resources that could not be shaped
22
+ * into a row), `vocab_version` (the OMOP vocabulary release codes were
23
+ * resolved against), and a small `summary` of the resolution outcomes.
32
24
  *
33
- * In every mode each `*_source_value` carries the verbatim FHIR coding
34
- * (`system#code`), `*_type_concept_id` is set to `32817` (EHR), and the
35
- * response `report` lists one Usagi-shaped entry per source coding describing
36
- * how it resolved (`ALREADY_STANDARD`, `MAPPED`, an `UNCHECKED` suggestion,
37
- * or `UNMAPPED`).
25
+ * A `concept_id` of `0` is reported, not omitted (OMOP "no matching
26
+ * concept" semantics): it covers both a coding with no standard match
27
+ * (`UNMAPPED`) and an unverified suggestion for a text-only resource
28
+ * (`UNCHECKED`). Only the primary clinical coding is resolved, so
29
+ * `gender`/`race`/`ethnicity`/`visit`/`value`/`unit` `concept_id`s are
30
+ * always `0`; the one populated non-resolved concept is measurement
31
+ * `operator_concept_id`, set from a value comparator (`<`, `<=`, `>`, `>=`)
32
+ * rather than the resolver. Each `*_source_value` carries the verbatim FHIR
33
+ * coding (`system#code`), and `*_type_concept_id` is set to `32817` (EHR).
38
34
  *
39
35
  * Medication codes are resolved whether they appear inline
40
36
  * (`medicationCodeableConcept`) or via a `medicationReference` to a contained,
@@ -42,7 +38,7 @@ export declare class Fhir2OmopClient {
42
38
  * Resources that cannot be shaped into a row — a medication with no usable
43
39
  * code, resolvable reference, or display, or any clinical resource whose
44
40
  * subject/patient reference cannot be tied to a person — are reported under
45
- * `scan_summary.dropped_resources` rather than emitted as blank rows. The
41
+ * `dropped` rather than emitted as blank rows. The
46
42
  * bundle must contain at least one Patient resource.
47
43
  *
48
44
  * @param {phenoml.fhir2Omop.CreateOmopRequest} request
@@ -51,6 +47,7 @@ export declare class Fhir2OmopClient {
51
47
  * @throws {@link phenoml.fhir2Omop.BadRequestError}
52
48
  * @throws {@link phenoml.fhir2Omop.UnauthorizedError}
53
49
  * @throws {@link phenoml.fhir2Omop.InternalServerError}
50
+ * @throws {@link phenoml.fhir2Omop.ServiceUnavailableError}
54
51
  *
55
52
  * @example
56
53
  * await client.fhir2Omop.create({
@@ -56,30 +56,26 @@ class Fhir2OmopClient {
56
56
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
57
57
  }
58
58
  /**
59
- * Shapes a FHIR R4 resource or Bundle into OMOP Common Data Model v5.4 rows
59
+ * Maps a FHIR R4 resource or Bundle into OMOP Common Data Model v5.4 rows
60
60
  * (person, visit_occurrence, condition_occurrence, drug_exposure,
61
61
  * procedure_occurrence, measurement, observation).
62
62
  *
63
- * **Two resolution modes, reported in `mode`.** `mode` reflects which
64
- * resolver is wired, not the path an individual coding took. With a
65
- * concept-resolver configured (the default), `mode` is `"resolved"` and the
66
- * resource's primary clinical coding is resolved to a real OMOP `concept_id`;
67
- * with no resolver configured, `mode` is `"structural"` and every clinical
68
- * and source `concept_id` is `0`. In `"resolved"` mode individual codings can
69
- * still land at `concept_id` `0` without changing the mode: a coding the
70
- * service finds no match for is `UNMAPPED`, and a coding that fell back to the
71
- * structural tier (the resolver was briefly unavailable, or the resource was
72
- * text-only) is surfaced in `scan_summary` (`concept_resolver_note`,
73
- * `construe_resolutions`). A `concept_id` of `0` is "no matching concept" per
74
- * OMOP semantics, deliberately not omitted. Only the primary clinical coding
75
- * is resolved — `gender`/`race`/`ethnicity`/`visit`/`value`/`unit`
76
- * `concept_id`s are always `0`.
63
+ * Each resource's primary clinical coding is resolved to a standard OMOP
64
+ * `concept_id`. Alongside the OMOP rows grouped by table (`tables`), the
65
+ * response carries `mappings` (how each source coding resolved, linked back
66
+ * to the row it produced), `dropped` (resources that could not be shaped
67
+ * into a row), `vocab_version` (the OMOP vocabulary release codes were
68
+ * resolved against), and a small `summary` of the resolution outcomes.
77
69
  *
78
- * In every mode each `*_source_value` carries the verbatim FHIR coding
79
- * (`system#code`), `*_type_concept_id` is set to `32817` (EHR), and the
80
- * response `report` lists one Usagi-shaped entry per source coding describing
81
- * how it resolved (`ALREADY_STANDARD`, `MAPPED`, an `UNCHECKED` suggestion,
82
- * or `UNMAPPED`).
70
+ * A `concept_id` of `0` is reported, not omitted (OMOP "no matching
71
+ * concept" semantics): it covers both a coding with no standard match
72
+ * (`UNMAPPED`) and an unverified suggestion for a text-only resource
73
+ * (`UNCHECKED`). Only the primary clinical coding is resolved, so
74
+ * `gender`/`race`/`ethnicity`/`visit`/`value`/`unit` `concept_id`s are
75
+ * always `0`; the one populated non-resolved concept is measurement
76
+ * `operator_concept_id`, set from a value comparator (`<`, `<=`, `>`, `>=`)
77
+ * rather than the resolver. Each `*_source_value` carries the verbatim FHIR
78
+ * coding (`system#code`), and `*_type_concept_id` is set to `32817` (EHR).
83
79
  *
84
80
  * Medication codes are resolved whether they appear inline
85
81
  * (`medicationCodeableConcept`) or via a `medicationReference` to a contained,
@@ -87,7 +83,7 @@ class Fhir2OmopClient {
87
83
  * Resources that cannot be shaped into a row — a medication with no usable
88
84
  * code, resolvable reference, or display, or any clinical resource whose
89
85
  * subject/patient reference cannot be tied to a person — are reported under
90
- * `scan_summary.dropped_resources` rather than emitted as blank rows. The
86
+ * `dropped` rather than emitted as blank rows. The
91
87
  * bundle must contain at least one Patient resource.
92
88
  *
93
89
  * @param {phenoml.fhir2Omop.CreateOmopRequest} request
@@ -96,6 +92,7 @@ class Fhir2OmopClient {
96
92
  * @throws {@link phenoml.fhir2Omop.BadRequestError}
97
93
  * @throws {@link phenoml.fhir2Omop.UnauthorizedError}
98
94
  * @throws {@link phenoml.fhir2Omop.InternalServerError}
95
+ * @throws {@link phenoml.fhir2Omop.ServiceUnavailableError}
99
96
  *
100
97
  * @example
101
98
  * await client.fhir2Omop.create({
@@ -196,6 +193,8 @@ class Fhir2OmopClient {
196
193
  throw new phenoml.fhir2Omop.UnauthorizedError(_response.error.body, _response.rawResponse);
197
194
  case 500:
198
195
  throw new phenoml.fhir2Omop.InternalServerError(_response.error.body, _response.rawResponse);
196
+ case 503:
197
+ throw new phenoml.fhir2Omop.ServiceUnavailableError(_response.error.body, _response.rawResponse);
199
198
  default:
200
199
  throw new errors.phenomlError({
201
200
  statusCode: _response.error.statusCode,
@@ -0,0 +1,5 @@
1
+ import type * as core from "../../../../core/index.js";
2
+ import * as errors from "../../../../errors/index.js";
3
+ export declare class ServiceUnavailableError extends errors.phenomlError {
4
+ constructor(body?: unknown, rawResponse?: core.RawResponse);
5
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.ServiceUnavailableError = void 0;
38
+ const errors = __importStar(require("../../../../errors/index.js"));
39
+ class ServiceUnavailableError extends errors.phenomlError {
40
+ constructor(body, rawResponse) {
41
+ super({
42
+ message: "ServiceUnavailableError",
43
+ statusCode: 503,
44
+ body: body,
45
+ rawResponse: rawResponse,
46
+ });
47
+ Object.setPrototypeOf(this, new.target.prototype);
48
+ if (Error.captureStackTrace) {
49
+ Error.captureStackTrace(this, this.constructor);
50
+ }
51
+ this.name = this.constructor.name;
52
+ }
53
+ }
54
+ exports.ServiceUnavailableError = ServiceUnavailableError;
@@ -1,3 +1,4 @@
1
1
  export * from "./BadRequestError.js";
2
2
  export * from "./InternalServerError.js";
3
+ export * from "./ServiceUnavailableError.js";
3
4
  export * from "./UnauthorizedError.js";
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./BadRequestError.js"), exports);
18
18
  __exportStar(require("./InternalServerError.js"), exports);
19
+ __exportStar(require("./ServiceUnavailableError.js"), exports);
19
20
  __exportStar(require("./UnauthorizedError.js"), exports);
@@ -6,6 +6,7 @@ export interface ConditionOccurrenceRow {
6
6
  condition_start_datetime?: string | undefined;
7
7
  condition_end_date?: string | undefined;
8
8
  condition_type_concept_id?: number | undefined;
9
+ visit_occurrence_id?: number | undefined;
9
10
  condition_source_value?: string | undefined;
10
11
  condition_source_concept_id?: number | undefined;
11
12
  condition_status_source_value?: string | undefined;
@@ -2,16 +2,16 @@ import type * as phenoml from "../../../index.js";
2
2
  export interface CreateOmopResponse {
3
3
  success?: boolean | undefined;
4
4
  message?: string | undefined;
5
+ tables?: phenoml.fhir2Omop.OmopTables | undefined;
6
+ /** One entry per source coding (or one entry for a text-only resource with no coding), describing how it resolved and linking back to the row it produced. */
7
+ mappings?: phenoml.fhir2Omop.MappingEntry[] | undefined;
8
+ /** Resources that could not be shaped into an OMOP row (rather than emitted as blank rows). */
9
+ dropped?: phenoml.fhir2Omop.DroppedResource[] | undefined;
5
10
  /**
6
- * Resolution mode. `resolved` (default) means clinical `concept_id`s were
7
- * filled by the concept-resolver service; `structural` means no resolver
8
- * was configured, so all clinical `concept_id`s are `0`. Reflects which
9
- * resolver is wired, not the path an individual coding took — per-coding
10
- * degradation is surfaced in `scan_summary`, not the mode.
11
+ * The OMOP vocabulary release the clinical codes were resolved against
12
+ * (e.g. "v20240229"), for reproducibility. Present when at least one
13
+ * coded concept was resolved.
11
14
  */
12
- mode?: string | undefined;
13
- tables?: phenoml.fhir2Omop.OmopTables | undefined;
14
- /** One Usagi-shaped entry per source coding routed through concept resolution. */
15
- report?: phenoml.fhir2Omop.MappingReportEntry[] | undefined;
16
- scan_summary?: phenoml.fhir2Omop.ScanSummary | undefined;
15
+ vocab_version?: string | undefined;
16
+ summary?: phenoml.fhir2Omop.Summary | undefined;
17
17
  }
@@ -8,6 +8,7 @@ export interface DrugExposureRow {
8
8
  drug_type_concept_id?: number | undefined;
9
9
  stop_reason?: string | undefined;
10
10
  sig?: string | undefined;
11
+ visit_occurrence_id?: number | undefined;
11
12
  drug_source_value?: string | undefined;
12
13
  drug_source_concept_id?: number | undefined;
13
14
  }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * How one source coding (or a text-only resource's free text) resolved to an OMOP standard concept.
3
+ */
4
+ export interface MappingEntry {
5
+ resource_type?: string | undefined;
6
+ resource_id?: string | undefined;
7
+ omop_table?: string | undefined;
8
+ /**
9
+ * The id of the OMOP row this coding produced (e.g. `condition_occurrence_id`),
10
+ * within `omop_table`. A resource with multiple codings yields one entry
11
+ * per coding, all sharing this id.
12
+ */
13
+ omop_id?: number | undefined;
14
+ source_system?: string | undefined;
15
+ source_code?: string | undefined;
16
+ source_name?: string | undefined;
17
+ target_vocabulary?: string | undefined;
18
+ /**
19
+ * The standard concept's own code: the source code itself for an
20
+ * ALREADY_STANDARD row, the standard concept's code for a MAPPED row,
21
+ * or the suggested code for an UNCHECKED row. Omitted for UNMAPPED
22
+ * rows.
23
+ */
24
+ target_code?: string | undefined;
25
+ target_name?: string | undefined;
26
+ /**
27
+ * ALREADY_STANDARD (source coding is already a standard OMOP concept),
28
+ * MAPPED (source coding was mapped to a standard concept), UNCHECKED (a
29
+ * standard code was suggested — e.g. for a text-only resource — but not
30
+ * verified against the OMOP vocabulary, so `concept_id` stays `0`), or
31
+ * UNMAPPED (no standard concept found).
32
+ */
33
+ mapping_status?: string | undefined;
34
+ note?: string | undefined;
35
+ }
@@ -6,10 +6,13 @@ export interface MeasurementRow {
6
6
  measurement_datetime?: string | undefined;
7
7
  measurement_type_concept_id?: number | undefined;
8
8
  value_as_number?: number | undefined;
9
+ /** OMOP "Meas Value Operator" standard concept qualifying value_as_number (<, <=, >, >=), parsed from a numeric-string value or a FHIR valueQuantity.comparator. 0 when no operator (a bare number). */
10
+ operator_concept_id?: number | undefined;
9
11
  value_as_concept_id?: number | undefined;
10
12
  unit_concept_id?: number | undefined;
11
13
  range_low?: number | undefined;
12
14
  range_high?: number | undefined;
15
+ visit_occurrence_id?: number | undefined;
13
16
  measurement_source_value?: string | undefined;
14
17
  measurement_source_concept_id?: number | undefined;
15
18
  unit_source_value?: string | undefined;
@@ -9,6 +9,7 @@ export interface ObservationRow {
9
9
  value_as_string?: string | undefined;
10
10
  value_as_concept_id?: number | undefined;
11
11
  unit_concept_id?: number | undefined;
12
+ visit_occurrence_id?: number | undefined;
12
13
  observation_source_value?: string | undefined;
13
14
  observation_source_concept_id?: number | undefined;
14
15
  unit_source_value?: string | undefined;
@@ -5,6 +5,7 @@ export interface ProcedureOccurrenceRow {
5
5
  procedure_date?: string | undefined;
6
6
  procedure_datetime?: string | undefined;
7
7
  procedure_type_concept_id?: number | undefined;
8
+ visit_occurrence_id?: number | undefined;
8
9
  procedure_source_value?: string | undefined;
9
10
  procedure_source_concept_id?: number | undefined;
10
11
  }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The request's data-quality headline: how the coded concepts split across
3
+ * resolution outcomes, and the share that was not already in a target
4
+ * standard vocabulary. Each coded resource is counted once (per resolved
5
+ * concept), even when it carried several codings — unlike `mappings`, which
6
+ * has one entry per coding.
7
+ */
8
+ export interface Summary {
9
+ /** Coded concepts already a standard OMOP concept (ALREADY_STANDARD). */
10
+ codes_already_standard?: number | undefined;
11
+ /** Coded concepts mapped or suggested to a standard concept (MAPPED or UNCHECKED). */
12
+ codes_normalized?: number | undefined;
13
+ /** Coded concepts with no standard concept found (UNMAPPED). */
14
+ codes_unmapped?: number | undefined;
15
+ /** Share of coded concepts not already standard ((normalized + unmapped) / total). */
16
+ off_vocab_rate?: number | undefined;
17
+ }
@@ -2,11 +2,11 @@ export * from "./ConditionOccurrenceRow.js";
2
2
  export * from "./CreateOmopResponse.js";
3
3
  export * from "./DroppedResource.js";
4
4
  export * from "./DrugExposureRow.js";
5
- export * from "./MappingReportEntry.js";
5
+ export * from "./MappingEntry.js";
6
6
  export * from "./MeasurementRow.js";
7
7
  export * from "./ObservationRow.js";
8
8
  export * from "./OmopTables.js";
9
9
  export * from "./PersonRow.js";
10
10
  export * from "./ProcedureOccurrenceRow.js";
11
- export * from "./ScanSummary.js";
11
+ export * from "./Summary.js";
12
12
  export * from "./VisitOccurrenceRow.js";
@@ -18,11 +18,11 @@ __exportStar(require("./ConditionOccurrenceRow.js"), exports);
18
18
  __exportStar(require("./CreateOmopResponse.js"), exports);
19
19
  __exportStar(require("./DroppedResource.js"), exports);
20
20
  __exportStar(require("./DrugExposureRow.js"), exports);
21
- __exportStar(require("./MappingReportEntry.js"), exports);
21
+ __exportStar(require("./MappingEntry.js"), exports);
22
22
  __exportStar(require("./MeasurementRow.js"), exports);
23
23
  __exportStar(require("./ObservationRow.js"), exports);
24
24
  __exportStar(require("./OmopTables.js"), exports);
25
25
  __exportStar(require("./PersonRow.js"), exports);
26
26
  __exportStar(require("./ProcedureOccurrenceRow.js"), exports);
27
- __exportStar(require("./ScanSummary.js"), exports);
27
+ __exportStar(require("./Summary.js"), exports);
28
28
  __exportStar(require("./VisitOccurrenceRow.js"), exports);
@@ -14,11 +14,19 @@ function anySignal(...args) {
14
14
  for (const signal of signals) {
15
15
  if (signal.aborted) {
16
16
  controller.abort(signal === null || signal === void 0 ? void 0 : signal.reason);
17
- break;
17
+ return controller.signal;
18
18
  }
19
19
  signal.addEventListener("abort", () => controller.abort(signal === null || signal === void 0 ? void 0 : signal.reason), {
20
20
  signal: controller.signal,
21
21
  });
22
+ // Re-check after adding listener: the signal may have aborted
23
+ // between the initial `signal.aborted` check and the `addEventListener`
24
+ // call above. If it did, the abort event was already dispatched and
25
+ // the listener will never fire — we must manually abort.
26
+ if (signal.aborted) {
27
+ controller.abort(signal === null || signal === void 0 ? void 0 : signal.reason);
28
+ return controller.signal;
29
+ }
22
30
  }
23
31
  return controller.signal;
24
32
  }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "17.2.0";
1
+ export declare const SDK_VERSION = "17.4.0";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "17.2.0";
4
+ exports.SDK_VERSION = "17.4.0";
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
6
6
  const headers = mergeHeaders({
7
7
  "X-Fern-Language": "JavaScript",
8
8
  "X-Fern-SDK-Name": "phenoml",
9
- "X-Fern-SDK-Version": "17.2.0",
10
- "User-Agent": "phenoml/17.2.0",
9
+ "X-Fern-SDK-Version": "17.4.0",
10
+ "User-Agent": "phenoml/17.4.0",
11
11
  "X-Fern-Runtime": core.RUNTIME.type,
12
12
  "X-Fern-Runtime-Version": core.RUNTIME.version,
13
13
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -11,30 +11,26 @@ export declare class Fhir2OmopClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<Fhir2OmopClient.Options>;
12
12
  constructor(options?: Fhir2OmopClient.Options);
13
13
  /**
14
- * Shapes a FHIR R4 resource or Bundle into OMOP Common Data Model v5.4 rows
14
+ * Maps a FHIR R4 resource or Bundle into OMOP Common Data Model v5.4 rows
15
15
  * (person, visit_occurrence, condition_occurrence, drug_exposure,
16
16
  * procedure_occurrence, measurement, observation).
17
17
  *
18
- * **Two resolution modes, reported in `mode`.** `mode` reflects which
19
- * resolver is wired, not the path an individual coding took. With a
20
- * concept-resolver configured (the default), `mode` is `"resolved"` and the
21
- * resource's primary clinical coding is resolved to a real OMOP `concept_id`;
22
- * with no resolver configured, `mode` is `"structural"` and every clinical
23
- * and source `concept_id` is `0`. In `"resolved"` mode individual codings can
24
- * still land at `concept_id` `0` without changing the mode: a coding the
25
- * service finds no match for is `UNMAPPED`, and a coding that fell back to the
26
- * structural tier (the resolver was briefly unavailable, or the resource was
27
- * text-only) is surfaced in `scan_summary` (`concept_resolver_note`,
28
- * `construe_resolutions`). A `concept_id` of `0` is "no matching concept" per
29
- * OMOP semantics, deliberately not omitted. Only the primary clinical coding
30
- * is resolved — `gender`/`race`/`ethnicity`/`visit`/`value`/`unit`
31
- * `concept_id`s are always `0`.
18
+ * Each resource's primary clinical coding is resolved to a standard OMOP
19
+ * `concept_id`. Alongside the OMOP rows grouped by table (`tables`), the
20
+ * response carries `mappings` (how each source coding resolved, linked back
21
+ * to the row it produced), `dropped` (resources that could not be shaped
22
+ * into a row), `vocab_version` (the OMOP vocabulary release codes were
23
+ * resolved against), and a small `summary` of the resolution outcomes.
32
24
  *
33
- * In every mode each `*_source_value` carries the verbatim FHIR coding
34
- * (`system#code`), `*_type_concept_id` is set to `32817` (EHR), and the
35
- * response `report` lists one Usagi-shaped entry per source coding describing
36
- * how it resolved (`ALREADY_STANDARD`, `MAPPED`, an `UNCHECKED` suggestion,
37
- * or `UNMAPPED`).
25
+ * A `concept_id` of `0` is reported, not omitted (OMOP "no matching
26
+ * concept" semantics): it covers both a coding with no standard match
27
+ * (`UNMAPPED`) and an unverified suggestion for a text-only resource
28
+ * (`UNCHECKED`). Only the primary clinical coding is resolved, so
29
+ * `gender`/`race`/`ethnicity`/`visit`/`value`/`unit` `concept_id`s are
30
+ * always `0`; the one populated non-resolved concept is measurement
31
+ * `operator_concept_id`, set from a value comparator (`<`, `<=`, `>`, `>=`)
32
+ * rather than the resolver. Each `*_source_value` carries the verbatim FHIR
33
+ * coding (`system#code`), and `*_type_concept_id` is set to `32817` (EHR).
38
34
  *
39
35
  * Medication codes are resolved whether they appear inline
40
36
  * (`medicationCodeableConcept`) or via a `medicationReference` to a contained,
@@ -42,7 +38,7 @@ export declare class Fhir2OmopClient {
42
38
  * Resources that cannot be shaped into a row — a medication with no usable
43
39
  * code, resolvable reference, or display, or any clinical resource whose
44
40
  * subject/patient reference cannot be tied to a person — are reported under
45
- * `scan_summary.dropped_resources` rather than emitted as blank rows. The
41
+ * `dropped` rather than emitted as blank rows. The
46
42
  * bundle must contain at least one Patient resource.
47
43
  *
48
44
  * @param {phenoml.fhir2Omop.CreateOmopRequest} request
@@ -51,6 +47,7 @@ export declare class Fhir2OmopClient {
51
47
  * @throws {@link phenoml.fhir2Omop.BadRequestError}
52
48
  * @throws {@link phenoml.fhir2Omop.UnauthorizedError}
53
49
  * @throws {@link phenoml.fhir2Omop.InternalServerError}
50
+ * @throws {@link phenoml.fhir2Omop.ServiceUnavailableError}
54
51
  *
55
52
  * @example
56
53
  * await client.fhir2Omop.create({
@@ -20,30 +20,26 @@ export class Fhir2OmopClient {
20
20
  this._options = normalizeClientOptionsWithAuth(options);
21
21
  }
22
22
  /**
23
- * Shapes a FHIR R4 resource or Bundle into OMOP Common Data Model v5.4 rows
23
+ * Maps a FHIR R4 resource or Bundle into OMOP Common Data Model v5.4 rows
24
24
  * (person, visit_occurrence, condition_occurrence, drug_exposure,
25
25
  * procedure_occurrence, measurement, observation).
26
26
  *
27
- * **Two resolution modes, reported in `mode`.** `mode` reflects which
28
- * resolver is wired, not the path an individual coding took. With a
29
- * concept-resolver configured (the default), `mode` is `"resolved"` and the
30
- * resource's primary clinical coding is resolved to a real OMOP `concept_id`;
31
- * with no resolver configured, `mode` is `"structural"` and every clinical
32
- * and source `concept_id` is `0`. In `"resolved"` mode individual codings can
33
- * still land at `concept_id` `0` without changing the mode: a coding the
34
- * service finds no match for is `UNMAPPED`, and a coding that fell back to the
35
- * structural tier (the resolver was briefly unavailable, or the resource was
36
- * text-only) is surfaced in `scan_summary` (`concept_resolver_note`,
37
- * `construe_resolutions`). A `concept_id` of `0` is "no matching concept" per
38
- * OMOP semantics, deliberately not omitted. Only the primary clinical coding
39
- * is resolved — `gender`/`race`/`ethnicity`/`visit`/`value`/`unit`
40
- * `concept_id`s are always `0`.
27
+ * Each resource's primary clinical coding is resolved to a standard OMOP
28
+ * `concept_id`. Alongside the OMOP rows grouped by table (`tables`), the
29
+ * response carries `mappings` (how each source coding resolved, linked back
30
+ * to the row it produced), `dropped` (resources that could not be shaped
31
+ * into a row), `vocab_version` (the OMOP vocabulary release codes were
32
+ * resolved against), and a small `summary` of the resolution outcomes.
41
33
  *
42
- * In every mode each `*_source_value` carries the verbatim FHIR coding
43
- * (`system#code`), `*_type_concept_id` is set to `32817` (EHR), and the
44
- * response `report` lists one Usagi-shaped entry per source coding describing
45
- * how it resolved (`ALREADY_STANDARD`, `MAPPED`, an `UNCHECKED` suggestion,
46
- * or `UNMAPPED`).
34
+ * A `concept_id` of `0` is reported, not omitted (OMOP "no matching
35
+ * concept" semantics): it covers both a coding with no standard match
36
+ * (`UNMAPPED`) and an unverified suggestion for a text-only resource
37
+ * (`UNCHECKED`). Only the primary clinical coding is resolved, so
38
+ * `gender`/`race`/`ethnicity`/`visit`/`value`/`unit` `concept_id`s are
39
+ * always `0`; the one populated non-resolved concept is measurement
40
+ * `operator_concept_id`, set from a value comparator (`<`, `<=`, `>`, `>=`)
41
+ * rather than the resolver. Each `*_source_value` carries the verbatim FHIR
42
+ * coding (`system#code`), and `*_type_concept_id` is set to `32817` (EHR).
47
43
  *
48
44
  * Medication codes are resolved whether they appear inline
49
45
  * (`medicationCodeableConcept`) or via a `medicationReference` to a contained,
@@ -51,7 +47,7 @@ export class Fhir2OmopClient {
51
47
  * Resources that cannot be shaped into a row — a medication with no usable
52
48
  * code, resolvable reference, or display, or any clinical resource whose
53
49
  * subject/patient reference cannot be tied to a person — are reported under
54
- * `scan_summary.dropped_resources` rather than emitted as blank rows. The
50
+ * `dropped` rather than emitted as blank rows. The
55
51
  * bundle must contain at least one Patient resource.
56
52
  *
57
53
  * @param {phenoml.fhir2Omop.CreateOmopRequest} request
@@ -60,6 +56,7 @@ export class Fhir2OmopClient {
60
56
  * @throws {@link phenoml.fhir2Omop.BadRequestError}
61
57
  * @throws {@link phenoml.fhir2Omop.UnauthorizedError}
62
58
  * @throws {@link phenoml.fhir2Omop.InternalServerError}
59
+ * @throws {@link phenoml.fhir2Omop.ServiceUnavailableError}
63
60
  *
64
61
  * @example
65
62
  * await client.fhir2Omop.create({
@@ -160,6 +157,8 @@ export class Fhir2OmopClient {
160
157
  throw new phenoml.fhir2Omop.UnauthorizedError(_response.error.body, _response.rawResponse);
161
158
  case 500:
162
159
  throw new phenoml.fhir2Omop.InternalServerError(_response.error.body, _response.rawResponse);
160
+ case 503:
161
+ throw new phenoml.fhir2Omop.ServiceUnavailableError(_response.error.body, _response.rawResponse);
163
162
  default:
164
163
  throw new errors.phenomlError({
165
164
  statusCode: _response.error.statusCode,
@@ -0,0 +1,5 @@
1
+ import type * as core from "../../../../core/index.mjs";
2
+ import * as errors from "../../../../errors/index.mjs";
3
+ export declare class ServiceUnavailableError extends errors.phenomlError {
4
+ constructor(body?: unknown, rawResponse?: core.RawResponse);
5
+ }
@@ -0,0 +1,17 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as errors from "../../../../errors/index.mjs";
3
+ export class ServiceUnavailableError extends errors.phenomlError {
4
+ constructor(body, rawResponse) {
5
+ super({
6
+ message: "ServiceUnavailableError",
7
+ statusCode: 503,
8
+ body: body,
9
+ rawResponse: rawResponse,
10
+ });
11
+ Object.setPrototypeOf(this, new.target.prototype);
12
+ if (Error.captureStackTrace) {
13
+ Error.captureStackTrace(this, this.constructor);
14
+ }
15
+ this.name = this.constructor.name;
16
+ }
17
+ }
@@ -1,3 +1,4 @@
1
1
  export * from "./BadRequestError.mjs";
2
2
  export * from "./InternalServerError.mjs";
3
+ export * from "./ServiceUnavailableError.mjs";
3
4
  export * from "./UnauthorizedError.mjs";
@@ -1,3 +1,4 @@
1
1
  export * from "./BadRequestError.mjs";
2
2
  export * from "./InternalServerError.mjs";
3
+ export * from "./ServiceUnavailableError.mjs";
3
4
  export * from "./UnauthorizedError.mjs";