feat(flow): port flows to the chain-0.16 YAML syntax + add bytes-input variant
The earlier durchstich-gewo-14.yaml used the templated
${{ inputs.x }} syntax and rich input declarations
(type / required / description). chain 0.16 expects the
simpler $inputs.x form and flat 'inputs: { name: type }'
maps — see flows/hello.yaml in fai/chain. Rewritten to match.
Adds two siblings:
- test-cohort.yaml: trivial stats.cohort_size-only smoke
test. Confirms a Recl∆Im module loads, instantiates against
the chain:platform/invoke@1.0.0 ABI, and writes a clean
flow.completed event. Useful as the first test you run
when wiring a fresh hub.
- durchstich-from-file.yaml: end-to-end demo without the
http.request permission dance. Takes the source XML as a
bytes input (--input content=@./norm.xml), runs through
text.akoma_normalize, stats.cohort_size and the
system.approval gate, and writes the norm + cohort bag to
the audit log. First end-to-end Recl∆Im flow that survives
a hub restart with audit-trail intact.
Verified locally: chain run flows/test-cohort.yaml → flow.completed
in 5 ms; chain run flows/durchstich-from-file.yaml + approve →
flow.completed in 6 s, output bag carries normalized GewO §14
with paragraphs + source_sha256.
Signed-off-by: flemming-it <sf@flemming.it>
This commit is contained in:
parent
1be2ad075d
commit
34c325e419
3 changed files with 83 additions and 106 deletions
39
flows/durchstich-from-file.yaml
Normal file
39
flows/durchstich-from-file.yaml
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
# Vertikaler Durchstich, Variante "ohne http-Permission".
|
||||||
|
#
|
||||||
|
# Nimmt das Norm-XML als bytes-Input direkt entgegen (statt es
|
||||||
|
# über http.request zu ziehen). Sinnvoll für den ersten end-to-
|
||||||
|
# end-Test gegen den lokal laufenden Hub, wenn dessen Operator-
|
||||||
|
# Policy noch keine Allowlist für gesetze-im-internet.de hat.
|
||||||
|
#
|
||||||
|
# Aufruf:
|
||||||
|
# chain run flows/durchstich-from-file.yaml \
|
||||||
|
# --input content=@/tmp/gewo-14-mini.xml \
|
||||||
|
# --input cohort_id=berlin-kmu
|
||||||
|
|
||||||
|
name: durchstich-from-file
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
content: bytes
|
||||||
|
cohort_id: text
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- id: normalize
|
||||||
|
use: text.akoma_normalize@^0
|
||||||
|
with:
|
||||||
|
content: $inputs.content
|
||||||
|
mime: "application/xml"
|
||||||
|
|
||||||
|
- id: cohort
|
||||||
|
use: stats.cohort_size@^0
|
||||||
|
with:
|
||||||
|
cohort_id: $inputs.cohort_id
|
||||||
|
|
||||||
|
- id: review
|
||||||
|
use: system.approval@^0
|
||||||
|
with:
|
||||||
|
title: "Recl∆Im — Review GewO §14"
|
||||||
|
payload: $normalize.norm
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
norm: $normalize.norm
|
||||||
|
cohort: $cohort.cohort
|
||||||
|
|
@ -1,131 +1,53 @@
|
||||||
# Vertikaler Durchstich Phase 0 — eine Norm (GewO §14) durch
|
# Phase-0 vertikaler Durchstich für GewO §14.
|
||||||
# alle 8 law*-Schritte + Juristen-Approval + Audit.
|
|
||||||
#
|
#
|
||||||
# Voraussetzung:
|
# Minimaler Pfad zum ersten echten flow.completed-Event im
|
||||||
# chain install text.akoma_normalize text.deontic_extract \
|
# Audit-Log — http.request → text.akoma_normalize →
|
||||||
# graph.citation_extract text.readability_score \
|
# stats.cohort_size → system.approval. Beweist, dass die
|
||||||
# stats.cohort_size graph.shapley_attribution \
|
# Recl∆Im-Pipeline live gegen den Ch∆In-Hub läuft. Die
|
||||||
# econ.skm_score law.benefit_score \
|
# komplexen Bewertungs-Schritte (econ.skm_score,
|
||||||
# http.request system.approval
|
# law.benefit_score, graph.shapley_attribution) bündeln wir in
|
||||||
|
# einem zweiten Flow, wenn dieser hier durchläuft.
|
||||||
|
#
|
||||||
|
# Voraussetzung — alle Module installieren:
|
||||||
|
# chain install --link <fai_chain_modules>/<modul>
|
||||||
|
# für: http-request, text-akoma-normalize, stats-cohort-size
|
||||||
#
|
#
|
||||||
# Aufruf:
|
# Aufruf:
|
||||||
# chain run flows/durchstich-gewo-14.yaml \
|
# chain run flows/durchstich-gewo-14.yaml \
|
||||||
# --input norm_url=https://www.gesetze-im-internet.de/gewo/__14.xml \
|
# --input norm_url=https://www.gesetze-im-internet.de/gewo/__14.xml \
|
||||||
# --input cohort_id=berlin-kmu
|
# --input cohort_id=berlin-kmu
|
||||||
|
|
||||||
inputs:
|
name: durchstich-gewo-14
|
||||||
norm_url:
|
|
||||||
type: string
|
|
||||||
required: true
|
|
||||||
description: ELI-resolvable URL der Quell-Norm
|
|
||||||
cohort_id:
|
|
||||||
type: string
|
|
||||||
required: true
|
|
||||||
description: Adressaten-Kohorte (siehe stats.cohort_size v0.1)
|
|
||||||
tariff_eur_per_hour:
|
|
||||||
type: number
|
|
||||||
default: 35.0
|
|
||||||
description: SKM-Tarif T
|
|
||||||
|
|
||||||
outputs:
|
inputs:
|
||||||
norm: ${{ normalize.norm }}
|
norm_url: text
|
||||||
duties: ${{ duties.duties }}
|
cohort_id: text
|
||||||
citations: ${{ citations.citations }}
|
|
||||||
cohort: ${{ cohort.cohort }}
|
|
||||||
skm: ${{ skm.report }}
|
|
||||||
frust: ${{ frust.score }}
|
|
||||||
benefit: ${{ benefit.score }}
|
|
||||||
attribution: ${{ attribution.attribution }}
|
|
||||||
reviewed: ${{ review.decision == 'approve' }}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- id: pull
|
- id: pull
|
||||||
use: http.request@^0
|
use: http.request@^0
|
||||||
with:
|
with:
|
||||||
url: ${{ inputs.norm_url }}
|
url: $inputs.norm_url
|
||||||
method: GET
|
method: "GET"
|
||||||
etag_cache: true
|
|
||||||
|
|
||||||
- id: normalize
|
- id: normalize
|
||||||
use: text.akoma_normalize@^0
|
use: text.akoma_normalize@^0
|
||||||
with:
|
with:
|
||||||
content: ${{ pull.body }}
|
content: $pull.body
|
||||||
mime: application/xml
|
mime: "application/xml"
|
||||||
|
|
||||||
- id: duties
|
|
||||||
use: text.deontic_extract@^0
|
|
||||||
with:
|
|
||||||
norm: ${{ normalize.norm }}
|
|
||||||
|
|
||||||
- id: citations
|
|
||||||
use: graph.citation_extract@^0
|
|
||||||
with:
|
|
||||||
norm: ${{ normalize.norm }}
|
|
||||||
|
|
||||||
- id: cohort
|
- id: cohort
|
||||||
use: stats.cohort_size@^0
|
use: stats.cohort_size@^0
|
||||||
with:
|
with:
|
||||||
cohort_id: ${{ inputs.cohort_id }}
|
cohort_id: $inputs.cohort_id
|
||||||
|
|
||||||
# SKM-Aufbereitung: jede Duty bekommt P/F/T/h aus
|
|
||||||
# Kohorten-Größe + per-Duty-Heuristik (Phase 1: NKR-Datenbank).
|
|
||||||
# Hier inline aufgebaut; in Phase 1 wird das ein eigener
|
|
||||||
# `econ.duties_enrich`-Schritt.
|
|
||||||
- id: skm
|
|
||||||
use: econ.skm_score@^0
|
|
||||||
with:
|
|
||||||
duties:
|
|
||||||
duties:
|
|
||||||
- population: ${{ cohort.cohort.count }}
|
|
||||||
frequency: 1.0
|
|
||||||
tariff_eur_per_hour: ${{ inputs.tariff_eur_per_hour }}
|
|
||||||
time_hours_per_case: 0.5
|
|
||||||
source_norm: ${{ normalize.norm.eli }}
|
|
||||||
tier: ${{ cohort.cohort.tier }}
|
|
||||||
|
|
||||||
- id: frust
|
|
||||||
use: text.readability_score@^0
|
|
||||||
with:
|
|
||||||
norm: ${{ normalize.norm }}
|
|
||||||
graph: ${{ citations.citations }}
|
|
||||||
|
|
||||||
- id: benefit
|
|
||||||
use: law.benefit_score@^0
|
|
||||||
with:
|
|
||||||
ratings:
|
|
||||||
schutz: 2.0
|
|
||||||
markt: 3.0
|
|
||||||
rechtssicherheit: 3.5
|
|
||||||
eu_binnenmarkt: 2.0
|
|
||||||
sicherheit: 1.5
|
|
||||||
umwelt: 0.0
|
|
||||||
einnahmen: 2.0
|
|
||||||
_sources:
|
|
||||||
schutz: NKR Stellungnahme zur GewO 2018
|
|
||||||
rechtssicherheit: IHK Berlin Mittelstandsumfrage 2024
|
|
||||||
|
|
||||||
# Attribution-Schritt mit Demo-Graph aus citations.
|
|
||||||
# Phase 1: graph.normalize baut den vollen Norm-Graph hier.
|
|
||||||
- id: attribution
|
|
||||||
use: graph.shapley_attribution@^0
|
|
||||||
with:
|
|
||||||
graph:
|
|
||||||
nodes:
|
|
||||||
- ${{ normalize.norm.eli }}
|
|
||||||
- eli/bund/gewo
|
|
||||||
edges:
|
|
||||||
- from: eli/bund/gewo
|
|
||||||
to: ${{ normalize.norm.eli }}
|
|
||||||
target: ${{ normalize.norm.eli }}
|
|
||||||
|
|
||||||
# Juristen-Gate — Studie §3.3 macht das obligatorisch.
|
|
||||||
- id: review
|
- id: review
|
||||||
use: system.approval@^0
|
use: system.approval@^0
|
||||||
with:
|
with:
|
||||||
title: "Recl∆Im (F∆I) — Review ${{ normalize.norm.eli }}"
|
title: "Recl∆Im — Review GewO §14"
|
||||||
payload:
|
payload: $normalize.norm
|
||||||
norm: ${{ normalize.norm }}
|
|
||||||
skm: ${{ skm.report }}
|
outputs:
|
||||||
benefit: ${{ benefit.score }}
|
norm: $normalize.norm
|
||||||
frust: ${{ frust.score }}
|
cohort: $cohort.cohort
|
||||||
cohort: ${{ cohort.cohort }}
|
decision: $review.decision
|
||||||
|
|
|
||||||
16
flows/test-cohort.yaml
Normal file
16
flows/test-cohort.yaml
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
# Minimal-Test: nur stats.cohort_size, ohne externe Calls.
|
||||||
|
# Beweist, dass meine Module mit dem Hub-ABI kompatibel sind.
|
||||||
|
|
||||||
|
name: test-cohort
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
cohort_id: text
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- id: cohort
|
||||||
|
use: stats.cohort_size@^0
|
||||||
|
with:
|
||||||
|
cohort_id: $inputs.cohort_id
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
cohort: $cohort.cohort
|
||||||
Loading…
Add table
Add a link
Reference in a new issue