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

Rule labels in regulations and regular regulations #97

Merged
merged 11 commits into from
Mar 20, 2024

Conversation

mopichalova
Copy link
Collaborator

@mopichalova mopichalova commented Mar 6, 2024

This pull request is ensuring all rule labels referenced in regulations exist within the model and makes sure that only correct regular expressions are allowed in regular regulation.

Invalid regulations now trigger new error RegulationParsingError.

Each regulation has now a method check_labels that makes sure labels mentioned in the regulation actually exist in the model.

Close #95
Close #88

@mopichalova
Copy link
Collaborator Author

I've implemented a check_labels method in the Regular regulation to ensure all rule labels used in a regex pattern actually exist in our model.

However, given that our labels are concatenated in the regex without any delimiters (e.g., spaces), I had to resort to generating all possible label permutations to validate against the regex. This approach ensures comprehensive validation but introduces significant time complexity due to the exhaustive permutation process.

I'm concerned about the performance impact and am currently exploring ways to optimize this operation. Do you have any suggestions or insights on more efficient methods to validate regex patterns against our label set without generating permutations? I'd greatly appreciate your input.

@xtrojak
Copy link
Collaborator

xtrojak commented Mar 10, 2024

Feel free to introduce some form of delimiters - don't pay attention to how it is right now.

eBCSgen/Parsing/ParseBCSL.py Outdated Show resolved Hide resolved
eBCSgen/Regulations/Programmed.py Outdated Show resolved Hide resolved
@mopichalova
Copy link
Collaborator Author

Feel free to introduce some form of delimiters - don't pay attention to how it is right now.

Introduced a ; delimiter for efficiency, ensuring it avoids regex conflicts and label definition. This change simplifies label processing in check_labels.

eBCSgen/Parsing/ParseBCSL.py Outdated Show resolved Hide resolved
eBCSgen/Parsing/ParseBCSL.py Show resolved Hide resolved
@xtrojak
Copy link
Collaborator

xtrojak commented Mar 17, 2024

I think we should also add tests covering these changes. We can discuss how to test this.

EDIT: to be continued in #101.

@xtrojak xtrojak merged commit 2e3b301 into sybila:improve-parsing Mar 20, 2024
1 of 2 checks passed
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.

2 participants