feat: Itinerary manager to enable itinerary modification#113
Open
erik-rosenstrom wants to merge 9 commits intoetr-school-closurefrom
Open
feat: Itinerary manager to enable itinerary modification#113erik-rosenstrom wants to merge 9 commits intoetr-school-closurefrom
erik-rosenstrom wants to merge 9 commits intoetr-school-closurefrom
Conversation
a56da6b to
6d10055
Compare
This file contains hidden or 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
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.
This PR implements an itinerary manager which modifies an individual's itinerary based on their person properties. The itinerary manager defines an itinerary modifier struct which has elements ranking, itinerary ratios, and modifier type. These modifiers are stored in a data plugin. The data plugin consists of a hashmap with the structure
HashMap<Property<Person>, HashMap<Property<Person>::CanonicalValue, Vec[ItineraryModifier]>>This data structure enables multiple itinerary modifiers to be registered with a single person property. The following methods are implemented in a context trait extension to interact with this data pluginregister_itinerary_modifier: given a person property and value likeAge(11)and an itinerary modifier, this method stores the person property and value and itinerary modifier in the data plugin. If an entry exists for the property and value the itinerary modifier is appended to the end of the vector.remove_itinerary_modifier_by_property: removes the entire vector of itinerary modifiers associated with a property and value. This does not remove the property entryremove_itinerary_modifier_by_property_and_type: removes a specific element withmodifier_typefrom the vector associated with property and valueget_itinerary_modifiers: iterates over all property and values in the data plugin and assess if the person of interest matches the property values. It returns a vector of all itinerary modifiers that match the person.get_dominant_itinerary_modifier: callsget_itinerary_modifierssorts them by ranking and pops the highest ranking modifier