ahbicht package
Subpackages
- ahbicht.content_evaluation package
- Submodules
- ahbicht.content_evaluation.ahb_context module
- ahbicht.content_evaluation.evaluationdatatypes module
- ahbicht.content_evaluation.evaluator_factory module
- ahbicht.content_evaluation.evaluators module
- ahbicht.content_evaluation.expression_check module
- ahbicht.content_evaluation.fc_evaluators module
- ahbicht.content_evaluation.german_strom_and_gas_tag module
EdifactDateTimeFormatEdifactDateTimeFormat.CCYYEdifactDateTimeFormat.CCYYMMEdifactDateTimeFormat.CCYYMMDDEdifactDateTimeFormat.CCYYMMDDHHMMEdifactDateTimeFormat.CCYYMMDDHHMMSSEdifactDateTimeFormat.CCYYMMDDHHMMSSZZZEdifactDateTimeFormat.CCYYMMDDHHMMZZZEdifactDateTimeFormat.MMEdifactDateTimeFormat.MMDDEdifactDateTimeFormat.MMWWMMWWEdifactDateTimeFormat.ZZRB
has_no_utc_offset()is_gastag_limit()is_stromtag_limit()is_xtag_limit()parse_as_datetime()
- ahbicht.content_evaluation.rc_evaluators module
- ahbicht.content_evaluation.token_logic_provider module
- Module contents
- ahbicht.expressions package
- Submodules
- ahbicht.expressions.ahb_expression_evaluation module
- ahbicht.expressions.ahb_expression_parser module
- ahbicht.expressions.base_transformer module
- ahbicht.expressions.condition_expression_parser module
- ahbicht.expressions.expression_builder module
- ahbicht.expressions.expression_resolver module
- ahbicht.expressions.format_constraint_expression_evaluation module
- ahbicht.expressions.hints_provider module
- ahbicht.expressions.package_expansion module
- ahbicht.expressions.requirement_constraint_expression_evaluation module
- ahbicht.expressions.sanitizer module
- Module contents
- ahbicht.json_serialization package
- ahbicht.models package
- Submodules
- ahbicht.models.categorized_key_extract module
CategorizedKeyExtractCategorizedKeyExtract.format_constraint_keysCategorizedKeyExtract.generate_possible_content_evaluation_results()CategorizedKeyExtract.hint_keysCategorizedKeyExtract.model_configCategorizedKeyExtract.package_keysCategorizedKeyExtract.requirement_constraint_keysCategorizedKeyExtract.sanitize()CategorizedKeyExtract.time_condition_keys
CategorizedKeyExtracts
- ahbicht.models.condition_node_type module
- ahbicht.models.condition_nodes module
- ahbicht.models.content_evaluation_result module
- ahbicht.models.enums module
- ahbicht.models.evaluation_results module
- ahbicht.models.mapping_results module
- Module contents
Submodules
ahbicht.condition_node_builder module
Module for taking all the condition keys of a condition expression and building their respective ConditionNodes. If necessary it evaluates the needed attributes.
- class ahbicht.condition_node_builder.ConditionNodeBuilder(condition_keys: list[str], ahb_context: AhbContext)[source]
Bases:
objectBuilds ConditionNodes for the given condition_keys by separating them into their respective types and evaluating the necessary attributes. It distinguishes between requirement constraint evaluation and format constraint evaluation.
- async requirement_content_evaluation_for_all_condition_keys() dict[str, RequirementConstraint | UnevaluatedFormatConstraint | Hint][source]
Gets input nodes for all condition keys.
ahbicht.condition_node_distinction module
A module to allow easy distinction between different types of condition nodes (by mapping their integer key)
- ahbicht.condition_node_distinction.PACKAGE_1P_HINT_KEY: str = '9999'
A special, hardcoded condition key that is used when resolving the package ‘1P’.
Background: Package ‘1P’ is defined to always resolve to a hint node, regardless of any PackageResolver configuration. Unlike other packages (e.g. ‘2P’, ‘3P’, …) which are resolved dynamically via a PackageResolver that maps package keys to condition expressions, ‘1P’ is treated as a special case and directly converted to a hint.
Why we chose this approach:
Hint condition keys are normally in the range 500-900 (as defined by EDI@Energy “Allgemeine Festlegungen”).
We cannot use any key in the 500-900 range because those keys may already be taken by actual hints defined in the AHB documents. Using an existing key would cause conflicts.
By using 9999 (a number well outside all defined ranges), we ensure no collision with any existing condition keys while still being able to leverage the existing hint infrastructure.
This constant is used in multiple places: in derive_condition_node_type() to recognize 9999 as a HINT type, in PackageExpansionTransformer to resolve ‘1P’ to this key, and in HintsProvider implementations to provide a hardcoded hint text for this key.
The hint text for this key is hardcoded as “Hinweis: Das ist das Standardpaket, wenn keine Bedingung zum Tragen kommt, z.B. im COM-Segment.” in the HintsProvider base class.
- ahbicht.condition_node_distinction.derive_condition_node_type(condition_key: str) ConditionNodeType[source]
Returns the corresponding type of condition node for a given condition key
ahbicht.utility_functions module
Functions that are not clearly related to another module
- async ahbicht.utility_functions.gather_if_necessary(results_and_awaitable_results: list[Result | Awaitable[Result]]) list[Result][source]
Await the awaitables, pass the un-awaitable results :param results_and_awaitable_results: heterogeneous list of both Ts and Awaitable[T]s. :return: list of T in the same order as in the input param.
- ahbicht.utility_functions.parse_repeatability(repeatability_string: str) Repeatability[source]
parses the given string as repeatability; e.g. 17..23 is parsed as min=17, max=23
- ahbicht.utility_functions.tree_copy(lru_cached_parsing_func: Callable[[str], Tree[Token]]) Callable[[str], Tree[Token]][source]
A decorator that returns copy of the cached result from the lru_cached_parsing_func. Rationale: We want to cache the tree for various expressions because this is definitely faster than re-parsing it. But we don’t want the same instance of the tree to be returned over and over again, because the calling code might modify the tree and (if we always returned the same instance) might also modify the cache entry. We don’t want this. The tree_copy decorator is used together shall be used with a @lru_cached function. It returns a copy of the cached value instead of the same instance. :param lru_cached_parsing_func: A function that parses a string to a tree which is decorated with @lru_cache. :return: the decorated function that always returns a copy of the cached result instead of the same instance
Module contents
AHBicht is a lark based parser and evaluation framework for conditions that occur in Anwendungshandbüchern (AHB).