@careevolution/mydatahelps-js
Version:
MyDataHelps client to be used by external applications for integrations inside the MyDataHelps platform
708 lines (707 loc) • 18.7 kB
TypeScript
export type SurveyTaskStatus = "incomplete" | "closed" | "complete";
export type SortOrder = "descending" | "ascending";
export type EventName = "applicationDidBecomeVisible" | "surveyDidFinish" | "externalAccountSyncComplete" | "tokenWillExpire" | "healthConnectSyncComplete" | "healthConnectPhrSyncComplete";
export type DeviceDataNamespace = "Project" | "Fitbit" | "AppleHealth" | "GoogleFit" | "AirNowApi" | "WeatherBit" | "Garmin" | "Omron";
export type DeviceDataV2Namespace = "Fitbit" | "AppleHealth" | "Garmin" | "Dexcom" | "HealthConnect" | "Oura";
export type DeviceDataV2AggregateIntervalType = "Minutes" | "Hours" | "Days" | "Weeks" | "Months";
export type ExternalAccountStatus = "unauthorized" | "fetchComplete" | "error" | "fetchingData";
export type NotificationType = "Sms" | "Push" | "Email";
export type NotificationStatusCode = "Succeeded" | "Unsubscribed" | "MissingContactInfo" | "NoRegisteredMobileDevice" | "NoAssociatedUser" | "ServiceError";
export type StatusBarStyle = "lightContent" | "darkContent" | "default";
export type InboxItemType = 'message' | 'survey' | 'resource';
export type InboxItemStatus = 'incomplete' | 'closed' | 'complete';
export type InboxItemSortColumn = 'insertedDate' | 'dueDate' | 'endDate';
export type InboxItemUpdate = 'markRead';
export type InboxItemUpdateStatus = 'success' | 'noChange' | 'error';
export type SurveyMode = "Design" | "Preview" | "Survey";
export type ScheduleIntervalType = "days" | "weeks" | "months" | "years";
export interface Guid extends String {
}
export interface StringMap {
[key: string]: string;
}
export interface QueryParameters {
limit?: number;
pageID?: any;
}
export interface ExternalAccount {
id: number;
provider: ExternalAccountProvider;
status: ExternalAccountStatus;
lastRefreshDate: string;
}
export interface ExternalAccountProvider {
id: number;
name: string;
category: string;
logoUrl: string;
enabled: boolean;
message?: string;
relatedProvider?: string;
managingOrganization?: string;
successorID?: number;
}
export interface ExternalAccountProvidersPage {
externalAccountProviders: ExternalAccountProvider[];
totalExternalAccountProviders: number;
}
export interface ProjectInfo {
id: Guid;
name: string;
description: string;
code: string;
type: string;
organization: {
id: Guid;
name: string;
description: string;
logoUrl: string;
color: string;
};
supportEmail: string;
supportPhone: string;
learnMoreLink: string;
learnMoreTitle: string;
platforms: string[];
}
export interface DeviceInfo {
identifier: Guid;
platform: string;
properties: {
[key: string]: string;
};
}
export interface StepConfiguration {
styles: {
[key: string]: any;
};
properties: {
[key: string]: any;
};
}
export interface SurveyContext {
surveyMode: SurveyMode;
}
export interface CurrentSurveyAnswer {
date: string;
stepIdentifier: string;
resultIdentifier: string;
answers: string[];
}
export interface CurrentSurveyConsentAnswer extends CurrentSurveyAnswer {
familyName: string;
givenName: string;
consented: boolean;
}
export interface ParticipantInfo {
participantID: Guid;
participantIdentifier: string;
secondaryIdentifier: string;
linkIdentifier: string;
demographics: ParticipantDemographics;
customFields: {
[key: string]: string;
};
enrollmentDate: string;
projectID: string;
}
export interface ParticipantDemographics extends Record<string, string> {
email: string;
mobilePhone: string;
firstName: string;
middleName: string;
lastName: string;
dateOfBirth: string;
gender: string;
preferredLanguage: string;
street1: string;
street2: string;
city: string;
state: string;
postalCode: string;
utcOffset: string;
unsubscribedFromEmails: string;
timeZone: string;
unsubscribedFromSms: string;
}
export interface NotificationQueryParameters extends QueryParameters {
sentBefore?: string;
sentAfter?: string;
identifier?: string;
type?: NotificationType;
statusCode?: NotificationStatusCode;
}
export interface NotificationsPage {
notifications: Notification[];
nextPageID?: Guid;
}
export interface NotificationUser {
email?: string;
name?: string;
}
export interface Notification {
id: Guid;
identifier: string;
participantID: Guid;
participantIdentifier?: string;
contentVersion?: number;
sentDate: string;
statusCode: NotificationStatusCode;
statusDetail?: string;
type: NotificationType;
recipients: string[];
content?: {
body?: string;
title?: string;
subject?: string;
};
sourceUser?: NotificationUser;
schedule?: ScheduleMetadata;
}
export interface SurveyTaskQueryParameters extends QueryParameters {
status?: SurveyTaskStatus | SurveyTaskStatus[];
surveyID?: Guid;
surveyName?: string | string[];
surveyCategory?: string;
linkIdentifier?: string;
sortOrder?: SortOrder;
event?: string | string[];
}
export interface SurveyTasksPage {
surveyTasks: SurveyTask[];
nextPageID?: Guid;
}
export interface SurveyTask {
id: Guid;
participantID: Guid;
participantIdentifier: string;
linkIdentifier: string;
surveyID: Guid;
surveyName: string;
surveyCategory?: string;
surveyDisplayName?: string;
surveyDescription?: string;
startDate?: string;
endDate?: string;
status: SurveyTaskStatus;
hasSavedProgress: boolean;
dueDate?: string;
insertedDate: string;
modifiedDate: string;
schedule?: ScheduleMetadata;
event?: string;
}
export interface ScheduleMetadata {
id: Guid;
name: string;
category?: string;
interval?: number;
intervalType?: ScheduleIntervalType;
}
export interface InboxItem {
type: InboxItemType;
id: Guid;
categories: string[];
insertedDate: string;
endDate?: string;
status: InboxItemStatus;
isNew: boolean;
}
export interface InboxMessageResource {
title: string;
subTitle?: string;
url: string;
imageUrl?: string;
}
export interface InboxMessage extends InboxItem {
title: string;
content: string;
relatedResources: InboxMessageResource[];
}
export interface InboxSurvey extends InboxItem {
dueDate?: string;
title?: string;
name: string;
displayName?: string;
description?: string;
hasRestorationData: boolean;
}
export interface InboxResource extends InboxItem {
title: string;
subTitle?: string;
url: string;
imageUrl?: string;
}
export interface InboxItemUpdateResult {
update: InboxItemUpdate;
status: InboxItemUpdateStatus;
message?: string;
}
export interface InboxItemQueryParameters extends QueryParameters {
type?: InboxItemType | InboxItemType[];
status?: InboxItemStatus | InboxItemStatus[];
category?: string;
sortOrder?: SortOrder;
sortColumn?: InboxItemSortColumn;
endsAfter?: string;
endsBefore?: string;
}
export interface InboxItemsPage {
items: InboxItem[];
nextPageID?: Guid;
}
export interface CustomEventInfo {
eventType: string;
properties: {
[key: string]: any;
};
}
export interface DeviceDataPointsPage {
deviceDataPoints: DeviceDataPoint[];
nextPageID?: Guid;
}
export interface PersistableDeviceDataPoint {
identifier?: string;
type: string;
value: string;
participantID?: Guid;
participantIdentifier?: string;
units?: string;
properties?: {
[key: string]: any;
};
source?: {
identifier: string;
properties?: {
[key: string]: any;
};
};
startDate?: string;
observationDate?: string;
}
export interface DeviceDataPoint extends PersistableDeviceDataPoint {
id: Guid;
namespace: DeviceDataNamespace;
deviceDataContextID?: string;
insertedDate: string;
modifiedDate: string;
}
export interface DeviceDataPointQuery extends QueryParameters {
namespace: DeviceDataNamespace;
type?: string | string[];
observedBefore?: string;
observedAfter?: string;
modifiedBefore?: string;
modifiedAfter?: string;
}
export interface SupportedDeviceDataType {
namespace: DeviceDataNamespace;
type: string;
enabled: boolean;
}
export interface DeviceDataV2Query extends QueryParameters {
namespace: DeviceDataV2Namespace;
/**
* @deprecated Use pageID instead
*/
anchor?: string;
type: string;
observedBefore?: string;
observedAfter?: string;
modifiedBefore?: string;
modifiedAfter?: string;
insertedBefore?: string;
insertedAfter?: string;
dataSource?: {
[key: string]: string;
};
properties?: {
[key: string]: string;
};
}
export interface DeviceDataV2Page {
deviceDataPoints: DeviceDataV2Point[];
/**
* @deprecated Use nextPageID instead
*/
anchor?: string;
nextPageID?: string;
}
export interface DeviceDataV2Point {
id: Guid;
participantID: Guid;
participantIdentifier: string;
namespace: DeviceDataV2Namespace;
type: string;
identifier: string;
value: string;
units: string;
startDate?: string;
startDateOffset: string;
observationDate: string;
observationDateOffset: string;
insertedDate: string;
modifiedDate: string;
properties?: {
[key: string]: any;
};
dataSource?: {
[key: string]: any;
};
}
export interface DeviceDataV2AggregateQuery extends DeviceDataV2Query {
intervalAmount: number;
intervalType: DeviceDataV2AggregateIntervalType;
aggregateFunctions: string | string[];
}
export interface DeviceDataV2AggregatePage {
intervals: DeviceDataV2Aggregate[];
/**
* @deprecated Use nextPageID instead
*/
anchor?: string;
nextPageID?: string;
}
export interface DeviceDataV2Aggregate {
participantID: Guid;
participantIdentifier: string;
namespace: DeviceDataV2Namespace;
type: string;
date: string;
statistics: {
[key: string]: number;
};
}
export interface DeviceDataV2DailySleepPage {
sleepStageSummaries: DeviceDataV2DailySleep[];
nextPageID?: string;
}
export interface DeviceDataV2DailySleep {
participantID: Guid;
participantIdentifier: string;
namespace: DeviceDataV2Namespace;
type: string;
date: string;
value: string;
duration: string;
}
export interface SupportedDeviceDataV2DataType {
namespace: DeviceDataV2Namespace;
type: string;
enabled: boolean;
retentionDays?: number;
}
export interface SurveyAnswersQuery extends QueryParameters {
surveyResultID?: string;
surveyID?: string;
surveyName?: string | string[];
after?: string;
before?: string;
stepIdentifier?: string | string[];
resultIdentifier?: string | string[];
answer?: string | string[];
insertedAfter?: string;
insertedBefore?: string;
event?: string | string[];
}
export interface SurveyAnswersPage {
surveyAnswers: SurveyAnswer[];
nextPageID?: Guid;
}
export interface SurveyAnswer {
id: Guid;
participantID: Guid;
participantIdentifier?: string;
surveyResultID: Guid;
surveyID: Guid;
surveyVersion: number;
taskID?: Guid;
surveyName: string;
surveyDisplayName: string;
date: string;
stepIdentifier: string;
resultIdentifier: string;
answers: string[];
insertedDate: string;
schedule?: ScheduleMetadata;
type: string;
event?: string;
}
export interface SurveyResultsQuery extends QueryParameters {
surveyID?: string;
surveyName?: string | string[];
after?: string;
before?: string;
insertedAfter?: string;
insertedBefore?: string;
event?: string | string[];
}
export interface SurveyResultsPage {
surveyResults: SurveyResult[];
nextPageID?: Guid;
}
export interface SurveyResult {
id: Guid;
participantID: Guid;
participantIdentifier?: string;
taskID?: Guid;
surveyID: Guid;
surveyVersion: number;
surveyName: string;
surveyDisplayName: string;
date: string;
insertedDate: string;
schedule?: ScheduleMetadata;
event?: string;
userType: string;
}
export interface FitbitQuery {
providerID?: number;
pageID?: Guid;
pageSize?: number;
startDate?: string;
endDate?: string;
}
export interface FitbitDailySummariesPage {
results: FitbitDailySummary[];
nextPageID?: Guid;
}
export interface FitbitDailySummary {
date: string;
activityCalories: number;
bodyBMI: number;
bodyFat: number;
bodyWeight: number;
calories: number;
caloriesBMR: number;
distance: number;
elevation: number;
foodCaloriesIn: number;
floors: number;
heartRateZones: FitbitHeartRateZones;
minutesFairlyActive: number;
minutesLightlyActive: number;
minutesSedentary: number;
minutesVeryActive: number;
steps: number;
tracker: FitbitTracker;
water: number;
modifiedDate: string;
restingHeartRate: number;
}
export interface FitbitHeartRateZones {
fatBurn: FitbitHeartRateZone;
cardio: FitbitHeartRateZone;
peak: FitbitHeartRateZone;
outOfRange: FitbitHeartRateZone;
}
export interface FitbitHeartRateZone {
caloriesOut: number;
min: number;
max: number;
minutes: number;
}
export interface FitbitTracker {
activityCalories: number;
calories: number;
distance: number;
elevation: number;
floors: number;
minutesFairlyActive: number;
minutesLightlyActive: number;
minutesSedentary: number;
minutesVeryActive: number;
steps: number;
}
export interface FitbitSleepLogsPage {
results: FitbitSleepLogs[];
nextPageID?: Guid;
}
export interface FitbitSleepLogs {
startTimestamp: string;
endTimestamp: string;
duration: number;
efficiency: number;
timeInBed: number;
infoCode: string;
type: string;
minutesAfterWakeup: number;
minutesAsleep: number;
minutesAwake: number;
minutesToFallAsleep: number;
sleepLevelAwake: number;
sleepLevelAsleep: number;
sleepLevelRestless: number;
sleepLevelDeep: number;
sleepLevelLight: number;
sleepLevelRem: number;
sleepLevelWake: number;
}
export interface AppleHealthQuery {
pageID?: Guid;
pageSize?: number;
startDate?: string;
endDate?: string;
}
export interface AppleHealthPage {
nextPageID?: Guid;
totalResults: number;
}
export interface AppleHealthActivitySummaryPage extends AppleHealthPage {
results: AppleHealthActivitySummary[];
}
export interface AppleHealthWorkoutPage extends AppleHealthPage {
results: AppleHealthWorkout[];
}
export interface AppleHealthActivitySummary {
id: Guid;
activeEnergyBurned: number;
activeEnergyBurnedGoal: number;
appleExerciseTime: number;
appleExerciseTimeGoal: number;
appleStandHours: number;
appleStandHoursGoal: number;
startDate: string;
endDate: string;
insertedDate: string;
}
export interface AppleHealthWorkout {
id: Guid;
startDate?: string;
endDate: string;
source: AppleHealthSourceInfo;
metadata: {
[key: string]: string;
};
insertedDate: string;
summary: AppleHealthWorkoutSummary;
device: AppleHealthDeviceInfo;
events: AppleHealthWorkoutEvent[];
}
export interface AppleHealthSourceInfo {
name: string;
identifier: string;
version: string;
operatingSystemVersion: string;
productType: string;
}
export interface AppleHealthDeviceInfo {
fdaIdentifier: string;
firmwareVersion: string;
hardwareVersion: string;
localIdentifier: string;
manufacturer: string;
model: string;
name: string;
softwareVersion: string;
}
export interface AppleHealthWorkoutSummary {
activityType: string;
duration?: number;
totalEnergyBurned?: number;
totalDistance?: number;
totalSwimmingStrokeCount?: number;
totalFlightsClimbed?: number;
}
export interface AppleHealthWorkoutEvent {
date?: string;
type: string;
metadata: {
[key: string]: string;
};
endDate?: string;
}
export interface UploadedFileQuery extends QueryParameters {
category?: string;
}
export interface UploadedFilesPage {
files: UploadedFile[];
nextPageID?: Guid;
}
export interface UploadedFile {
participantID: Guid;
participantIdentifier: string;
key: string;
category: string;
fileName: string;
lastModified: string;
}
export interface DownloadedFile {
preSignedUrl: string;
}
export interface EventData {
type: string;
messageID?: number;
}
export interface Token {
expires_in: number;
access_token: string;
token_type: string;
}
export interface OpenApplicationOptions {
modal: boolean;
}
export interface ShowDashboardOptions {
modal: boolean;
title?: string;
}
export interface ShowWebVisualizationOptions {
modal: boolean;
title?: string;
}
export interface ShowWebVisualizationPdfOptions {
landscape: boolean;
htmlViewerZoom: number;
}
export interface DataCollectionSettings {
fitbitEnabled: boolean;
ehrEnabled: boolean;
garminEnabled: boolean;
dexcomEnabled: boolean;
omronEnabled: boolean;
airQualityEnabled: boolean;
weatherEnabled: boolean;
queryableDeviceDataTypes: QueryableDeviceDataType[];
sensorDataCollectionEndDate: string;
appleHealthRecordsEnabled: boolean;
appleHealthEnabled: boolean;
googleFitEnabled: boolean;
healthConnectEnabled: boolean;
ouraEnabled: boolean;
}
export interface QueryableDeviceDataType {
namespace: DeviceDataNamespace;
type: string;
}
export interface ConnectExternalAccountOptions {
standaloneModeFinalRedirectPath?: string;
openNewWindow: boolean;
width?: number;
height?: number;
}
export interface HealthConnectStatus {
available: boolean;
requestedQueryRules: string[];
enabledQueryRules: string[];
running: boolean;
lastPrompted?: string;
}
export interface HealthConnectPhrStatus {
available: boolean;
requestedPermissions: string[];
enabledPermissions: string[];
running: boolean;
lastPrompted?: string;
}
export interface DataAvailability {
appleHealthRecords: boolean;
healthConnectPhr: boolean;
}
export interface StartSurveyOptions {
editResultID?: string;
event?: string;
}
export interface SecondaryView {
key: string;
url: string;
}