@laplace.live/internal 1.3.33 → 1.3.35

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laplace.live/internal",
3
- "version": "1.3.33",
3
+ "version": "1.3.35",
4
4
  "module": "src/index.d.ts",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -792,6 +792,58 @@ export declare namespace LaplaceInternal {
792
792
  submittedAt: number
793
793
  /** Optional: URL or description of the evidence source (e.g., livestream clip, tweet) */
794
794
  source?: string
795
+ /** Optional: prediction basis live when this entry was added; absent on legacy and backfilled entries */
796
+ predictedWith?: CyclePredictionBasis
797
+ }
798
+
799
+ /**
800
+ * What the live status projects the next period from
801
+ *
802
+ * @since Oct 4, 2026
803
+ */
804
+ export interface CyclePredictionBasis {
805
+ /** Unix timestamp (ms) - latest recorded period start at the time */
806
+ lastPeriodStart: number
807
+ /** Cycle length (days) in effect at the time */
808
+ effectiveCycleLength: number
809
+ }
810
+
811
+ /**
812
+ * How far a recorded period landed from its predicted start. Ovulation is predicted as next period - 14 days,
813
+ * so this is also the ovulation-date error.
814
+ *
815
+ * @since Oct 4, 2026
816
+ */
817
+ export interface PeriodPrediction {
818
+ /** ISO date string (YYYY-MM-DD, CST) */
819
+ predictedStart: string
820
+ /** Recorded minus predicted, in days: positive = came later than predicted */
821
+ errorDays: number
822
+ /** `snapshot` = stored when the entry was added; `backtest` = recomputed from the entries before it */
823
+ method: 'snapshot' | 'backtest'
824
+ }
825
+
826
+ /**
827
+ * Per-user summary of PeriodPrediction errors. Only periods recorded ~1 cycle after the previous one are
828
+ * scored; gaps with unrecorded periods in between (≥ 1.5 cycles) and sub-21-day noise are skipped.
829
+ *
830
+ * @since Oct 4, 2026
831
+ */
832
+ export interface PredictionAccuracy {
833
+ /** Mean absolute error in days (1 decimal); null when nothing is scored */
834
+ meanAbsErrorDays: number | null
835
+ /** Mean signed error in days (1 decimal), positive = periods come later than predicted; null when nothing is scored */
836
+ meanErrorDays: number | null
837
+ /** Number of scored periods */
838
+ samples: number
839
+ }
840
+
841
+ /**
842
+ * History entry as returned by GET /laplace/fertility/:uid
843
+ */
844
+ export interface FertilityHistoryEntry extends Omit<CycleHistoryItem, 'predictedWith'> {
845
+ /** Null when unscored: first entry, noise gap, or unrecorded periods in between */
846
+ prediction: PeriodPrediction | null
795
847
  }
796
848
 
797
849
  /**
@@ -868,11 +920,13 @@ export declare namespace LaplaceInternal {
868
920
  * status are projected from a stale observation.
869
921
  */
870
922
  cyclesElapsedSinceObservation: number
923
+ /** How far recorded periods landed from our predictions */
924
+ predictionAccuracy: PredictionAccuracy
871
925
  userPreferences: {
872
926
  cycleLength: number
873
927
  periodLength: number
874
928
  }
875
- history: CycleHistoryItem[]
929
+ history: FertilityHistoryEntry[]
876
930
  }
877
931
 
878
932
  /**
@@ -927,6 +981,8 @@ export declare namespace LaplaceInternal {
927
981
  * status are projected from a stale observation.
928
982
  */
929
983
  cyclesElapsedSinceObservation: number
984
+ /** How far recorded periods landed from our predictions */
985
+ predictionAccuracy: PredictionAccuracy
930
986
  }
931
987
 
932
988
  /**
@@ -1158,6 +1214,32 @@ export declare namespace LaplaceInternal {
1158
1214
  avgProcessingTimeMs: number | null
1159
1215
  /** Average time from submission to approval/rejection in hours (1 decimal) */
1160
1216
  avgProcessingTimeHours: number | null
1217
+ /** Site-wide accuracy of our period/ovulation predictions */
1218
+ predictionAccuracy: SitePredictionAccuracy
1219
+ }
1220
+
1221
+ /**
1222
+ * Site-wide prediction accuracy for one CST calendar month of recorded periods
1223
+ *
1224
+ * @since Oct 4, 2026
1225
+ */
1226
+ export interface PredictionAccuracyMonth extends PredictionAccuracy {
1227
+ /** YYYY-MM (CST) of the recorded period start */
1228
+ month: string
1229
+ }
1230
+
1231
+ /**
1232
+ * Every user's scored periods pooled (scoring rules: see PredictionAccuracy)
1233
+ *
1234
+ * @since Oct 4, 2026
1235
+ */
1236
+ export interface SitePredictionAccuracy {
1237
+ /** All scored periods across all users */
1238
+ overall: PredictionAccuracy
1239
+ /** Users with at least one scored period */
1240
+ users: number
1241
+ /** Ascending; months without scored periods are omitted */
1242
+ months: PredictionAccuracyMonth[]
1161
1243
  }
1162
1244
 
1163
1245
  // ============================================