@tryvital/vital-node 2.1.5 → 2.1.7
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/client/LabTests.ts +105 -101
- package/client/Vitals.ts +114 -11
- package/client/models/activity.ts +19 -0
- package/client/models/lab_tests_model.ts +22 -2
- package/client/models/sleep_models.ts +13 -0
- package/client/models/workout_models.ts +12 -0
- package/dist/client/LabTests.d.ts +3 -2
- package/dist/client/LabTests.js +26 -11
- package/dist/client/Vitals.d.ts +10 -3
- package/dist/client/Vitals.js +55 -6
- package/dist/client/models/activity.d.ts +21 -2
- package/dist/client/models/lab_tests_model.d.ts +17 -1
- package/dist/client/models/sleep_models.d.ts +13 -0
- package/dist/client/models/workout_models.d.ts +12 -0
- package/package.json +2 -2
package/client/LabTests.ts
CHANGED
@@ -1,118 +1,122 @@
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
2
2
|
import {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
3
|
+
AreaInfo,
|
4
|
+
ClientFacingLabTest,
|
5
|
+
HealthInsurance,
|
6
|
+
LabResultsMetadata,
|
7
|
+
LabResultsResponse,
|
8
|
+
Order,
|
9
|
+
OrderRequestResponse,
|
10
|
+
PatientAdress,
|
11
|
+
PatientDetails,
|
12
|
+
Physician,
|
11
13
|
} from './models/lab_tests_model';
|
12
14
|
|
13
|
-
|
14
|
-
|
15
15
|
export class OrdersApi {
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
baseURL: string;
|
17
|
+
client: AxiosInstance;
|
18
|
+
constructor(baseURL: string, axios: AxiosInstance) {
|
19
|
+
this.baseURL = baseURL;
|
20
|
+
this.client = axios;
|
21
|
+
}
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
);
|
43
|
-
return resp.data;
|
44
|
-
}
|
23
|
+
// Create new order
|
24
|
+
public async create_order(
|
25
|
+
user_id: string,
|
26
|
+
patient_details: PatientDetails,
|
27
|
+
patient_address: PatientAdress,
|
28
|
+
lab_test_id: string,
|
29
|
+
physician?: Physician,
|
30
|
+
health_insurance?: HealthInsurance
|
31
|
+
): Promise<OrderRequestResponse> {
|
32
|
+
const resp = await this.client.post(this.baseURL.concat('/order'), {
|
33
|
+
user_id: user_id,
|
34
|
+
patient_details: patient_details,
|
35
|
+
patient_address: patient_address,
|
36
|
+
lab_test_id: lab_test_id,
|
37
|
+
physician: physician ? physician : null,
|
38
|
+
health_insurance: health_insurance ? health_insurance : null,
|
39
|
+
});
|
40
|
+
return resp.data;
|
41
|
+
}
|
45
42
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
43
|
+
// Get order status.
|
44
|
+
public async getOrder(orderId: string): Promise<Order> {
|
45
|
+
const resp = await this.client.get(
|
46
|
+
this.baseURL.concat(`/order/${orderId}`)
|
47
|
+
);
|
48
|
+
return resp.data;
|
49
|
+
}
|
53
50
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
51
|
+
// Cancels order.
|
52
|
+
public async cancelOrder(orderId: string): Promise<OrderRequestResponse> {
|
53
|
+
const resp = await this.client.post(
|
54
|
+
this.baseURL.concat(`/order/${orderId}/cancel`)
|
55
|
+
);
|
56
|
+
return resp.data;
|
57
|
+
}
|
61
58
|
}
|
62
59
|
|
63
60
|
export class ResultsApi {
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
61
|
+
baseURL: string;
|
62
|
+
client: AxiosInstance;
|
63
|
+
constructor(baseURL: string, axios: AxiosInstance) {
|
64
|
+
this.baseURL = baseURL;
|
65
|
+
this.client = axios;
|
66
|
+
}
|
67
|
+
// GET both metadata and raw json test data.
|
68
|
+
public async getResults(orderId: string): Promise<LabResultsResponse> {
|
69
|
+
const resp = await this.client.get(
|
70
|
+
this.baseURL.concat(`/order/${orderId}/result`)
|
71
|
+
);
|
72
|
+
return resp.data;
|
73
|
+
}
|
77
74
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
// GET metadata related to order results, such as
|
88
|
-
// lab metadata, provider and sample dates.
|
89
|
-
public async getResultsMetadata(orderId: string): Promise<LabResultsMetadata> {
|
90
|
-
const resp = await this.client.get(
|
91
|
-
this.baseURL.concat(`/order/${orderId}/result/metadata`)
|
92
|
-
);
|
93
|
-
return resp.data;
|
94
|
-
}
|
95
|
-
}
|
75
|
+
// GET gets the lab result for the order in PDF format.
|
76
|
+
// TODO Check response type for PDF
|
77
|
+
public async getResultsPdf(orderId: string): Promise<string> {
|
78
|
+
const resp = await this.client.get(
|
79
|
+
this.baseURL.concat(`/order/${orderId}/result/pdf`)
|
80
|
+
);
|
81
|
+
return resp.data;
|
82
|
+
}
|
96
83
|
|
84
|
+
// GET metadata related to order results, such as
|
85
|
+
// lab metadata, provider and sample dates.
|
86
|
+
public async getResultsMetadata(
|
87
|
+
orderId: string
|
88
|
+
): Promise<LabResultsMetadata> {
|
89
|
+
const resp = await this.client.get(
|
90
|
+
this.baseURL.concat(`/order/${orderId}/result/metadata`)
|
91
|
+
);
|
92
|
+
return resp.data;
|
93
|
+
}
|
97
94
|
|
95
|
+
// GET lab-testing information about a geographical area,
|
96
|
+
// such as whether the area is served by our Phlebotomy network.
|
97
|
+
public async getAreaInfo(zip_code: string): Promise<AreaInfo> {
|
98
|
+
const resp = await this.client.get(
|
99
|
+
this.baseURL.concat('/area/info?') +
|
100
|
+
new URLSearchParams({ zip_code: zip_code })
|
101
|
+
);
|
102
|
+
return resp.data;
|
103
|
+
}
|
104
|
+
}
|
98
105
|
|
99
106
|
export class LabTestsApi {
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
constructor(baseURL: string, axios: AxiosInstance) {
|
106
|
-
this.baseURL = baseURL;
|
107
|
-
this.client = axios;
|
108
|
-
this.Orders = new OrdersApi(baseURL, axios)
|
109
|
-
this.Results = new ResultsApi(baseURL, axios)
|
107
|
+
baseURL: string;
|
108
|
+
client: AxiosInstance;
|
109
|
+
Orders: OrdersApi;
|
110
|
+
Results: ResultsApi;
|
110
111
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
112
|
+
constructor(baseURL: string, axios: AxiosInstance) {
|
113
|
+
this.baseURL = baseURL;
|
114
|
+
this.client = axios;
|
115
|
+
this.Orders = new OrdersApi(baseURL, axios);
|
116
|
+
this.Results = new ResultsApi(baseURL, axios);
|
117
|
+
}
|
118
|
+
public async getTests(): Promise<ClientFacingLabTest> {
|
119
|
+
const resp = await this.client.get(this.baseURL.concat(`/lab_tests`));
|
120
|
+
return resp.data;
|
121
|
+
}
|
122
|
+
}
|
package/client/Vitals.ts
CHANGED
@@ -25,6 +25,51 @@ export class VitalsApi {
|
|
25
25
|
return resp.data;
|
26
26
|
}
|
27
27
|
|
28
|
+
public async bloodOxygen(
|
29
|
+
userId: string,
|
30
|
+
startDate: Date,
|
31
|
+
endDate?: Date,
|
32
|
+
provider?: string,
|
33
|
+
): Promise<TimeseriesPoint[]> {
|
34
|
+
return this.timeseriesData(
|
35
|
+
userId,
|
36
|
+
'blood_oxygen',
|
37
|
+
startDate,
|
38
|
+
endDate,
|
39
|
+
provider
|
40
|
+
);
|
41
|
+
}
|
42
|
+
|
43
|
+
public async bloodPressure(
|
44
|
+
userId: string,
|
45
|
+
startDate: Date,
|
46
|
+
endDate?: Date,
|
47
|
+
provider?: string,
|
48
|
+
): Promise<TimeseriesBloodPressurePoint[]> {
|
49
|
+
return this.timeseriesData<TimeseriesBloodPressurePoint>(
|
50
|
+
userId,
|
51
|
+
'blood_pressure',
|
52
|
+
startDate,
|
53
|
+
endDate,
|
54
|
+
provider
|
55
|
+
);
|
56
|
+
}
|
57
|
+
|
58
|
+
public async caffeine(
|
59
|
+
userId: string,
|
60
|
+
startDate: Date,
|
61
|
+
endDate?: Date,
|
62
|
+
provider?: string
|
63
|
+
): Promise<TimeseriesPoint[]> {
|
64
|
+
return this.timeseriesData(
|
65
|
+
userId,
|
66
|
+
'caffeine',
|
67
|
+
startDate,
|
68
|
+
endDate,
|
69
|
+
provider
|
70
|
+
);
|
71
|
+
}
|
72
|
+
|
28
73
|
public async cholesterol(
|
29
74
|
type: 'ldl' | 'total' | 'triglycerides' | 'hdl',
|
30
75
|
userId: string,
|
@@ -56,6 +101,51 @@ export class VitalsApi {
|
|
56
101
|
);
|
57
102
|
}
|
58
103
|
|
104
|
+
public async heartrate(
|
105
|
+
userId: string,
|
106
|
+
startDate: Date,
|
107
|
+
endDate?: Date,
|
108
|
+
provider?: string
|
109
|
+
): Promise<TimeseriesPoint[]> {
|
110
|
+
return this.timeseriesData(
|
111
|
+
userId,
|
112
|
+
'heartrate',
|
113
|
+
startDate,
|
114
|
+
endDate,
|
115
|
+
provider
|
116
|
+
);
|
117
|
+
}
|
118
|
+
|
119
|
+
public async hrv(
|
120
|
+
userId: string,
|
121
|
+
startDate: Date,
|
122
|
+
endDate?: Date,
|
123
|
+
provider?: string
|
124
|
+
): Promise<TimeseriesPoint[]> {
|
125
|
+
return this.timeseriesData(
|
126
|
+
userId,
|
127
|
+
'hrv',
|
128
|
+
startDate,
|
129
|
+
endDate,
|
130
|
+
provider
|
131
|
+
);
|
132
|
+
}
|
133
|
+
|
134
|
+
public async hypnogram(
|
135
|
+
userId: string,
|
136
|
+
startDate: Date,
|
137
|
+
endDate?: Date,
|
138
|
+
provider?: string
|
139
|
+
): Promise<TimeseriesPoint[]> {
|
140
|
+
return this.timeseriesData(
|
141
|
+
userId,
|
142
|
+
'hypnogram',
|
143
|
+
startDate,
|
144
|
+
endDate,
|
145
|
+
provider
|
146
|
+
);
|
147
|
+
}
|
148
|
+
|
59
149
|
public async ige(
|
60
150
|
userId: string,
|
61
151
|
startDate: Date,
|
@@ -74,7 +164,7 @@ export class VitalsApi {
|
|
74
164
|
return this.timeseriesData(userId, 'igg', startDate, endDate, provider);
|
75
165
|
}
|
76
166
|
|
77
|
-
public async
|
167
|
+
public async mindfulnessMinutes(
|
78
168
|
userId: string,
|
79
169
|
startDate: Date,
|
80
170
|
endDate?: Date,
|
@@ -82,39 +172,52 @@ export class VitalsApi {
|
|
82
172
|
): Promise<TimeseriesPoint[]> {
|
83
173
|
return this.timeseriesData(
|
84
174
|
userId,
|
85
|
-
'
|
175
|
+
'mindfulness_minutes',
|
86
176
|
startDate,
|
87
177
|
endDate,
|
88
178
|
provider
|
89
179
|
);
|
90
180
|
}
|
91
181
|
|
92
|
-
public async
|
182
|
+
public async respiratoryRate(
|
93
183
|
userId: string,
|
94
184
|
startDate: Date,
|
95
185
|
endDate?: Date,
|
96
|
-
provider?: string
|
97
|
-
|
186
|
+
provider?: string
|
98
187
|
): Promise<TimeseriesPoint[]> {
|
99
188
|
return this.timeseriesData(
|
100
189
|
userId,
|
101
|
-
'
|
190
|
+
'respiratory_rate',
|
102
191
|
startDate,
|
103
192
|
endDate,
|
104
193
|
provider
|
105
194
|
);
|
106
195
|
}
|
107
196
|
|
108
|
-
public async
|
197
|
+
public async steps(
|
109
198
|
userId: string,
|
110
199
|
startDate: Date,
|
111
200
|
endDate?: Date,
|
112
|
-
provider?: string
|
201
|
+
provider?: string
|
202
|
+
): Promise<TimeseriesPoint[]> {
|
203
|
+
return this.timeseriesData(
|
204
|
+
userId,
|
205
|
+
'steps',
|
206
|
+
startDate,
|
207
|
+
endDate,
|
208
|
+
provider
|
209
|
+
);
|
210
|
+
}
|
113
211
|
|
114
|
-
|
115
|
-
|
212
|
+
public async water(
|
213
|
+
userId: string,
|
214
|
+
startDate: Date,
|
215
|
+
endDate?: Date,
|
216
|
+
provider?: string
|
217
|
+
): Promise<TimeseriesPoint[]> {
|
218
|
+
return this.timeseriesData(
|
116
219
|
userId,
|
117
|
-
'
|
220
|
+
'water',
|
118
221
|
startDate,
|
119
222
|
endDate,
|
120
223
|
provider
|
@@ -11,8 +11,15 @@ export interface ClientFacingActivity {
|
|
11
11
|
* Date for specified record
|
12
12
|
* @type {Date}
|
13
13
|
* @memberof ClientFacingActivity
|
14
|
+
* @deprecated Use calendar_date instead
|
14
15
|
*/
|
15
16
|
date: Date;
|
17
|
+
/**
|
18
|
+
* Date for specified record (YYYY-MM-DD)
|
19
|
+
* @type {String}
|
20
|
+
* @memberof ClientFacingActivity
|
21
|
+
*/
|
22
|
+
calendar_date: string;
|
16
23
|
/**
|
17
24
|
* Total energy consumption during the day including Basal Metabolic Rate in kilocalories.::kilocalories
|
18
25
|
* @type {number}
|
@@ -25,6 +32,12 @@ export interface ClientFacingActivity {
|
|
25
32
|
* @memberof ClientFacingActivity
|
26
33
|
*/
|
27
34
|
calories_active: number;
|
35
|
+
/**
|
36
|
+
* Number of floors climbed by the user::count
|
37
|
+
* @type {number}
|
38
|
+
* @memberof ClientFacingActivity
|
39
|
+
*/
|
40
|
+
floors_climbed?: number;
|
28
41
|
/**
|
29
42
|
* Total number of steps registered during the day.::steps
|
30
43
|
* @type {number}
|
@@ -56,6 +69,12 @@ export interface ClientFacingActivity {
|
|
56
69
|
*/
|
57
70
|
high?: number;
|
58
71
|
/**
|
72
|
+
* Timezone offset from UTC as seconds. For example, EEST (Eastern European Summer Time, +3h) is 10800. PST (Pacific Standard Time, -8h) is -28800::seconds
|
73
|
+
* @type {number}
|
74
|
+
* @memberof ClientFacingActivity
|
75
|
+
*/
|
76
|
+
timezone_offset?: number;
|
77
|
+
/**
|
59
78
|
* Source the data has come from.
|
60
79
|
* @type {SourceClientFacing}
|
61
80
|
* @memberof ClientFacingActivity
|
@@ -4,7 +4,8 @@ export interface PatientAdress {
|
|
4
4
|
state: string;
|
5
5
|
zip: string;
|
6
6
|
country: string;
|
7
|
-
|
7
|
+
first_line: string;
|
8
|
+
second_line?: string;
|
8
9
|
}
|
9
10
|
|
10
11
|
export interface PatientDetails {
|
@@ -16,6 +17,16 @@ export interface PatientDetails {
|
|
16
17
|
last_name: string;
|
17
18
|
}
|
18
19
|
|
20
|
+
export interface HealthInsurance {
|
21
|
+
front_image: Image;
|
22
|
+
back_image: Image;
|
23
|
+
}
|
24
|
+
|
25
|
+
export interface Image {
|
26
|
+
content: string;
|
27
|
+
content_type: 'image/jpeg' | 'image/jpg' | 'image/png';
|
28
|
+
}
|
29
|
+
|
19
30
|
export interface Physician {
|
20
31
|
first_name: string;
|
21
32
|
last_name: string;
|
@@ -50,7 +61,7 @@ export interface Order {
|
|
50
61
|
team_id: string;
|
51
62
|
patient_details: PatientDetails;
|
52
63
|
patient_address: PatientAdress;
|
53
|
-
physician: Physician
|
64
|
+
physician: Physician;
|
54
65
|
lab_test: Testkit;
|
55
66
|
// TODO CHECK WHAT DETAILS IS
|
56
67
|
details: Object;
|
@@ -124,3 +135,12 @@ export interface LabResultsResponse {
|
|
124
135
|
metadata: LabResultsMetadata;
|
125
136
|
results: Object;
|
126
137
|
}
|
138
|
+
|
139
|
+
export interface AreaInfo {
|
140
|
+
zip_code: string;
|
141
|
+
phlebotomy: PhlebotomyAreaInfo;
|
142
|
+
}
|
143
|
+
|
144
|
+
export interface PhlebotomyAreaInfo {
|
145
|
+
is_served: boolean;
|
146
|
+
}
|
@@ -17,8 +17,15 @@ export interface ClientFacingSleep {
|
|
17
17
|
* Date for specified record
|
18
18
|
* @type {Date}
|
19
19
|
* @memberof ClientFacingSleep
|
20
|
+
* @deprecated Use calendar_date instead
|
20
21
|
*/
|
21
22
|
date: Date;
|
23
|
+
/**
|
24
|
+
* Date for specified record (YYYY-MM-DD). This generally matches the sleep end date.
|
25
|
+
* @type {String}
|
26
|
+
* @memberof ClientFacingSleep
|
27
|
+
*/
|
28
|
+
calendar_date: string;
|
22
29
|
/**
|
23
30
|
* UTC Time when the sleep period started
|
24
31
|
* @type {Date}
|
@@ -115,6 +122,12 @@ export interface ClientFacingSleep {
|
|
115
122
|
* @memberof ClientFacingSleep
|
116
123
|
*/
|
117
124
|
respiratory_rate?: number;
|
125
|
+
/**
|
126
|
+
* Average skin temperature.::celcius
|
127
|
+
* @type {number}
|
128
|
+
* @memberof ClientFacingSleep
|
129
|
+
*/
|
130
|
+
skin_temperature?: number;
|
118
131
|
/**
|
119
132
|
* Source the data has come from.
|
120
133
|
* @type {SourceClientFacing}
|
@@ -57,6 +57,12 @@ export interface ClientFacingWorkout {
|
|
57
57
|
* @memberof ClientFacingWorkout
|
58
58
|
*/
|
59
59
|
time_end: Date;
|
60
|
+
/**
|
61
|
+
* Date for specified record (YYYY-MM-DD)
|
62
|
+
* @type {String}
|
63
|
+
* @memberof ClientFacingWorkout
|
64
|
+
*/
|
65
|
+
calendar_date: string;
|
60
66
|
/**
|
61
67
|
* Calories burned during the workout::kCal
|
62
68
|
* @type {number}
|
@@ -153,6 +159,12 @@ export interface ClientFacingWorkout {
|
|
153
159
|
* @memberof ClientFacingWorkout
|
154
160
|
*/
|
155
161
|
map?: string;
|
162
|
+
/**
|
163
|
+
* Timezone offset from UTC as seconds. For example, EEST (Eastern European Summer Time, +3h) is 10800. PST (Pacific Standard Time, -8h) is -28800::seconds
|
164
|
+
* @type {number}
|
165
|
+
* @memberof ClientFacingActivity
|
166
|
+
*/
|
167
|
+
timezone_offset?: number;
|
156
168
|
}
|
157
169
|
|
158
170
|
export interface ClientWorkoutResponse {
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
2
|
-
import { ClientFacingLabTest, LabResultsMetadata, LabResultsResponse, Order, OrderRequestResponse, PatientAdress, PatientDetails, Physician } from './models/lab_tests_model';
|
2
|
+
import { AreaInfo, ClientFacingLabTest, HealthInsurance, LabResultsMetadata, LabResultsResponse, Order, OrderRequestResponse, PatientAdress, PatientDetails, Physician } from './models/lab_tests_model';
|
3
3
|
export declare class OrdersApi {
|
4
4
|
baseURL: string;
|
5
5
|
client: AxiosInstance;
|
6
6
|
constructor(baseURL: string, axios: AxiosInstance);
|
7
|
-
create_order(user_id: string, patient_details: PatientDetails, patient_address: PatientAdress, lab_test_id: string, physician?: Physician): Promise<OrderRequestResponse>;
|
7
|
+
create_order(user_id: string, patient_details: PatientDetails, patient_address: PatientAdress, lab_test_id: string, physician?: Physician, health_insurance?: HealthInsurance): Promise<OrderRequestResponse>;
|
8
8
|
getOrder(orderId: string): Promise<Order>;
|
9
9
|
cancelOrder(orderId: string): Promise<OrderRequestResponse>;
|
10
10
|
}
|
@@ -15,6 +15,7 @@ export declare class ResultsApi {
|
|
15
15
|
getResults(orderId: string): Promise<LabResultsResponse>;
|
16
16
|
getResultsPdf(orderId: string): Promise<string>;
|
17
17
|
getResultsMetadata(orderId: string): Promise<LabResultsMetadata>;
|
18
|
+
getAreaInfo(zip_code: string): Promise<AreaInfo>;
|
18
19
|
}
|
19
20
|
export declare class LabTestsApi {
|
20
21
|
baseURL: string;
|
package/dist/client/LabTests.js
CHANGED
@@ -42,20 +42,19 @@ var OrdersApi = /** @class */ (function () {
|
|
42
42
|
this.baseURL = baseURL;
|
43
43
|
this.client = axios;
|
44
44
|
}
|
45
|
-
// Create new order
|
46
|
-
OrdersApi.prototype.create_order = function (user_id, patient_details, patient_address, lab_test_id, physician) {
|
45
|
+
// Create new order
|
46
|
+
OrdersApi.prototype.create_order = function (user_id, patient_details, patient_address, lab_test_id, physician, health_insurance) {
|
47
47
|
return __awaiter(this, void 0, void 0, function () {
|
48
48
|
var resp;
|
49
49
|
return __generator(this, function (_a) {
|
50
50
|
switch (_a.label) {
|
51
51
|
case 0: return [4 /*yield*/, this.client.post(this.baseURL.concat('/order'), {
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
},
|
52
|
+
user_id: user_id,
|
53
|
+
patient_details: patient_details,
|
54
|
+
patient_address: patient_address,
|
55
|
+
lab_test_id: lab_test_id,
|
56
|
+
physician: physician ? physician : null,
|
57
|
+
health_insurance: health_insurance ? health_insurance : null,
|
59
58
|
})];
|
60
59
|
case 1:
|
61
60
|
resp = _a.sent();
|
@@ -114,7 +113,7 @@ var ResultsApi = /** @class */ (function () {
|
|
114
113
|
});
|
115
114
|
});
|
116
115
|
};
|
117
|
-
// GET gets the lab result for the order in PDF format.
|
116
|
+
// GET gets the lab result for the order in PDF format.
|
118
117
|
// TODO Check response type for PDF
|
119
118
|
ResultsApi.prototype.getResultsPdf = function (orderId) {
|
120
119
|
return __awaiter(this, void 0, void 0, function () {
|
@@ -129,7 +128,7 @@ var ResultsApi = /** @class */ (function () {
|
|
129
128
|
});
|
130
129
|
});
|
131
130
|
};
|
132
|
-
// GET metadata related to order results, such as
|
131
|
+
// GET metadata related to order results, such as
|
133
132
|
// lab metadata, provider and sample dates.
|
134
133
|
ResultsApi.prototype.getResultsMetadata = function (orderId) {
|
135
134
|
return __awaiter(this, void 0, void 0, function () {
|
@@ -144,6 +143,22 @@ var ResultsApi = /** @class */ (function () {
|
|
144
143
|
});
|
145
144
|
});
|
146
145
|
};
|
146
|
+
// GET lab-testing information about a geographical area,
|
147
|
+
// such as whether the area is served by our Phlebotomy network.
|
148
|
+
ResultsApi.prototype.getAreaInfo = function (zip_code) {
|
149
|
+
return __awaiter(this, void 0, void 0, function () {
|
150
|
+
var resp;
|
151
|
+
return __generator(this, function (_a) {
|
152
|
+
switch (_a.label) {
|
153
|
+
case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat('/area/info?') +
|
154
|
+
new URLSearchParams({ zip_code: zip_code }))];
|
155
|
+
case 1:
|
156
|
+
resp = _a.sent();
|
157
|
+
return [2 /*return*/, resp.data];
|
158
|
+
}
|
159
|
+
});
|
160
|
+
});
|
161
|
+
};
|
147
162
|
return ResultsApi;
|
148
163
|
}());
|
149
164
|
exports.ResultsApi = ResultsApi;
|
package/dist/client/Vitals.d.ts
CHANGED
@@ -5,11 +5,18 @@ export declare class VitalsApi {
|
|
5
5
|
client: AxiosInstance;
|
6
6
|
constructor(baseURL: string, axios: AxiosInstance);
|
7
7
|
private timeseriesData;
|
8
|
+
bloodOxygen(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
|
9
|
+
bloodPressure(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesBloodPressurePoint[]>;
|
10
|
+
caffeine(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
|
8
11
|
cholesterol(type: 'ldl' | 'total' | 'triglycerides' | 'hdl', userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
|
9
12
|
glucose(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
|
13
|
+
heartrate(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
|
14
|
+
hrv(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
|
15
|
+
hypnogram(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
|
10
16
|
ige(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
|
11
17
|
igg(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
|
12
|
-
|
13
|
-
|
14
|
-
|
18
|
+
mindfulnessMinutes(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
|
19
|
+
respiratoryRate(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
|
20
|
+
steps(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
|
21
|
+
water(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
|
15
22
|
}
|
package/dist/client/Vitals.js
CHANGED
@@ -57,6 +57,27 @@ var VitalsApi = /** @class */ (function () {
|
|
57
57
|
});
|
58
58
|
});
|
59
59
|
};
|
60
|
+
VitalsApi.prototype.bloodOxygen = function (userId, startDate, endDate, provider) {
|
61
|
+
return __awaiter(this, void 0, void 0, function () {
|
62
|
+
return __generator(this, function (_a) {
|
63
|
+
return [2 /*return*/, this.timeseriesData(userId, 'blood_oxygen', startDate, endDate, provider)];
|
64
|
+
});
|
65
|
+
});
|
66
|
+
};
|
67
|
+
VitalsApi.prototype.bloodPressure = function (userId, startDate, endDate, provider) {
|
68
|
+
return __awaiter(this, void 0, void 0, function () {
|
69
|
+
return __generator(this, function (_a) {
|
70
|
+
return [2 /*return*/, this.timeseriesData(userId, 'blood_pressure', startDate, endDate, provider)];
|
71
|
+
});
|
72
|
+
});
|
73
|
+
};
|
74
|
+
VitalsApi.prototype.caffeine = function (userId, startDate, endDate, provider) {
|
75
|
+
return __awaiter(this, void 0, void 0, function () {
|
76
|
+
return __generator(this, function (_a) {
|
77
|
+
return [2 /*return*/, this.timeseriesData(userId, 'caffeine', startDate, endDate, provider)];
|
78
|
+
});
|
79
|
+
});
|
80
|
+
};
|
60
81
|
VitalsApi.prototype.cholesterol = function (type, userId, startDate, endDate, provider) {
|
61
82
|
return __awaiter(this, void 0, void 0, function () {
|
62
83
|
return __generator(this, function (_a) {
|
@@ -71,6 +92,27 @@ var VitalsApi = /** @class */ (function () {
|
|
71
92
|
});
|
72
93
|
});
|
73
94
|
};
|
95
|
+
VitalsApi.prototype.heartrate = function (userId, startDate, endDate, provider) {
|
96
|
+
return __awaiter(this, void 0, void 0, function () {
|
97
|
+
return __generator(this, function (_a) {
|
98
|
+
return [2 /*return*/, this.timeseriesData(userId, 'heartrate', startDate, endDate, provider)];
|
99
|
+
});
|
100
|
+
});
|
101
|
+
};
|
102
|
+
VitalsApi.prototype.hrv = function (userId, startDate, endDate, provider) {
|
103
|
+
return __awaiter(this, void 0, void 0, function () {
|
104
|
+
return __generator(this, function (_a) {
|
105
|
+
return [2 /*return*/, this.timeseriesData(userId, 'hrv', startDate, endDate, provider)];
|
106
|
+
});
|
107
|
+
});
|
108
|
+
};
|
109
|
+
VitalsApi.prototype.hypnogram = function (userId, startDate, endDate, provider) {
|
110
|
+
return __awaiter(this, void 0, void 0, function () {
|
111
|
+
return __generator(this, function (_a) {
|
112
|
+
return [2 /*return*/, this.timeseriesData(userId, 'hypnogram', startDate, endDate, provider)];
|
113
|
+
});
|
114
|
+
});
|
115
|
+
};
|
74
116
|
VitalsApi.prototype.ige = function (userId, startDate, endDate, provider) {
|
75
117
|
return __awaiter(this, void 0, void 0, function () {
|
76
118
|
return __generator(this, function (_a) {
|
@@ -85,24 +127,31 @@ var VitalsApi = /** @class */ (function () {
|
|
85
127
|
});
|
86
128
|
});
|
87
129
|
};
|
88
|
-
VitalsApi.prototype.
|
130
|
+
VitalsApi.prototype.mindfulnessMinutes = function (userId, startDate, endDate, provider) {
|
89
131
|
return __awaiter(this, void 0, void 0, function () {
|
90
132
|
return __generator(this, function (_a) {
|
91
|
-
return [2 /*return*/, this.timeseriesData(userId, '
|
133
|
+
return [2 /*return*/, this.timeseriesData(userId, 'mindfulness_minutes', startDate, endDate, provider)];
|
92
134
|
});
|
93
135
|
});
|
94
136
|
};
|
95
|
-
VitalsApi.prototype.
|
137
|
+
VitalsApi.prototype.respiratoryRate = function (userId, startDate, endDate, provider) {
|
96
138
|
return __awaiter(this, void 0, void 0, function () {
|
97
139
|
return __generator(this, function (_a) {
|
98
|
-
return [2 /*return*/, this.timeseriesData(userId, '
|
140
|
+
return [2 /*return*/, this.timeseriesData(userId, 'respiratory_rate', startDate, endDate, provider)];
|
99
141
|
});
|
100
142
|
});
|
101
143
|
};
|
102
|
-
VitalsApi.prototype.
|
144
|
+
VitalsApi.prototype.steps = function (userId, startDate, endDate, provider) {
|
103
145
|
return __awaiter(this, void 0, void 0, function () {
|
104
146
|
return __generator(this, function (_a) {
|
105
|
-
return [2 /*return*/, this.timeseriesData(userId, '
|
147
|
+
return [2 /*return*/, this.timeseriesData(userId, 'steps', startDate, endDate, provider)];
|
148
|
+
});
|
149
|
+
});
|
150
|
+
};
|
151
|
+
VitalsApi.prototype.water = function (userId, startDate, endDate, provider) {
|
152
|
+
return __awaiter(this, void 0, void 0, function () {
|
153
|
+
return __generator(this, function (_a) {
|
154
|
+
return [2 /*return*/, this.timeseriesData(userId, 'water', startDate, endDate, provider)];
|
106
155
|
});
|
107
156
|
});
|
108
157
|
};
|
@@ -10,8 +10,15 @@ export interface ClientFacingActivity {
|
|
10
10
|
* Date for specified record
|
11
11
|
* @type {Date}
|
12
12
|
* @memberof ClientFacingActivity
|
13
|
+
* @deprecated Use calendar_date instead
|
13
14
|
*/
|
14
15
|
date: Date;
|
16
|
+
/**
|
17
|
+
* Date for specified record (YYYY-MM-DD)
|
18
|
+
* @type {String}
|
19
|
+
* @memberof ClientFacingActivity
|
20
|
+
*/
|
21
|
+
calendar_date: string;
|
15
22
|
/**
|
16
23
|
* Total energy consumption during the day including Basal Metabolic Rate in kilocalories.::kilocalories
|
17
24
|
* @type {number}
|
@@ -24,6 +31,12 @@ export interface ClientFacingActivity {
|
|
24
31
|
* @memberof ClientFacingActivity
|
25
32
|
*/
|
26
33
|
calories_active: number;
|
34
|
+
/**
|
35
|
+
* Number of floors climbed by the user::count
|
36
|
+
* @type {number}
|
37
|
+
* @memberof ClientFacingActivity
|
38
|
+
*/
|
39
|
+
floors_climbed?: number;
|
27
40
|
/**
|
28
41
|
* Total number of steps registered during the day.::steps
|
29
42
|
* @type {number}
|
@@ -55,10 +68,16 @@ export interface ClientFacingActivity {
|
|
55
68
|
*/
|
56
69
|
high?: number;
|
57
70
|
/**
|
58
|
-
*
|
59
|
-
* @type {
|
71
|
+
* Timezone offset from UTC as seconds. For example, EEST (Eastern European Summer Time, +3h) is 10800. PST (Pacific Standard Time, -8h) is -28800::seconds
|
72
|
+
* @type {number}
|
60
73
|
* @memberof ClientFacingActivity
|
61
74
|
*/
|
75
|
+
timezone_offset?: number;
|
76
|
+
/**
|
77
|
+
* Source the data has come from.
|
78
|
+
* @type {SourceClientFacing}
|
79
|
+
* @memberof ClientFacingActivity
|
80
|
+
*/
|
62
81
|
source: SourceClientFacing;
|
63
82
|
user_id: string;
|
64
83
|
}
|
@@ -4,7 +4,8 @@ export interface PatientAdress {
|
|
4
4
|
state: string;
|
5
5
|
zip: string;
|
6
6
|
country: string;
|
7
|
-
|
7
|
+
first_line: string;
|
8
|
+
second_line?: string;
|
8
9
|
}
|
9
10
|
export interface PatientDetails {
|
10
11
|
dob: string;
|
@@ -14,6 +15,14 @@ export interface PatientDetails {
|
|
14
15
|
phone_number: string;
|
15
16
|
last_name: string;
|
16
17
|
}
|
18
|
+
export interface HealthInsurance {
|
19
|
+
front_image: Image;
|
20
|
+
back_image: Image;
|
21
|
+
}
|
22
|
+
export interface Image {
|
23
|
+
content: string;
|
24
|
+
content_type: 'image/jpeg' | 'image/jpg' | 'image/png';
|
25
|
+
}
|
17
26
|
export interface Physician {
|
18
27
|
first_name: string;
|
19
28
|
last_name: string;
|
@@ -97,3 +106,10 @@ export interface LabResultsResponse {
|
|
97
106
|
metadata: LabResultsMetadata;
|
98
107
|
results: Object;
|
99
108
|
}
|
109
|
+
export interface AreaInfo {
|
110
|
+
zip_code: string;
|
111
|
+
phlebotomy: PhlebotomyAreaInfo;
|
112
|
+
}
|
113
|
+
export interface PhlebotomyAreaInfo {
|
114
|
+
is_served: boolean;
|
115
|
+
}
|
@@ -16,8 +16,15 @@ export interface ClientFacingSleep {
|
|
16
16
|
* Date for specified record
|
17
17
|
* @type {Date}
|
18
18
|
* @memberof ClientFacingSleep
|
19
|
+
* @deprecated Use calendar_date instead
|
19
20
|
*/
|
20
21
|
date: Date;
|
22
|
+
/**
|
23
|
+
* Date for specified record (YYYY-MM-DD). This generally matches the sleep end date.
|
24
|
+
* @type {String}
|
25
|
+
* @memberof ClientFacingSleep
|
26
|
+
*/
|
27
|
+
calendar_date: string;
|
21
28
|
/**
|
22
29
|
* UTC Time when the sleep period started
|
23
30
|
* @type {Date}
|
@@ -114,6 +121,12 @@ export interface ClientFacingSleep {
|
|
114
121
|
* @memberof ClientFacingSleep
|
115
122
|
*/
|
116
123
|
respiratory_rate?: number;
|
124
|
+
/**
|
125
|
+
* Average skin temperature.::celcius
|
126
|
+
* @type {number}
|
127
|
+
* @memberof ClientFacingSleep
|
128
|
+
*/
|
129
|
+
skin_temperature?: number;
|
117
130
|
/**
|
118
131
|
* Source the data has come from.
|
119
132
|
* @type {SourceClientFacing}
|
@@ -55,6 +55,12 @@ export interface ClientFacingWorkout {
|
|
55
55
|
* @memberof ClientFacingWorkout
|
56
56
|
*/
|
57
57
|
time_end: Date;
|
58
|
+
/**
|
59
|
+
* Date for specified record (YYYY-MM-DD)
|
60
|
+
* @type {String}
|
61
|
+
* @memberof ClientFacingWorkout
|
62
|
+
*/
|
63
|
+
calendar_date: string;
|
58
64
|
/**
|
59
65
|
* Calories burned during the workout::kCal
|
60
66
|
* @type {number}
|
@@ -146,6 +152,12 @@ export interface ClientFacingWorkout {
|
|
146
152
|
* @memberof ClientFacingWorkout
|
147
153
|
*/
|
148
154
|
map?: string;
|
155
|
+
/**
|
156
|
+
* Timezone offset from UTC as seconds. For example, EEST (Eastern European Summer Time, +3h) is 10800. PST (Pacific Standard Time, -8h) is -28800::seconds
|
157
|
+
* @type {number}
|
158
|
+
* @memberof ClientFacingActivity
|
159
|
+
*/
|
160
|
+
timezone_offset?: number;
|
149
161
|
}
|
150
162
|
export interface ClientWorkoutResponse {
|
151
163
|
/**
|
package/package.json
CHANGED