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

chore: Demonstrate use of hashmap with new result objects for analysis storage #130

Merged
merged 7 commits into from
Jun 24, 2024

Conversation

j-lanson
Copy link
Collaborator

@j-lanson j-lanson commented Jun 19, 2024

This PR addresses the 4th task in #28 , showing how the new results.rs structs/enums can be used to replace AnalysisResults with a Hashmap<String, HCStoredResult>, enabling a future dynamic set of analyses to support the plugin architecture.

Particular focus on impl of struct AltAnalysisResults and the code savings of the following line:
let (act_score, outcome) = alt_results.table.get(ACTIVITY_PHASE).unwrap().score();

I also updated AnalysisResults::activity to be of type Option<HCStoredResults>. Since this makes it so the compiler cannot know the type is really ThresholdPredicate inside dyn HCPredicate, I had to do some Any wizardry and add as_any() as a trait func for HCPredicate so report_builder.rs could downcast it as such: let Some(pred) = analysis.as_any().downcast_ref::<ThresholdPredicate>(). This may be able to be removed in the future if new reporting infrastructure removes then need to access particular predicate fields.

@j-lanson j-lanson requested a review from alilleybrinker June 19, 2024 17:42
@alilleybrinker alilleybrinker changed the title refactor: demonstrate use of hashmap with new result objects for analysis storage chore: Demonstrate use of hashmap with new result objects for analysis storage Jun 21, 2024
@alilleybrinker alilleybrinker added the type: chore Clean up or management task. label Jun 21, 2024
@alilleybrinker alilleybrinker added this to the 3.4.0 milestone Jun 21, 2024
@alilleybrinker alilleybrinker merged commit 8fe00c7 into main Jun 24, 2024
9 checks passed
@j-lanson j-lanson deleted the jlanson/analysis-storage-refactor branch July 31, 2024 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: chore Clean up or management task.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants