Initial commit of akmon project

This commit is contained in:
2026-01-20 08:04:15 +08:00
commit 77a2bab985
1309 changed files with 343305 additions and 0 deletions

301
pages/sense/types.uts Normal file
View File

@@ -0,0 +1,301 @@
// 传感器数据类型定义
export type SensorMeasurement = {
id: string;
device_id: string;
user_id: string;
measurement_type: string;
measured_at: string;
unit: string;
raw_data: UTSJSONObject;
created_at: string;
}
export type SensorAnalysisResult = {
id: string;
user_id: string;
analysis_type: string;
result: UTSJSONObject;
summary: string;
recommendations: Array<string>;
created_at: string;
}
export type DeviceInfo = {
id: string;
user_id: string;
device_type: string;
device_name: string;
device_mac: string;
bind_time: string;
status: string;
extra: UTSJSONObject;
}
export type ChartDataPoint = {
time: string;
value: number;
type: string;
}
// 扩展的传感器数据类型
export type HeartRateData = {
bpm: number;
rr_interval?: number;
hrv?: number;
quality?: number;
}
export type StepsData = {
count: number;
distance?: number;
calories?: number;
cadence?: number;
}
export type SpO2Data = {
spo2: number;
pi?: number;
quality?: number;
}
export type BloodPressureData = {
systolic: number;
diastolic: number;
pulse_pressure?: number;
map?: number;
}
export type TemperatureData = {
temp: number;
ambient_temp?: number;
location?: string;
}
export type StrideData = {
stride_length: number;
step_frequency: number;
ground_contact_time?: number;
flight_time?: number;
}
export type LocationData = {
latitude: number;
longitude: number;
altitude?: number;
accuracy?: number;
speed?: number;
heading?: number;
}
export type ECGData = {
raw_signal: Array<number>;
heart_rate?: number;
rhythm_type?: string;
qrs_duration?: number;
pr_interval?: number;
qt_interval?: number;
}
// 设备配置类型
export type DeviceConfig = {
sample_rate: string;
upload_interval: string;
auto_sync: boolean;
battery_optimization: boolean;
data_encryption: boolean;
}
// 数据分析配置
export type AnalysisConfig = {
analysis_types: Array<string>;
time_range: string;
alert_thresholds: UTSJSONObject;
ai_enabled: boolean;
}
// 实时数据订阅配置
export type RealtimeConfig = {
channels: Array<string>;
filters: UTSJSONObject;
max_frequency: number;
}
// 传感器类型枚举
export const SENSOR_TYPES = {
HEART_RATE: 'heart_rate',
STEPS: 'steps',
SPO2: 'spo2',
BLOOD_PRESSURE: 'bp',
TEMPERATURE: 'temp',
STRIDE: 'stride',
LOCATION: 'location',
ECG: 'ecg',
RESPIRATORY_RATE: 'respiratory_rate',
BLOOD_GLUCOSE: 'blood_glucose',
SLEEP: 'sleep',
FALL_DETECTION: 'fall_detection'
} as const
// 设备类型枚举
export const DEVICE_TYPES = {
SMARTWATCH: 'smartwatch',
FITNESS_BAND: 'fitness_band',
HEART_MONITOR: 'heart_monitor',
BLOOD_PRESSURE_MONITOR: 'blood_pressure',
THERMOMETER: 'thermometer',
PEDOMETER: 'pedometer',
GPS_TRACKER: 'gps_tracker',
ECG_MONITOR: 'ecg_monitor'
} as const
// 健康评分数据类型
export type HealthScoreBreakdown = {
category: string;
score: number;
percentage: number;
trend: string;
color: string;
}
// 健康异常数据类型
export type HealthAnomaly = {
id: string;
type: string;
severity: string;
description: string;
detected_at: string;
resolved: boolean;
}
// AI分析报告类型
export type AIAnalysisReport = {
health_assessment: string;
trend_analysis: string;
recommendations: Array<string>;
risk_factors: Array<string>;
generated_at: string;
}
// 趋势对比数据类型
export type TrendComparison = {
current_period: number;
previous_period: number;
change_percentage: number;
change_direction: string;
metric_name: string;
time_range: string;
}
// Settings related types
export type UserSettings = {
realtime_enabled: boolean
auto_backup: boolean
anomaly_detection: boolean
ai_analysis: boolean
}
export type NotificationSettings = {
anomaly_alert: boolean
daily_report: boolean
device_offline: boolean
report_time: string
}
export type DataManagementSettings = {
retention_index: number
cloud_sync: boolean
data_compression: boolean
}
export type PrivacySettings = {
data_encryption: boolean
anonymous_stats: boolean
location_data: boolean
}
export type SensorFrequency = {
name: string
key: string
frequency_index: number
}
export type SensorThreshold = {
name: string
key: string
min_value: string
max_value: string
}
export type UserSettingsRecord = {
id: string
user_id: string
setting_category: string
setting_key: string
setting_value: UTSJSONObject
created_at: string
updated_at: string
}
// Simulator related types
export type SensorConfig = {
key: string
name: string
enabled: boolean
frequency_index: number
min_value: string
max_value: string
trend_index: number
}
export type RecentDataItem = {
type: string
value: string
timestamp: number
}
// Settings configuration types
export type SensorConfigItem = {
name: string
key: string
frequency_index: number
}
export type ThresholdConfigItem = {
name: string
key: string
min: number
max: number
}
import type { HealthData } from '@/uni_modules/ak-sbsrv/utssdk/interface.uts'
// BLE健康监控相关类型定义
export type NotifyLogItem = {
ts: number
pkt: HealthData
hex?: string
b64?: string
}
export type RealtimeMetric = {
type: string
label: string
icon: string
value: string
unit: string
high?: string
low?: string
}
export type ChartBuffer = {
type: string
data: Array<number>
labels: Array<string>
}
export type HealthSample = {
heartRate: number
spo2: number
steps: number
speed: number
timestamp: Date
}