Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨Implement Packages #72

Closed
wants to merge 32 commits into from
Closed

✨Implement Packages #72

wants to merge 32 commits into from

Conversation

hf-kklein
Copy link
Contributor

@hf-kklein hf-kklein commented Oct 26, 2021

fixes #23

What it does

  • Introduces PackageResolver: The base class of all classes that translat a package key (f.e. '123P'->"[1] U ([2] O [3]) to a condition expression (using the PackageKeyConditionExpressionMapping)
  • Introduces hardcoded/dictbased Package Resolver

̶W̶h̶a̶t̶'̶s̶ ̶s̶t̶i̶l̶l̶ ̶m̶i̶s̶s̶i̶n̶g̶:

  • s̶o̶ ̶f̶a̶r̶ ̶w̶e̶ ̶m̶i̶s̶s̶ ̶t̶h̶e̶ ̶p̶o̶s̶s̶i̶b̶i̶l̶i̶t̶y̶ ̶t̶o̶ ̶e̶v̶a̶l̶u̶a̶t̶e̶ ̶a̶ ̶p̶a̶c̶k̶a̶g̶e̶ ̶a̶s̶ ̶a̶ ̶w̶h̶o̶l̶e̶/̶s̶h̶o̶r̶t̶c̶u̶t̶ ̶(̶f̶.̶e̶.̶ ̶"̶1̶2̶3̶P̶"̶-̶>̶F̶u̶l̶f̶i̶l̶l̶e̶d̶)̶ => we won't build this.

@hf-kklein hf-kklein self-assigned this Oct 26, 2021
@hf-kklein hf-kklein changed the title Implement Packages ✨Implement Packages Oct 26, 2021
@hf-kklein

This comment has been minimized.

@hf-kklein hf-kklein marked this pull request as ready for review January 2, 2022 16:54
@hf-kklein hf-kklein requested a review from a team January 21, 2022 13:10
Copy link
Collaborator

@hf-aschloegl hf-aschloegl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Die Test schauen soweit ja gut aus, aber ich hatte doch ein paar Schwierigkeiten beim Nachvollziehen. Nachdem die Packages ja wieder ein größerer Baustein sind, könntest du die README und das Ablaufdiagramm anpassen, damit man die Idee dahinter nachvollziehen kann? Mir ist der gedachte Ablauf noch nicht hundertpro klar.
Besonders den einen Punkt den ich auch im Code angemerkt habe, wieso das eine Attribut sowohl die resolved packages, auch auch ihr evaluation result beinhalten sollte.
Vielleicht liegt das auch an der Idee des Shortcuts das Paket auszuwerten ohne es aufzulösen, aber das kannst du ja auch schon im Ablauf beschreiben ;)

Zweiter Punkt, war es Absicht nur die Pakete in der [INT P] Form zu behandeln? Weil oft ist ja auch noch die Wiederholung hinten dran a la [3P0..1].
Und können wir die Grammatik nicht direkt benutzen die Pakete als Pakete zu definieren und weiterzubenutzen, statt später nochmal mit regex oder ähnlichem wieder rauszusammeln?

@@ -101,6 +123,7 @@ def generate_possible_content_evaluation_results(self) -> List[ContentEvaluation
if fc_kvp[0] != "fc_dummy"
},
requirement_constraints={rc_kvp[0]: rc_kvp[1] for rc_kvp in fc_rc_tuple[1] if rc_kvp[0] != "rc_dummy"},
packages={},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ist das auch erstmal nur ein Dummy? Falls ja, kannst du dazu einen kurzen Kommentar schreiben?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kommentar ist da.

Comment on lines +72 to +73
maps the key of a package (e.g. '123') to the respective expression (e.g. '[1] U ([2] O [3])'
OR to a condition fulfilled value that applies to the entire package.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Das fühlt sich komisch an entweder die resolved expressionvom package da reinzuschreiben oder den condition fulfilled value.
Kannst du mir die beiden Fälle erklären, wann man welchen braucht und warum sie im selben Attribut sein sollen?

Copy link
Contributor Author

@hf-kklein hf-kklein Jan 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ja, ich dachte s wäre praktisch. aber es ist in der tat schwieriger zu erklären, warum wir das wollen. und

if it's hard to explain...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

habe das ausgebaut.

src/ahbicht/expressions/base_transformer.py Outdated Show resolved Hide resolved
| condition_key
?brackets: "(" expression ")"
package: "[" INT "P]"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Damit fängst du aber noch nicht die Pakete ab, bei denen die Wiederholungen mit angegeben werden, z.B. [3P0..1]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

das war mir nicht klar, dass da noch mehr kommt

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ich würde die wiederholbarkeiten #96 gerne nicht in diesem PR machen.

Comment on lines 112 to 114
# as of now the packages are extracted separatly via their rule, not by analyzing the key
# elif condition_node_type is ConditionNodeType.PACKAGE:
# result.package_keys.append(condition_key)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kannst du auch noch den Grund nennen, wieso?

@@ -130,5 +151,5 @@ def test_possible_cer_generation_large_results(self, test_file_path, datafiles):
categoried_keys = CategorizedKeyExtractSchema().load(file_content["categorizedKeyExtract"])
expected_result = ContentEvaluationResultSchema(many=True).load(file_content["expected_result"])
actual = categoried_keys.generate_possible_content_evaluation_results()
json_string = ContentEvaluationResultSchema(many=True).dumps(actual)
# json_string = ContentEvaluationResultSchema(many=True).dumps(actual)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warum wurde das auskommentiert?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ich glaube nur, weil es nicht genutzt wurde.

@@ -90,19 +119,29 @@ def extract_categorized_keys_from_tree(
result.hint_keys.append(condition_key)
elif condition_node_type is ConditionNodeType.FORMAT_CONSTRAINT:
result.format_constraint_keys.append(condition_key)
elif condition_node_type is ConditionNodeType.PACKAGE:
result.package_keys.append(condition_key)
# As of now the packages are extracted separately via their rule, not by analyzing the key.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

und an der stelle bricht sehr viel zusammen...

There has to be a better way of doing this.
The rule name can either be "condition_key" or "package"
"""
# Prior to the introduction of packages we could simply loop over all the 'INT' terminals and be sure that
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hard to explain, ugly workaround

@hf-kklein
Copy link
Contributor Author

obsoleted by #116

@hf-kklein hf-kklein closed this Jan 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement "Packages" for EdifactFormatVersion.FV2204 (aka MaKo2022)
2 participants