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
Reintroduce detail level system #943
Merged
PiTrem
merged 74 commits into
ComPlat:development-5
from
megorei:reintroduce-detail-level-system-for-reports
Oct 18, 2022
Merged
Reintroduce detail level system #943
PiTrem
merged 74 commits into
ComPlat:development-5
from
megorei:reintroduce-detail-level-system-for-reports
Oct 18, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This class reimplements the logic from the ElementPermissionProxy. As the name suggests, it only calculates the detail levels (more efficiently I think). It does explicitly NOT include functionality to serialize elements. This should be done separately (see ApplicationEntity#entity_for_level).
- anonymize_below: X -> anonymizes the field with a default string if the current detail level of the object is lower than X - anonymize_with: Y -> uses Y as a replacement when a value gets anonymized
…ntend and the anonymization code was broken anyway
As we discussed, we will only use the simpler logic of nested_detail_levels, based on the maximum configured level over all accessible collections. This removes a lot of special cases (that were not required anyway). Further optimization will be possible when the shared and synced collections feature gets merged, so we only have one of those left.
…from ReactionEntity
When no detail levels are configured, 10 is returned for every requested class. When detail levels are configured, every request for an unconfigured class returns 0, configured classes return their respective configuration. This allows us to use simple hashes in our specs, instead of relying on the result of the ElementDetailLevelCalculator.
The spec tries to parse a Xlsx file generated by Axlsx using Roo. The currently used Roo gem has a parser implementation that does not properly understand the valid xml structure Axlsx generates, so the spec fails. The newer version Roo 2.9.0 appears to have addressed this bug but requires Ruby 2.7 to run. Until we complete the Rails 6 Upgrade, this spec is pending
matt-hh
changed the title
Reintroduce detail level system for reports
Reintroduce Detail Level system
Oct 13, 2022
matt-hh
changed the title
Reintroduce Detail Level system
Reintroduce detail level system
Oct 14, 2022
PiTrem
approved these changes
Oct 18, 2022
mehreenmansur
pushed a commit
that referenced
this pull request
Dec 12, 2022
* Create infrastructure to configure Entities for different Detail Levels * Introduce ElementDetailLevelCalculator This class reimplements the logic from the ElementPermissionProxy. As the name suggests, it only calculates the detail levels (more efficiently I think). It does explicitly NOT include functionality to serialize elements. This should be done separately (see ApplicationEntity#entity_for_level). * Fix some lint issues * Fix internal datastructure in ElementDetailLevelCalculator * Fix bugs in ElementDetailLevelCalculator * Add expose! method with additional features - anonymize_below: X -> anonymizes the field with a default string if the current detail level of the object is lower than X - anonymize_with: Y -> uses Y as a replacement when a value gets anonymized * Some fixes * Fix usage of with_options * Fix specs * Add specs for calculator and application entity * Use with_options to make SampleEntity a little more readable * Remove analyses field from sample entity as it is not used in the frontend and the anonymization code was broken anyway * Introduce detail levels into WellplateEntity * Introduce detail levels to WellEntity * Fix well entity * Fix anonymization bugs in SampleEntity * Use expose! in WellplateEntity and fix some anonymizations * Use expose! in WellEntity and fix double expose of readouts * Rework ResearchPlanEntity a little, but it does not use anonymization anyway * Introduce detail levels into Screen * Fix syntax bug in ResearchPlanEntity * Fix ElementDetailLevelCalculatorSpec * Remove detail_level method from ElementDetailLevelCalculator As we discussed, we will only use the simpler logic of nested_detail_levels, based on the maximum configured level over all accessible collections. This removes a lot of special cases (that were not required anyway). Further optimization will be possible when the shared and synced collections feature gets merged, so we only have one of those left. * Reintroduce anonymization to ElementAPI * Reintroduce anonymization to SampleAPI * Reintroduce anonymization to ScreenAPI * Reintroduce anonymization to SearchAPI * Reintroduce anonymization to WellplateAPI * Reintroduce anonymization to ResearchPlanAPI * Reintroduce anonymization into ReactionAPI * WIP find a better workflow to test entities * Fix logic bug in ApplicationEntity that made anonymization options within with_options not work properly * Add final spec for sample entity * Add specs for 2 special cases * Add specs for well entity * Add specs for wellplate entity * Fix some linter issues * Fix more rubocop issues * Fix rubocop issues in classes * Add specs for screen entity * Update ResearchPlanEntity * Add anonymization to SampleReportEntity * Refactor LiteratureEntity * Make literatures method in SampleReportEntity private * Fix invocation of ElementDetailLevelCalculator in ReactionAPI * Inntroduce anonymization to ReactionEntity * Add default for detail_levels in ElementDetailLevelCalculator * Fix specs that broke after introducing anonymization * Use expose! in ReactionMaterialEntity * Introduce anonymization and analyses into ReactionMaterialReportEntity * Fix syntax issue in SampleReportEntity * Fix filenames of several spec files * Prevent deprecation warnings about unsafe SQL strings * Fix reporter specs for csv and html * Raise exception when inkscape is not installed * Rework ReactionReportEntity to include anonymization and inheritance from ReactionEntity * Introduce anonymization into ElementEntity * Reintroduce detail levels into GenericElementAPI * Make PurificationSolvents available for DetailLevel0 * Add specs for research plan entity * WIP Add specs for reaction * Make usage of ApplicationEntity#detail_levels less error-prone When no detail levels are configured, 10 is returned for every requested class. When detail levels are configured, every request for an unconfigured class returns 0, configured classes return their respective configuration. This allows us to use simple hashes in our specs, instead of relying on the result of the ElementDetailLevelCalculator. * Unify usage of expose! in ReactionMaterialEntity * Set Reporter::Xlsx::ReactionList spec to pending The spec tries to parse a Xlsx file generated by Axlsx using Roo. The currently used Roo gem has a parser implementation that does not properly understand the valid xml structure Axlsx generates, so the spec fails. The newer version Roo 2.9.0 appears to have addressed this bug but requires Ruby 2.7 to run. Until we complete the Rails 6 Upgrade, this spec is pending * Add reaction entity spec * Add spec for sample report spec * Reintroduce Detail levels to some more codepaths * Fix reaction material Entity to display analyses properly * Remove fcontext and binding.pry * Add ci image with inkscape dependency * Fix ci image again * Add a working ci image * Fix spec * Disable spec with missing dependency Co-authored-by: Johannes Haubold <jh@megorei.com>
TasnimMehzabin
pushed a commit
that referenced
this pull request
Mar 24, 2023
* Create infrastructure to configure Entities for different Detail Levels * Introduce ElementDetailLevelCalculator This class reimplements the logic from the ElementPermissionProxy. As the name suggests, it only calculates the detail levels (more efficiently I think). It does explicitly NOT include functionality to serialize elements. This should be done separately (see ApplicationEntity#entity_for_level). * Fix some lint issues * Fix internal datastructure in ElementDetailLevelCalculator * Fix bugs in ElementDetailLevelCalculator * Add expose! method with additional features - anonymize_below: X -> anonymizes the field with a default string if the current detail level of the object is lower than X - anonymize_with: Y -> uses Y as a replacement when a value gets anonymized * Some fixes * Fix usage of with_options * Fix specs * Add specs for calculator and application entity * Use with_options to make SampleEntity a little more readable * Remove analyses field from sample entity as it is not used in the frontend and the anonymization code was broken anyway * Introduce detail levels into WellplateEntity * Introduce detail levels to WellEntity * Fix well entity * Fix anonymization bugs in SampleEntity * Use expose! in WellplateEntity and fix some anonymizations * Use expose! in WellEntity and fix double expose of readouts * Rework ResearchPlanEntity a little, but it does not use anonymization anyway * Introduce detail levels into Screen * Fix syntax bug in ResearchPlanEntity * Fix ElementDetailLevelCalculatorSpec * Remove detail_level method from ElementDetailLevelCalculator As we discussed, we will only use the simpler logic of nested_detail_levels, based on the maximum configured level over all accessible collections. This removes a lot of special cases (that were not required anyway). Further optimization will be possible when the shared and synced collections feature gets merged, so we only have one of those left. * Reintroduce anonymization to ElementAPI * Reintroduce anonymization to SampleAPI * Reintroduce anonymization to ScreenAPI * Reintroduce anonymization to SearchAPI * Reintroduce anonymization to WellplateAPI * Reintroduce anonymization to ResearchPlanAPI * Reintroduce anonymization into ReactionAPI * WIP find a better workflow to test entities * Fix logic bug in ApplicationEntity that made anonymization options within with_options not work properly * Add final spec for sample entity * Add specs for 2 special cases * Add specs for well entity * Add specs for wellplate entity * Fix some linter issues * Fix more rubocop issues * Fix rubocop issues in classes * Add specs for screen entity * Update ResearchPlanEntity * Add anonymization to SampleReportEntity * Refactor LiteratureEntity * Make literatures method in SampleReportEntity private * Fix invocation of ElementDetailLevelCalculator in ReactionAPI * Inntroduce anonymization to ReactionEntity * Add default for detail_levels in ElementDetailLevelCalculator * Fix specs that broke after introducing anonymization * Use expose! in ReactionMaterialEntity * Introduce anonymization and analyses into ReactionMaterialReportEntity * Fix syntax issue in SampleReportEntity * Fix filenames of several spec files * Prevent deprecation warnings about unsafe SQL strings * Fix reporter specs for csv and html * Raise exception when inkscape is not installed * Rework ReactionReportEntity to include anonymization and inheritance from ReactionEntity * Introduce anonymization into ElementEntity * Reintroduce detail levels into GenericElementAPI * Make PurificationSolvents available for DetailLevel0 * Add specs for research plan entity * WIP Add specs for reaction * Make usage of ApplicationEntity#detail_levels less error-prone When no detail levels are configured, 10 is returned for every requested class. When detail levels are configured, every request for an unconfigured class returns 0, configured classes return their respective configuration. This allows us to use simple hashes in our specs, instead of relying on the result of the ElementDetailLevelCalculator. * Unify usage of expose! in ReactionMaterialEntity * Set Reporter::Xlsx::ReactionList spec to pending The spec tries to parse a Xlsx file generated by Axlsx using Roo. The currently used Roo gem has a parser implementation that does not properly understand the valid xml structure Axlsx generates, so the spec fails. The newer version Roo 2.9.0 appears to have addressed this bug but requires Ruby 2.7 to run. Until we complete the Rails 6 Upgrade, this spec is pending * Add reaction entity spec * Add spec for sample report spec * Reintroduce Detail levels to some more codepaths * Fix reaction material Entity to display analyses properly * Remove fcontext and binding.pry * Add ci image with inkscape dependency * Fix ci image again * Add a working ci image * Fix spec * Disable spec with missing dependency Co-authored-by: Johannes Haubold <jh@megorei.com>
baolanlequang
pushed a commit
that referenced
this pull request
Mar 5, 2024
* Create infrastructure to configure Entities for different Detail Levels * Introduce ElementDetailLevelCalculator This class reimplements the logic from the ElementPermissionProxy. As the name suggests, it only calculates the detail levels (more efficiently I think). It does explicitly NOT include functionality to serialize elements. This should be done separately (see ApplicationEntity#entity_for_level). * Fix some lint issues * Fix internal datastructure in ElementDetailLevelCalculator * Fix bugs in ElementDetailLevelCalculator * Add expose! method with additional features - anonymize_below: X -> anonymizes the field with a default string if the current detail level of the object is lower than X - anonymize_with: Y -> uses Y as a replacement when a value gets anonymized * Some fixes * Fix usage of with_options * Fix specs * Add specs for calculator and application entity * Use with_options to make SampleEntity a little more readable * Remove analyses field from sample entity as it is not used in the frontend and the anonymization code was broken anyway * Introduce detail levels into WellplateEntity * Introduce detail levels to WellEntity * Fix well entity * Fix anonymization bugs in SampleEntity * Use expose! in WellplateEntity and fix some anonymizations * Use expose! in WellEntity and fix double expose of readouts * Rework ResearchPlanEntity a little, but it does not use anonymization anyway * Introduce detail levels into Screen * Fix syntax bug in ResearchPlanEntity * Fix ElementDetailLevelCalculatorSpec * Remove detail_level method from ElementDetailLevelCalculator As we discussed, we will only use the simpler logic of nested_detail_levels, based on the maximum configured level over all accessible collections. This removes a lot of special cases (that were not required anyway). Further optimization will be possible when the shared and synced collections feature gets merged, so we only have one of those left. * Reintroduce anonymization to ElementAPI * Reintroduce anonymization to SampleAPI * Reintroduce anonymization to ScreenAPI * Reintroduce anonymization to SearchAPI * Reintroduce anonymization to WellplateAPI * Reintroduce anonymization to ResearchPlanAPI * Reintroduce anonymization into ReactionAPI * WIP find a better workflow to test entities * Fix logic bug in ApplicationEntity that made anonymization options within with_options not work properly * Add final spec for sample entity * Add specs for 2 special cases * Add specs for well entity * Add specs for wellplate entity * Fix some linter issues * Fix more rubocop issues * Fix rubocop issues in classes * Add specs for screen entity * Update ResearchPlanEntity * Add anonymization to SampleReportEntity * Refactor LiteratureEntity * Make literatures method in SampleReportEntity private * Fix invocation of ElementDetailLevelCalculator in ReactionAPI * Inntroduce anonymization to ReactionEntity * Add default for detail_levels in ElementDetailLevelCalculator * Fix specs that broke after introducing anonymization * Use expose! in ReactionMaterialEntity * Introduce anonymization and analyses into ReactionMaterialReportEntity * Fix syntax issue in SampleReportEntity * Fix filenames of several spec files * Prevent deprecation warnings about unsafe SQL strings * Fix reporter specs for csv and html * Raise exception when inkscape is not installed * Rework ReactionReportEntity to include anonymization and inheritance from ReactionEntity * Introduce anonymization into ElementEntity * Reintroduce detail levels into GenericElementAPI * Make PurificationSolvents available for DetailLevel0 * Add specs for research plan entity * WIP Add specs for reaction * Make usage of ApplicationEntity#detail_levels less error-prone When no detail levels are configured, 10 is returned for every requested class. When detail levels are configured, every request for an unconfigured class returns 0, configured classes return their respective configuration. This allows us to use simple hashes in our specs, instead of relying on the result of the ElementDetailLevelCalculator. * Unify usage of expose! in ReactionMaterialEntity * Set Reporter::Xlsx::ReactionList spec to pending The spec tries to parse a Xlsx file generated by Axlsx using Roo. The currently used Roo gem has a parser implementation that does not properly understand the valid xml structure Axlsx generates, so the spec fails. The newer version Roo 2.9.0 appears to have addressed this bug but requires Ruby 2.7 to run. Until we complete the Rails 6 Upgrade, this spec is pending * Add reaction entity spec * Add spec for sample report spec * Reintroduce Detail levels to some more codepaths * Fix reaction material Entity to display analyses properly * Remove fcontext and binding.pry * Add ci image with inkscape dependency * Fix ci image again * Add a working ci image * Fix spec * Disable spec with missing dependency Co-authored-by: Johannes Haubold <jh@megorei.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.