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
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
3
|
+
import * as core from "../../../../core/index.mjs";
|
|
4
|
+
import * as phenoml from "../../../index.mjs";
|
|
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,161 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
12
|
+
import { mergeHeaders } from "../../../../core/headers.mjs";
|
|
13
|
+
import * as core from "../../../../core/index.mjs";
|
|
14
|
+
import * as environments from "../../../../environments.mjs";
|
|
15
|
+
import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
|
|
16
|
+
import * as errors from "../../../../errors/index.mjs";
|
|
17
|
+
import * as phenoml from "../../../index.mjs";
|
|
18
|
+
export class Fhir2OmopClient {
|
|
19
|
+
constructor(options = {}) {
|
|
20
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Shapes a FHIR R4 resource or Bundle into OMOP Common Data Model v5.4 rows
|
|
24
|
+
* (person, visit_occurrence, condition_occurrence, drug_exposure,
|
|
25
|
+
* procedure_occurrence, measurement, observation).
|
|
26
|
+
*
|
|
27
|
+
* **This is a structural mapping (`mode: "structural"`).** Rows are
|
|
28
|
+
* structurally valid OMOP, but every clinical and source `concept_id` is `0`:
|
|
29
|
+
* the vocabulary crosswalk that assigns real OMOP `concept_id`s is a planned
|
|
30
|
+
* follow-up. Each `*_source_value` carries the verbatim FHIR coding
|
|
31
|
+
* (`system#code`), `*_type_concept_id` is set to `32817` (EHR), and the
|
|
32
|
+
* response `report` lists a standard-code *suggestion* for each source coding
|
|
33
|
+
* (already-standard, an unchecked normalization suggestion, or unmapped). Do
|
|
34
|
+
* not treat the output as analytically resolved OMOP until `concept_id`s are
|
|
35
|
+
* populated.
|
|
36
|
+
*
|
|
37
|
+
* Medication codes are resolved whether they appear inline
|
|
38
|
+
* (`medicationCodeableConcept`) or via a `medicationReference` to a contained,
|
|
39
|
+
* relative (`Type/id`), or bundle-entry (`urn:uuid`) `Medication` resource.
|
|
40
|
+
* A medication with no usable code, resolvable reference, or display is
|
|
41
|
+
* reported under `scan_summary.dropped_resources` rather than emitted as a
|
|
42
|
+
* blank row. The bundle must contain at least one Patient resource.
|
|
43
|
+
*
|
|
44
|
+
* @param {phenoml.fhir2Omop.CreateOmopRequest} request
|
|
45
|
+
* @param {Fhir2OmopClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
46
|
+
*
|
|
47
|
+
* @throws {@link phenoml.fhir2Omop.BadRequestError}
|
|
48
|
+
* @throws {@link phenoml.fhir2Omop.UnauthorizedError}
|
|
49
|
+
* @throws {@link phenoml.fhir2Omop.InternalServerError}
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* await client.fhir2Omop.create({
|
|
53
|
+
* fhir_resources: {
|
|
54
|
+
* "resourceType": "Bundle",
|
|
55
|
+
* "type": "collection",
|
|
56
|
+
* "entry": [
|
|
57
|
+
* {
|
|
58
|
+
* "resource": {
|
|
59
|
+
* "resourceType": "Patient",
|
|
60
|
+
* "id": "patient-1",
|
|
61
|
+
* "gender": "female",
|
|
62
|
+
* "birthDate": "1985-07-22"
|
|
63
|
+
* }
|
|
64
|
+
* },
|
|
65
|
+
* {
|
|
66
|
+
* "resource": {
|
|
67
|
+
* "resourceType": "Condition",
|
|
68
|
+
* "id": "condition-1",
|
|
69
|
+
* "subject": {
|
|
70
|
+
* "reference": "Patient/patient-1"
|
|
71
|
+
* },
|
|
72
|
+
* "code": {
|
|
73
|
+
* "coding": [
|
|
74
|
+
* {
|
|
75
|
+
* "system": "http://snomed.info/sct",
|
|
76
|
+
* "code": "44054006",
|
|
77
|
+
* "display": "Type 2 diabetes mellitus"
|
|
78
|
+
* }
|
|
79
|
+
* ]
|
|
80
|
+
* },
|
|
81
|
+
* "onsetDateTime": "2024-01-15"
|
|
82
|
+
* }
|
|
83
|
+
* },
|
|
84
|
+
* {
|
|
85
|
+
* "resource": {
|
|
86
|
+
* "resourceType": "MedicationRequest",
|
|
87
|
+
* "id": "medreq-1",
|
|
88
|
+
* "status": "active",
|
|
89
|
+
* "subject": {
|
|
90
|
+
* "reference": "Patient/patient-1"
|
|
91
|
+
* },
|
|
92
|
+
* "medicationReference": {
|
|
93
|
+
* "reference": "#med0"
|
|
94
|
+
* },
|
|
95
|
+
* "authoredOn": "2024-01-16",
|
|
96
|
+
* "contained": [
|
|
97
|
+
* {
|
|
98
|
+
* "resourceType": "Medication",
|
|
99
|
+
* "id": "med0",
|
|
100
|
+
* "code": {
|
|
101
|
+
* "coding": [
|
|
102
|
+
* {
|
|
103
|
+
* "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
|
|
104
|
+
* "code": "860975",
|
|
105
|
+
* "display": "metformin hydrochloride 500 MG"
|
|
106
|
+
* }
|
|
107
|
+
* ]
|
|
108
|
+
* }
|
|
109
|
+
* }
|
|
110
|
+
* ]
|
|
111
|
+
* }
|
|
112
|
+
* }
|
|
113
|
+
* ]
|
|
114
|
+
* }
|
|
115
|
+
* })
|
|
116
|
+
*/
|
|
117
|
+
create(request, requestOptions) {
|
|
118
|
+
return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
|
|
119
|
+
}
|
|
120
|
+
__create(request, requestOptions) {
|
|
121
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
123
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
124
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
125
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
126
|
+
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"),
|
|
127
|
+
method: "POST",
|
|
128
|
+
headers: _headers,
|
|
129
|
+
contentType: "application/json",
|
|
130
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
131
|
+
requestType: "json",
|
|
132
|
+
body: request,
|
|
133
|
+
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,
|
|
134
|
+
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,
|
|
135
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
136
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
137
|
+
logging: this._options.logging,
|
|
138
|
+
});
|
|
139
|
+
if (_response.ok) {
|
|
140
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
141
|
+
}
|
|
142
|
+
if (_response.error.reason === "status-code") {
|
|
143
|
+
switch (_response.error.statusCode) {
|
|
144
|
+
case 400:
|
|
145
|
+
throw new phenoml.fhir2Omop.BadRequestError(_response.error.body, _response.rawResponse);
|
|
146
|
+
case 401:
|
|
147
|
+
throw new phenoml.fhir2Omop.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
148
|
+
case 500:
|
|
149
|
+
throw new phenoml.fhir2Omop.InternalServerError(_response.error.body, _response.rawResponse);
|
|
150
|
+
default:
|
|
151
|
+
throw new errors.phenomlError({
|
|
152
|
+
statusCode: _response.error.statusCode,
|
|
153
|
+
body: _response.error.body,
|
|
154
|
+
rawResponse: _response.rawResponse,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/fhir2omop/create");
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -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.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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 BadRequestError extends errors.phenomlError {
|
|
4
|
+
constructor(body, rawResponse) {
|
|
5
|
+
super({
|
|
6
|
+
message: "BadRequestError",
|
|
7
|
+
statusCode: 400,
|
|
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
|
+
}
|
|
@@ -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 InternalServerError extends errors.phenomlError {
|
|
4
|
+
constructor(body, rawResponse) {
|
|
5
|
+
super({
|
|
6
|
+
message: "InternalServerError",
|
|
7
|
+
statusCode: 500,
|
|
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
|
+
}
|
|
@@ -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 UnauthorizedError extends errors.phenomlError {
|
|
4
|
+
constructor(body, rawResponse) {
|
|
5
|
+
super({
|
|
6
|
+
message: "UnauthorizedError",
|
|
7
|
+
statusCode: 401,
|
|
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
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface ConditionOccurrenceRow {
|
|
2
|
+
condition_occurrence_id?: number | undefined;
|
|
3
|
+
person_id?: number | undefined;
|
|
4
|
+
condition_concept_id?: number | undefined;
|
|
5
|
+
condition_start_date?: string | undefined;
|
|
6
|
+
condition_start_datetime?: string | undefined;
|
|
7
|
+
condition_end_date?: string | undefined;
|
|
8
|
+
condition_type_concept_id?: number | undefined;
|
|
9
|
+
condition_source_value?: string | undefined;
|
|
10
|
+
condition_source_concept_id?: number | undefined;
|
|
11
|
+
condition_status_source_value?: string | undefined;
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as phenoml from "../../../index.mjs";
|
|
2
|
+
export interface CreateOmopResponse {
|
|
3
|
+
success?: boolean | undefined;
|
|
4
|
+
message?: string | undefined;
|
|
5
|
+
/** Resolution mode. `structural` means all clinical concept_ids are 0 (vocabulary crosswalk pending). */
|
|
6
|
+
mode?: string | undefined;
|
|
7
|
+
tables?: phenoml.fhir2Omop.OmopTables | undefined;
|
|
8
|
+
/** One Usagi-shaped entry per source coding routed through concept resolution. */
|
|
9
|
+
report?: phenoml.fhir2Omop.MappingReportEntry[] | undefined;
|
|
10
|
+
scan_summary?: phenoml.fhir2Omop.ScanSummary | undefined;
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface DrugExposureRow {
|
|
2
|
+
drug_exposure_id?: number | undefined;
|
|
3
|
+
person_id?: number | undefined;
|
|
4
|
+
drug_concept_id?: number | undefined;
|
|
5
|
+
drug_exposure_start_date?: string | undefined;
|
|
6
|
+
drug_exposure_start_datetime?: string | undefined;
|
|
7
|
+
drug_exposure_end_date?: string | undefined;
|
|
8
|
+
drug_type_concept_id?: number | undefined;
|
|
9
|
+
stop_reason?: string | undefined;
|
|
10
|
+
sig?: string | undefined;
|
|
11
|
+
drug_source_value?: string | undefined;
|
|
12
|
+
drug_source_concept_id?: number | undefined;
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One source_to_concept_map-style mapping suggestion (Usagi-shaped).
|
|
3
|
+
*/
|
|
4
|
+
export interface MappingReportEntry {
|
|
5
|
+
resource_type?: string | undefined;
|
|
6
|
+
resource_id?: string | undefined;
|
|
7
|
+
omop_table?: string | undefined;
|
|
8
|
+
source_system?: string | undefined;
|
|
9
|
+
source_code?: string | undefined;
|
|
10
|
+
source_name?: string | undefined;
|
|
11
|
+
target_vocabulary?: string | undefined;
|
|
12
|
+
target_code?: string | undefined;
|
|
13
|
+
target_name?: string | undefined;
|
|
14
|
+
/** ALREADY_STANDARD (source already in target vocabulary), UNCHECKED (unreviewed suggestion), or UNMAPPED (no candidate found). */
|
|
15
|
+
mapping_status?: string | undefined;
|
|
16
|
+
equivalence?: string | undefined;
|
|
17
|
+
note?: string | undefined;
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface MeasurementRow {
|
|
2
|
+
measurement_id?: number | undefined;
|
|
3
|
+
person_id?: number | undefined;
|
|
4
|
+
measurement_concept_id?: number | undefined;
|
|
5
|
+
measurement_date?: string | undefined;
|
|
6
|
+
measurement_datetime?: string | undefined;
|
|
7
|
+
measurement_type_concept_id?: number | undefined;
|
|
8
|
+
value_as_number?: number | undefined;
|
|
9
|
+
value_as_concept_id?: number | undefined;
|
|
10
|
+
unit_concept_id?: number | undefined;
|
|
11
|
+
range_low?: number | undefined;
|
|
12
|
+
range_high?: number | undefined;
|
|
13
|
+
measurement_source_value?: string | undefined;
|
|
14
|
+
measurement_source_concept_id?: number | undefined;
|
|
15
|
+
unit_source_value?: string | undefined;
|
|
16
|
+
value_source_value?: string | undefined;
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface ObservationRow {
|
|
2
|
+
observation_id?: number | undefined;
|
|
3
|
+
person_id?: number | undefined;
|
|
4
|
+
observation_concept_id?: number | undefined;
|
|
5
|
+
observation_date?: string | undefined;
|
|
6
|
+
observation_datetime?: string | undefined;
|
|
7
|
+
observation_type_concept_id?: number | undefined;
|
|
8
|
+
value_as_number?: number | undefined;
|
|
9
|
+
value_as_string?: string | undefined;
|
|
10
|
+
value_as_concept_id?: number | undefined;
|
|
11
|
+
unit_concept_id?: number | undefined;
|
|
12
|
+
observation_source_value?: string | undefined;
|
|
13
|
+
observation_source_concept_id?: number | undefined;
|
|
14
|
+
unit_source_value?: string | undefined;
|
|
15
|
+
value_source_value?: string | undefined;
|
|
16
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type * as phenoml from "../../../index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* OMOP CDM v5.4 rows grouped by destination table.
|
|
4
|
+
*/
|
|
5
|
+
export interface OmopTables {
|
|
6
|
+
person?: phenoml.fhir2Omop.PersonRow[] | undefined;
|
|
7
|
+
visit_occurrence?: phenoml.fhir2Omop.VisitOccurrenceRow[] | undefined;
|
|
8
|
+
condition_occurrence?: phenoml.fhir2Omop.ConditionOccurrenceRow[] | undefined;
|
|
9
|
+
drug_exposure?: phenoml.fhir2Omop.DrugExposureRow[] | undefined;
|
|
10
|
+
procedure_occurrence?: phenoml.fhir2Omop.ProcedureOccurrenceRow[] | undefined;
|
|
11
|
+
measurement?: phenoml.fhir2Omop.MeasurementRow[] | undefined;
|
|
12
|
+
observation?: phenoml.fhir2Omop.ObservationRow[] | undefined;
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface PersonRow {
|
|
2
|
+
person_id?: number | undefined;
|
|
3
|
+
gender_concept_id?: number | undefined;
|
|
4
|
+
year_of_birth?: number | undefined;
|
|
5
|
+
month_of_birth?: number | undefined;
|
|
6
|
+
day_of_birth?: number | undefined;
|
|
7
|
+
birth_datetime?: string | undefined;
|
|
8
|
+
race_concept_id?: number | undefined;
|
|
9
|
+
ethnicity_concept_id?: number | undefined;
|
|
10
|
+
person_source_value?: string | undefined;
|
|
11
|
+
gender_source_value?: string | undefined;
|
|
12
|
+
race_source_value?: string | undefined;
|
|
13
|
+
ethnicity_source_value?: string | undefined;
|
|
14
|
+
}
|