feat: initial F∆I Law-Heatmap Phase 0 scaffold
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>
This commit is contained in:
commit
8ee6a294a1
64 changed files with 5641 additions and 0 deletions
274
app/lib/data/fixtures.dart
Normal file
274
app/lib/data/fixtures.dart
Normal file
|
|
@ -0,0 +1,274 @@
|
|||
import 'models.dart';
|
||||
|
||||
/// Phase-0 fixture data for the five pilot norms.
|
||||
///
|
||||
/// **THIS IS DEMO DATA.** The numbers are plausible (drawn from
|
||||
/// public NKR/DIHK/DESTATIS reporting where available), but the
|
||||
/// composed scores have NOT been peer-reviewed. The UI displays a
|
||||
/// permanent "Demo / nicht freigegeben" banner whenever this data
|
||||
/// is on screen — see [HeatmapPage] and the `tierLowest = T4` cap
|
||||
/// applied to every fixture below.
|
||||
///
|
||||
/// Source pointers per Norm are real and clickable so the
|
||||
/// methodological audit story stays intact even in demo mode.
|
||||
class Fixtures {
|
||||
static final List<Evaluation> evaluations = [
|
||||
_gewo14,
|
||||
_kassenSichV,
|
||||
_dsgvoArt30,
|
||||
_berlinBauO60,
|
||||
_miLoG17,
|
||||
];
|
||||
|
||||
static final _gewo14 = Evaluation(
|
||||
norm: Norm(
|
||||
eli: 'eli/bund/gewo/14',
|
||||
title: 'Anzeigepflicht',
|
||||
jurabk: 'GewO',
|
||||
paragraph: '§ 14',
|
||||
standDate: DateTime.utc(2025, 12, 1),
|
||||
sourceUrl: 'https://www.gesetze-im-internet.de/gewo/__14.html',
|
||||
sourceSha256: 'demo-${'a' * 60}',
|
||||
),
|
||||
skmEurPerYear: 2_800_000,
|
||||
benefitScore: 2.5,
|
||||
affectedCount: 180_000,
|
||||
frustScore: 4.5,
|
||||
tierLowest: EvidenceTier.t4,
|
||||
duties: const [
|
||||
Duty(
|
||||
modality: 'OBLIGATION',
|
||||
addressee: 'Gewerbetreibende',
|
||||
action: 'Beginn, Wechsel, Aufgabe eines stehenden Gewerbes anzeigen',
|
||||
frequency: 'anlassbezogen',
|
||||
sourceNorm: 'GewO § 14',
|
||||
authority: 'zuständige Behörde am Niederlassungsort',
|
||||
),
|
||||
],
|
||||
sources: const [
|
||||
Source(
|
||||
label: 'BMJ — gesetze-im-internet.de',
|
||||
url: 'https://www.gesetze-im-internet.de/gewo/__14.html',
|
||||
tier: EvidenceTier.t1,
|
||||
),
|
||||
Source(
|
||||
label: 'NKR Bürokratiekosten-Datenbank',
|
||||
url: 'https://www.normenkontrollrat.bund.de/',
|
||||
tier: EvidenceTier.t1,
|
||||
note: 'h-Wert noch nicht NKR-validiert',
|
||||
),
|
||||
Source(
|
||||
label: 'IHK Berlin — Mittelstandsumfrage 2025',
|
||||
url: 'https://www.ihk.de/berlin',
|
||||
tier: EvidenceTier.t2,
|
||||
),
|
||||
],
|
||||
auditEventId: 'demo-evt-gewo-14',
|
||||
notes:
|
||||
'Demo-Schätzung. h aus IHK-Beispielwert, P aus DESTATIS Unternehmensregister Berlin.',
|
||||
);
|
||||
|
||||
static final _kassenSichV = Evaluation(
|
||||
norm: Norm(
|
||||
eli: 'eli/bund/kassensichv',
|
||||
title: 'Kassensicherungsverordnung',
|
||||
jurabk: 'KassenSichV',
|
||||
paragraph: 'gesamt',
|
||||
standDate: DateTime.utc(2025, 11, 15),
|
||||
sourceUrl:
|
||||
'https://www.gesetze-im-internet.de/kassensichv/index.html',
|
||||
sourceSha256: 'demo-${'b' * 60}',
|
||||
),
|
||||
skmEurPerYear: 25_000_000,
|
||||
benefitScore: 3.0,
|
||||
affectedCount: 500_000,
|
||||
frustScore: 7.5,
|
||||
tierLowest: EvidenceTier.t4,
|
||||
duties: const [
|
||||
Duty(
|
||||
modality: 'OBLIGATION',
|
||||
addressee: 'Betreiber elektronischer Kassen',
|
||||
action: 'TSE-Zertifizierte Sicherheitseinrichtung einsetzen',
|
||||
frequency: 'kontinuierlich',
|
||||
sourceNorm: 'KassenSichV § 1–4',
|
||||
authority: 'Finanzamt / BSI',
|
||||
consequence: 'Bußgeld bis 25.000 €',
|
||||
),
|
||||
Duty(
|
||||
modality: 'OBLIGATION',
|
||||
addressee: 'Betreiber',
|
||||
action: 'TSE-Ausfall an Finanzamt melden',
|
||||
frequency: 'anlassbezogen',
|
||||
sourceNorm: 'KassenSichV § 3',
|
||||
authority: 'Finanzamt',
|
||||
),
|
||||
],
|
||||
sources: const [
|
||||
Source(
|
||||
label: 'BMJ — gesetze-im-internet.de',
|
||||
url:
|
||||
'https://www.gesetze-im-internet.de/kassensichv/index.html',
|
||||
tier: EvidenceTier.t1,
|
||||
),
|
||||
Source(
|
||||
label: 'DIHK — Bürokratie-Index 2025',
|
||||
url: 'https://www.dihk.de/buerokratie',
|
||||
tier: EvidenceTier.t2,
|
||||
),
|
||||
Source(
|
||||
label: 'DEHOGA Berlin Mittelstandsumfrage',
|
||||
url: 'https://www.dehoga-berlin.de/',
|
||||
tier: EvidenceTier.t2,
|
||||
note: 'h-Wert aus Gastronomie-Stichprobe',
|
||||
),
|
||||
],
|
||||
auditEventId: 'demo-evt-kassensichv',
|
||||
notes:
|
||||
'Demo. Hoher Frust-Score wegen TSE-Ausfallmeldung + Hardware-Folgekosten.',
|
||||
);
|
||||
|
||||
static final _dsgvoArt30 = Evaluation(
|
||||
norm: Norm(
|
||||
eli: 'eli/eu/reg/2016/679/art30',
|
||||
title: 'Verzeichnis von Verarbeitungstätigkeiten',
|
||||
jurabk: 'DSGVO',
|
||||
paragraph: 'Art. 30',
|
||||
standDate: DateTime.utc(2025, 10, 1),
|
||||
sourceUrl: 'https://eur-lex.europa.eu/eli/reg/2016/679',
|
||||
sourceSha256: 'demo-${'c' * 60}',
|
||||
),
|
||||
skmEurPerYear: 450_000_000,
|
||||
benefitScore: 3.8,
|
||||
affectedCount: 3_000_000,
|
||||
frustScore: 8.5,
|
||||
tierLowest: EvidenceTier.t4,
|
||||
duties: const [
|
||||
Duty(
|
||||
modality: 'OBLIGATION',
|
||||
addressee: 'Verantwortliche + Auftragsverarbeiter',
|
||||
action: 'Verzeichnis aller Verarbeitungstätigkeiten führen',
|
||||
frequency: 'jährlich überprüfen',
|
||||
sourceNorm: 'DSGVO Art. 30 Abs. 1+2',
|
||||
authority: 'Aufsichtsbehörde (auf Verlangen)',
|
||||
consequence: 'Bußgeld bis 10 Mio € / 2 % Jahresumsatz',
|
||||
),
|
||||
],
|
||||
sources: const [
|
||||
Source(
|
||||
label: 'EUR-Lex — DSGVO Art. 30',
|
||||
url: 'https://eur-lex.europa.eu/eli/reg/2016/679',
|
||||
tier: EvidenceTier.t1,
|
||||
),
|
||||
Source(
|
||||
label: 'DIHK — DSGVO-Belastung der Wirtschaft 2024',
|
||||
url: 'https://www.dihk.de/dsgvo',
|
||||
tier: EvidenceTier.t2,
|
||||
),
|
||||
Source(
|
||||
label: 'BfDI — Tätigkeitsbericht',
|
||||
url: 'https://www.bfdi.bund.de/',
|
||||
tier: EvidenceTier.t1,
|
||||
),
|
||||
],
|
||||
auditEventId: 'demo-evt-dsgvo-30',
|
||||
notes:
|
||||
'Demo. EU-determiniert → Reform-Vorschlag muss Brüssel adressieren, nicht DE-Streichung.',
|
||||
);
|
||||
|
||||
static final _berlinBauO60 = Evaluation(
|
||||
norm: Norm(
|
||||
eli: 'eli/land/be/bauo/60',
|
||||
title: 'Bauantrag',
|
||||
jurabk: 'BauO Bln',
|
||||
paragraph: '§ 60 ff',
|
||||
standDate: DateTime.utc(2025, 9, 1),
|
||||
sourceUrl:
|
||||
'https://gesetze.berlin.de/bsbe/document/jlr-BauOBE2005V25P60',
|
||||
sourceSha256: 'demo-${'d' * 60}',
|
||||
),
|
||||
skmEurPerYear: 72_000_000,
|
||||
benefitScore: 3.5,
|
||||
affectedCount: 15_000,
|
||||
frustScore: 9.0,
|
||||
tierLowest: EvidenceTier.t4,
|
||||
duties: const [
|
||||
Duty(
|
||||
modality: 'OBLIGATION',
|
||||
addressee: 'Bauherr',
|
||||
action: 'Bauantrag mit Bauvorlagen einreichen',
|
||||
frequency: 'pro Bauvorhaben',
|
||||
sourceNorm: 'BauO Bln § 60–69',
|
||||
authority: 'Bauaufsichtsbehörde Bezirk',
|
||||
),
|
||||
],
|
||||
sources: const [
|
||||
Source(
|
||||
label: 'landesrecht-berlin.de',
|
||||
url:
|
||||
'https://gesetze.berlin.de/bsbe/document/jlr-BauOBE2005V25P60',
|
||||
tier: EvidenceTier.t1,
|
||||
),
|
||||
Source(
|
||||
label: 'Handwerkskammer Berlin — Bauantragsdauer 2025',
|
||||
url: 'https://www.hwk-berlin.de/',
|
||||
tier: EvidenceTier.t2,
|
||||
),
|
||||
Source(
|
||||
label: 'mein.berlin.de — Bürgerbeteiligung Bauverfahren',
|
||||
url: 'https://mein.berlin.de/',
|
||||
tier: EvidenceTier.t4,
|
||||
),
|
||||
],
|
||||
auditEventId: 'demo-evt-berlinbauo-60',
|
||||
notes:
|
||||
'Demo. Höchster Frust-Score (Verweistiefe + Behörden-Pluralität Bezirk×Senat).',
|
||||
);
|
||||
|
||||
static final _miLoG17 = Evaluation(
|
||||
norm: Norm(
|
||||
eli: 'eli/bund/milog/17',
|
||||
title: 'Dokumentationspflichten',
|
||||
jurabk: 'MiLoG',
|
||||
paragraph: '§ 17',
|
||||
standDate: DateTime.utc(2025, 11, 1),
|
||||
sourceUrl: 'https://www.gesetze-im-internet.de/milog/__17.html',
|
||||
sourceSha256: 'demo-${'e' * 60}',
|
||||
),
|
||||
skmEurPerYear: 270_000_000,
|
||||
benefitScore: 3.2,
|
||||
affectedCount: 3_000_000,
|
||||
frustScore: 7.0,
|
||||
tierLowest: EvidenceTier.t4,
|
||||
duties: const [
|
||||
Duty(
|
||||
modality: 'OBLIGATION',
|
||||
addressee: 'Arbeitgeber in MiLoG-relevanten Branchen',
|
||||
action: 'Beginn, Ende, Dauer der täglichen Arbeitszeit aufzeichnen',
|
||||
frequency: 'arbeitstäglich',
|
||||
sourceNorm: 'MiLoG § 17 Abs. 1',
|
||||
authority: 'Zoll (FKS)',
|
||||
consequence: 'Bußgeld bis 30.000 €',
|
||||
),
|
||||
],
|
||||
sources: const [
|
||||
Source(
|
||||
label: 'BMJ — gesetze-im-internet.de',
|
||||
url: 'https://www.gesetze-im-internet.de/milog/__17.html',
|
||||
tier: EvidenceTier.t1,
|
||||
),
|
||||
Source(
|
||||
label: 'NKR — Stellungnahme Mindestlohngesetz',
|
||||
url: 'https://www.normenkontrollrat.bund.de/',
|
||||
tier: EvidenceTier.t1,
|
||||
),
|
||||
Source(
|
||||
label: 'ZDH — Bürokratiekosten Handwerk',
|
||||
url: 'https://www.zdh.de/',
|
||||
tier: EvidenceTier.t2,
|
||||
),
|
||||
],
|
||||
auditEventId: 'demo-evt-milog-17',
|
||||
notes:
|
||||
'Demo. P × F × T × h: 3 Mio Betroffene × 220 Arbeitstage × 0,1h × 30€/h.',
|
||||
);
|
||||
}
|
||||
144
app/lib/data/models.dart
Normal file
144
app/lib/data/models.dart
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
// Domain model for the F∆I Law-Heatmap client.
|
||||
//
|
||||
// These types are the lingua franca between the (eventually
|
||||
// gRPC-fed) repository and the UI. Names mirror the Studie's
|
||||
// §5.3 data model.
|
||||
|
||||
/// Evidence tier of the lowest-tier ingredient in a value.
|
||||
/// Per Studie §6.7: "Regel der niedrigsten Stufe" — any composed
|
||||
/// figure carries the tier of its weakest input.
|
||||
enum EvidenceTier {
|
||||
/// Official / peer-reviewed: NKR, DESTATIS, ifo, ZEW.
|
||||
t1,
|
||||
|
||||
/// Verbands-Erhebung: DIHK, BDI, ZDH, IHK.
|
||||
t2,
|
||||
|
||||
/// Eigene strukturierte Erhebung (Phase 2/3).
|
||||
t3,
|
||||
|
||||
/// Qualitatives Signal — pain indicator only, never magnitude.
|
||||
t4,
|
||||
}
|
||||
|
||||
extension EvidenceTierLabel on EvidenceTier {
|
||||
String get short => switch (this) {
|
||||
EvidenceTier.t1 => 'T1',
|
||||
EvidenceTier.t2 => 'T2',
|
||||
EvidenceTier.t3 => 'T3',
|
||||
EvidenceTier.t4 => 'T4',
|
||||
};
|
||||
|
||||
String get description => switch (this) {
|
||||
EvidenceTier.t1 => 'amtlich / peer-reviewed',
|
||||
EvidenceTier.t2 => 'Verband',
|
||||
EvidenceTier.t3 => 'eigene Erhebung',
|
||||
EvidenceTier.t4 => 'qualitatives Signal',
|
||||
};
|
||||
}
|
||||
|
||||
/// A citable source — never an LLM, always a public document or
|
||||
/// dataset reference. UI surfaces these next to every figure.
|
||||
class Source {
|
||||
const Source({
|
||||
required this.label,
|
||||
required this.url,
|
||||
required this.tier,
|
||||
this.note,
|
||||
});
|
||||
|
||||
final String label;
|
||||
final String url;
|
||||
final EvidenceTier tier;
|
||||
final String? note;
|
||||
}
|
||||
|
||||
/// One atomic obligation (Pflicht) extracted from a norm.
|
||||
/// Tuple shape matches Studie §6.3.
|
||||
class Duty {
|
||||
const Duty({
|
||||
required this.modality,
|
||||
required this.addressee,
|
||||
required this.action,
|
||||
required this.frequency,
|
||||
required this.sourceNorm,
|
||||
this.authority,
|
||||
this.consequence,
|
||||
});
|
||||
|
||||
final String modality; // OBLIGATION | PROHIBITION | …
|
||||
final String addressee;
|
||||
final String action;
|
||||
final String frequency;
|
||||
final String sourceNorm;
|
||||
final String? authority;
|
||||
final String? consequence;
|
||||
}
|
||||
|
||||
/// One norm version — a versioned legal text identified by its
|
||||
/// (synthetic for now) ELI/CELEX.
|
||||
class Norm {
|
||||
const Norm({
|
||||
required this.eli,
|
||||
required this.title,
|
||||
required this.jurabk,
|
||||
required this.paragraph,
|
||||
required this.standDate,
|
||||
required this.sourceUrl,
|
||||
required this.sourceSha256,
|
||||
});
|
||||
|
||||
final String eli;
|
||||
final String title;
|
||||
final String jurabk;
|
||||
final String paragraph;
|
||||
final DateTime standDate;
|
||||
final String sourceUrl;
|
||||
final String sourceSha256;
|
||||
}
|
||||
|
||||
/// A heatmap point: one norm with its computed scores.
|
||||
/// Axes mirror §6 in the study.
|
||||
class Evaluation {
|
||||
const Evaluation({
|
||||
required this.norm,
|
||||
required this.skmEurPerYear,
|
||||
required this.benefitScore,
|
||||
required this.affectedCount,
|
||||
required this.frustScore,
|
||||
required this.tierLowest,
|
||||
required this.duties,
|
||||
required this.sources,
|
||||
required this.auditEventId,
|
||||
this.notes,
|
||||
});
|
||||
|
||||
final Norm norm;
|
||||
|
||||
/// Yearly bureaucracy cost across the addressee population.
|
||||
/// €/year, computed via SKM (`P × F × T × h`).
|
||||
final double skmEurPerYear;
|
||||
|
||||
/// 0–5, composite of seven dimensions
|
||||
/// (safety / market / legal-certainty / EU-harmony / …).
|
||||
final double benefitScore;
|
||||
|
||||
/// Number of addressees (KMU, Bürger, etc.). UI uses this for
|
||||
/// heatmap point size.
|
||||
final int affectedCount;
|
||||
|
||||
/// 0–10, composite of readability + Verweistiefe + Akteurs-
|
||||
/// pluralität + Norm-Volatilität.
|
||||
final double frustScore;
|
||||
|
||||
/// Lowest tier among all ingredients of any displayed figure.
|
||||
final EvidenceTier tierLowest;
|
||||
|
||||
final List<Duty> duties;
|
||||
final List<Source> sources;
|
||||
|
||||
/// Pointer into the Ch∆In audit log (SQLite event_log row).
|
||||
final String auditEventId;
|
||||
|
||||
final String? notes;
|
||||
}
|
||||
38
app/lib/data/repository.dart
Normal file
38
app/lib/data/repository.dart
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import 'models.dart';
|
||||
import 'fixtures.dart';
|
||||
|
||||
/// Repository abstraction for evaluations.
|
||||
///
|
||||
/// Phase 0 ships exactly one implementation: [MockRepository],
|
||||
/// backed by [Fixtures]. The live implementation (gRPC against a
|
||||
/// running `chain serve`) lands in Phase 0 week 1 — its API will
|
||||
/// match this interface so no UI change is needed.
|
||||
abstract class EvaluationRepository {
|
||||
Future<List<Evaluation>> list();
|
||||
Future<Evaluation?> byEli(String eli);
|
||||
String get mode;
|
||||
String get hubLabel;
|
||||
}
|
||||
|
||||
/// In-memory, no-network implementation. Marks itself clearly so
|
||||
/// the UI shows a "demo mode" badge.
|
||||
class MockRepository implements EvaluationRepository {
|
||||
const MockRepository();
|
||||
|
||||
@override
|
||||
Future<List<Evaluation>> list() async => Fixtures.evaluations;
|
||||
|
||||
@override
|
||||
Future<Evaluation?> byEli(String eli) async {
|
||||
for (final e in Fixtures.evaluations) {
|
||||
if (e.norm.eli == eli) return e;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
String get mode => 'demo';
|
||||
|
||||
@override
|
||||
String get hubLabel => 'in-memory fixtures (kein Hub)';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue