Skip to content

Commit fde557c

Browse files
committed
Query all available HealthConnect data for classifier training
Changed default from 48 hours (2 days) to 87600 hours (~10 years) to use all available historical sleep data for learning.
1 parent 3837ecb commit fde557c

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

services/sleep.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export async function startSleepSession(
134134
return currentSession;
135135
}
136136

137-
learnFromRecentNights(48).catch(console.error);
137+
learnFromRecentNights(87600).catch(console.error); // ~10 years - get all available data
138138
await startHybridSession();
139139

140140
const session: SleepSession = {

services/sleepStageLearning.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export function getStageProportions(): StageProportions | null {
133133
return cachedModel?.stageProportions ?? null;
134134
}
135135

136-
export async function learnFromRecentNights(hoursBack: number = 48): Promise<LearnedModel> {
136+
export async function learnFromRecentNights(hoursBack: number = 87600): Promise<LearnedModel> {
137137
const platform = Platform.OS;
138138

139139
if (platform !== 'android' && platform !== 'ios') {
@@ -334,7 +334,7 @@ export async function refreshModelIfNeeded(): Promise<boolean> {
334334
const model = await loadModel();
335335

336336
if (!isModelValid(model)) {
337-
await learnFromRecentNights(48);
337+
await learnFromRecentNights(87600);
338338
return true;
339339
}
340340

@@ -439,7 +439,7 @@ export interface DebugReport {
439439
errors: string[];
440440
}
441441

442-
export async function runDebugReport(hoursBack: number = 48): Promise<DebugReport> {
442+
export async function runDebugReport(hoursBack: number = 87600): Promise<DebugReport> {
443443
const platform = Platform.OS;
444444
const errors: string[] = [];
445445
const report: DebugReport = {

0 commit comments

Comments
 (0)