phenoml 17.0.1 → 17.2.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 +123 -0
- package/dist/cjs/api/resources/fhir2Omop/client/Client.js +211 -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 +17 -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 +32 -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 +41 -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/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 +123 -0
- package/dist/esm/api/resources/fhir2Omop/client/Client.mjs +174 -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 +17 -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 +32 -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 +41 -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/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/openapi/openapi.json +844 -1
- package/package.json +15 -4
- package/reference.md +159 -0
|
@@ -0,0 +1,123 @@
|
|
|
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
|
+
* **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`.
|
|
32
|
+
*
|
|
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`).
|
|
38
|
+
*
|
|
39
|
+
* Medication codes are resolved whether they appear inline
|
|
40
|
+
* (`medicationCodeableConcept`) or via a `medicationReference` to a contained,
|
|
41
|
+
* relative (`Type/id`), or bundle-entry (`urn:uuid`) `Medication` resource.
|
|
42
|
+
* Resources that cannot be shaped into a row — a medication with no usable
|
|
43
|
+
* code, resolvable reference, or display, or any clinical resource whose
|
|
44
|
+
* subject/patient reference cannot be tied to a person — are reported under
|
|
45
|
+
* `scan_summary.dropped_resources` rather than emitted as blank rows. The
|
|
46
|
+
* bundle must contain at least one Patient resource.
|
|
47
|
+
*
|
|
48
|
+
* @param {phenoml.fhir2Omop.CreateOmopRequest} request
|
|
49
|
+
* @param {Fhir2OmopClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
50
|
+
*
|
|
51
|
+
* @throws {@link phenoml.fhir2Omop.BadRequestError}
|
|
52
|
+
* @throws {@link phenoml.fhir2Omop.UnauthorizedError}
|
|
53
|
+
* @throws {@link phenoml.fhir2Omop.InternalServerError}
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* await client.fhir2Omop.create({
|
|
57
|
+
* fhir_resources: {
|
|
58
|
+
* "resourceType": "Bundle",
|
|
59
|
+
* "type": "collection",
|
|
60
|
+
* "entry": [
|
|
61
|
+
* {
|
|
62
|
+
* "resource": {
|
|
63
|
+
* "resourceType": "Patient",
|
|
64
|
+
* "id": "patient-1",
|
|
65
|
+
* "gender": "female",
|
|
66
|
+
* "birthDate": "1985-07-22"
|
|
67
|
+
* }
|
|
68
|
+
* },
|
|
69
|
+
* {
|
|
70
|
+
* "resource": {
|
|
71
|
+
* "resourceType": "Condition",
|
|
72
|
+
* "id": "condition-1",
|
|
73
|
+
* "subject": {
|
|
74
|
+
* "reference": "Patient/patient-1"
|
|
75
|
+
* },
|
|
76
|
+
* "code": {
|
|
77
|
+
* "coding": [
|
|
78
|
+
* {
|
|
79
|
+
* "system": "http://snomed.info/sct",
|
|
80
|
+
* "code": "44054006",
|
|
81
|
+
* "display": "Type 2 diabetes mellitus"
|
|
82
|
+
* }
|
|
83
|
+
* ]
|
|
84
|
+
* },
|
|
85
|
+
* "onsetDateTime": "2024-01-15"
|
|
86
|
+
* }
|
|
87
|
+
* },
|
|
88
|
+
* {
|
|
89
|
+
* "resource": {
|
|
90
|
+
* "resourceType": "MedicationRequest",
|
|
91
|
+
* "id": "medreq-1",
|
|
92
|
+
* "status": "active",
|
|
93
|
+
* "subject": {
|
|
94
|
+
* "reference": "Patient/patient-1"
|
|
95
|
+
* },
|
|
96
|
+
* "medicationReference": {
|
|
97
|
+
* "reference": "#med0"
|
|
98
|
+
* },
|
|
99
|
+
* "authoredOn": "2024-01-16",
|
|
100
|
+
* "contained": [
|
|
101
|
+
* {
|
|
102
|
+
* "resourceType": "Medication",
|
|
103
|
+
* "id": "med0",
|
|
104
|
+
* "code": {
|
|
105
|
+
* "coding": [
|
|
106
|
+
* {
|
|
107
|
+
* "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
|
|
108
|
+
* "code": "860975",
|
|
109
|
+
* "display": "metformin hydrochloride 500 MG"
|
|
110
|
+
* }
|
|
111
|
+
* ]
|
|
112
|
+
* }
|
|
113
|
+
* }
|
|
114
|
+
* ]
|
|
115
|
+
* }
|
|
116
|
+
* }
|
|
117
|
+
* ]
|
|
118
|
+
* }
|
|
119
|
+
* })
|
|
120
|
+
*/
|
|
121
|
+
create(request: phenoml.fhir2Omop.CreateOmopRequest, requestOptions?: Fhir2OmopClient.RequestOptions): core.HttpResponsePromise<phenoml.fhir2Omop.CreateOmopResponse>;
|
|
122
|
+
private __create;
|
|
123
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
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
|
+
* **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`.
|
|
41
|
+
*
|
|
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`).
|
|
47
|
+
*
|
|
48
|
+
* Medication codes are resolved whether they appear inline
|
|
49
|
+
* (`medicationCodeableConcept`) or via a `medicationReference` to a contained,
|
|
50
|
+
* relative (`Type/id`), or bundle-entry (`urn:uuid`) `Medication` resource.
|
|
51
|
+
* Resources that cannot be shaped into a row — a medication with no usable
|
|
52
|
+
* code, resolvable reference, or display, or any clinical resource whose
|
|
53
|
+
* subject/patient reference cannot be tied to a person — are reported under
|
|
54
|
+
* `scan_summary.dropped_resources` rather than emitted as blank rows. The
|
|
55
|
+
* bundle must contain at least one Patient resource.
|
|
56
|
+
*
|
|
57
|
+
* @param {phenoml.fhir2Omop.CreateOmopRequest} request
|
|
58
|
+
* @param {Fhir2OmopClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
59
|
+
*
|
|
60
|
+
* @throws {@link phenoml.fhir2Omop.BadRequestError}
|
|
61
|
+
* @throws {@link phenoml.fhir2Omop.UnauthorizedError}
|
|
62
|
+
* @throws {@link phenoml.fhir2Omop.InternalServerError}
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* await client.fhir2Omop.create({
|
|
66
|
+
* fhir_resources: {
|
|
67
|
+
* "resourceType": "Bundle",
|
|
68
|
+
* "type": "collection",
|
|
69
|
+
* "entry": [
|
|
70
|
+
* {
|
|
71
|
+
* "resource": {
|
|
72
|
+
* "resourceType": "Patient",
|
|
73
|
+
* "id": "patient-1",
|
|
74
|
+
* "gender": "female",
|
|
75
|
+
* "birthDate": "1985-07-22"
|
|
76
|
+
* }
|
|
77
|
+
* },
|
|
78
|
+
* {
|
|
79
|
+
* "resource": {
|
|
80
|
+
* "resourceType": "Condition",
|
|
81
|
+
* "id": "condition-1",
|
|
82
|
+
* "subject": {
|
|
83
|
+
* "reference": "Patient/patient-1"
|
|
84
|
+
* },
|
|
85
|
+
* "code": {
|
|
86
|
+
* "coding": [
|
|
87
|
+
* {
|
|
88
|
+
* "system": "http://snomed.info/sct",
|
|
89
|
+
* "code": "44054006",
|
|
90
|
+
* "display": "Type 2 diabetes mellitus"
|
|
91
|
+
* }
|
|
92
|
+
* ]
|
|
93
|
+
* },
|
|
94
|
+
* "onsetDateTime": "2024-01-15"
|
|
95
|
+
* }
|
|
96
|
+
* },
|
|
97
|
+
* {
|
|
98
|
+
* "resource": {
|
|
99
|
+
* "resourceType": "MedicationRequest",
|
|
100
|
+
* "id": "medreq-1",
|
|
101
|
+
* "status": "active",
|
|
102
|
+
* "subject": {
|
|
103
|
+
* "reference": "Patient/patient-1"
|
|
104
|
+
* },
|
|
105
|
+
* "medicationReference": {
|
|
106
|
+
* "reference": "#med0"
|
|
107
|
+
* },
|
|
108
|
+
* "authoredOn": "2024-01-16",
|
|
109
|
+
* "contained": [
|
|
110
|
+
* {
|
|
111
|
+
* "resourceType": "Medication",
|
|
112
|
+
* "id": "med0",
|
|
113
|
+
* "code": {
|
|
114
|
+
* "coding": [
|
|
115
|
+
* {
|
|
116
|
+
* "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
|
|
117
|
+
* "code": "860975",
|
|
118
|
+
* "display": "metformin hydrochloride 500 MG"
|
|
119
|
+
* }
|
|
120
|
+
* ]
|
|
121
|
+
* }
|
|
122
|
+
* }
|
|
123
|
+
* ]
|
|
124
|
+
* }
|
|
125
|
+
* }
|
|
126
|
+
* ]
|
|
127
|
+
* }
|
|
128
|
+
* })
|
|
129
|
+
*/
|
|
130
|
+
create(request, requestOptions) {
|
|
131
|
+
return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
|
|
132
|
+
}
|
|
133
|
+
__create(request, requestOptions) {
|
|
134
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
135
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
136
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
137
|
+
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);
|
|
138
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
139
|
+
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"),
|
|
140
|
+
method: "POST",
|
|
141
|
+
headers: _headers,
|
|
142
|
+
contentType: "application/json",
|
|
143
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
144
|
+
requestType: "json",
|
|
145
|
+
body: request,
|
|
146
|
+
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,
|
|
147
|
+
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,
|
|
148
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
149
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
150
|
+
logging: this._options.logging,
|
|
151
|
+
});
|
|
152
|
+
if (_response.ok) {
|
|
153
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
154
|
+
}
|
|
155
|
+
if (_response.error.reason === "status-code") {
|
|
156
|
+
switch (_response.error.statusCode) {
|
|
157
|
+
case 400:
|
|
158
|
+
throw new phenoml.fhir2Omop.BadRequestError(_response.error.body, _response.rawResponse);
|
|
159
|
+
case 401:
|
|
160
|
+
throw new phenoml.fhir2Omop.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
161
|
+
case 500:
|
|
162
|
+
throw new phenoml.fhir2Omop.InternalServerError(_response.error.body, _response.rawResponse);
|
|
163
|
+
default:
|
|
164
|
+
throw new errors.phenomlError({
|
|
165
|
+
statusCode: _response.error.statusCode,
|
|
166
|
+
body: _response.error.body,
|
|
167
|
+
rawResponse: _response.rawResponse,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/fhir2omop/create");
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
@@ -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,17 @@
|
|
|
1
|
+
import type * as phenoml from "../../../index.mjs";
|
|
2
|
+
export interface CreateOmopResponse {
|
|
3
|
+
success?: boolean | undefined;
|
|
4
|
+
message?: string | undefined;
|
|
5
|
+
/**
|
|
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
|
+
*/
|
|
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;
|
|
17
|
+
}
|
|
@@ -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,32 @@
|
|
|
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
|
+
/**
|
|
13
|
+
* Standard concept code. Set when a coding is matched by the structural
|
|
14
|
+
* (construe) tier — an already-standard code taken verbatim, or a
|
|
15
|
+
* construe-suggested code — which is every match in structural mode and,
|
|
16
|
+
* in resolved mode, codings for text-only resources or ones that fell back
|
|
17
|
+
* when the resolver was unavailable. Omitted for codings resolved directly
|
|
18
|
+
* by the concept-resolver service, which returns the standard concept's
|
|
19
|
+
* id, name, and vocabulary but not its `concept_code`.
|
|
20
|
+
*/
|
|
21
|
+
target_code?: string | undefined;
|
|
22
|
+
target_name?: string | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* ALREADY_STANDARD (source already in the target standard vocabulary),
|
|
25
|
+
* MAPPED (resolved to a standard concept via the OMOP "Maps to" crosswalk
|
|
26
|
+
* or UMLS-CUI bridge; resolved mode only), UNCHECKED (an unreviewed
|
|
27
|
+
* construe suggestion; structural / fallback only), or UNMAPPED (no
|
|
28
|
+
* candidate found).
|
|
29
|
+
*/
|
|
30
|
+
mapping_status?: string | undefined;
|
|
31
|
+
note?: string | undefined;
|
|
32
|
+
}
|
|
@@ -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
|
+
}
|