@tryvital/vital-node 2.1.0 → 2.1.1
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/.github/workflows/test-build.yaml +32 -0
- package/__tests__/activity.test.ts +4 -5
- package/__tests__/arrange.ts +5 -12
- package/__tests__/body.test.ts +4 -5
- package/__tests__/link.test.ts +3 -4
- package/__tests__/profile.test.ts +3 -4
- package/__tests__/providers.test.ts +2 -2
- package/__tests__/sleep.test.ts +8 -10
- package/__tests__/user.test.ts +7 -10
- package/__tests__/vitals.test.ts +7 -8
- package/__tests__/workouts.test.ts +4 -5
- package/client/LabTests.ts +1 -3
- package/client/Testkits.ts +107 -0
- package/client/index.ts +1 -0
- package/client/models/lab_tests_model.ts +129 -0
- package/client/models/testkit_models.ts +26 -57
- package/dist/client/LabTests.d.ts +1 -1
- package/dist/client/Testkits.d.ts +15 -0
- package/dist/client/Testkits.js +171 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.js +3 -1
- package/dist/client/models/lab_tests_model.d.ts +102 -0
- package/dist/client/models/lab_tests_model.js +2 -0
- package/dist/client/models/testkit_models.d.ts +24 -46
- package/dist/index.d.ts +1 -4
- package/dist/index.js +7 -26
- package/index.ts +4 -16
- package/package.json +2 -3
- package/__tests__/devices.test.ts +0 -16
- package/dist/lib/credentials.d.ts +0 -8
- package/dist/lib/credentials.js +0 -87
- package/lib/credentials.ts +0 -36
@@ -0,0 +1,32 @@
|
|
1
|
+
on:
|
2
|
+
push:
|
3
|
+
branches-ignore:
|
4
|
+
- master
|
5
|
+
env:
|
6
|
+
TEST_EU_API_KEY: ${{ secrets.TEST_EU_API_KEY }}
|
7
|
+
TEST_US_API_KEY: ${{ secrets.TEST_US_API_KEY }}
|
8
|
+
TEST_ENVIRONMENT: "sandbox"
|
9
|
+
name: Test compile
|
10
|
+
jobs:
|
11
|
+
test-build:
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v2
|
15
|
+
# Setup .npmrc file to publish to npm
|
16
|
+
- uses: actions/setup-node@v2
|
17
|
+
with:
|
18
|
+
node-version: '16.x'
|
19
|
+
registry-url: 'https://registry.npmjs.org'
|
20
|
+
- run: npm ci
|
21
|
+
- run: npm run build
|
22
|
+
test-code:
|
23
|
+
runs-on: ubuntu-latest
|
24
|
+
steps:
|
25
|
+
- uses: actions/checkout@v2
|
26
|
+
# Setup .npmrc file to publish to npm
|
27
|
+
- uses: actions/setup-node@v2
|
28
|
+
with:
|
29
|
+
node-version: '16.x'
|
30
|
+
registry-url: 'https://registry.npmjs.org'
|
31
|
+
- run: npm ci
|
32
|
+
- run: npm run test-client
|
@@ -1,18 +1,17 @@
|
|
1
1
|
import { VitalClient } from "..";
|
2
|
-
import {
|
2
|
+
import { testUSClient, testEUClient, getUserId } from "./arrange";
|
3
3
|
|
4
4
|
|
5
5
|
describe('Activity', () => {
|
6
6
|
it.each([
|
7
|
-
["
|
8
|
-
["
|
9
|
-
["us_api_key", testApiKeyClient],
|
7
|
+
["eu_api_key", testEUClient],
|
8
|
+
["us_api_key", testUSClient],
|
10
9
|
])('should return activity data %p', async (region: string, client: VitalClient) => {
|
11
10
|
const userId = await getUserId(client)
|
12
11
|
const data = await client.Activity.get(
|
13
12
|
userId,
|
14
13
|
new Date("2020-01-01"),
|
15
|
-
new Date("2022-01
|
14
|
+
new Date("2022-12-01"),
|
16
15
|
)
|
17
16
|
expect(data.activity.length).toBeGreaterThan(0)
|
18
17
|
});
|
package/__tests__/arrange.ts
CHANGED
@@ -3,22 +3,15 @@ require('dotenv').config({
|
|
3
3
|
path: '.env'
|
4
4
|
})
|
5
5
|
|
6
|
-
export const
|
7
|
-
|
8
|
-
client_secret: process.env.TEST_CLIENT_SECRET,
|
6
|
+
export const testEUClient = new VitalClient({
|
7
|
+
api_key: process.env.TEST_EU_API_KEY,
|
9
8
|
environment: process.env.TEST_ENVIRONMENT as any,
|
10
|
-
region: "us",
|
11
|
-
});
|
12
|
-
|
13
|
-
export const testEuClient = new VitalClient({
|
14
|
-
client_id: process.env.TEST_EU_CLIENT_ID,
|
15
|
-
client_secret: process.env.TEST_EU_CLIENT_SECRET,
|
16
|
-
environment: "development",
|
17
9
|
region: "eu",
|
18
10
|
});
|
19
11
|
|
20
|
-
|
21
|
-
|
12
|
+
|
13
|
+
export const testUSClient = new VitalClient({
|
14
|
+
api_key: process.env.TEST_US_API_KEY,
|
22
15
|
environment: process.env.TEST_ENVIRONMENT as any,
|
23
16
|
region: "us",
|
24
17
|
});
|
package/__tests__/body.test.ts
CHANGED
@@ -1,17 +1,16 @@
|
|
1
1
|
import { VitalClient } from "..";
|
2
|
-
import {
|
2
|
+
import { testEUClient, testUSClient, getUserId } from "./arrange";
|
3
3
|
|
4
4
|
describe('Body', () => {
|
5
5
|
it.each([
|
6
|
-
["
|
7
|
-
["
|
8
|
-
["us_api_key", testApiKeyClient],
|
6
|
+
["eu_api_key", testEUClient],
|
7
|
+
["us_api_key", testUSClient],
|
9
8
|
])('should return body data %p', async (region: string, client: VitalClient) => {
|
10
9
|
const userId = await getUserId(client)
|
11
10
|
const data = await client.Body.get(
|
12
11
|
userId,
|
13
12
|
new Date("2021-01-01"),
|
14
|
-
new Date("2022-01
|
13
|
+
new Date("2022-12-01"),
|
15
14
|
)
|
16
15
|
expect(data.body.length).toBeGreaterThan(0)
|
17
16
|
});
|
package/__tests__/link.test.ts
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
import { VitalClient } from "..";
|
2
|
-
import {
|
2
|
+
import { testEUClient, testUSClient, getUserId } from "./arrange";
|
3
3
|
|
4
4
|
describe('Link', () => {
|
5
5
|
it.each([
|
6
|
-
["
|
7
|
-
["
|
8
|
-
["us_api_key", testApiKeyClient],
|
6
|
+
["eu_api_key", testEUClient],
|
7
|
+
["us_api_key", testUSClient],
|
9
8
|
])('should create a link token %p', async (region: string, client: VitalClient) => {
|
10
9
|
const userId = await getUserId(client)
|
11
10
|
const data = await client.Link.create(
|
@@ -1,11 +1,10 @@
|
|
1
1
|
import { VitalClient } from "..";
|
2
|
-
import {
|
2
|
+
import { testEUClient, testUSClient, getUserId } from "./arrange";
|
3
3
|
|
4
4
|
describe('Profile', () => {
|
5
5
|
it.each([
|
6
|
-
["
|
7
|
-
["
|
8
|
-
["us_api_key", testApiKeyClient],
|
6
|
+
["eu_api_key", testEUClient],
|
7
|
+
["us_api_key", testUSClient],
|
9
8
|
])('should return profile data %p', async (region: string, client: VitalClient) => {
|
10
9
|
const userId = await getUserId(client)
|
11
10
|
const data = await client.Profile.get(
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import {
|
1
|
+
import { testUSClient } from "./arrange";
|
2
2
|
|
3
3
|
it('should return supported providers', async () => {
|
4
|
-
const data = await
|
4
|
+
const data = await testUSClient.Providers.getSupportedProviders()
|
5
5
|
expect(data.length).toBeGreaterThan(0)
|
6
6
|
})
|
package/__tests__/sleep.test.ts
CHANGED
@@ -1,31 +1,29 @@
|
|
1
1
|
import { VitalClient } from "..";
|
2
|
-
import {
|
2
|
+
import { testEUClient, testUSClient, getUserId } from "./arrange";
|
3
3
|
|
4
4
|
describe('Sleep', () => {
|
5
5
|
it.each([
|
6
|
-
["
|
7
|
-
["
|
8
|
-
["us_api_key", testApiKeyClient],
|
6
|
+
["eu_api_key", testEUClient],
|
7
|
+
["us_api_key", testUSClient],
|
9
8
|
])('should return sleep data %p', async (region: string, client: VitalClient) => {
|
10
9
|
const userId = await getUserId(client)
|
11
10
|
const data = await client.Sleep.get(
|
12
11
|
userId,
|
13
12
|
new Date("2021-01-01"),
|
14
|
-
new Date("2022-01
|
13
|
+
new Date("2022-12-01"),
|
15
14
|
)
|
16
15
|
expect(data.sleep.length).toBeGreaterThan(0)
|
17
16
|
});
|
18
17
|
|
19
18
|
it.each([
|
20
|
-
["
|
21
|
-
["
|
22
|
-
["us_api_key", testApiKeyClient],
|
19
|
+
["eu_api_key", testEUClient],
|
20
|
+
["us_api_key", testUSClient],
|
23
21
|
])('should return sleep stream data %p', async (region: string, client: VitalClient) => {
|
24
22
|
const userId = await getUserId(client)
|
25
23
|
const data = await client.Sleep.getSleepWithStream(
|
26
24
|
userId,
|
27
|
-
new Date("
|
28
|
-
new Date("
|
25
|
+
new Date("2022-10-30"),
|
26
|
+
new Date("2022-11-01"),
|
29
27
|
)
|
30
28
|
expect(data.sleep.length).toBeGreaterThan(0)
|
31
29
|
expect(data.sleep[0].sleep_stream).toBeDefined()
|
package/__tests__/user.test.ts
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
import { VitalClient } from "..";
|
2
|
-
import {
|
2
|
+
import { testEUClient, testUSClient, getUserId, randomString, test_user_id } from "./arrange";
|
3
3
|
|
4
4
|
describe('User', () => {
|
5
5
|
const user_id = randomString(10);
|
6
6
|
it.each([
|
7
|
-
["
|
8
|
-
["
|
9
|
-
["us_api_key", testApiKeyClient],
|
7
|
+
["eu_api_key", testEUClient],
|
8
|
+
["us_api_key", testUSClient],
|
10
9
|
])('should create a user %p', async (region: string, client: VitalClient) => {
|
11
10
|
const user = await client.User.create(
|
12
11
|
user_id,
|
@@ -15,9 +14,8 @@ describe('User', () => {
|
|
15
14
|
});
|
16
15
|
|
17
16
|
it.each([
|
18
|
-
|
19
|
-
|
20
|
-
testApiKeyClient
|
17
|
+
testEUClient,
|
18
|
+
testUSClient,
|
21
19
|
])('should find a user', async (client: VitalClient) => {
|
22
20
|
const user = await client.User.resolve(
|
23
21
|
test_user_id,
|
@@ -26,9 +24,8 @@ describe('User', () => {
|
|
26
24
|
});
|
27
25
|
|
28
26
|
it.each([
|
29
|
-
|
30
|
-
|
31
|
-
testApiKeyClient
|
27
|
+
testEUClient,
|
28
|
+
testUSClient,
|
32
29
|
])('should delete a user', async (client: VitalClient) => {
|
33
30
|
const userToDelete = await getUserId(client, user_id);
|
34
31
|
const user = await client.User.delete(
|
package/__tests__/vitals.test.ts
CHANGED
@@ -1,17 +1,16 @@
|
|
1
1
|
import { VitalClient } from "..";
|
2
|
-
import {
|
2
|
+
import { testEUClient, testUSClient, getUserId } from "./arrange";
|
3
3
|
|
4
4
|
describe('Vitals', () => {
|
5
5
|
it.each([
|
6
|
-
["
|
7
|
-
["
|
8
|
-
|
9
|
-
])('should return glucose data %p', async (region: string, client: VitalClient) => {
|
6
|
+
["eu_api_key", testEUClient],
|
7
|
+
["us_api_key", testUSClient],
|
8
|
+
])('should return heartrate data %p', async (region: string, client: VitalClient) => {
|
10
9
|
const userId = await getUserId(client)
|
11
|
-
const data = await client.Vitals.
|
10
|
+
const data = await client.Vitals.heartrate(
|
12
11
|
userId,
|
13
|
-
new Date("
|
14
|
-
new Date("2022-01
|
12
|
+
new Date("2022-10-01"),
|
13
|
+
new Date("2022-11-01"),
|
15
14
|
)
|
16
15
|
expect(data.length).toBeGreaterThan(0)
|
17
16
|
});
|
@@ -1,17 +1,16 @@
|
|
1
1
|
import { VitalClient } from "..";
|
2
|
-
import {
|
2
|
+
import { testEUClient, testUSClient, getUserId } from "./arrange";
|
3
3
|
|
4
4
|
describe('Workouts', () => {
|
5
5
|
it.each([
|
6
|
-
["
|
7
|
-
["
|
8
|
-
["us_api_key", testApiKeyClient],
|
6
|
+
["eu_api_key", testEUClient],
|
7
|
+
["us_api_key", testUSClient],
|
9
8
|
])('should return workout data %p', async (region: string, client: VitalClient) => {
|
10
9
|
const userId = await getUserId(client)
|
11
10
|
const data = await client.Workouts.get(
|
12
11
|
userId,
|
13
12
|
new Date("2021-01-01"),
|
14
|
-
new Date("2022-01
|
13
|
+
new Date("2022-12-01"),
|
15
14
|
)
|
16
15
|
expect(data.workouts.length).toBeGreaterThan(0)
|
17
16
|
});
|
package/client/LabTests.ts
CHANGED
@@ -8,7 +8,7 @@ import {
|
|
8
8
|
PatientAdress,
|
9
9
|
PatientDetails,
|
10
10
|
Physician,
|
11
|
-
} from './models/
|
11
|
+
} from './models/lab_tests_model';
|
12
12
|
|
13
13
|
|
14
14
|
|
@@ -96,8 +96,6 @@ export class ResultsApi {
|
|
96
96
|
|
97
97
|
|
98
98
|
|
99
|
-
|
100
|
-
|
101
99
|
export class LabTestsApi {
|
102
100
|
baseURL: string;
|
103
101
|
client: AxiosInstance;
|
@@ -0,0 +1,107 @@
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
2
|
+
import {
|
3
|
+
LabResultsMetadata,
|
4
|
+
LabResultsRaw,
|
5
|
+
Order,
|
6
|
+
OrderRequestResponse,
|
7
|
+
OrderResponse,
|
8
|
+
PatientAdress,
|
9
|
+
PatientDetails,
|
10
|
+
TestkitResponse,
|
11
|
+
} from './models/testkit_models';
|
12
|
+
|
13
|
+
export class TestkitsApi {
|
14
|
+
baseURL: string;
|
15
|
+
client: AxiosInstance;
|
16
|
+
constructor(baseURL: string, axios: AxiosInstance) {
|
17
|
+
this.baseURL = baseURL;
|
18
|
+
this.client = axios;
|
19
|
+
}
|
20
|
+
|
21
|
+
public async get(): Promise<TestkitResponse> {
|
22
|
+
const resp = await this.client.get(this.baseURL.concat('/testkit'));
|
23
|
+
return resp.data;
|
24
|
+
}
|
25
|
+
|
26
|
+
public async get_orders(
|
27
|
+
startDate: Date,
|
28
|
+
endDate: Date,
|
29
|
+
status?: string[],
|
30
|
+
userId?: string,
|
31
|
+
patientName?: string,
|
32
|
+
page?: number,
|
33
|
+
size?: number
|
34
|
+
): Promise<OrderResponse> {
|
35
|
+
const resp = await this.client.get(
|
36
|
+
this.baseURL.concat('/testkit/orders'),
|
37
|
+
{
|
38
|
+
params: {
|
39
|
+
start_date: startDate,
|
40
|
+
end_date: endDate,
|
41
|
+
status: status ? status : null,
|
42
|
+
user_id: userId ? userId : null,
|
43
|
+
patient_name: patientName ? patientName : null,
|
44
|
+
...(page && { page }),
|
45
|
+
...(size && { size }),
|
46
|
+
},
|
47
|
+
}
|
48
|
+
);
|
49
|
+
return resp.data;
|
50
|
+
}
|
51
|
+
|
52
|
+
public async order(
|
53
|
+
userId: string,
|
54
|
+
testkitId: string,
|
55
|
+
patientAddress: PatientAdress,
|
56
|
+
patientDetails: PatientDetails
|
57
|
+
): Promise<OrderRequestResponse> {
|
58
|
+
const resp = await this.client.post(
|
59
|
+
this.baseURL.concat('/testkit/orders'),
|
60
|
+
{
|
61
|
+
user_key: userId,
|
62
|
+
testkit_id: testkitId,
|
63
|
+
patient_address: patientAddress,
|
64
|
+
patient_details: patientDetails,
|
65
|
+
}
|
66
|
+
);
|
67
|
+
return resp.data;
|
68
|
+
}
|
69
|
+
|
70
|
+
public async get_order(orderId: string): Promise<Order> {
|
71
|
+
const resp = await this.client.get(
|
72
|
+
this.baseURL.concat(`/testkit/orders/${orderId}`)
|
73
|
+
);
|
74
|
+
return resp.data;
|
75
|
+
}
|
76
|
+
|
77
|
+
public async cancel_order(orderId: string): Promise<OrderRequestResponse> {
|
78
|
+
const resp = await this.client.post(
|
79
|
+
this.baseURL.concat(`/testkit/orders/${orderId}/cancel`)
|
80
|
+
);
|
81
|
+
return resp.data;
|
82
|
+
}
|
83
|
+
|
84
|
+
public async get_results(orderId: string): Promise<string> {
|
85
|
+
const resp = await this.client.get(
|
86
|
+
this.baseURL.concat(`/testkit/orders/${orderId}/results`),
|
87
|
+
{
|
88
|
+
responseType: 'arraybuffer',
|
89
|
+
}
|
90
|
+
);
|
91
|
+
return resp.data;
|
92
|
+
}
|
93
|
+
|
94
|
+
public async getMetadata(orderId: string): Promise<LabResultsMetadata> {
|
95
|
+
const resp = await this.client.get(
|
96
|
+
this.baseURL.concat(`/testkit/orders/${orderId}/results/metadata`)
|
97
|
+
);
|
98
|
+
return resp.data;
|
99
|
+
}
|
100
|
+
|
101
|
+
public async getRawResults(orderId: string): Promise<LabResultsRaw> {
|
102
|
+
const resp = await this.client.get(
|
103
|
+
this.baseURL.concat(`/testkit/orders/${orderId}/results/raw`)
|
104
|
+
);
|
105
|
+
return resp.data;
|
106
|
+
}
|
107
|
+
}
|
package/client/index.ts
CHANGED
@@ -0,0 +1,129 @@
|
|
1
|
+
export interface PatientAdress {
|
2
|
+
receiver_name: string;
|
3
|
+
city: string;
|
4
|
+
state: string;
|
5
|
+
zip: string;
|
6
|
+
country: string;
|
7
|
+
street_number?: string;
|
8
|
+
}
|
9
|
+
|
10
|
+
export interface PatientDetails {
|
11
|
+
dob: string;
|
12
|
+
gender: string;
|
13
|
+
email?: string;
|
14
|
+
first_name: string;
|
15
|
+
phone_number: string;
|
16
|
+
last_name: string;
|
17
|
+
}
|
18
|
+
|
19
|
+
export interface Physician {
|
20
|
+
first_name: string;
|
21
|
+
last_name: string;
|
22
|
+
npi: string;
|
23
|
+
email?: string;
|
24
|
+
licensed_states?: string[];
|
25
|
+
created_at?: string;
|
26
|
+
updated_at?: string;
|
27
|
+
}
|
28
|
+
|
29
|
+
export interface Marker {
|
30
|
+
name: string;
|
31
|
+
slug: string;
|
32
|
+
description?: string;
|
33
|
+
}
|
34
|
+
|
35
|
+
export interface Testkit {
|
36
|
+
id: string;
|
37
|
+
name: string;
|
38
|
+
description: string;
|
39
|
+
markers: Marker[];
|
40
|
+
turnaround_time_lower: number;
|
41
|
+
turnaround_time_upper: number;
|
42
|
+
price: number;
|
43
|
+
}
|
44
|
+
|
45
|
+
export interface TestkitEvent {
|
46
|
+
id: number;
|
47
|
+
created_at: string;
|
48
|
+
status: string;
|
49
|
+
}
|
50
|
+
|
51
|
+
export interface Order {
|
52
|
+
user_id: string;
|
53
|
+
id: string;
|
54
|
+
team_id: string;
|
55
|
+
patient_details: PatientDetails;
|
56
|
+
patient_address: PatientAdress;
|
57
|
+
lab_test: Testkit;
|
58
|
+
// TODO CHECK WHAT DETAILS IS
|
59
|
+
details: Object;
|
60
|
+
created_at: string;
|
61
|
+
updated_at: string;
|
62
|
+
events: TestkitEvent;
|
63
|
+
user_key?: string;
|
64
|
+
sample_id?: string;
|
65
|
+
notes?: string;
|
66
|
+
status?:
|
67
|
+
| 'ordered'
|
68
|
+
| 'transit_customer'
|
69
|
+
| 'out_for_delivery'
|
70
|
+
| 'with_customer'
|
71
|
+
| 'transit_lab'
|
72
|
+
| 'delivered_to_lab'
|
73
|
+
| 'processing_lab'
|
74
|
+
| 'completed'
|
75
|
+
| 'failure_to_deliver_to_customer'
|
76
|
+
| 'failure_to_deliver_to_lab'
|
77
|
+
| 'cancelled'
|
78
|
+
| 'do_not_process'
|
79
|
+
| 'unknown'
|
80
|
+
| 'rejected'
|
81
|
+
| 'lost';
|
82
|
+
}
|
83
|
+
|
84
|
+
export interface OrderRequestResponse {
|
85
|
+
order: Order;
|
86
|
+
status: string;
|
87
|
+
message: string;
|
88
|
+
}
|
89
|
+
|
90
|
+
export interface LabClientFacing {
|
91
|
+
slug: string;
|
92
|
+
name: string;
|
93
|
+
first_line_address: string;
|
94
|
+
city: string;
|
95
|
+
zipcode: string;
|
96
|
+
}
|
97
|
+
|
98
|
+
export interface ClientFacingLabTest {
|
99
|
+
id: string;
|
100
|
+
slug: string;
|
101
|
+
name: string;
|
102
|
+
sample_type: string;
|
103
|
+
method: string;
|
104
|
+
price: number;
|
105
|
+
is_active: boolean;
|
106
|
+
lab: LabClientFacing;
|
107
|
+
markers: Marker;
|
108
|
+
}
|
109
|
+
export interface TestkitResponse {
|
110
|
+
testkits: Testkit[];
|
111
|
+
}
|
112
|
+
|
113
|
+
export interface LabResultsMetadata {
|
114
|
+
age: string;
|
115
|
+
dob: string;
|
116
|
+
patient: string;
|
117
|
+
date_reported: string;
|
118
|
+
date_collected: string;
|
119
|
+
specimen_number: string;
|
120
|
+
clia?: string;
|
121
|
+
provider?: string;
|
122
|
+
laboratory?: string;
|
123
|
+
date_received?: string;
|
124
|
+
}
|
125
|
+
|
126
|
+
export interface LabResultsResponse {
|
127
|
+
metadata: LabResultsMetadata;
|
128
|
+
results: Object;
|
129
|
+
}
|
@@ -1,33 +1,18 @@
|
|
1
|
-
import internal = require("stream");
|
2
|
-
import { IntegrationKeyOut } from "svix";
|
3
|
-
|
4
1
|
export interface PatientAdress {
|
5
2
|
receiver_name: string;
|
6
|
-
|
3
|
+
first_line: string;
|
4
|
+
second_line?: string;
|
7
5
|
city: string;
|
8
6
|
state: string;
|
9
7
|
zip: string;
|
10
8
|
country: string;
|
11
9
|
phone_number: string;
|
12
|
-
street_number?: string;
|
13
10
|
}
|
14
11
|
|
15
12
|
export interface PatientDetails {
|
16
13
|
dob: string;
|
17
14
|
gender: string;
|
18
|
-
email: string;
|
19
|
-
}
|
20
|
-
|
21
|
-
export interface Physician {
|
22
|
-
first_name: string;
|
23
|
-
last_name: string;
|
24
|
-
npi: string;
|
25
|
-
email?: string;
|
26
|
-
licensed_states?: string[];
|
27
|
-
created_at?: string;
|
28
|
-
updated_at?: string;
|
29
15
|
}
|
30
|
-
|
31
16
|
export interface Marker {
|
32
17
|
name: string;
|
33
18
|
slug: string;
|
@@ -44,30 +29,18 @@ export interface Testkit {
|
|
44
29
|
price: number;
|
45
30
|
}
|
46
31
|
|
47
|
-
export interface TestkitEvent {
|
48
|
-
id: number;
|
49
|
-
created_at: string;
|
50
|
-
status: string;
|
51
|
-
}
|
52
|
-
|
53
|
-
|
54
|
-
|
55
32
|
export interface Order {
|
56
|
-
user_id: string;
|
57
33
|
id: string;
|
58
34
|
team_id: string;
|
35
|
+
created_on: Date;
|
36
|
+
updated_on: Date;
|
59
37
|
patient_details: PatientDetails;
|
60
38
|
patient_address: PatientAdress;
|
61
|
-
lab_test: Testkit;
|
62
|
-
// TODO CHECK WHAT DETAILS IS
|
63
|
-
details: Object;
|
64
39
|
created_at: string;
|
65
40
|
updated_at: string;
|
66
|
-
events: TestkitEvent;
|
67
|
-
user_key?: string;
|
68
41
|
sample_id?: string;
|
69
42
|
notes?: string;
|
70
|
-
status
|
43
|
+
status:
|
71
44
|
| 'ordered'
|
72
45
|
| 'transit_customer'
|
73
46
|
| 'out_for_delivery'
|
@@ -83,6 +56,20 @@ export interface Order {
|
|
83
56
|
| 'unknown'
|
84
57
|
| "rejected"
|
85
58
|
| "lost";
|
59
|
+
user_key: string;
|
60
|
+
testkit_id: string;
|
61
|
+
testkit: Testkit;
|
62
|
+
inbound_tracking_number?: string;
|
63
|
+
outbound_tracking_number?: string;
|
64
|
+
outbound_courier?: string;
|
65
|
+
inbound_courier?: string;
|
66
|
+
}
|
67
|
+
|
68
|
+
export interface OrderResponse {
|
69
|
+
orders: Order[];
|
70
|
+
total: number;
|
71
|
+
page: number;
|
72
|
+
size: number;
|
86
73
|
}
|
87
74
|
|
88
75
|
export interface OrderRequestResponse {
|
@@ -91,25 +78,6 @@ export interface OrderRequestResponse {
|
|
91
78
|
message: string;
|
92
79
|
}
|
93
80
|
|
94
|
-
export interface LabClientFacing {
|
95
|
-
slug: string;
|
96
|
-
name: string;
|
97
|
-
first_line_address: string;
|
98
|
-
city: string;
|
99
|
-
zipcode: string;
|
100
|
-
}
|
101
|
-
|
102
|
-
export interface ClientFacingLabTest {
|
103
|
-
id: string;
|
104
|
-
slug: string;
|
105
|
-
name: string;
|
106
|
-
sample_type: string;
|
107
|
-
method: string;
|
108
|
-
price: number;
|
109
|
-
is_active: boolean;
|
110
|
-
lab: LabClientFacing;
|
111
|
-
markers: Marker;
|
112
|
-
}
|
113
81
|
export interface TestkitResponse {
|
114
82
|
testkits: Testkit[];
|
115
83
|
}
|
@@ -117,17 +85,18 @@ export interface TestkitResponse {
|
|
117
85
|
export interface LabResultsMetadata {
|
118
86
|
age: string;
|
119
87
|
dob: string;
|
88
|
+
clia_number: string;
|
120
89
|
patient: string;
|
90
|
+
provider: string;
|
91
|
+
laboratory: string;
|
121
92
|
date_reported: string;
|
122
93
|
date_collected: string;
|
123
94
|
specimen_number: string;
|
124
|
-
clia?: string;
|
125
|
-
provider?: string;
|
126
|
-
laboratory?: string;
|
127
95
|
date_received?: string;
|
96
|
+
clia?: string;
|
128
97
|
}
|
129
98
|
|
130
|
-
export interface
|
99
|
+
export interface LabResultsRaw {
|
131
100
|
metadata: LabResultsMetadata;
|
132
|
-
results:
|
133
|
-
}
|
101
|
+
results: Record<string, string>;
|
102
|
+
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
2
|
-
import { ClientFacingLabTest, LabResultsMetadata, LabResultsResponse, Order, OrderRequestResponse, PatientAdress, PatientDetails, Physician } from './models/
|
2
|
+
import { ClientFacingLabTest, 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;
|