First end-to-end-buildable cut of the pflicht-/graph-basierte
Wirkungsanalyse von Rechtsnormen, running on Ch∆In. Demo runs
without external dependencies and without a hub connection so
the methodology + UI stack can be reviewed before any Verbands-
Kooperation or Beirats-Validierung kicks in.
Tree layout
MACHBARKEITSSTUDIE.md v0.3 — pflicht-basierte Methodik,
4-Tier-Evidenz, 8 law*-Module
auf Ch∆In statt der alten F∆I-
Plattform.
RUN.md one-page how-to-run.
flows/durchstich-gewo-14.yaml
vertical Phase-0 flow: pull →
normalize → duties → citations →
cohort → skm → frust → benefit →
attribution → system.approval.
app/ Flutter macOS client, design
language pulled from fai_web
(ink #08090A, paper #F4F3EF,
petrol signal #2E8F9E). Mock
repository ships five fixture
norms with real source URLs and a
permanent T4 demo-banner so no
figure can be mistaken for a
validated one.
Module repos (separate, see chain-modules*/):
text-akoma-normalize, text-deontic-extract, graph-citation-
extract, text-readability-score, stats-cohort-size, graph-
shapley-attribution, econ-skm-score, law-benefit-score.
What runs today
- flutter analyze: 0 issues
- flutter test: 2/2 (landing + nav-to-shell smoke)
- flutter build macos (via app/build-macos.sh) and ad-hoc
codesign, app launches and the Dart VM service comes up
- native cargo test green on every module
- cargo build --release --target wasm32-wasip2 produces a
130 KiB artefact for text-akoma-normalize
What is deliberately mock / stub
- gRPC wire from the client to a chain serve hub (Repository
abstraction is in place; live impl is the next step)
- NKR Bürokratiekosten-Datenbank ingestion (for the canonical
h-Werte that close out the Engpass per Studie §6.7)
- DESTATIS GENESIS-API adapter for stats.cohort_size
License: Apache-2.0. Author/contact in MACHBARKEITSSTUDIE.md.
Signed-off-by: flemming-it <sf@flemming.it>
271 lines
9.3 KiB
Dart
271 lines
9.3 KiB
Dart
import 'package:flutter/material.dart';
|
||
|
||
import '../data/models.dart';
|
||
import '../data/repository.dart';
|
||
import '../theme/lawheatmap_tokens.dart';
|
||
import '../widgets/demo_banner.dart';
|
||
import '../widgets/evidence_sidebar.dart';
|
||
import '../widgets/lawheatmap_card.dart';
|
||
import '../widgets/tier_badge.dart';
|
||
|
||
class NormDetailPage extends StatelessWidget {
|
||
const NormDetailPage({
|
||
super.key,
|
||
required this.repository,
|
||
required this.evaluation,
|
||
});
|
||
|
||
final EvaluationRepository repository;
|
||
final Evaluation evaluation;
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
final t = Theme.of(context).textTheme;
|
||
final e = evaluation;
|
||
return Scaffold(
|
||
appBar: AppBar(
|
||
title: Text('${e.norm.jurabk} ${e.norm.paragraph}'),
|
||
),
|
||
body: Column(
|
||
children: [
|
||
const DemoBanner(),
|
||
Expanded(
|
||
child: SingleChildScrollView(
|
||
padding: const EdgeInsets.all(LawHeatmapSpace.xl),
|
||
child: Row(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
Expanded(
|
||
flex: 3,
|
||
child: Column(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
Row(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
Expanded(
|
||
child: Column(
|
||
crossAxisAlignment:
|
||
CrossAxisAlignment.start,
|
||
children: [
|
||
Text(e.norm.title,
|
||
style: t.displaySmall),
|
||
const SizedBox(height: 4),
|
||
SelectableText(
|
||
e.norm.eli,
|
||
style: t.bodyLarge?.copyWith(
|
||
fontFamily:
|
||
LawHeatmapTypography.mono,
|
||
color: LawHeatmapColors.mute,
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
TierBadge(tier: e.tierLowest),
|
||
],
|
||
),
|
||
const SizedBox(height: LawHeatmapSpace.lg),
|
||
_MetricsRow(e: e),
|
||
const SizedBox(height: LawHeatmapSpace.lg),
|
||
LawHeatmapCard(
|
||
child: Column(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
Text('Pflichten',
|
||
style: t.headlineSmall),
|
||
const SizedBox(
|
||
height: LawHeatmapSpace.sm),
|
||
Text(
|
||
'Atomare deontische Aussagen, extrahiert '
|
||
'aus dem Norm-Text (Phase 1: regex + LLM-'
|
||
'Vorschlag, Juristen-Review obligatorisch).',
|
||
style: t.labelSmall?.copyWith(
|
||
color: LawHeatmapColors.mute),
|
||
),
|
||
const SizedBox(
|
||
height: LawHeatmapSpace.md),
|
||
for (final d in e.duties)
|
||
_DutyTile(duty: d),
|
||
],
|
||
),
|
||
),
|
||
if (e.notes != null) ...[
|
||
const SizedBox(height: LawHeatmapSpace.lg),
|
||
LawHeatmapCard(
|
||
child: Column(
|
||
crossAxisAlignment:
|
||
CrossAxisAlignment.start,
|
||
children: [
|
||
Text('Methodik-Notiz',
|
||
style: t.headlineSmall),
|
||
const SizedBox(
|
||
height: LawHeatmapSpace.sm),
|
||
Text(e.notes!, style: t.bodyLarge),
|
||
],
|
||
),
|
||
),
|
||
],
|
||
],
|
||
),
|
||
),
|
||
const SizedBox(width: LawHeatmapSpace.xl),
|
||
SizedBox(
|
||
width: 340,
|
||
child: EvidenceSidebar(evaluation: e),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
],
|
||
),
|
||
);
|
||
}
|
||
}
|
||
|
||
class _MetricsRow extends StatelessWidget {
|
||
const _MetricsRow({required this.e});
|
||
final Evaluation e;
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
return Row(
|
||
children: [
|
||
_MetricBox(
|
||
label: 'Schaden',
|
||
value: _eur(e.skmEurPerYear),
|
||
sub: 'SKM P×F×T×h',
|
||
),
|
||
const SizedBox(width: LawHeatmapSpace.md),
|
||
_MetricBox(
|
||
label: 'Nutzen',
|
||
value: '${e.benefitScore.toStringAsFixed(1)} / 5',
|
||
sub: '7-dim. Score',
|
||
),
|
||
const SizedBox(width: LawHeatmapSpace.md),
|
||
_MetricBox(
|
||
label: 'Betroffene',
|
||
value: _kmu(e.affectedCount),
|
||
sub: 'DESTATIS',
|
||
),
|
||
const SizedBox(width: LawHeatmapSpace.md),
|
||
_MetricBox(
|
||
label: 'Frust',
|
||
value: '${e.frustScore.toStringAsFixed(1)} / 10',
|
||
sub: 'Lesbarkeit + Tiefe',
|
||
),
|
||
],
|
||
);
|
||
}
|
||
|
||
static String _eur(double v) {
|
||
if (v >= 1e9) return '${(v / 1e9).toStringAsFixed(2)} Mrd €';
|
||
if (v >= 1e6) return '${(v / 1e6).toStringAsFixed(1)} Mio €';
|
||
if (v >= 1e3) return '${(v / 1e3).toStringAsFixed(0)} k €';
|
||
return '${v.toStringAsFixed(0)} €';
|
||
}
|
||
|
||
static String _kmu(int n) {
|
||
if (n >= 1_000_000) return '${(n / 1e6).toStringAsFixed(1)} Mio';
|
||
if (n >= 1_000) return '${(n / 1e3).toStringAsFixed(0)} k';
|
||
return n.toString();
|
||
}
|
||
}
|
||
|
||
class _MetricBox extends StatelessWidget {
|
||
const _MetricBox({
|
||
required this.label,
|
||
required this.value,
|
||
required this.sub,
|
||
});
|
||
final String label;
|
||
final String value;
|
||
final String sub;
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
final t = Theme.of(context).textTheme;
|
||
return Expanded(
|
||
child: LawHeatmapCard(
|
||
child: Column(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
Text(label,
|
||
style: t.labelSmall
|
||
?.copyWith(color: LawHeatmapColors.mute)),
|
||
const SizedBox(height: 4),
|
||
Text(value, style: t.displaySmall),
|
||
const SizedBox(height: 4),
|
||
Text(sub,
|
||
style: t.labelSmall
|
||
?.copyWith(color: LawHeatmapColors.mute)),
|
||
],
|
||
),
|
||
),
|
||
);
|
||
}
|
||
}
|
||
|
||
class _DutyTile extends StatelessWidget {
|
||
const _DutyTile({required this.duty});
|
||
final Duty duty;
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
final t = Theme.of(context).textTheme;
|
||
return Padding(
|
||
padding: const EdgeInsets.only(bottom: LawHeatmapSpace.md),
|
||
child: Container(
|
||
padding: const EdgeInsets.all(LawHeatmapSpace.md),
|
||
decoration: BoxDecoration(
|
||
border: Border.all(
|
||
color: Theme.of(context)
|
||
.colorScheme
|
||
.onSurface
|
||
.withValues(alpha: 0.12)),
|
||
borderRadius: const BorderRadius.all(LawHeatmapRadius.sm),
|
||
),
|
||
child: Column(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
Row(children: [
|
||
Container(
|
||
padding: const EdgeInsets.symmetric(
|
||
horizontal: 6, vertical: 2),
|
||
decoration: BoxDecoration(
|
||
color: LawHeatmapColors.signal.withValues(alpha: 0.18),
|
||
borderRadius:
|
||
const BorderRadius.all(LawHeatmapRadius.sm),
|
||
),
|
||
child: Text(
|
||
duty.modality,
|
||
style: t.labelSmall?.copyWith(
|
||
color: LawHeatmapColors.signal,
|
||
fontWeight: FontWeight.w600,
|
||
),
|
||
),
|
||
),
|
||
const SizedBox(width: LawHeatmapSpace.sm),
|
||
Text(duty.sourceNorm,
|
||
style: t.labelSmall?.copyWith(
|
||
fontFamily: LawHeatmapTypography.mono,
|
||
color: LawHeatmapColors.mute,
|
||
)),
|
||
]),
|
||
const SizedBox(height: LawHeatmapSpace.sm),
|
||
Text(duty.action, style: t.bodyLarge),
|
||
const SizedBox(height: 4),
|
||
Text(
|
||
'Adressat: ${duty.addressee} · '
|
||
'Frequenz: ${duty.frequency}'
|
||
'${duty.authority != null ? " · Behörde: ${duty.authority}" : ""}'
|
||
'${duty.consequence != null ? " · Sanktion: ${duty.consequence}" : ""}',
|
||
style: t.labelSmall?.copyWith(color: LawHeatmapColors.mute),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
);
|
||
}
|
||
}
|