phenoml 17.0.0 → 17.1.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.
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +3 -0
- package/dist/cjs/Client.js +15 -10
- package/dist/cjs/api/resources/fhir2Omop/client/Client.d.ts +110 -0
- package/dist/cjs/api/resources/fhir2Omop/client/Client.js +198 -0
- package/dist/cjs/api/resources/fhir2Omop/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/fhir2Omop/client/index.js +17 -0
- package/dist/cjs/api/resources/fhir2Omop/client/requests/CreateOmopRequest.d.ts +76 -0
- package/dist/cjs/api/resources/fhir2Omop/client/requests/CreateOmopRequest.js +3 -0
- package/dist/cjs/api/resources/fhir2Omop/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/fhir2Omop/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/fhir2Omop/errors/BadRequestError.d.ts +5 -0
- package/dist/cjs/api/resources/fhir2Omop/errors/BadRequestError.js +54 -0
- package/dist/cjs/api/resources/fhir2Omop/errors/InternalServerError.d.ts +5 -0
- package/dist/cjs/api/resources/fhir2Omop/errors/InternalServerError.js +54 -0
- package/dist/cjs/api/resources/fhir2Omop/errors/UnauthorizedError.d.ts +5 -0
- package/dist/cjs/api/resources/fhir2Omop/errors/UnauthorizedError.js +54 -0
- package/dist/cjs/api/resources/fhir2Omop/errors/index.d.ts +3 -0
- package/dist/cjs/api/resources/fhir2Omop/errors/index.js +19 -0
- package/dist/cjs/api/resources/fhir2Omop/exports.d.ts +2 -0
- package/dist/cjs/api/resources/fhir2Omop/exports.js +21 -0
- package/dist/cjs/api/resources/fhir2Omop/index.d.ts +3 -0
- package/dist/cjs/api/resources/fhir2Omop/index.js +19 -0
- package/dist/cjs/api/resources/fhir2Omop/types/ConditionOccurrenceRow.d.ts +12 -0
- package/dist/cjs/api/resources/fhir2Omop/types/ConditionOccurrenceRow.js +3 -0
- package/dist/cjs/api/resources/fhir2Omop/types/CreateOmopResponse.d.ts +11 -0
- package/dist/cjs/api/resources/fhir2Omop/types/CreateOmopResponse.js +3 -0
- package/dist/cjs/api/resources/fhir2Omop/types/DroppedResource.d.ts +5 -0
- package/dist/cjs/api/resources/fhir2Omop/types/DroppedResource.js +3 -0
- package/dist/cjs/api/resources/fhir2Omop/types/DrugExposureRow.d.ts +13 -0
- package/dist/cjs/api/resources/fhir2Omop/types/DrugExposureRow.js +3 -0
- package/dist/cjs/api/resources/fhir2Omop/types/MappingReportEntry.d.ts +18 -0
- package/dist/cjs/api/resources/fhir2Omop/types/MappingReportEntry.js +3 -0
- package/dist/cjs/api/resources/fhir2Omop/types/MeasurementRow.d.ts +17 -0
- package/dist/cjs/api/resources/fhir2Omop/types/MeasurementRow.js +3 -0
- package/dist/cjs/api/resources/fhir2Omop/types/ObservationRow.d.ts +16 -0
- package/dist/cjs/api/resources/fhir2Omop/types/ObservationRow.js +3 -0
- package/dist/cjs/api/resources/fhir2Omop/types/OmopTables.d.ts +13 -0
- package/dist/cjs/api/resources/fhir2Omop/types/OmopTables.js +3 -0
- package/dist/cjs/api/resources/fhir2Omop/types/PersonRow.d.ts +14 -0
- package/dist/cjs/api/resources/fhir2Omop/types/PersonRow.js +3 -0
- package/dist/cjs/api/resources/fhir2Omop/types/ProcedureOccurrenceRow.d.ts +10 -0
- package/dist/cjs/api/resources/fhir2Omop/types/ProcedureOccurrenceRow.js +3 -0
- package/dist/cjs/api/resources/fhir2Omop/types/ScanSummary.d.ts +15 -0
- package/dist/cjs/api/resources/fhir2Omop/types/ScanSummary.js +3 -0
- package/dist/cjs/api/resources/fhir2Omop/types/VisitOccurrenceRow.d.ts +11 -0
- package/dist/cjs/api/resources/fhir2Omop/types/VisitOccurrenceRow.js +3 -0
- package/dist/cjs/api/resources/fhir2Omop/types/index.d.ts +12 -0
- package/dist/cjs/api/resources/fhir2Omop/types/index.js +28 -0
- package/dist/cjs/api/resources/index.d.ts +1 -0
- package/dist/cjs/api/resources/index.js +2 -1
- package/dist/cjs/core/fetcher/getResponseBody.js +11 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.d.mts +3 -0
- package/dist/esm/Client.mjs +5 -0
- package/dist/esm/api/resources/fhir2Omop/client/Client.d.mts +110 -0
- package/dist/esm/api/resources/fhir2Omop/client/Client.mjs +161 -0
- package/dist/esm/api/resources/fhir2Omop/client/index.d.mts +1 -0
- package/dist/esm/api/resources/fhir2Omop/client/index.mjs +1 -0
- package/dist/esm/api/resources/fhir2Omop/client/requests/CreateOmopRequest.d.mts +76 -0
- package/dist/esm/api/resources/fhir2Omop/client/requests/CreateOmopRequest.mjs +2 -0
- package/dist/esm/api/resources/fhir2Omop/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/fhir2Omop/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/fhir2Omop/errors/BadRequestError.d.mts +5 -0
- package/dist/esm/api/resources/fhir2Omop/errors/BadRequestError.mjs +17 -0
- package/dist/esm/api/resources/fhir2Omop/errors/InternalServerError.d.mts +5 -0
- package/dist/esm/api/resources/fhir2Omop/errors/InternalServerError.mjs +17 -0
- package/dist/esm/api/resources/fhir2Omop/errors/UnauthorizedError.d.mts +5 -0
- package/dist/esm/api/resources/fhir2Omop/errors/UnauthorizedError.mjs +17 -0
- package/dist/esm/api/resources/fhir2Omop/errors/index.d.mts +3 -0
- package/dist/esm/api/resources/fhir2Omop/errors/index.mjs +3 -0
- package/dist/esm/api/resources/fhir2Omop/exports.d.mts +2 -0
- package/dist/esm/api/resources/fhir2Omop/exports.mjs +3 -0
- package/dist/esm/api/resources/fhir2Omop/index.d.mts +3 -0
- package/dist/esm/api/resources/fhir2Omop/index.mjs +3 -0
- package/dist/esm/api/resources/fhir2Omop/types/ConditionOccurrenceRow.d.mts +12 -0
- package/dist/esm/api/resources/fhir2Omop/types/ConditionOccurrenceRow.mjs +2 -0
- package/dist/esm/api/resources/fhir2Omop/types/CreateOmopResponse.d.mts +11 -0
- package/dist/esm/api/resources/fhir2Omop/types/CreateOmopResponse.mjs +2 -0
- package/dist/esm/api/resources/fhir2Omop/types/DroppedResource.d.mts +5 -0
- package/dist/esm/api/resources/fhir2Omop/types/DroppedResource.mjs +2 -0
- package/dist/esm/api/resources/fhir2Omop/types/DrugExposureRow.d.mts +13 -0
- package/dist/esm/api/resources/fhir2Omop/types/DrugExposureRow.mjs +2 -0
- package/dist/esm/api/resources/fhir2Omop/types/MappingReportEntry.d.mts +18 -0
- package/dist/esm/api/resources/fhir2Omop/types/MappingReportEntry.mjs +2 -0
- package/dist/esm/api/resources/fhir2Omop/types/MeasurementRow.d.mts +17 -0
- package/dist/esm/api/resources/fhir2Omop/types/MeasurementRow.mjs +2 -0
- package/dist/esm/api/resources/fhir2Omop/types/ObservationRow.d.mts +16 -0
- package/dist/esm/api/resources/fhir2Omop/types/ObservationRow.mjs +2 -0
- package/dist/esm/api/resources/fhir2Omop/types/OmopTables.d.mts +13 -0
- package/dist/esm/api/resources/fhir2Omop/types/OmopTables.mjs +2 -0
- package/dist/esm/api/resources/fhir2Omop/types/PersonRow.d.mts +14 -0
- package/dist/esm/api/resources/fhir2Omop/types/PersonRow.mjs +2 -0
- package/dist/esm/api/resources/fhir2Omop/types/ProcedureOccurrenceRow.d.mts +10 -0
- package/dist/esm/api/resources/fhir2Omop/types/ProcedureOccurrenceRow.mjs +2 -0
- package/dist/esm/api/resources/fhir2Omop/types/ScanSummary.d.mts +15 -0
- package/dist/esm/api/resources/fhir2Omop/types/ScanSummary.mjs +2 -0
- package/dist/esm/api/resources/fhir2Omop/types/VisitOccurrenceRow.d.mts +11 -0
- package/dist/esm/api/resources/fhir2Omop/types/VisitOccurrenceRow.mjs +2 -0
- package/dist/esm/api/resources/fhir2Omop/types/index.d.mts +12 -0
- package/dist/esm/api/resources/fhir2Omop/types/index.mjs +12 -0
- package/dist/esm/api/resources/index.d.mts +1 -0
- package/dist/esm/api/resources/index.mjs +1 -0
- package/dist/esm/core/fetcher/getResponseBody.mjs +11 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/openapi/openapi.json +731 -1
- package/package.json +15 -4
- package/reference.md +146 -0
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -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.
|
|
47
|
-
"User-Agent": "phenoml/17.
|
|
46
|
+
"X-Fern-SDK-Version": "17.1.0",
|
|
47
|
+
"User-Agent": "phenoml/17.1.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);
|
package/dist/cjs/Client.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { AuthtokenClient } from "./api/resources/authtoken/client/Client.js";
|
|
|
3
3
|
import { CohortClient } from "./api/resources/cohort/client/Client.js";
|
|
4
4
|
import { ConstrueClient } from "./api/resources/construe/client/Client.js";
|
|
5
5
|
import { FhirClient } from "./api/resources/fhir/client/Client.js";
|
|
6
|
+
import { Fhir2OmopClient } from "./api/resources/fhir2Omop/client/Client.js";
|
|
6
7
|
import { FhirProviderClient } from "./api/resources/fhirProvider/client/Client.js";
|
|
7
8
|
import { Lang2FhirClient } from "./api/resources/lang2Fhir/client/Client.js";
|
|
8
9
|
import { SummaryClient } from "./api/resources/summary/client/Client.js";
|
|
@@ -23,6 +24,7 @@ export declare class phenomlClient {
|
|
|
23
24
|
protected _cohort: CohortClient | undefined;
|
|
24
25
|
protected _construe: ConstrueClient | undefined;
|
|
25
26
|
protected _fhir: FhirClient | undefined;
|
|
27
|
+
protected _fhir2Omop: Fhir2OmopClient | undefined;
|
|
26
28
|
protected _fhirProvider: FhirProviderClient | undefined;
|
|
27
29
|
protected _lang2Fhir: Lang2FhirClient | undefined;
|
|
28
30
|
protected _summary: SummaryClient | undefined;
|
|
@@ -34,6 +36,7 @@ export declare class phenomlClient {
|
|
|
34
36
|
get cohort(): CohortClient;
|
|
35
37
|
get construe(): ConstrueClient;
|
|
36
38
|
get fhir(): FhirClient;
|
|
39
|
+
get fhir2Omop(): Fhir2OmopClient;
|
|
37
40
|
get fhirProvider(): FhirProviderClient;
|
|
38
41
|
get lang2Fhir(): Lang2FhirClient;
|
|
39
42
|
get summary(): SummaryClient;
|
package/dist/cjs/Client.js
CHANGED
|
@@ -49,11 +49,12 @@ const Client_js_2 = require("./api/resources/authtoken/client/Client.js");
|
|
|
49
49
|
const Client_js_3 = require("./api/resources/cohort/client/Client.js");
|
|
50
50
|
const Client_js_4 = require("./api/resources/construe/client/Client.js");
|
|
51
51
|
const Client_js_5 = require("./api/resources/fhir/client/Client.js");
|
|
52
|
-
const Client_js_6 = require("./api/resources/
|
|
53
|
-
const Client_js_7 = require("./api/resources/
|
|
54
|
-
const Client_js_8 = require("./api/resources/
|
|
55
|
-
const Client_js_9 = require("./api/resources/
|
|
56
|
-
const Client_js_10 = require("./api/resources/
|
|
52
|
+
const Client_js_6 = require("./api/resources/fhir2Omop/client/Client.js");
|
|
53
|
+
const Client_js_7 = require("./api/resources/fhirProvider/client/Client.js");
|
|
54
|
+
const Client_js_8 = require("./api/resources/lang2Fhir/client/Client.js");
|
|
55
|
+
const Client_js_9 = require("./api/resources/summary/client/Client.js");
|
|
56
|
+
const Client_js_10 = require("./api/resources/tools/client/Client.js");
|
|
57
|
+
const Client_js_11 = require("./api/resources/workflows/client/Client.js");
|
|
57
58
|
const BaseClient_js_1 = require("./BaseClient.js");
|
|
58
59
|
const core = __importStar(require("./core/index.js"));
|
|
59
60
|
class phenomlClient {
|
|
@@ -80,25 +81,29 @@ class phenomlClient {
|
|
|
80
81
|
var _a;
|
|
81
82
|
return ((_a = this._fhir) !== null && _a !== void 0 ? _a : (this._fhir = new Client_js_5.FhirClient(this._options)));
|
|
82
83
|
}
|
|
84
|
+
get fhir2Omop() {
|
|
85
|
+
var _a;
|
|
86
|
+
return ((_a = this._fhir2Omop) !== null && _a !== void 0 ? _a : (this._fhir2Omop = new Client_js_6.Fhir2OmopClient(this._options)));
|
|
87
|
+
}
|
|
83
88
|
get fhirProvider() {
|
|
84
89
|
var _a;
|
|
85
|
-
return ((_a = this._fhirProvider) !== null && _a !== void 0 ? _a : (this._fhirProvider = new
|
|
90
|
+
return ((_a = this._fhirProvider) !== null && _a !== void 0 ? _a : (this._fhirProvider = new Client_js_7.FhirProviderClient(this._options)));
|
|
86
91
|
}
|
|
87
92
|
get lang2Fhir() {
|
|
88
93
|
var _a;
|
|
89
|
-
return ((_a = this._lang2Fhir) !== null && _a !== void 0 ? _a : (this._lang2Fhir = new
|
|
94
|
+
return ((_a = this._lang2Fhir) !== null && _a !== void 0 ? _a : (this._lang2Fhir = new Client_js_8.Lang2FhirClient(this._options)));
|
|
90
95
|
}
|
|
91
96
|
get summary() {
|
|
92
97
|
var _a;
|
|
93
|
-
return ((_a = this._summary) !== null && _a !== void 0 ? _a : (this._summary = new
|
|
98
|
+
return ((_a = this._summary) !== null && _a !== void 0 ? _a : (this._summary = new Client_js_9.SummaryClient(this._options)));
|
|
94
99
|
}
|
|
95
100
|
get tools() {
|
|
96
101
|
var _a;
|
|
97
|
-
return ((_a = this._tools) !== null && _a !== void 0 ? _a : (this._tools = new
|
|
102
|
+
return ((_a = this._tools) !== null && _a !== void 0 ? _a : (this._tools = new Client_js_10.ToolsClient(this._options)));
|
|
98
103
|
}
|
|
99
104
|
get workflows() {
|
|
100
105
|
var _a;
|
|
101
|
-
return ((_a = this._workflows) !== null && _a !== void 0 ? _a : (this._workflows = new
|
|
106
|
+
return ((_a = this._workflows) !== null && _a !== void 0 ? _a : (this._workflows = new Client_js_11.WorkflowsClient(this._options)));
|
|
102
107
|
}
|
|
103
108
|
/**
|
|
104
109
|
* Make a passthrough request using the SDK's configured auth, retry, logging, etc.
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
|
|
3
|
+
import * as core from "../../../../core/index.js";
|
|
4
|
+
import * as phenoml from "../../../index.js";
|
|
5
|
+
export declare namespace Fhir2OmopClient {
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class Fhir2OmopClient {
|
|
11
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<Fhir2OmopClient.Options>;
|
|
12
|
+
constructor(options?: Fhir2OmopClient.Options);
|
|
13
|
+
/**
|
|
14
|
+
* Shapes a FHIR R4 resource or Bundle into OMOP Common Data Model v5.4 rows
|
|
15
|
+
* (person, visit_occurrence, condition_occurrence, drug_exposure,
|
|
16
|
+
* procedure_occurrence, measurement, observation).
|
|
17
|
+
*
|
|
18
|
+
* **This is a structural mapping (`mode: "structural"`).** Rows are
|
|
19
|
+
* structurally valid OMOP, but every clinical and source `concept_id` is `0`:
|
|
20
|
+
* the vocabulary crosswalk that assigns real OMOP `concept_id`s is a planned
|
|
21
|
+
* follow-up. Each `*_source_value` carries the verbatim FHIR coding
|
|
22
|
+
* (`system#code`), `*_type_concept_id` is set to `32817` (EHR), and the
|
|
23
|
+
* response `report` lists a standard-code *suggestion* for each source coding
|
|
24
|
+
* (already-standard, an unchecked normalization suggestion, or unmapped). Do
|
|
25
|
+
* not treat the output as analytically resolved OMOP until `concept_id`s are
|
|
26
|
+
* populated.
|
|
27
|
+
*
|
|
28
|
+
* Medication codes are resolved whether they appear inline
|
|
29
|
+
* (`medicationCodeableConcept`) or via a `medicationReference` to a contained,
|
|
30
|
+
* relative (`Type/id`), or bundle-entry (`urn:uuid`) `Medication` resource.
|
|
31
|
+
* A medication with no usable code, resolvable reference, or display is
|
|
32
|
+
* reported under `scan_summary.dropped_resources` rather than emitted as a
|
|
33
|
+
* blank row. The bundle must contain at least one Patient resource.
|
|
34
|
+
*
|
|
35
|
+
* @param {phenoml.fhir2Omop.CreateOmopRequest} request
|
|
36
|
+
* @param {Fhir2OmopClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
37
|
+
*
|
|
38
|
+
* @throws {@link phenoml.fhir2Omop.BadRequestError}
|
|
39
|
+
* @throws {@link phenoml.fhir2Omop.UnauthorizedError}
|
|
40
|
+
* @throws {@link phenoml.fhir2Omop.InternalServerError}
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* await client.fhir2Omop.create({
|
|
44
|
+
* fhir_resources: {
|
|
45
|
+
* "resourceType": "Bundle",
|
|
46
|
+
* "type": "collection",
|
|
47
|
+
* "entry": [
|
|
48
|
+
* {
|
|
49
|
+
* "resource": {
|
|
50
|
+
* "resourceType": "Patient",
|
|
51
|
+
* "id": "patient-1",
|
|
52
|
+
* "gender": "female",
|
|
53
|
+
* "birthDate": "1985-07-22"
|
|
54
|
+
* }
|
|
55
|
+
* },
|
|
56
|
+
* {
|
|
57
|
+
* "resource": {
|
|
58
|
+
* "resourceType": "Condition",
|
|
59
|
+
* "id": "condition-1",
|
|
60
|
+
* "subject": {
|
|
61
|
+
* "reference": "Patient/patient-1"
|
|
62
|
+
* },
|
|
63
|
+
* "code": {
|
|
64
|
+
* "coding": [
|
|
65
|
+
* {
|
|
66
|
+
* "system": "http://snomed.info/sct",
|
|
67
|
+
* "code": "44054006",
|
|
68
|
+
* "display": "Type 2 diabetes mellitus"
|
|
69
|
+
* }
|
|
70
|
+
* ]
|
|
71
|
+
* },
|
|
72
|
+
* "onsetDateTime": "2024-01-15"
|
|
73
|
+
* }
|
|
74
|
+
* },
|
|
75
|
+
* {
|
|
76
|
+
* "resource": {
|
|
77
|
+
* "resourceType": "MedicationRequest",
|
|
78
|
+
* "id": "medreq-1",
|
|
79
|
+
* "status": "active",
|
|
80
|
+
* "subject": {
|
|
81
|
+
* "reference": "Patient/patient-1"
|
|
82
|
+
* },
|
|
83
|
+
* "medicationReference": {
|
|
84
|
+
* "reference": "#med0"
|
|
85
|
+
* },
|
|
86
|
+
* "authoredOn": "2024-01-16",
|
|
87
|
+
* "contained": [
|
|
88
|
+
* {
|
|
89
|
+
* "resourceType": "Medication",
|
|
90
|
+
* "id": "med0",
|
|
91
|
+
* "code": {
|
|
92
|
+
* "coding": [
|
|
93
|
+
* {
|
|
94
|
+
* "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
|
|
95
|
+
* "code": "860975",
|
|
96
|
+
* "display": "metformin hydrochloride 500 MG"
|
|
97
|
+
* }
|
|
98
|
+
* ]
|
|
99
|
+
* }
|
|
100
|
+
* }
|
|
101
|
+
* ]
|
|
102
|
+
* }
|
|
103
|
+
* }
|
|
104
|
+
* ]
|
|
105
|
+
* }
|
|
106
|
+
* })
|
|
107
|
+
*/
|
|
108
|
+
create(request: phenoml.fhir2Omop.CreateOmopRequest, requestOptions?: Fhir2OmopClient.RequestOptions): core.HttpResponsePromise<phenoml.fhir2Omop.CreateOmopResponse>;
|
|
109
|
+
private __create;
|
|
110
|
+
}
|
|
@@ -0,0 +1,198 @@
|
|
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.Fhir2OmopClient = void 0;
|
|
47
|
+
const BaseClient_js_1 = require("../../../../BaseClient.js");
|
|
48
|
+
const headers_js_1 = require("../../../../core/headers.js");
|
|
49
|
+
const core = __importStar(require("../../../../core/index.js"));
|
|
50
|
+
const environments = __importStar(require("../../../../environments.js"));
|
|
51
|
+
const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
|
|
52
|
+
const errors = __importStar(require("../../../../errors/index.js"));
|
|
53
|
+
const phenoml = __importStar(require("../../../index.js"));
|
|
54
|
+
class Fhir2OmopClient {
|
|
55
|
+
constructor(options = {}) {
|
|
56
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Shapes a FHIR R4 resource or Bundle into OMOP Common Data Model v5.4 rows
|
|
60
|
+
* (person, visit_occurrence, condition_occurrence, drug_exposure,
|
|
61
|
+
* procedure_occurrence, measurement, observation).
|
|
62
|
+
*
|
|
63
|
+
* **This is a structural mapping (`mode: "structural"`).** Rows are
|
|
64
|
+
* structurally valid OMOP, but every clinical and source `concept_id` is `0`:
|
|
65
|
+
* the vocabulary crosswalk that assigns real OMOP `concept_id`s is a planned
|
|
66
|
+
* follow-up. Each `*_source_value` carries the verbatim FHIR coding
|
|
67
|
+
* (`system#code`), `*_type_concept_id` is set to `32817` (EHR), and the
|
|
68
|
+
* response `report` lists a standard-code *suggestion* for each source coding
|
|
69
|
+
* (already-standard, an unchecked normalization suggestion, or unmapped). Do
|
|
70
|
+
* not treat the output as analytically resolved OMOP until `concept_id`s are
|
|
71
|
+
* populated.
|
|
72
|
+
*
|
|
73
|
+
* Medication codes are resolved whether they appear inline
|
|
74
|
+
* (`medicationCodeableConcept`) or via a `medicationReference` to a contained,
|
|
75
|
+
* relative (`Type/id`), or bundle-entry (`urn:uuid`) `Medication` resource.
|
|
76
|
+
* A medication with no usable code, resolvable reference, or display is
|
|
77
|
+
* reported under `scan_summary.dropped_resources` rather than emitted as a
|
|
78
|
+
* blank row. The bundle must contain at least one Patient resource.
|
|
79
|
+
*
|
|
80
|
+
* @param {phenoml.fhir2Omop.CreateOmopRequest} request
|
|
81
|
+
* @param {Fhir2OmopClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
82
|
+
*
|
|
83
|
+
* @throws {@link phenoml.fhir2Omop.BadRequestError}
|
|
84
|
+
* @throws {@link phenoml.fhir2Omop.UnauthorizedError}
|
|
85
|
+
* @throws {@link phenoml.fhir2Omop.InternalServerError}
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* await client.fhir2Omop.create({
|
|
89
|
+
* fhir_resources: {
|
|
90
|
+
* "resourceType": "Bundle",
|
|
91
|
+
* "type": "collection",
|
|
92
|
+
* "entry": [
|
|
93
|
+
* {
|
|
94
|
+
* "resource": {
|
|
95
|
+
* "resourceType": "Patient",
|
|
96
|
+
* "id": "patient-1",
|
|
97
|
+
* "gender": "female",
|
|
98
|
+
* "birthDate": "1985-07-22"
|
|
99
|
+
* }
|
|
100
|
+
* },
|
|
101
|
+
* {
|
|
102
|
+
* "resource": {
|
|
103
|
+
* "resourceType": "Condition",
|
|
104
|
+
* "id": "condition-1",
|
|
105
|
+
* "subject": {
|
|
106
|
+
* "reference": "Patient/patient-1"
|
|
107
|
+
* },
|
|
108
|
+
* "code": {
|
|
109
|
+
* "coding": [
|
|
110
|
+
* {
|
|
111
|
+
* "system": "http://snomed.info/sct",
|
|
112
|
+
* "code": "44054006",
|
|
113
|
+
* "display": "Type 2 diabetes mellitus"
|
|
114
|
+
* }
|
|
115
|
+
* ]
|
|
116
|
+
* },
|
|
117
|
+
* "onsetDateTime": "2024-01-15"
|
|
118
|
+
* }
|
|
119
|
+
* },
|
|
120
|
+
* {
|
|
121
|
+
* "resource": {
|
|
122
|
+
* "resourceType": "MedicationRequest",
|
|
123
|
+
* "id": "medreq-1",
|
|
124
|
+
* "status": "active",
|
|
125
|
+
* "subject": {
|
|
126
|
+
* "reference": "Patient/patient-1"
|
|
127
|
+
* },
|
|
128
|
+
* "medicationReference": {
|
|
129
|
+
* "reference": "#med0"
|
|
130
|
+
* },
|
|
131
|
+
* "authoredOn": "2024-01-16",
|
|
132
|
+
* "contained": [
|
|
133
|
+
* {
|
|
134
|
+
* "resourceType": "Medication",
|
|
135
|
+
* "id": "med0",
|
|
136
|
+
* "code": {
|
|
137
|
+
* "coding": [
|
|
138
|
+
* {
|
|
139
|
+
* "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
|
|
140
|
+
* "code": "860975",
|
|
141
|
+
* "display": "metformin hydrochloride 500 MG"
|
|
142
|
+
* }
|
|
143
|
+
* ]
|
|
144
|
+
* }
|
|
145
|
+
* }
|
|
146
|
+
* ]
|
|
147
|
+
* }
|
|
148
|
+
* }
|
|
149
|
+
* ]
|
|
150
|
+
* }
|
|
151
|
+
* })
|
|
152
|
+
*/
|
|
153
|
+
create(request, requestOptions) {
|
|
154
|
+
return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
|
|
155
|
+
}
|
|
156
|
+
__create(request, requestOptions) {
|
|
157
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
158
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
159
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
160
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
161
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
162
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, "fhir2omop/create"),
|
|
163
|
+
method: "POST",
|
|
164
|
+
headers: _headers,
|
|
165
|
+
contentType: "application/json",
|
|
166
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
167
|
+
requestType: "json",
|
|
168
|
+
body: request,
|
|
169
|
+
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
170
|
+
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
171
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
172
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
173
|
+
logging: this._options.logging,
|
|
174
|
+
});
|
|
175
|
+
if (_response.ok) {
|
|
176
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
177
|
+
}
|
|
178
|
+
if (_response.error.reason === "status-code") {
|
|
179
|
+
switch (_response.error.statusCode) {
|
|
180
|
+
case 400:
|
|
181
|
+
throw new phenoml.fhir2Omop.BadRequestError(_response.error.body, _response.rawResponse);
|
|
182
|
+
case 401:
|
|
183
|
+
throw new phenoml.fhir2Omop.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
184
|
+
case 500:
|
|
185
|
+
throw new phenoml.fhir2Omop.InternalServerError(_response.error.body, _response.rawResponse);
|
|
186
|
+
default:
|
|
187
|
+
throw new errors.phenomlError({
|
|
188
|
+
statusCode: _response.error.statusCode,
|
|
189
|
+
body: _response.error.body,
|
|
190
|
+
rawResponse: _response.rawResponse,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/fhir2omop/create");
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
exports.Fhir2OmopClient = Fhir2OmopClient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./requests/index.js"), exports);
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* fhir_resources: {
|
|
5
|
+
* "resourceType": "Bundle",
|
|
6
|
+
* "type": "collection",
|
|
7
|
+
* "entry": [
|
|
8
|
+
* {
|
|
9
|
+
* "resource": {
|
|
10
|
+
* "resourceType": "Patient",
|
|
11
|
+
* "id": "patient-1",
|
|
12
|
+
* "gender": "female",
|
|
13
|
+
* "birthDate": "1985-07-22"
|
|
14
|
+
* }
|
|
15
|
+
* },
|
|
16
|
+
* {
|
|
17
|
+
* "resource": {
|
|
18
|
+
* "resourceType": "Condition",
|
|
19
|
+
* "id": "condition-1",
|
|
20
|
+
* "subject": {
|
|
21
|
+
* "reference": "Patient/patient-1"
|
|
22
|
+
* },
|
|
23
|
+
* "code": {
|
|
24
|
+
* "coding": [
|
|
25
|
+
* {
|
|
26
|
+
* "system": "http://snomed.info/sct",
|
|
27
|
+
* "code": "44054006",
|
|
28
|
+
* "display": "Type 2 diabetes mellitus"
|
|
29
|
+
* }
|
|
30
|
+
* ]
|
|
31
|
+
* },
|
|
32
|
+
* "onsetDateTime": "2024-01-15"
|
|
33
|
+
* }
|
|
34
|
+
* },
|
|
35
|
+
* {
|
|
36
|
+
* "resource": {
|
|
37
|
+
* "resourceType": "MedicationRequest",
|
|
38
|
+
* "id": "medreq-1",
|
|
39
|
+
* "status": "active",
|
|
40
|
+
* "subject": {
|
|
41
|
+
* "reference": "Patient/patient-1"
|
|
42
|
+
* },
|
|
43
|
+
* "medicationReference": {
|
|
44
|
+
* "reference": "#med0"
|
|
45
|
+
* },
|
|
46
|
+
* "authoredOn": "2024-01-16",
|
|
47
|
+
* "contained": [
|
|
48
|
+
* {
|
|
49
|
+
* "resourceType": "Medication",
|
|
50
|
+
* "id": "med0",
|
|
51
|
+
* "code": {
|
|
52
|
+
* "coding": [
|
|
53
|
+
* {
|
|
54
|
+
* "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
|
|
55
|
+
* "code": "860975",
|
|
56
|
+
* "display": "metformin hydrochloride 500 MG"
|
|
57
|
+
* }
|
|
58
|
+
* ]
|
|
59
|
+
* }
|
|
60
|
+
* }
|
|
61
|
+
* ]
|
|
62
|
+
* }
|
|
63
|
+
* }
|
|
64
|
+
* ]
|
|
65
|
+
* }
|
|
66
|
+
* }
|
|
67
|
+
*/
|
|
68
|
+
export interface CreateOmopRequest {
|
|
69
|
+
/**
|
|
70
|
+
* FHIR resources (single resource or Bundle). Must contain at least one
|
|
71
|
+
* Patient resource. Resources are mapped to OMOP rows; standalone
|
|
72
|
+
* Medication resources are consumed by medication references rather than
|
|
73
|
+
* mapped to their own table.
|
|
74
|
+
*/
|
|
75
|
+
fhir_resources: Record<string, unknown>;
|
|
76
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { CreateOmopRequest } from "./CreateOmopRequest.js";
|
|
@@ -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.BadRequestError = void 0;
|
|
38
|
+
const errors = __importStar(require("../../../../errors/index.js"));
|
|
39
|
+
class BadRequestError extends errors.phenomlError {
|
|
40
|
+
constructor(body, rawResponse) {
|
|
41
|
+
super({
|
|
42
|
+
message: "BadRequestError",
|
|
43
|
+
statusCode: 400,
|
|
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.BadRequestError = BadRequestError;
|
|
@@ -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.InternalServerError = void 0;
|
|
38
|
+
const errors = __importStar(require("../../../../errors/index.js"));
|
|
39
|
+
class InternalServerError extends errors.phenomlError {
|
|
40
|
+
constructor(body, rawResponse) {
|
|
41
|
+
super({
|
|
42
|
+
message: "InternalServerError",
|
|
43
|
+
statusCode: 500,
|
|
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.InternalServerError = InternalServerError;
|