@metriport/api-sdk 6.0.1-alpha.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/.eslintignore +4 -0
- package/.eslintrc.js +7 -0
- package/LICENSE +21 -0
- package/README.md +67 -0
- package/dist/devices/client/metriport.d.ts +155 -0
- package/dist/devices/client/metriport.d.ts.map +1 -0
- package/dist/devices/client/metriport.js +225 -0
- package/dist/devices/client/metriport.js.map +1 -0
- package/dist/devices/client/models/get-connect-token-response.d.ts +4 -0
- package/dist/devices/client/models/get-connect-token-response.d.ts.map +1 -0
- package/dist/devices/client/models/get-connect-token-response.js +3 -0
- package/dist/devices/client/models/get-connect-token-response.js.map +1 -0
- package/dist/devices/client/models/get-connected-users-response.d.ts +5 -0
- package/dist/devices/client/models/get-connected-users-response.d.ts.map +1 -0
- package/dist/devices/client/models/get-connected-users-response.js +3 -0
- package/dist/devices/client/models/get-connected-users-response.js.map +1 -0
- package/dist/devices/client/models/get-metriport-user-id-response.d.ts +4 -0
- package/dist/devices/client/models/get-metriport-user-id-response.d.ts.map +1 -0
- package/dist/devices/client/models/get-metriport-user-id-response.js +3 -0
- package/dist/devices/client/models/get-metriport-user-id-response.js.map +1 -0
- package/dist/devices/client/models/settings-response.d.ts +6 -0
- package/dist/devices/client/models/settings-response.d.ts.map +1 -0
- package/dist/devices/client/models/settings-response.js +3 -0
- package/dist/devices/client/models/settings-response.js.map +1 -0
- package/dist/devices/client/models/webhook-status-response.d.ts +7 -0
- package/dist/devices/client/models/webhook-status-response.d.ts.map +1 -0
- package/dist/devices/client/models/webhook-status-response.js +3 -0
- package/dist/devices/client/models/webhook-status-response.js.map +1 -0
- package/dist/devices/client/util/date-util.d.ts +2 -0
- package/dist/devices/client/util/date-util.d.ts.map +1 -0
- package/dist/devices/client/util/date-util.js +17 -0
- package/dist/devices/client/util/date-util.js.map +1 -0
- package/dist/devices/models/activity.d.ts +22 -0
- package/dist/devices/models/activity.d.ts.map +1 -0
- package/dist/devices/models/activity.js +3 -0
- package/dist/devices/models/activity.js.map +1 -0
- package/dist/devices/models/biometrics.d.ts +16 -0
- package/dist/devices/models/biometrics.d.ts.map +1 -0
- package/dist/devices/models/biometrics.js +3 -0
- package/dist/devices/models/biometrics.js.map +1 -0
- package/dist/devices/models/body.d.ts +13 -0
- package/dist/devices/models/body.d.ts.map +1 -0
- package/dist/devices/models/body.js +3 -0
- package/dist/devices/models/body.js.map +1 -0
- package/dist/devices/models/common/activity-durations.d.ts +19 -0
- package/dist/devices/models/common/activity-durations.d.ts.map +1 -0
- package/dist/devices/models/common/activity-durations.js +3 -0
- package/dist/devices/models/common/activity-durations.js.map +1 -0
- package/dist/devices/models/common/activity-log.d.ts +32 -0
- package/dist/devices/models/common/activity-log.d.ts.map +1 -0
- package/dist/devices/models/common/activity-log.js +3 -0
- package/dist/devices/models/common/activity-log.js.map +1 -0
- package/dist/devices/models/common/activity-movement.d.ts +16 -0
- package/dist/devices/models/common/activity-movement.d.ts.map +1 -0
- package/dist/devices/models/common/activity-movement.js +3 -0
- package/dist/devices/models/common/activity-movement.js.map +1 -0
- package/dist/devices/models/common/aminos.d.ts +23 -0
- package/dist/devices/models/common/aminos.d.ts.map +1 -0
- package/dist/devices/models/common/aminos.js +3 -0
- package/dist/devices/models/common/aminos.js.map +1 -0
- package/dist/devices/models/common/blood-glucose.d.ts +6 -0
- package/dist/devices/models/common/blood-glucose.d.ts.map +1 -0
- package/dist/devices/models/common/blood-glucose.js +3 -0
- package/dist/devices/models/common/blood-glucose.js.map +1 -0
- package/dist/devices/models/common/blood-pressure.d.ts +10 -0
- package/dist/devices/models/common/blood-pressure.d.ts.map +1 -0
- package/dist/devices/models/common/blood-pressure.js +3 -0
- package/dist/devices/models/common/blood-pressure.js.map +1 -0
- package/dist/devices/models/common/connected-user-info.d.ts +6 -0
- package/dist/devices/models/common/connected-user-info.d.ts.map +1 -0
- package/dist/devices/models/common/connected-user-info.js +3 -0
- package/dist/devices/models/common/connected-user-info.js.map +1 -0
- package/dist/devices/models/common/energy-expenditure.d.ts +7 -0
- package/dist/devices/models/common/energy-expenditure.d.ts.map +1 -0
- package/dist/devices/models/common/energy-expenditure.js +3 -0
- package/dist/devices/models/common/energy-expenditure.js.map +1 -0
- package/dist/devices/models/common/food.d.ts +15 -0
- package/dist/devices/models/common/food.d.ts.map +1 -0
- package/dist/devices/models/common/food.js +3 -0
- package/dist/devices/models/common/food.js.map +1 -0
- package/dist/devices/models/common/heart-rate-variability.d.ts +12 -0
- package/dist/devices/models/common/heart-rate-variability.d.ts.map +1 -0
- package/dist/devices/models/common/heart-rate-variability.js +3 -0
- package/dist/devices/models/common/heart-rate-variability.js.map +1 -0
- package/dist/devices/models/common/heart-rate.d.ts +9 -0
- package/dist/devices/models/common/heart-rate.d.ts.map +1 -0
- package/dist/devices/models/common/heart-rate.js +3 -0
- package/dist/devices/models/common/heart-rate.js.map +1 -0
- package/dist/devices/models/common/lat-lon.d.ts +5 -0
- package/dist/devices/models/common/lat-lon.d.ts.map +1 -0
- package/dist/devices/models/common/lat-lon.js +3 -0
- package/dist/devices/models/common/lat-lon.js.map +1 -0
- package/dist/devices/models/common/macros.d.ts +14 -0
- package/dist/devices/models/common/macros.d.ts.map +1 -0
- package/dist/devices/models/common/macros.js +3 -0
- package/dist/devices/models/common/macros.js.map +1 -0
- package/dist/devices/models/common/metadata.d.ts +10 -0
- package/dist/devices/models/common/metadata.d.ts.map +1 -0
- package/dist/devices/models/common/metadata.js +3 -0
- package/dist/devices/models/common/metadata.js.map +1 -0
- package/dist/devices/models/common/micros.d.ts +28 -0
- package/dist/devices/models/common/micros.d.ts.map +1 -0
- package/dist/devices/models/common/micros.js +3 -0
- package/dist/devices/models/common/micros.js.map +1 -0
- package/dist/devices/models/common/provider-source.d.ts +12 -0
- package/dist/devices/models/common/provider-source.d.ts.map +1 -0
- package/dist/devices/models/common/provider-source.js +16 -0
- package/dist/devices/models/common/provider-source.js.map +1 -0
- package/dist/devices/models/common/respiration.d.ts +15 -0
- package/dist/devices/models/common/respiration.d.ts.map +1 -0
- package/dist/devices/models/common/respiration.js +3 -0
- package/dist/devices/models/common/respiration.js.map +1 -0
- package/dist/devices/models/common/sample.d.ts +7 -0
- package/dist/devices/models/common/sample.d.ts.map +1 -0
- package/dist/devices/models/common/sample.js +3 -0
- package/dist/devices/models/common/sample.js.map +1 -0
- package/dist/devices/models/common/sex.d.ts +2 -0
- package/dist/devices/models/common/sex.d.ts.map +1 -0
- package/dist/devices/models/common/sex.js +3 -0
- package/dist/devices/models/common/sex.js.map +1 -0
- package/dist/devices/models/common/source-info.d.ts +8 -0
- package/dist/devices/models/common/source-info.d.ts.map +1 -0
- package/dist/devices/models/common/source-info.js +3 -0
- package/dist/devices/models/common/source-info.js.map +1 -0
- package/dist/devices/models/common/source-type.d.ts +5 -0
- package/dist/devices/models/common/source-type.d.ts.map +1 -0
- package/dist/devices/models/common/source-type.js +9 -0
- package/dist/devices/models/common/source-type.js.map +1 -0
- package/dist/devices/models/common/temperature.d.ts +13 -0
- package/dist/devices/models/common/temperature.d.ts.map +1 -0
- package/dist/devices/models/common/temperature.js +3 -0
- package/dist/devices/models/common/temperature.js.map +1 -0
- package/dist/devices/models/metriport-data.d.ts +5 -0
- package/dist/devices/models/metriport-data.d.ts.map +1 -0
- package/dist/devices/models/metriport-data.js +3 -0
- package/dist/devices/models/metriport-data.js.map +1 -0
- package/dist/devices/models/nutrition.d.ts +14 -0
- package/dist/devices/models/nutrition.d.ts.map +1 -0
- package/dist/devices/models/nutrition.js +3 -0
- package/dist/devices/models/nutrition.js.map +1 -0
- package/dist/devices/models/sleep.d.ts +28 -0
- package/dist/devices/models/sleep.d.ts.map +1 -0
- package/dist/devices/models/sleep.js +3 -0
- package/dist/devices/models/sleep.js.map +1 -0
- package/dist/devices/models/user.d.ts +14 -0
- package/dist/devices/models/user.d.ts.map +1 -0
- package/dist/devices/models/user.js +3 -0
- package/dist/devices/models/user.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -0
- package/dist/medical/client/metriport.d.ts +152 -0
- package/dist/medical/client/metriport.d.ts.map +1 -0
- package/dist/medical/client/metriport.js +290 -0
- package/dist/medical/client/metriport.js.map +1 -0
- package/dist/medical/models/common/address.d.ts +25 -0
- package/dist/medical/models/common/address.d.ts.map +1 -0
- package/dist/medical/models/common/address.js +21 -0
- package/dist/medical/models/common/address.js.map +1 -0
- package/dist/medical/models/common/base-update.d.ts +16 -0
- package/dist/medical/models/common/base-update.d.ts.map +1 -0
- package/dist/medical/models/common/base-update.js +13 -0
- package/dist/medical/models/common/base-update.js.map +1 -0
- package/dist/medical/models/common/medical-data-source.d.ts +4 -0
- package/dist/medical/models/common/medical-data-source.d.ts.map +1 -0
- package/dist/medical/models/common/medical-data-source.js +8 -0
- package/dist/medical/models/common/medical-data-source.js.map +1 -0
- package/dist/medical/models/common/us-data.d.ts +56 -0
- package/dist/medical/models/common/us-data.d.ts.map +1 -0
- package/dist/medical/models/common/us-data.js +60 -0
- package/dist/medical/models/common/us-data.js.map +1 -0
- package/dist/medical/models/demographics.d.ts +317 -0
- package/dist/medical/models/demographics.d.ts.map +1 -0
- package/dist/medical/models/demographics.js +50 -0
- package/dist/medical/models/demographics.js.map +1 -0
- package/dist/medical/models/document.d.ts +271 -0
- package/dist/medical/models/document.d.ts.map +1 -0
- package/dist/medical/models/document.js +41 -0
- package/dist/medical/models/document.js.map +1 -0
- package/dist/medical/models/facility.d.ts +214 -0
- package/dist/medical/models/facility.d.ts.map +1 -0
- package/dist/medical/models/facility.js +22 -0
- package/dist/medical/models/facility.js.map +1 -0
- package/dist/medical/models/organization.d.ts +115 -0
- package/dist/medical/models/organization.d.ts.map +1 -0
- package/dist/medical/models/organization.js +23 -0
- package/dist/medical/models/organization.js.map +1 -0
- package/dist/medical/models/patient.d.ts +1097 -0
- package/dist/medical/models/patient.d.ts.map +1 -0
- package/dist/medical/models/patient.js +15 -0
- package/dist/medical/models/patient.js.map +1 -0
- package/dist/shared.d.ts +14 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +28 -0
- package/dist/shared.js.map +1 -0
- package/package.json +67 -0
- package/src/devices/client/metriport.ts +261 -0
- package/src/devices/client/models/get-connect-token-response.ts +3 -0
- package/src/devices/client/models/get-connected-users-response.ts +5 -0
- package/src/devices/client/models/get-metriport-user-id-response.ts +3 -0
- package/src/devices/client/models/settings-response.ts +5 -0
- package/src/devices/client/models/webhook-status-response.ts +6 -0
- package/src/devices/client/util/date-util.ts +17 -0
- package/src/devices/models/activity.ts +22 -0
- package/src/devices/models/biometrics.ts +17 -0
- package/src/devices/models/body.ts +12 -0
- package/src/devices/models/common/activity-durations.ts +20 -0
- package/src/devices/models/common/activity-log.ts +33 -0
- package/src/devices/models/common/activity-movement.ts +15 -0
- package/src/devices/models/common/aminos.ts +22 -0
- package/src/devices/models/common/blood-glucose.ts +6 -0
- package/src/devices/models/common/blood-pressure.ts +10 -0
- package/src/devices/models/common/connected-user-info.ts +5 -0
- package/src/devices/models/common/energy-expenditure.ts +6 -0
- package/src/devices/models/common/food.ts +15 -0
- package/src/devices/models/common/heart-rate-variability.ts +12 -0
- package/src/devices/models/common/heart-rate.ts +9 -0
- package/src/devices/models/common/lat-lon.ts +4 -0
- package/src/devices/models/common/macros.ts +13 -0
- package/src/devices/models/common/metadata.ts +10 -0
- package/src/devices/models/common/micros.ts +27 -0
- package/src/devices/models/common/provider-source.ts +11 -0
- package/src/devices/models/common/respiration.ts +16 -0
- package/src/devices/models/common/sample.ts +7 -0
- package/src/devices/models/common/sex.ts +1 -0
- package/src/devices/models/common/source-info.ts +8 -0
- package/src/devices/models/common/source-type.ts +4 -0
- package/src/devices/models/common/temperature.ts +13 -0
- package/src/devices/models/metriport-data.ts +5 -0
- package/src/devices/models/nutrition.ts +10 -0
- package/src/devices/models/sleep.ts +29 -0
- package/src/devices/models/user.ts +14 -0
- package/src/index.ts +60 -0
- package/src/medical/client/metriport.ts +328 -0
- package/src/medical/models/common/address.ts +20 -0
- package/src/medical/models/common/base-update.ts +11 -0
- package/src/medical/models/common/medical-data-source.ts +3 -0
- package/src/medical/models/common/us-data.ts +56 -0
- package/src/medical/models/demographics.ts +63 -0
- package/src/medical/models/document.ts +49 -0
- package/src/medical/models/facility.ts +23 -0
- package/src/medical/models/organization.ts +24 -0
- package/src/medical/models/patient.ts +18 -0
- package/src/shared.ts +25 -0
- package/tsconfig.json +24 -0
- package/tsconfig.ref.json +7 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patient.d.ts","sourceRoot":"","sources":["../../../src/medical/models/patient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAqB,CAAC;AACtD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA8C,CAAC;AAC/E,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAExB,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAE5B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.patientListSchema = exports.patientSchema = exports.patientUpdateSchema = exports.patientCreateSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const base_update_1 = require("./common/base-update");
|
|
6
|
+
const demographics_1 = require("./demographics");
|
|
7
|
+
exports.patientCreateSchema = demographics_1.demographicsSchema;
|
|
8
|
+
exports.patientUpdateSchema = exports.patientCreateSchema.merge(base_update_1.baseUpdateSchema);
|
|
9
|
+
exports.patientSchema = exports.patientUpdateSchema.extend({
|
|
10
|
+
facilityIds: zod_1.z.array(zod_1.z.string()),
|
|
11
|
+
});
|
|
12
|
+
exports.patientListSchema = zod_1.z.object({
|
|
13
|
+
patients: zod_1.z.array(exports.patientSchema),
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=patient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patient.js","sourceRoot":"","sources":["../../../src/medical/models/patient.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,sDAAwD;AACxD,iDAAoD;AAEvC,QAAA,mBAAmB,GAAG,iCAAkB,CAAC;AAGzC,QAAA,mBAAmB,GAAG,2BAAmB,CAAC,KAAK,CAAC,8BAAgB,CAAC,CAAC;AAGlE,QAAA,aAAa,GAAG,2BAAmB,CAAC,MAAM,CAAC;IACtD,WAAW,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;CACjC,CAAC,CAAC;AAGU,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IACxC,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,qBAAa,CAAC;CACjC,CAAC,CAAC"}
|
package/dist/shared.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z, ZodString } from "zod";
|
|
2
|
+
export declare const BASE_ADDRESS = "https://api.metriport.com";
|
|
3
|
+
export declare const BASE_ADDRESS_SANDBOX = "https://api.sandbox.metriport.com";
|
|
4
|
+
export declare const API_KEY_HEADER = "x-api-key";
|
|
5
|
+
export declare const DEFAULT_AXIOS_TIMEOUT_MILLIS = 20000;
|
|
6
|
+
export declare const emptyStringToUndefined: (v: string | undefined | null) => string | undefined;
|
|
7
|
+
export declare const optionalString: (zodSchema: ZodString) => z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodOptional<z.ZodString>]>, string | undefined, string | undefined>;
|
|
8
|
+
export declare function stripNonNumericChars(str: string): string;
|
|
9
|
+
export declare const ISO_DATE = "YYYY-MM-DD";
|
|
10
|
+
export declare const defaultString: z.ZodString;
|
|
11
|
+
export declare const defaultOptionalString: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodOptional<z.ZodString>]>, string | undefined, string | undefined>;
|
|
12
|
+
export declare const defaultDateString: z.ZodEffects<z.ZodString, string, string>;
|
|
13
|
+
export declare const defaultNameString: z.ZodString;
|
|
14
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAEnC,eAAO,MAAM,YAAY,8BAA8B,CAAC;AACxD,eAAO,MAAM,oBAAoB,sCAAsC,CAAC;AACxE,eAAO,MAAM,cAAc,cAAc,CAAC;AAC1C,eAAO,MAAM,4BAA4B,QAAS,CAAC;AAEnD,eAAO,MAAM,sBAAsB,MAAO,MAAM,GAAG,SAAS,GAAG,IAAI,uBACxB,CAAC;AAE5C,eAAO,MAAM,cAAc,cAAe,SAAS,gHACoB,CAAC;AAExE,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,eAAO,MAAM,QAAQ,eAAe,CAAC;AACrC,eAAO,MAAM,aAAa,aAAoB,CAAC;AAC/C,eAAO,MAAM,qBAAqB,6GAAgC,CAAC;AACnE,eAAO,MAAM,iBAAiB,2CAE5B,CAAC;AACH,eAAO,MAAM,iBAAiB,aAAuB,CAAC"}
|
package/dist/shared.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.defaultNameString = exports.defaultDateString = exports.defaultOptionalString = exports.defaultString = exports.ISO_DATE = exports.stripNonNumericChars = exports.optionalString = exports.emptyStringToUndefined = exports.DEFAULT_AXIOS_TIMEOUT_MILLIS = exports.API_KEY_HEADER = exports.BASE_ADDRESS_SANDBOX = exports.BASE_ADDRESS = void 0;
|
|
7
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
8
|
+
const zod_1 = require("zod");
|
|
9
|
+
exports.BASE_ADDRESS = "https://api.metriport.com";
|
|
10
|
+
exports.BASE_ADDRESS_SANDBOX = "https://api.sandbox.metriport.com";
|
|
11
|
+
exports.API_KEY_HEADER = "x-api-key";
|
|
12
|
+
exports.DEFAULT_AXIOS_TIMEOUT_MILLIS = 20000;
|
|
13
|
+
const emptyStringToUndefined = (v) => v == null || v.length < 1 ? undefined : v;
|
|
14
|
+
exports.emptyStringToUndefined = emptyStringToUndefined;
|
|
15
|
+
const optionalString = (zodSchema) => zodSchema.or(zod_1.z.string().optional()).transform(exports.emptyStringToUndefined);
|
|
16
|
+
exports.optionalString = optionalString;
|
|
17
|
+
function stripNonNumericChars(str) {
|
|
18
|
+
return str.trim().replace(/\D/g, "");
|
|
19
|
+
}
|
|
20
|
+
exports.stripNonNumericChars = stripNonNumericChars;
|
|
21
|
+
exports.ISO_DATE = "YYYY-MM-DD";
|
|
22
|
+
exports.defaultString = zod_1.z.string().trim();
|
|
23
|
+
exports.defaultOptionalString = (0, exports.optionalString)(exports.defaultString);
|
|
24
|
+
exports.defaultDateString = exports.defaultString.refine(v => (0, dayjs_1.default)(v, exports.ISO_DATE, true).isValid(), {
|
|
25
|
+
message: `Date must be a valid ISO 8601 date formatted ${exports.ISO_DATE}. Example: 2023-05-03`,
|
|
26
|
+
});
|
|
27
|
+
exports.defaultNameString = exports.defaultString.min(1);
|
|
28
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,6BAAmC;AAEtB,QAAA,YAAY,GAAG,2BAA2B,CAAC;AAC3C,QAAA,oBAAoB,GAAG,mCAAmC,CAAC;AAC3D,QAAA,cAAc,GAAG,WAAW,CAAC;AAC7B,QAAA,4BAA4B,GAAG,KAAM,CAAC;AAE5C,MAAM,sBAAsB,GAAG,CAAC,CAA4B,EAAE,EAAE,CACrE,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAD/B,QAAA,sBAAsB,0BACS;AAErC,MAAM,cAAc,GAAG,CAAC,SAAoB,EAAE,EAAE,CACrD,SAAS,CAAC,EAAE,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,SAAS,CAAC,8BAAsB,CAAC,CAAC;AAD3D,QAAA,cAAc,kBAC6C;AAExE,SAAgB,oBAAoB,CAAC,GAAW;IAC9C,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACvC,CAAC;AAFD,oDAEC;AAEY,QAAA,QAAQ,GAAG,YAAY,CAAC;AACxB,QAAA,aAAa,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;AAClC,QAAA,qBAAqB,GAAG,IAAA,sBAAc,EAAC,qBAAa,CAAC,CAAC;AACtD,QAAA,iBAAiB,GAAG,qBAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,IAAA,eAAK,EAAC,CAAC,EAAE,gBAAQ,EAAE,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;IAC7F,OAAO,EAAE,gDAAgD,gBAAQ,uBAAuB;CACzF,CAAC,CAAC;AACU,QAAA,iBAAiB,GAAG,qBAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@metriport/api-sdk",
|
|
3
|
+
"version": "6.0.1-alpha.1",
|
|
4
|
+
"description": "Metriport helps you access and manage health and medical data, through a single open source API.",
|
|
5
|
+
"author": "Metriport Inc. <contact@metriport.com>",
|
|
6
|
+
"homepage": "https://metriport.com/",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"exports": {
|
|
14
|
+
".": "./dist/index.js",
|
|
15
|
+
"./devices/*": "./dist/devices/*.js",
|
|
16
|
+
"./medical/*": "./dist/medical/*.js"
|
|
17
|
+
},
|
|
18
|
+
"typesVersions": {
|
|
19
|
+
"*": {
|
|
20
|
+
"/": [
|
|
21
|
+
"dist/index.d.ts"
|
|
22
|
+
],
|
|
23
|
+
"devices/*": [
|
|
24
|
+
"dist/devices/*"
|
|
25
|
+
],
|
|
26
|
+
"medical/*": [
|
|
27
|
+
"dist/medical/*"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"clean": "rimraf dist && rimraf node_modules",
|
|
33
|
+
"tsc": "tsc",
|
|
34
|
+
"build": "tsc -p .",
|
|
35
|
+
"build:cloud": "npm run build",
|
|
36
|
+
"typecheck": "tsc --noEmit",
|
|
37
|
+
"lint": "npx eslint . --ext .ts",
|
|
38
|
+
"lint-fix": "npm run lint --fix",
|
|
39
|
+
"prettier-fix": "npx prettier '**/*.ts' --write",
|
|
40
|
+
"test": "echo \"No test specified yet\""
|
|
41
|
+
},
|
|
42
|
+
"repository": {
|
|
43
|
+
"url": "https://github.com/metriport/metriport.git",
|
|
44
|
+
"type": "git",
|
|
45
|
+
"directory": "packages/api-sdk"
|
|
46
|
+
},
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/metriport/metriport/issues"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@metriport/commonwell-sdk": "^4.4.1-alpha.1",
|
|
52
|
+
"axios": "^1.3.4",
|
|
53
|
+
"dayjs": "^1.11.7",
|
|
54
|
+
"zod": "^3.20.2"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@tsconfig/recommended": "^1.0.2",
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^5.48.2",
|
|
59
|
+
"@typescript-eslint/parser": "^5.48.2",
|
|
60
|
+
"eslint": "^8.32.0",
|
|
61
|
+
"eslint-config-prettier": "^8.6.0",
|
|
62
|
+
"prettier": "^2.8.3",
|
|
63
|
+
"ts-essentials": "^9.3.1",
|
|
64
|
+
"typescript": "^4.9.5"
|
|
65
|
+
},
|
|
66
|
+
"gitHead": "c77eacae50fdd3fcf56adb64af186ba914b0ff48"
|
|
67
|
+
}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import axios, { AxiosInstance } from "axios";
|
|
2
|
+
import {
|
|
3
|
+
API_KEY_HEADER,
|
|
4
|
+
BASE_ADDRESS,
|
|
5
|
+
BASE_ADDRESS_SANDBOX,
|
|
6
|
+
DEFAULT_AXIOS_TIMEOUT_MILLIS,
|
|
7
|
+
} from "../../shared";
|
|
8
|
+
import { Activity } from "../models/activity";
|
|
9
|
+
import { Biometrics } from "../models/biometrics";
|
|
10
|
+
import { Body } from "../models/body";
|
|
11
|
+
import { ProviderSource } from "../models/common/provider-source";
|
|
12
|
+
import { Nutrition } from "../models/nutrition";
|
|
13
|
+
import { Sleep } from "../models/sleep";
|
|
14
|
+
import { User } from "../models/user";
|
|
15
|
+
import { GetConnectTokenResponse } from "./models/get-connect-token-response";
|
|
16
|
+
import { GetMetriportUserIDResponse } from "./models/get-metriport-user-id-response";
|
|
17
|
+
import { SettingsResponse } from "./models/settings-response";
|
|
18
|
+
import { WebhookStatusResponse } from "./models/webhook-status-response";
|
|
19
|
+
import { GetConnectedUsersResponse } from "./models/get-connected-users-response";
|
|
20
|
+
import { ConnectedUserInfo } from "../models/common/connected-user-info";
|
|
21
|
+
import { dateIsValid } from "./util/date-util";
|
|
22
|
+
|
|
23
|
+
export type Options = {
|
|
24
|
+
sandbox?: boolean;
|
|
25
|
+
timeout?: number;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export class MetriportDevicesApi {
|
|
29
|
+
private api: AxiosInstance;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Creates a new instance of the Metriport Devices API client.
|
|
33
|
+
*
|
|
34
|
+
* @param apiKey - Your Metriport API key.
|
|
35
|
+
* @param options - Optional parameters
|
|
36
|
+
* @param options.sandbox - Indicates whether to connect to the sandbox, default false.
|
|
37
|
+
* @param options.timeout - Connection timeout in milliseconds, default 20 seconds.
|
|
38
|
+
*/
|
|
39
|
+
constructor(apiKey: string, options: Options = {}) {
|
|
40
|
+
const { sandbox, timeout } = options;
|
|
41
|
+
const baseURL = sandbox ? BASE_ADDRESS_SANDBOX : BASE_ADDRESS;
|
|
42
|
+
this.api = axios.create({
|
|
43
|
+
timeout: timeout ?? DEFAULT_AXIOS_TIMEOUT_MILLIS,
|
|
44
|
+
baseURL,
|
|
45
|
+
headers: { [API_KEY_HEADER]: apiKey },
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* For your given user ID, returns the Metriport user ID used for identifying
|
|
51
|
+
* the user and making subsequent calls for the user's data.
|
|
52
|
+
*
|
|
53
|
+
* @param {string} appUserId - The unique ID for the user in your app.
|
|
54
|
+
* @returns The userId of the user.
|
|
55
|
+
*/
|
|
56
|
+
async getMetriportUserId(appUserId: string): Promise<string> {
|
|
57
|
+
const resp = await this.api.post<GetMetriportUserIDResponse>("/user", null, {
|
|
58
|
+
params: { appUserId: appUserId },
|
|
59
|
+
});
|
|
60
|
+
return resp.data.userId;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* For your given user ID, returns the user's connected providers
|
|
65
|
+
*
|
|
66
|
+
* @param {string} userId - The unique ID for the user in your app.
|
|
67
|
+
* @returns Object containing array of connected providers.
|
|
68
|
+
*/
|
|
69
|
+
async getConnectedProviders(userId: string): Promise<{ connectedProviders: string[] }> {
|
|
70
|
+
const resp = await this.api.get<{ connectedProviders: string[] }>(
|
|
71
|
+
`/user/${userId}/connected-providers`
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
return resp.data;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Returns all your users and their connected providers.
|
|
79
|
+
*
|
|
80
|
+
* @returns List of connected users, containing their ids and providers.
|
|
81
|
+
*/
|
|
82
|
+
async getConnectedUsers(): Promise<{ connectedUsers: ConnectedUserInfo[] }> {
|
|
83
|
+
const resp = await this.api.get<GetConnectedUsersResponse>("/user");
|
|
84
|
+
return resp.data;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* For the given user ID, get a token to be used for a Metriport Connect session.
|
|
89
|
+
*
|
|
90
|
+
* @param {string} userId - The user ID of the user that will be using the Connect widget.
|
|
91
|
+
* @returns The Metriport Connect session token.
|
|
92
|
+
*/
|
|
93
|
+
async getConnectToken(userId: string): Promise<string> {
|
|
94
|
+
const resp = await this.api.get<GetConnectTokenResponse>("/user/connect/token", {
|
|
95
|
+
params: { userId: userId },
|
|
96
|
+
});
|
|
97
|
+
return resp.data.token;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* For the given user ID, revokes the user's access to the specified provider.
|
|
102
|
+
*
|
|
103
|
+
* @param {string} userId - The user ID of the user for which to revoke access.
|
|
104
|
+
* @param {ProviderSource} provider - The data provider to revoke access to.
|
|
105
|
+
* @returns void.
|
|
106
|
+
*/
|
|
107
|
+
async revokeUserAccessToProvider(userId: string, provider: ProviderSource): Promise<void> {
|
|
108
|
+
await this.api.delete(`/user/${userId}/revoke`, {
|
|
109
|
+
params: { provider: provider.toString() },
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* For the given user ID, revokes access tokens for all providers and deletes the user.
|
|
115
|
+
*
|
|
116
|
+
* @param {string} userId - The user ID of the user to be deleted.
|
|
117
|
+
* @returns void.
|
|
118
|
+
*/
|
|
119
|
+
async deleteUser(userId: string): Promise<void> {
|
|
120
|
+
await this.api.delete(`/user/${userId}`);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Gets the activity info for the specified user ID and date.
|
|
125
|
+
*
|
|
126
|
+
* @param {string} userId - The userId of the user you want to get data for.
|
|
127
|
+
* @param {string} date - The date you want to get the data for (YYYY-MM-DD).
|
|
128
|
+
* @returns An array of activity data from each connected provider.
|
|
129
|
+
*/
|
|
130
|
+
async getActivityData(userId: string, date: string): Promise<Activity[]> {
|
|
131
|
+
const resp = await this.api.get<Activity[]>("/activity", {
|
|
132
|
+
params: this.validateAndBuildParams(userId, date),
|
|
133
|
+
});
|
|
134
|
+
return resp.data;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Gets the body data for the specified user ID and date.
|
|
139
|
+
*
|
|
140
|
+
* @param {string} userId - The userId of the user you want to get data for.
|
|
141
|
+
* @param {string} date - The date you want to get the data for (YYYY-MM-DD).
|
|
142
|
+
* @returns An array of body data from each connected provider.
|
|
143
|
+
*/
|
|
144
|
+
async getBodyData(userId: string, date: string): Promise<Body[]> {
|
|
145
|
+
const resp = await this.api.get<Body[]>("/body", {
|
|
146
|
+
params: this.validateAndBuildParams(userId, date),
|
|
147
|
+
});
|
|
148
|
+
return resp.data;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Gets the biometrics data for the specified user ID and date.
|
|
153
|
+
*
|
|
154
|
+
* @param {string} userId - The userId of the user you want to get data for.
|
|
155
|
+
* @param {string} date - The date you want to get the data for (YYYY-MM-DD).
|
|
156
|
+
* @returns An array of biometrics data from each connected provider.
|
|
157
|
+
*/
|
|
158
|
+
async getBiometricsData(userId: string, date: string): Promise<Biometrics[]> {
|
|
159
|
+
const resp = await this.api.get<Biometrics[]>("/biometrics", {
|
|
160
|
+
params: this.validateAndBuildParams(userId, date),
|
|
161
|
+
});
|
|
162
|
+
return resp.data;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Gets the nutrition data for the specified user ID and date.
|
|
167
|
+
*
|
|
168
|
+
* @param {string} userId - The userId of the user you want to get data for.
|
|
169
|
+
* @param {string} date - The date you want to get the data for (YYYY-MM-DD).
|
|
170
|
+
* @returns An array of nutrition data from each connected provider.
|
|
171
|
+
*/
|
|
172
|
+
async getNutritionData(userId: string, date: string): Promise<Nutrition[]> {
|
|
173
|
+
const resp = await this.api.get<Nutrition[]>("/nutrition", {
|
|
174
|
+
params: this.validateAndBuildParams(userId, date),
|
|
175
|
+
});
|
|
176
|
+
return resp.data;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Gets the sleep data for the specified user ID and date.
|
|
181
|
+
*
|
|
182
|
+
* @param {string} userId - The userId of the user you want to get data for.
|
|
183
|
+
* @param {string} date - The date you want to get the data for (YYYY-MM-DD).
|
|
184
|
+
* @returns An array of sleep data from each connected provider.
|
|
185
|
+
*/
|
|
186
|
+
async getSleepData(userId: string, date: string): Promise<Sleep[]> {
|
|
187
|
+
const resp = await this.api.get<Sleep[]>("/sleep", {
|
|
188
|
+
params: this.validateAndBuildParams(userId, date),
|
|
189
|
+
});
|
|
190
|
+
return resp.data;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Gets the user info for the specified user ID and date.
|
|
195
|
+
*
|
|
196
|
+
* @param {string} userId - The userId of the user you want to get data for.
|
|
197
|
+
* @param {string} date - The date you want to get the data for (YYYY-MM-DD).
|
|
198
|
+
* @returns An array of user data from each connected provider.
|
|
199
|
+
*/
|
|
200
|
+
async getUserData(userId: string, date: string): Promise<User[]> {
|
|
201
|
+
const resp = await this.api.get<User[]>("/user", {
|
|
202
|
+
params: this.validateAndBuildParams(userId, date),
|
|
203
|
+
});
|
|
204
|
+
return resp.data;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* If the userId is empty or the date is not in the correct format, throw an error. Otherwise, return
|
|
209
|
+
* an object with the userId and date.
|
|
210
|
+
*
|
|
211
|
+
* @param {string} userId - The userId of the user you want to get the data for.
|
|
212
|
+
* @param {string} date - The date to get the user's schedule for.
|
|
213
|
+
* @returns an object with the userId and date properties.
|
|
214
|
+
*/
|
|
215
|
+
private validateAndBuildParams(userId: string, date: string) {
|
|
216
|
+
if (userId.trim().length < 1) throw Error(`userId must not be empty!`);
|
|
217
|
+
if (!dateIsValid(date)) throw Error(`date must be in format YYYY-MM-DD!`);
|
|
218
|
+
return { userId, date };
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Gets the settings for your account.
|
|
223
|
+
*
|
|
224
|
+
* @returns Your account settings.
|
|
225
|
+
*/
|
|
226
|
+
async getSettings(): Promise<SettingsResponse> {
|
|
227
|
+
const resp = await this.api.get<SettingsResponse>("/settings");
|
|
228
|
+
return resp.data;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Update the settings for your account.
|
|
233
|
+
*
|
|
234
|
+
* @returns Your updated account settings.
|
|
235
|
+
*/
|
|
236
|
+
async updateSettings(webhookUrl: string): Promise<SettingsResponse> {
|
|
237
|
+
const resp = await this.api.post<SettingsResponse>("/settings", {
|
|
238
|
+
webhookUrl,
|
|
239
|
+
});
|
|
240
|
+
return resp.data;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Gets the status of communication with your app's webhook.
|
|
245
|
+
*
|
|
246
|
+
* @returns The status of communication with your app's webhook.
|
|
247
|
+
*/
|
|
248
|
+
async getWebhookStatus(): Promise<WebhookStatusResponse> {
|
|
249
|
+
const resp = await this.api.get<WebhookStatusResponse>("/settings/webhook");
|
|
250
|
+
return resp.data;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Retries failed webhook requests.
|
|
255
|
+
*
|
|
256
|
+
* @returns void
|
|
257
|
+
*/
|
|
258
|
+
async retryWebhookRequests(): Promise<void> {
|
|
259
|
+
await this.api.post("/settings/webhook/retry");
|
|
260
|
+
}
|
|
261
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function dateIsValid(dateStr: string): boolean {
|
|
2
|
+
const regex = /^\d{4}-\d{2}-\d{2}$/;
|
|
3
|
+
|
|
4
|
+
if (dateStr.match(regex) === null) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const date = new Date(dateStr);
|
|
9
|
+
|
|
10
|
+
const timestamp = date.getTime();
|
|
11
|
+
|
|
12
|
+
if (typeof timestamp !== "number" || Number.isNaN(timestamp)) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return date.toISOString().startsWith(dateStr);
|
|
17
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ActivityDurations } from "./common/activity-durations";
|
|
2
|
+
import { ActivityLog } from "./common/activity-log";
|
|
3
|
+
import { ActivityMovement } from "./common/activity-movement";
|
|
4
|
+
import { EnergyExpenditure } from "./common/energy-expenditure";
|
|
5
|
+
import { HeartRate } from "./common/heart-rate";
|
|
6
|
+
import { HeartRateVariability } from "./common/heart-rate-variability";
|
|
7
|
+
import { Respiration } from "./common/respiration";
|
|
8
|
+
import { MetriportData } from "./metriport-data";
|
|
9
|
+
|
|
10
|
+
export interface Activity extends MetriportData {
|
|
11
|
+
summary?: {
|
|
12
|
+
durations?: ActivityDurations;
|
|
13
|
+
energy_expenditure?: EnergyExpenditure;
|
|
14
|
+
movement?: ActivityMovement;
|
|
15
|
+
biometrics?: {
|
|
16
|
+
heart_rate?: HeartRate;
|
|
17
|
+
hrv?: HeartRateVariability;
|
|
18
|
+
respiration?: Respiration;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
activity_logs?: ActivityLog[];
|
|
22
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BloodGlucose } from "./common/blood-glucose";
|
|
2
|
+
import { BloodPressure } from "./common/blood-pressure";
|
|
3
|
+
import { HeartRate } from "./common/heart-rate";
|
|
4
|
+
import { HeartRateVariability } from "./common/heart-rate-variability";
|
|
5
|
+
import { Respiration } from "./common/respiration";
|
|
6
|
+
import { Temperature } from "./common/temperature";
|
|
7
|
+
import { MetriportData } from "./metriport-data";
|
|
8
|
+
|
|
9
|
+
export interface Biometrics extends MetriportData {
|
|
10
|
+
blood_glucose?: BloodGlucose;
|
|
11
|
+
blood_pressure?: BloodPressure;
|
|
12
|
+
heart_rate?: HeartRate;
|
|
13
|
+
hrv?: HeartRateVariability;
|
|
14
|
+
respiration?: Respiration;
|
|
15
|
+
temperature?: Temperature;
|
|
16
|
+
// todo: ecg?
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MetriportData } from "./metriport-data";
|
|
2
|
+
import { Sample } from "./common/sample";
|
|
3
|
+
export interface Body extends MetriportData {
|
|
4
|
+
body_fat_pct?: number;
|
|
5
|
+
height_cm?: number;
|
|
6
|
+
weight_kg?: number;
|
|
7
|
+
bone_mass_kg?: number;
|
|
8
|
+
muscle_mass_kg?: number;
|
|
9
|
+
lean_mass_kg?: number;
|
|
10
|
+
max_possible_heart_rate_bpm?: number;
|
|
11
|
+
weight_samples_kg?: Sample[];
|
|
12
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface ActivityDurations {
|
|
2
|
+
active_seconds?: number;
|
|
3
|
+
// also referred to as metabolic-equivalent minutes
|
|
4
|
+
intensity?: {
|
|
5
|
+
rest_seconds?: number;
|
|
6
|
+
very_low_seconds?: number;
|
|
7
|
+
low_seconds?: number;
|
|
8
|
+
med_seconds?: number;
|
|
9
|
+
high_seconds?: number;
|
|
10
|
+
};
|
|
11
|
+
// also referred to as stress
|
|
12
|
+
strain?: {
|
|
13
|
+
rest_seconds?: number;
|
|
14
|
+
very_low_seconds?: number;
|
|
15
|
+
low_seconds?: number;
|
|
16
|
+
med_seconds?: number;
|
|
17
|
+
high_seconds?: number;
|
|
18
|
+
very_high_seconds?: number;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ActivityDurations } from "./activity-durations";
|
|
2
|
+
import { ActivityMovement } from "./activity-movement";
|
|
3
|
+
import { EnergyExpenditure } from "./energy-expenditure";
|
|
4
|
+
import { HeartRate } from "./heart-rate";
|
|
5
|
+
import { HeartRateVariability } from "./heart-rate-variability";
|
|
6
|
+
import { LatLon } from "./lat-lon";
|
|
7
|
+
import { Metadata } from "./metadata";
|
|
8
|
+
import { Respiration } from "./respiration";
|
|
9
|
+
|
|
10
|
+
export interface ActivityLog {
|
|
11
|
+
metadata: Metadata;
|
|
12
|
+
name?: string;
|
|
13
|
+
type?: string;
|
|
14
|
+
start_time?: string;
|
|
15
|
+
end_time?: string;
|
|
16
|
+
durations?: ActivityDurations;
|
|
17
|
+
energy_expenditure?: EnergyExpenditure;
|
|
18
|
+
movement?: ActivityMovement;
|
|
19
|
+
location?: {
|
|
20
|
+
start_lat_lon_deg?: LatLon;
|
|
21
|
+
end_lat_lon_deg?: LatLon;
|
|
22
|
+
polystring?: string;
|
|
23
|
+
city?: string;
|
|
24
|
+
country?: string;
|
|
25
|
+
region?: string; // can be state, province, etc.
|
|
26
|
+
};
|
|
27
|
+
biometrics?: {
|
|
28
|
+
heart_rate?: HeartRate;
|
|
29
|
+
hrv?: HeartRateVariability;
|
|
30
|
+
respiration?: Respiration;
|
|
31
|
+
};
|
|
32
|
+
// todo: laps + more time samples thoughout the models?
|
|
33
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface ActivityMovement {
|
|
2
|
+
steps_count?: number;
|
|
3
|
+
floors_count?: number;
|
|
4
|
+
elevation?: {
|
|
5
|
+
gain_meters?: number;
|
|
6
|
+
min_meters?: number;
|
|
7
|
+
max_meters?: number;
|
|
8
|
+
};
|
|
9
|
+
speed?: {
|
|
10
|
+
max_km_h?: number;
|
|
11
|
+
avg_km_h?: number;
|
|
12
|
+
};
|
|
13
|
+
avg_cadence?: number;
|
|
14
|
+
distance_meters?: number;
|
|
15
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface Aminos {
|
|
2
|
+
alanine_g?: number;
|
|
3
|
+
arginine_g?: number;
|
|
4
|
+
asparagine_g?: number;
|
|
5
|
+
aspartic_acid_g?: number;
|
|
6
|
+
cysteine_g?: number;
|
|
7
|
+
glutamine_g?: number;
|
|
8
|
+
glutamic_acid_g?: number;
|
|
9
|
+
glycine_g?: number;
|
|
10
|
+
histidine_g?: number;
|
|
11
|
+
isoleucine_g?: number;
|
|
12
|
+
leucine_g?: number;
|
|
13
|
+
lysine_g?: number;
|
|
14
|
+
methionine_g?: number;
|
|
15
|
+
phenylalanine_g?: number;
|
|
16
|
+
proline_g?: number;
|
|
17
|
+
serine_g?: number;
|
|
18
|
+
threonine_g?: number;
|
|
19
|
+
tryptophan_g?: number;
|
|
20
|
+
tyrosine_g?: number;
|
|
21
|
+
valine_g?: number;
|
|
22
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Aminos } from "./aminos";
|
|
2
|
+
import { Macros } from "./macros";
|
|
3
|
+
import { Micros } from "./micros";
|
|
4
|
+
|
|
5
|
+
export interface Food {
|
|
6
|
+
name?: string;
|
|
7
|
+
brand?: string;
|
|
8
|
+
amount?: number;
|
|
9
|
+
unit?: string;
|
|
10
|
+
nutrition_facts?: {
|
|
11
|
+
macros?: Macros;
|
|
12
|
+
micros?: Micros;
|
|
13
|
+
aminos?: Aminos;
|
|
14
|
+
};
|
|
15
|
+
}
|