Initial commit: Grounded Flutter frontend
A to-do app that doesn't believe you — an enforcement layer rather than a
neutral ledger.
Architecture ported from Autoreceptives/Frontend/Receptive: stacked MVVM with
the mandatory 4-file screen pattern, one ParentViewModel owning the loading /
network / error overlays and the handleError decision tree, one AppDataManager
gateway, dio comms carrying the three identity headers, secure storage with
random-suffixed keys, and a single-chokepoint Navigator. Package root and Dart
package name are both Grounded; org is nya.
The enforcement engine, one unit per formula in utils/:
- DebtEngine w(class) x severity(d) x decay(t), sublinear severity so old
misses cannot swamp the score; abandonment 2x with 30-day
decay immunity; late complete retains 30%
- StandingEngine Good -> Warned -> Grounded -> Lockdown, derived not set;
Grounded replaces home with the overdue queue
- CapacityEngine blocks over-scheduling against p50 of historically completed
minutes, with a learned per-category estimation multiplier
- IntegrityEngine session integrity, weekly volume, plyometric contact ceiling
and enforced recovery gaps
- ExcuseAnalyser on-device excuse clustering plus the confrontation copy
- GuardrailEngine distress detection and rationed amnesty
- ToneEngine all enforcement copy, so the tone cap lives in one place
CommitmentEvent is append-only and is the source of truth rather than the
status field, which is what makes honest history and excuse analysis possible.
Goals contain commitments via parentId, and a task can be run from a
full-screen runner that derives elapsed time from wall-clock so screen-off
cannot lose time. Backgrounding pauses the clock and is counted. The runner is
mirrored into an ongoing notification, with alarm-class full-screen intents
reserved for non-negotiables.
Design language, fonts, icon and native splash are in place; Mason bricks are
retargeted to this project and verified end-to-end.
flutter analyze lib/ reports no errors.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mfu2gQLSFN21YRBcU2NrTt
This commit is contained in:
192
frontend/lib/Grounded/about/external/data/ReportCard.dart
vendored
Normal file
192
frontend/lib/Grounded/about/external/data/ReportCard.dart
vendored
Normal file
@@ -0,0 +1,192 @@
|
||||
import 'ExcuseCluster.dart';
|
||||
|
||||
/// The weekly parent-teacher conference. One assigned action for next week —
|
||||
/// not five.
|
||||
class ReportCard {
|
||||
String? id;
|
||||
|
||||
DateTime? periodStart;
|
||||
|
||||
DateTime? periodEnd;
|
||||
|
||||
/// Completion rate 0..1, keyed by commitment class name.
|
||||
Map<String, double> completionByClass;
|
||||
|
||||
/// Completion rate 0..1, keyed by category.
|
||||
Map<String, double> completionByCategory;
|
||||
|
||||
/// Completion rate 0..1, keyed by weekday (1 = Monday).
|
||||
Map<int, double> completionByWeekday;
|
||||
|
||||
/// The recurring window where things go to die, as an hour of the day.
|
||||
int worstHour;
|
||||
|
||||
/// Debt score sampled per day across the period.
|
||||
List<double> debtTrend;
|
||||
|
||||
/// The commitments dodged most, highest first.
|
||||
List<DeferralCount> deferralLeaderboard;
|
||||
|
||||
List<ExcuseCluster> excuseTaxonomy;
|
||||
|
||||
/// Estimation multiplier per category, surfaced here rather than hidden.
|
||||
Map<String, double> estimationAccuracy;
|
||||
|
||||
/// Training adherence 0..1 across the period.
|
||||
double trainingAdherence;
|
||||
|
||||
double programIntegrity;
|
||||
|
||||
/// The single assigned action for next week.
|
||||
String assignedAction;
|
||||
|
||||
/// Cosmetic but effective.
|
||||
String grade;
|
||||
|
||||
/// Rationed, specific praise — empty when nothing was genuinely earned.
|
||||
String praise;
|
||||
|
||||
ReportCard({
|
||||
this.id,
|
||||
this.periodStart,
|
||||
this.periodEnd,
|
||||
Map<String, double>? completionByClass,
|
||||
Map<String, double>? completionByCategory,
|
||||
Map<int, double>? completionByWeekday,
|
||||
this.worstHour = -1,
|
||||
List<double>? debtTrend,
|
||||
List<DeferralCount>? deferralLeaderboard,
|
||||
List<ExcuseCluster>? excuseTaxonomy,
|
||||
Map<String, double>? estimationAccuracy,
|
||||
this.trainingAdherence = 0,
|
||||
this.programIntegrity = 0,
|
||||
this.assignedAction = "",
|
||||
this.grade = "",
|
||||
this.praise = "",
|
||||
}) : completionByClass = completionByClass ?? <String, double>{},
|
||||
completionByCategory = completionByCategory ?? <String, double>{},
|
||||
completionByWeekday = completionByWeekday ?? <int, double>{},
|
||||
debtTrend = debtTrend ?? <double>[],
|
||||
deferralLeaderboard = deferralLeaderboard ?? <DeferralCount>[],
|
||||
excuseTaxonomy = excuseTaxonomy ?? <ExcuseCluster>[],
|
||||
estimationAccuracy = estimationAccuracy ?? <String, double>{};
|
||||
|
||||
factory ReportCard.fromJson(Map<String, dynamic> json) {
|
||||
final Map<String, double> byClass = <String, double>{};
|
||||
if (json['completionByClass'] != null) {
|
||||
(json['completionByClass'] as Map<String, dynamic>).forEach((key, value) {
|
||||
byClass[key] = (value ?? 0).toDouble();
|
||||
});
|
||||
}
|
||||
|
||||
final Map<String, double> byCategory = <String, double>{};
|
||||
if (json['completionByCategory'] != null) {
|
||||
(json['completionByCategory'] as Map<String, dynamic>)
|
||||
.forEach((key, value) {
|
||||
byCategory[key] = (value ?? 0).toDouble();
|
||||
});
|
||||
}
|
||||
|
||||
final Map<int, double> byWeekday = <int, double>{};
|
||||
if (json['completionByWeekday'] != null) {
|
||||
(json['completionByWeekday'] as Map<String, dynamic>)
|
||||
.forEach((key, value) {
|
||||
byWeekday[int.tryParse(key) ?? 1] = (value ?? 0).toDouble();
|
||||
});
|
||||
}
|
||||
|
||||
final Map<String, double> estimation = <String, double>{};
|
||||
if (json['estimationAccuracy'] != null) {
|
||||
(json['estimationAccuracy'] as Map<String, dynamic>)
|
||||
.forEach((key, value) {
|
||||
estimation[key] = (value ?? 1).toDouble();
|
||||
});
|
||||
}
|
||||
|
||||
return ReportCard(
|
||||
id: json['id'],
|
||||
periodStart: DateTime.tryParse(json['periodStart'] ?? ""),
|
||||
periodEnd: DateTime.tryParse(json['periodEnd'] ?? ""),
|
||||
completionByClass: byClass,
|
||||
completionByCategory: byCategory,
|
||||
completionByWeekday: byWeekday,
|
||||
worstHour: json['worstHour'] ?? -1,
|
||||
debtTrend: json['debtTrend'] == null
|
||||
? <double>[]
|
||||
: (json['debtTrend'] as List)
|
||||
.map((item) => (item ?? 0).toDouble() as double)
|
||||
.toList(),
|
||||
deferralLeaderboard: json['deferralLeaderboard'] == null
|
||||
? <DeferralCount>[]
|
||||
: (json['deferralLeaderboard'] as List)
|
||||
.map((item) => DeferralCount.fromJson(item))
|
||||
.toList(),
|
||||
excuseTaxonomy: json['excuseTaxonomy'] == null
|
||||
? <ExcuseCluster>[]
|
||||
: (json['excuseTaxonomy'] as List)
|
||||
.map((item) => ExcuseCluster.fromJson(item))
|
||||
.toList(),
|
||||
estimationAccuracy: estimation,
|
||||
trainingAdherence: (json['trainingAdherence'] ?? 0).toDouble(),
|
||||
programIntegrity: (json['programIntegrity'] ?? 0).toDouble(),
|
||||
assignedAction: json['assignedAction'] ?? "",
|
||||
grade: json['grade'] ?? "",
|
||||
praise: json['praise'] ?? "",
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id'] = id;
|
||||
data['periodStart'] = periodStart?.toIso8601String();
|
||||
data['periodEnd'] = periodEnd?.toIso8601String();
|
||||
data['completionByClass'] = completionByClass;
|
||||
data['completionByCategory'] = completionByCategory;
|
||||
data['completionByWeekday'] =
|
||||
completionByWeekday.map((key, value) => MapEntry(key.toString(), value));
|
||||
data['worstHour'] = worstHour;
|
||||
data['debtTrend'] = debtTrend;
|
||||
data['deferralLeaderboard'] =
|
||||
deferralLeaderboard.map((item) => item.toJson()).toList();
|
||||
data['excuseTaxonomy'] =
|
||||
excuseTaxonomy.map((item) => item.toJson()).toList();
|
||||
data['estimationAccuracy'] = estimationAccuracy;
|
||||
data['trainingAdherence'] = trainingAdherence;
|
||||
data['programIntegrity'] = programIntegrity;
|
||||
data['assignedAction'] = assignedAction;
|
||||
data['grade'] = grade;
|
||||
data['praise'] = praise;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
/// One row of the deferral leaderboard — the tasks dodged most.
|
||||
class DeferralCount {
|
||||
String commitmentId;
|
||||
|
||||
String title;
|
||||
|
||||
int count;
|
||||
|
||||
DeferralCount({
|
||||
this.commitmentId = "",
|
||||
this.title = "",
|
||||
this.count = 0,
|
||||
});
|
||||
|
||||
factory DeferralCount.fromJson(Map<String, dynamic> json) {
|
||||
return DeferralCount(
|
||||
commitmentId: json['commitmentId'] ?? "",
|
||||
title: json['title'] ?? "",
|
||||
count: json['count'] ?? 0,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['commitmentId'] = commitmentId;
|
||||
data['title'] = title;
|
||||
data['count'] = count;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user