@metriport/api-sdk 6.0.1-alpha.1 → 6.0.1-alpha.3

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.
Files changed (53) hide show
  1. package/package.json +9 -3
  2. package/.eslintignore +0 -4
  3. package/.eslintrc.js +0 -7
  4. package/src/devices/client/metriport.ts +0 -261
  5. package/src/devices/client/models/get-connect-token-response.ts +0 -3
  6. package/src/devices/client/models/get-connected-users-response.ts +0 -5
  7. package/src/devices/client/models/get-metriport-user-id-response.ts +0 -3
  8. package/src/devices/client/models/settings-response.ts +0 -5
  9. package/src/devices/client/models/webhook-status-response.ts +0 -6
  10. package/src/devices/client/util/date-util.ts +0 -17
  11. package/src/devices/models/activity.ts +0 -22
  12. package/src/devices/models/biometrics.ts +0 -17
  13. package/src/devices/models/body.ts +0 -12
  14. package/src/devices/models/common/activity-durations.ts +0 -20
  15. package/src/devices/models/common/activity-log.ts +0 -33
  16. package/src/devices/models/common/activity-movement.ts +0 -15
  17. package/src/devices/models/common/aminos.ts +0 -22
  18. package/src/devices/models/common/blood-glucose.ts +0 -6
  19. package/src/devices/models/common/blood-pressure.ts +0 -10
  20. package/src/devices/models/common/connected-user-info.ts +0 -5
  21. package/src/devices/models/common/energy-expenditure.ts +0 -6
  22. package/src/devices/models/common/food.ts +0 -15
  23. package/src/devices/models/common/heart-rate-variability.ts +0 -12
  24. package/src/devices/models/common/heart-rate.ts +0 -9
  25. package/src/devices/models/common/lat-lon.ts +0 -4
  26. package/src/devices/models/common/macros.ts +0 -13
  27. package/src/devices/models/common/metadata.ts +0 -10
  28. package/src/devices/models/common/micros.ts +0 -27
  29. package/src/devices/models/common/provider-source.ts +0 -11
  30. package/src/devices/models/common/respiration.ts +0 -16
  31. package/src/devices/models/common/sample.ts +0 -7
  32. package/src/devices/models/common/sex.ts +0 -1
  33. package/src/devices/models/common/source-info.ts +0 -8
  34. package/src/devices/models/common/source-type.ts +0 -4
  35. package/src/devices/models/common/temperature.ts +0 -13
  36. package/src/devices/models/metriport-data.ts +0 -5
  37. package/src/devices/models/nutrition.ts +0 -10
  38. package/src/devices/models/sleep.ts +0 -29
  39. package/src/devices/models/user.ts +0 -14
  40. package/src/index.ts +0 -60
  41. package/src/medical/client/metriport.ts +0 -328
  42. package/src/medical/models/common/address.ts +0 -20
  43. package/src/medical/models/common/base-update.ts +0 -11
  44. package/src/medical/models/common/medical-data-source.ts +0 -3
  45. package/src/medical/models/common/us-data.ts +0 -56
  46. package/src/medical/models/demographics.ts +0 -63
  47. package/src/medical/models/document.ts +0 -49
  48. package/src/medical/models/facility.ts +0 -23
  49. package/src/medical/models/organization.ts +0 -24
  50. package/src/medical/models/patient.ts +0 -18
  51. package/src/shared.ts +0 -25
  52. package/tsconfig.json +0 -24
  53. package/tsconfig.ref.json +0 -7
@@ -1,49 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export const documentReferenceSchema = z.object({
4
- id: z.string(),
5
- fileName: z.string(),
6
- location: z.string(),
7
- description: z.string().optional(),
8
- status: z.string().optional(),
9
- indexed: z.string().optional(), // ISO-8601
10
- mimeType: z.string().optional(),
11
- size: z.number().optional(), // bytes
12
- type: z
13
- .object({
14
- coding: z
15
- .array(
16
- z.object({
17
- system: z.string().optional().nullable(),
18
- code: z.string().optional().nullable(),
19
- display: z.string().optional().nullable(),
20
- })
21
- )
22
- .optional(),
23
- text: z.string().optional(),
24
- })
25
- .optional(),
26
- });
27
- export type DocumentReference = z.infer<typeof documentReferenceSchema>;
28
-
29
- export const documentQueryStatusSchema = z.enum(["processing", "completed", "failed"]);
30
- export type DocumentQueryStatus = z.infer<typeof documentQueryStatusSchema>;
31
-
32
- export const progressSchema = z.object({
33
- status: documentQueryStatusSchema,
34
- total: z.number().optional(),
35
- successful: z.number().optional(),
36
- errors: z.number().optional(),
37
- });
38
-
39
- export const documentQuerySchema = z.object({
40
- download: progressSchema.optional(),
41
- convert: progressSchema.optional(),
42
- });
43
-
44
- export type DocumentQuery = z.infer<typeof documentQuerySchema>;
45
-
46
- export const documentListSchema = z.object({
47
- documents: z.array(documentReferenceSchema),
48
- });
49
- export type DocumentList = z.infer<typeof documentListSchema>;
@@ -1,23 +0,0 @@
1
- import { z } from "zod";
2
- import { addressSchema } from "./common/address";
3
- import { baseUpdateSchema } from "./common/base-update";
4
- import { validateNPI } from "@metriport/commonwell-sdk/common/validate-npi";
5
-
6
- export const facilityCreateSchema = z.object({
7
- name: z.string().min(1),
8
- npi: z
9
- .string()
10
- .length(10)
11
- .refine(npi => validateNPI(npi), { message: "NPI is not valid" }),
12
- tin: z.string().optional().nullable(),
13
- active: z.boolean().optional().nullable(),
14
- address: addressSchema,
15
- });
16
- export type FacilityCreate = z.infer<typeof facilityCreateSchema>;
17
-
18
- export const facilitySchema = facilityCreateSchema.merge(baseUpdateSchema);
19
- export type Facility = z.infer<typeof facilitySchema>;
20
-
21
- export const facilityListSchema = z.object({
22
- facilities: z.array(facilitySchema),
23
- });
@@ -1,24 +0,0 @@
1
- import { z } from "zod";
2
- import { addressSchema } from "./common/address";
3
- import { baseUpdateSchema } from "./common/base-update";
4
-
5
- export enum OrgType {
6
- acuteCare = "acuteCare",
7
- ambulatory = "ambulatory",
8
- hospital = "hospital",
9
- labSystems = "labSystems",
10
- pharmacy = "pharmacy",
11
- postAcuteCare = "postAcuteCare",
12
- }
13
-
14
- export const orgTypeSchema = z.nativeEnum(OrgType);
15
-
16
- export const organizationCreateSchema = z.object({
17
- name: z.string(),
18
- type: orgTypeSchema,
19
- location: addressSchema,
20
- });
21
- export type OrganizationCreate = z.infer<typeof organizationCreateSchema>;
22
-
23
- export const organizationSchema = organizationCreateSchema.merge(baseUpdateSchema);
24
- export type Organization = z.infer<typeof organizationSchema>;
@@ -1,18 +0,0 @@
1
- import { z } from "zod";
2
- import { baseUpdateSchema } from "./common/base-update";
3
- import { demographicsSchema } from "./demographics";
4
-
5
- export const patientCreateSchema = demographicsSchema;
6
- export type PatientCreate = z.infer<typeof patientCreateSchema>;
7
-
8
- export const patientUpdateSchema = patientCreateSchema.merge(baseUpdateSchema);
9
- export type PatientUpdate = z.infer<typeof patientUpdateSchema>;
10
-
11
- export const patientSchema = patientUpdateSchema.extend({
12
- facilityIds: z.array(z.string()),
13
- });
14
- export type Patient = z.infer<typeof patientSchema>;
15
-
16
- export const patientListSchema = z.object({
17
- patients: z.array(patientSchema),
18
- });
package/src/shared.ts DELETED
@@ -1,25 +0,0 @@
1
- import dayjs from "dayjs";
2
- import { z, ZodString } from "zod";
3
-
4
- export const BASE_ADDRESS = "https://api.metriport.com";
5
- export const BASE_ADDRESS_SANDBOX = "https://api.sandbox.metriport.com";
6
- export const API_KEY_HEADER = "x-api-key";
7
- export const DEFAULT_AXIOS_TIMEOUT_MILLIS = 20_000;
8
-
9
- export const emptyStringToUndefined = (v: string | undefined | null) =>
10
- v == null || v.length < 1 ? undefined : v;
11
-
12
- export const optionalString = (zodSchema: ZodString) =>
13
- zodSchema.or(z.string().optional()).transform(emptyStringToUndefined);
14
-
15
- export function stripNonNumericChars(str: string): string {
16
- return str.trim().replace(/\D/g, "");
17
- }
18
-
19
- export const ISO_DATE = "YYYY-MM-DD";
20
- export const defaultString = z.string().trim();
21
- export const defaultOptionalString = optionalString(defaultString);
22
- export const defaultDateString = defaultString.refine(v => dayjs(v, ISO_DATE, true).isValid(), {
23
- message: `Date must be a valid ISO 8601 date formatted ${ISO_DATE}. Example: 2023-05-03`,
24
- });
25
- export const defaultNameString = defaultString.min(1);
package/tsconfig.json DELETED
@@ -1,24 +0,0 @@
1
- {
2
- "extends": "@tsconfig/recommended/tsconfig.json",
3
- "compilerOptions": {
4
- "target": "es2020",
5
- "sourceMap": true,
6
- "declaration": true,
7
- "declarationMap": true, // enables importers to jump to source
8
- "emitDecoratorMetadata": true,
9
- "experimentalDecorators": true,
10
- // START - From @tsconfig/strictest
11
- "allowUnusedLabels": false,
12
- "allowUnreachableCode": false,
13
- "noFallthroughCasesInSwitch": true,
14
- "noImplicitOverride": true,
15
- "noUnusedLocals": true,
16
- "checkJs": true,
17
- "exactOptionalPropertyTypes": true,
18
- "noImplicitReturns": true,
19
- // END - From @tsconfig/strictest
20
- "outDir": "./dist"
21
- },
22
- "include": ["./src"],
23
- "exclude": ["./dist"]
24
- }
package/tsconfig.ref.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "include": ["src/**/*"],
4
- "compilerOptions": {
5
- "composite": true,
6
- },
7
- }