ahbicht package
Subpackages
- ahbicht.content_evaluation package
- Submodules
- ahbicht.content_evaluation.categorized_key_extract module
CategorizedKeyExtract
CategorizedKeyExtract.format_constraint_keys
CategorizedKeyExtract.generate_possible_content_evaluation_results()
CategorizedKeyExtract.hint_keys
CategorizedKeyExtract.package_keys
CategorizedKeyExtract.requirement_constraint_keys
CategorizedKeyExtract.sanitize()
CategorizedKeyExtract.time_condition_keys
CategorizedKeyExtractSchema
- ahbicht.content_evaluation.content_evaluation_result module
- ahbicht.content_evaluation.evaluationdatatypes module
- ahbicht.content_evaluation.evaluator_factory module
- ahbicht.content_evaluation.evaluators module
- ahbicht.content_evaluation.fc_evaluators module
- ahbicht.content_evaluation.german_strom_and_gas_tag module
- 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.condition_nodes module
- ahbicht.expressions.enums 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
- Module contents
- ahbicht.json_serialization package
- ahbicht.validation package
- Submodules
- ahbicht.validation.validation module
combine_requirements_of_different_levels()
get_segment_level_requirement_validation_value()
map_requirement_validation_values()
validate_data_element()
validate_data_element_freetext()
validate_data_element_valuepool()
validate_deep_anwendungshandbuch()
validate_segment()
validate_segment_group()
validate_segment_level()
- ahbicht.validation.validation_results module
DataElementValidationResult
DataElementValidationResultSchema
ListOfValidationResultInContext
ListOfValidationResultInContext.filter_for_boneycomb_path_results()
ListOfValidationResultInContext.filter_for_data_element_validation_results()
ListOfValidationResultInContext.remove_absender_and_empfaenger_path_results()
ListOfValidationResultInContext.replace_edi_domain_paths_with_application_domain_paths()
ListOfValidationResultInContext.validation_results
ListOfValidationResultInContextSchema
SegmentLevelValidationResult
SegmentLevelValidationResultSchema
ValidationResult
ValidationResultAttributesSchema
ValidationResultInContext
ValidationResultInContextSchema
ValidationResultSchema
- ahbicht.validation.validation_values module
RequirementValidationValue
RequirementValidationValue.IS_FORBIDDEN
RequirementValidationValue.IS_FORBIDDEN_AND_EMPTY
RequirementValidationValue.IS_FORBIDDEN_AND_FILLED
RequirementValidationValue.IS_OPTIONAL
RequirementValidationValue.IS_OPTIONAL_AND_EMPTY
RequirementValidationValue.IS_OPTIONAL_AND_FILLED
RequirementValidationValue.IS_REQUIRED
RequirementValidationValue.IS_REQUIRED_AND_EMPTY
RequirementValidationValue.IS_REQUIRED_AND_FILLED
- 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])[source]
Bases:
object
Builds 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)
- class ahbicht.condition_node_distinction.ConditionNodeType(value)[source]
Bases:
StrEnum
Possible types of condition nodes. The value is usually determined using the key of the respective condition node. For the descriptions of the different types see also the README.
- FORMAT_CONSTRAINT = 'FORMAT_CONSTRAINT'
A Format Constraint (FC) is what edi@energy refers to as “Formatbedingung”. Other than requirement constraints (RC) format constraints do not refer to a data constellation in the edifact message as a whole (or at least parts of it) but to the value used at the place where the format constraint is used.
- HINT = 'HINT'
A Hint is a node whose text/description starts with “Hinweis”. It’s a text that cannot be interpreted automatically.
- PACKAGE = 'PACKAGE'
A package is an abbreviation for an expression.
- REPEATABILITY_CONSTRAINT = 'REPEATABILITY_CONSTRAINT'
Repeatability Constraints are what edi@energy refers to as “Wiederholbarkeiten”. They describe how often you may insert segment (groups) into a message (e.g. min. 1 but max 10 times).
- REQUIREMENT_CONSTRAINT = 'REQUIREMENT_CONSTRAINT'
A Requirement Constraint (RC) is what edi@energy refers to as “Voraussetzung”. It describes a data constellation that might (or might not) occur in a edifact message.
- 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.evaluation_results module
This module contains the classes for the evaluation results. A “result” is the outcome of an evaluation. It requires actual data to be present.
- class ahbicht.evaluation_results.AhbExpressionEvaluationResult(*, requirement_indicator: PrefixOperator | ModalMark, requirement_constraint_evaluation_result: RequirementConstraintEvaluationResult, format_constraint_evaluation_result: FormatConstraintEvaluationResult)[source]
Bases:
object
A class for the result of an ahb expression evaluation.
- format_constraint_evaluation_result: FormatConstraintEvaluationResult
- requirement_constraint_evaluation_result: RequirementConstraintEvaluationResult
- requirement_indicator: PrefixOperator | ModalMark
- class ahbicht.evaluation_results.AhbExpressionEvaluationResultSchema(*, only: Sequence[str] | AbstractSet[str] | None = None, exclude: Sequence[str] | AbstractSet[str] = (), many: bool = False, context: dict | None = None, load_only: Sequence[str] | AbstractSet[str] = (), dump_only: Sequence[str] | AbstractSet[str] = (), partial: bool | Sequence[str] | AbstractSet[str] | None = None, unknown: str | None = None)[source]
Bases:
Schema
A schema to (de-)serialize AhbExpressionEvaluationResults
- deserialize(data, **kwargs) AhbExpressionEvaluationResult [source]
Converts the barely typed data dictionary into an actual AhbExpressionEvaluationResult
- opts: SchemaOpts = <marshmallow.schema.SchemaOpts object>
- class ahbicht.evaluation_results.FormatConstraintEvaluationResult(*, format_constraints_fulfilled: bool, error_message: str | None = None)[source]
Bases:
object
A class for the result of the format constraint evaluation.
- class ahbicht.evaluation_results.FormatConstraintEvaluationResultSchema(*, only: Sequence[str] | AbstractSet[str] | None = None, exclude: Sequence[str] | AbstractSet[str] = (), many: bool = False, context: dict | None = None, load_only: Sequence[str] | AbstractSet[str] = (), dump_only: Sequence[str] | AbstractSet[str] = (), partial: bool | Sequence[str] | AbstractSet[str] | None = None, unknown: str | None = None)[source]
Bases:
Schema
A class to (de-)serialize FormatConstraintEvaluationResult
- deserialize(data, **kwargs) FormatConstraintEvaluationResult [source]
Converts the barely typed data dictionary into an actual FormatConstraintEvaluationResult :param data: :param kwargs: :return:
- opts: SchemaOpts = <marshmallow.schema.SchemaOpts object>
- class ahbicht.evaluation_results.RequirementConstraintEvaluationResult(*, requirement_constraints_fulfilled: bool | None, requirement_is_conditional: bool | None, format_constraints_expression: str | None = None, hints: str | None = None)[source]
Bases:
object
A class for the result of the requirement constraint evaluation.
- hints: str | None
‘ID der Messlokation’”
- Type:
Hint text that should be displayed in the frontend, e.g. “[501] Hinweis
- class ahbicht.evaluation_results.RequirementConstraintEvaluationResultSchema(*, only: Sequence[str] | AbstractSet[str] | None = None, exclude: Sequence[str] | AbstractSet[str] = (), many: bool = False, context: dict | None = None, load_only: Sequence[str] | AbstractSet[str] = (), dump_only: Sequence[str] | AbstractSet[str] = (), partial: bool | Sequence[str] | AbstractSet[str] | None = None, unknown: str | None = None)[source]
Bases:
Schema
A schema to (de-)serialize RequirementConstraintEvaluationResult
- deserialize(data, **kwargs) RequirementConstraintEvaluationResult [source]
Converts the barely typed data dictionary into an actual RequirementConstraintEvaluationResult :param data: :param kwargs: :return:
- opts: SchemaOpts = <marshmallow.schema.SchemaOpts object>
ahbicht.mapping_results module
This module contains classes that are returned by mappers, meaning they contain a mapping.
- class ahbicht.mapping_results.ConditionKeyConditionTextMapping(*, edifact_format: EdifactFormat, condition_key: str, condition_text: str | None = None)[source]
Bases:
object
maps a condition from a specified EDIFACT format onto a text as it is found in the AHB.
- condition_text: str | None
the description of the condition as in the AHB; None if unknown; e.g. ‘Wenn SG4 STS+7++E02 (Transaktionsgrund: Einzug/Neuanlage) nicht vorhanden’.
- edifact_format: EdifactFormat
the format in which the condition is used; e.g. ‘UTILMD’
- class ahbicht.mapping_results.ConditionKeyConditionTextMappingSchema(*, only: Sequence[str] | AbstractSet[str] | None = None, exclude: Sequence[str] | AbstractSet[str] = (), many: bool = False, context: dict | None = None, load_only: Sequence[str] | AbstractSet[str] = (), dump_only: Sequence[str] | AbstractSet[str] = (), partial: bool | Sequence[str] | AbstractSet[str] | None = None, unknown: str | None = None)[source]
Bases:
Schema
A schema to (de-)serialize
ConditionKeyConditionTextMapping
s- deserialize(data, **kwargs) ConditionKeyConditionTextMapping [source]
Converts the barely typed data dictionary into an actual
ConditionKeyConditionTextMapping
- opts: SchemaOpts = <marshmallow.schema.SchemaOpts object>
- class ahbicht.mapping_results.PackageKeyConditionExpressionMapping(*, edifact_format: EdifactFormat, package_key: str, package_expression: str | None = None)[source]
Bases:
object
maps a package key from a specified EDIFACT format onto a (not yet parsed) condition expression as it is found in the AHB.
- edifact_format: EdifactFormat
the format in which the package is used; e.g. ‘UTILMD’
- has_been_resolved_successfully() bool [source]
return true iff the package has been resolved successfully
- class ahbicht.mapping_results.PackageKeyConditionExpressionMappingSchema(*, only: Sequence[str] | AbstractSet[str] | None = None, exclude: Sequence[str] | AbstractSet[str] = (), many: bool = False, context: dict | None = None, load_only: Sequence[str] | AbstractSet[str] = (), dump_only: Sequence[str] | AbstractSet[str] = (), partial: bool | Sequence[str] | AbstractSet[str] | None = None, unknown: str | None = None)[source]
Bases:
Schema
A schema to (de-)serialize
PackageKeyConditionExpressionMapping
s- deserialize(data, **kwargs) PackageKeyConditionExpressionMapping [source]
Converts the barely typed data dictionary into an actual
PackageKeyConditionExpressionMapping
- opts: SchemaOpts = <marshmallow.schema.SchemaOpts object>
- class ahbicht.mapping_results.Repeatability(*, min_occurrences: int, max_occurrences: int)[source]
Bases:
object
describes how often a segment/code must be used when a “repeatability” is provided with packages
- is_optional() bool [source]
returns true if the package used together with this repeatability is optional
- ahbicht.mapping_results.check_max_greater_or_equal_than_min(instance: Repeatability, attribute, value)[source]
assert that 0<=min<max and not both min and max are 0
- ahbicht.mapping_results.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 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: heterogenous list of both Ts and Awaitable[T]s. :return: list of T in the same order as in the input param.
- ahbicht.utility_functions.tree_copy(lru_cached_parsing_func: Callable[[str], Tree])[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).