Profile Files

What a profile is: mig.json and ahb.json, generated from the BDEW MIG and AHB PDFs, keyed by the MIG's running segment number.

View as Markdown

On this page 4 sections

A profile is one MIG and one AHB of one format version, as two files under crates/edi-energy/profiles/<type>/<fvYYYYMMDD>/. Both are generated by cargo xtask import-profiles from the BDEW PDFs named in profiles/sources.json, and both carry schema_version: 2.

mig.json — the Nachrichtenbeschreibung

FieldContent
message_type, release, trackUTILMD, the UNH DE 0057 wire code, Strom/Gas where one message type has two MIGs
valid_from, valid_until, publikationsdatum, ahb_versionthe Anwendungszeitpunkt window and the AHB the MIG pairs with
pid_source, pid_exemptpreferred location for scanning (rff_z13 or bgm_de1004). Validation selects APERAK's named columns by BGM DE 1001. CONTRL has pid_exempt and selects by best fit.
sourcethe PDF filename, title, SHA-256 of the bytes read and normalized pdftotext version
structurethe Nachrichtenstruktur as a tree of groups (group, status, max, children) and segments (nr, tag, status, max, elements)
envelopethe UNB/UNZ layouts, outside the message

Every segment carries the MIG's running number Nr (00047) and its Segmentlayout: data elements with BDEW status (M, R, C, D, O, N; groups and segments use M/R/D/O), format (an..35, n11), note and admitted codes, composites with their components. The Nr is what tells two places of the same tag apart — SG5 LOC+Z16 Marktlokation and SG5 LOC+Z17 Messlokation are two nodes with two layouts.

ahb.json — the Anwendungshandbuch

FieldContent
conditionsevery Bedingung as printed, by number: Voraussetzungen 1–499, Hinweise 500–899, Formatbedingungen 901–999, Wiederholbarkeiten 2000–2499, UB1–UB3
packagesPakete (1P) with their Paketvoraussetzung
anwendungsfaelleone entry per AHB column — the Prüfschablone

A Prüfschablone has pid, name, communication, chapter, rows (the status of each segment nr or group — Muss, Muss [10], Soll [3] ∧ [4]) and elements (per nr and data element, the operands on its codes or on the value — X, X [UB1], M [7]). CONTRL stores its three columns without a pid and selects them by best fit. For APERAK, 29001 and 29002 are local selectors for Fehlermeldung and Anerkennungsmeldung. The wire selector is BGM DE 1001 (APERAK AHB 1.1, ch. 3, pp. 26–27).

What the runtime does with them

  • Structure compiles the MIG into a resolver that assigns every segment of a message to its Nr — the leading qualifier tells places apart, a stray segment is reported and skipped rather than derailing the rest.
  • Profile::validate runs the MIG checks (structure, cardinality, layout) and the column's Prüfschablone, and evaluates Voraussetzungen against the message (Wenn SG5 LOC+Z17 nicht vorhanden, Wenn SG10 QTY DE6063 mit Wert 67 vorhanden, mehr als einmal vorhanden).
  • Profile::skeleton generates the minimal message a column admits; every Anwendungsfall's skeleton validating against its own column is the test that extraction and validator agree (tests/it/skeletons.rs).
  • Profile::pruefschablone(pid) prints the column for a reader.

Versioning

schema_version is the shape of these files. A new shape is a new number, a re-import of every profile and a matching change in crates/edi-energy/src/profile/model.rs; nothing reads an older shape. Additive fields are #[serde(default)] and need no bump.

validate-profiles holds the committed files against sources.json (release, dates, AHB version, document names), against each other (every AHB row names a Nr the MIG has, every column lists UNH, Prüfidentifikatoren are five digits and unique), and checks both source records against the tracked mirror manifest and xtask/pdftotext-version. This works offline. With the PDFs present, import-profiles --check repeats extraction and compares the generated files.

Edit this page ↗