Skip to main content

Crate edifact_mapper

Crate edifact_mapper 

Source
Expand description

§edifact-mapper

EDIFACT to BO4E bidirectional conversion for the German energy market.

This crate provides a high-level Mapper API that loads precompiled DataBundle files and exposes ConversionService and MappingEngine instances for specific format versions, message variants, and PIDs.

§Quick Start

use edifact_mapper::{DataDir, Mapper};

// Auto-detect data directory ($EDIFACT_DATA_DIR or ~/.edifact/data)
let mapper = Mapper::from_data_dir(DataDir::auto())?;

// Or explicit path with eager loading
let mapper = Mapper::from_data_dir(
    DataDir::path("/opt/edifact/data").eager(&["FV2504"])
)?;

// Get a conversion service for EDIFACT parsing + MIG assembly
let cs = mapper.conversion_service("FV2504", "UTILMD_Strom")?;

// Get a mapping engine for a specific PID
let engine = mapper.engine("FV2504", "UTILMD_Strom", "55001")?;

§Mid-level Access

For advanced use cases, key types from internal crates are re-exported:

Re-exports§

pub use data_dir::DataDir;
pub use error::MapperError;
pub use mapper::Bo4eResult;
pub use mapper::Mapper;
pub use edifact_parser;

Modules§

data_dir
Data directory configuration for locating DataBundle files on disk.
error
Error types for the edifact-mapper facade crate.
evaluator_factory
Factory for creating condition evaluators by variant name and format version.
mapper
High-level Mapper API for EDIFACT-to-BO4E conversion.

Structs§

AssembledTree
A generic assembled tree node (before PID-specific typing).
ConversionService
High-level service that holds a parsed MIG schema and provides convenient methods for EDIFACT conversion.
DataBundle
Bundled data for a single format version (e.g., FV2504).
MappingEngine
The mapping engine holds all loaded mapping definitions and provides methods for bidirectional conversion.
ValidationReport
A collection of validation errors for a PID.
VariantCache
Precompiled cache for a single format-version/variant (e.g., FV2504/UTILMD_Strom).

Enums§

PidValidationError
A single PID validation error.

Functions§

validate_with_conditions
Validate a BO4E JSON value against PID requirements with AHB condition awareness.