You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by GitBox <gi...@apache.org> on 2021/12/20 11:27:31 UTC

[GitHub] [unomi] sergehuber opened a new pull request #368: UNOMI-537 Add control groups to personalizations

sergehuber opened a new pull request #368:
URL: https://github.com/apache/unomi/pull/368


   - Personalizations will now store a control group election in the session or in the profile
   - Updated documentation for personalization
   - Implemented integration tests for control groups
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@unomi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [unomi] sergehuber commented on a change in pull request #368: UNOMI-537 Add control groups to personalizations

Posted by GitBox <gi...@apache.org>.
sergehuber commented on a change in pull request #368:
URL: https://github.com/apache/unomi/pull/368#discussion_r784117695



##########
File path: rest/src/main/java/org/apache/unomi/rest/endpoints/ContextJsonEndpoint.java
##########
@@ -378,6 +372,26 @@ private Changes handleRequest(ContextRequest contextRequest, Session session, Pr
         Changes changes = restServiceUtils.handleEvents(contextRequest.getEvents(), session, profile, request, response, timestamp);
         data.setProcessedEvents(changes.getProcessedItems());
 
+        List<PersonalizationService.PersonalizedContent> filterNodes = contextRequest.getFilters();
+        if (filterNodes != null) {
+            data.setFilteringResults(new HashMap<>());
+            for (PersonalizationService.PersonalizedContent personalizedContent : sanitizePersonalizedContentObjects(filterNodes)) {
+                data.getFilteringResults()
+                        .put(personalizedContent.getId(), personalizationService.filter(profile, session, personalizedContent));
+            }
+        }
+
+        List<PersonalizationService.PersonalizationRequest> personalizations = contextRequest.getPersonalizations();
+        if (personalizations != null) {
+            data.setPersonalizations(new HashMap<>());
+            for (PersonalizationService.PersonalizationRequest personalization : sanitizePersonalizations(personalizations)) {
+                PersonalizationResult personalizationResult = personalizationService.personalizeList(profile, session, personalization);
+                changes.setChangeType(changes.getChangeType() | personalizationResult.getChangeType());
+                data.getPersonalizations()
+                        .put(personalization.getId(), personalizationResult.getContentIds());
+            }
+        }
+

Review comment:
       I like this suggestion. Should we merge this first and then rewrite it or should we change directly in the same PR ? 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@unomi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [unomi] jkevan commented on a change in pull request #368: UNOMI-537 Add control groups to personalizations

Posted by GitBox <gi...@apache.org>.
jkevan commented on a change in pull request #368:
URL: https://github.com/apache/unomi/pull/368#discussion_r776750331



##########
File path: rest/src/main/java/org/apache/unomi/rest/endpoints/ContextJsonEndpoint.java
##########
@@ -378,6 +372,26 @@ private Changes handleRequest(ContextRequest contextRequest, Session session, Pr
         Changes changes = restServiceUtils.handleEvents(contextRequest.getEvents(), session, profile, request, response, timestamp);
         data.setProcessedEvents(changes.getProcessedItems());
 
+        List<PersonalizationService.PersonalizedContent> filterNodes = contextRequest.getFilters();
+        if (filterNodes != null) {
+            data.setFilteringResults(new HashMap<>());
+            for (PersonalizationService.PersonalizedContent personalizedContent : sanitizePersonalizedContentObjects(filterNodes)) {
+                data.getFilteringResults()
+                        .put(personalizedContent.getId(), personalizationService.filter(profile, session, personalizedContent));
+            }
+        }
+
+        List<PersonalizationService.PersonalizationRequest> personalizations = contextRequest.getPersonalizations();
+        if (personalizations != null) {
+            data.setPersonalizations(new HashMap<>());
+            for (PersonalizationService.PersonalizationRequest personalization : sanitizePersonalizations(personalizations)) {
+                PersonalizationResult personalizationResult = personalizationService.personalizeList(profile, session, personalization);
+                changes.setChangeType(changes.getChangeType() | personalizationResult.getChangeType());
+                data.getPersonalizations()
+                        .put(personalization.getId(), personalizationResult.getContentIds());
+            }
+        }
+

Review comment:
       We could consider using event mechanism to resolve the personalizations, since it can now modify the profile or the session it would make sense.
   And we would benefit from the "changes" return by the event evaluation instead of having to implement a changes handler inside the personalizaton layer.
   
   We would need:
   -  a new event: personalizationEvent that contains the perso(s) to be evaiuated
   - a new action: resolve personalizations
   - a new rules that listen on this event to resolve the perso
   
   The only blocking point would be getting the result of the perso from this kind of execution and pass it to the contextResponse as it was done before.
   May be we could store this in the event it self and catching those events here to get the result out of them.
   
   I dont know why, but I think trying to rely the more we can on rules/events/actions for internal mechanism improve the genericity of unomi features.
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@unomi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [unomi] jkevan commented on a change in pull request #368: UNOMI-537 Add control groups to personalizations

Posted by GitBox <gi...@apache.org>.
jkevan commented on a change in pull request #368:
URL: https://github.com/apache/unomi/pull/368#discussion_r784683001



##########
File path: rest/src/main/java/org/apache/unomi/rest/endpoints/ContextJsonEndpoint.java
##########
@@ -378,6 +372,26 @@ private Changes handleRequest(ContextRequest contextRequest, Session session, Pr
         Changes changes = restServiceUtils.handleEvents(contextRequest.getEvents(), session, profile, request, response, timestamp);
         data.setProcessedEvents(changes.getProcessedItems());
 
+        List<PersonalizationService.PersonalizedContent> filterNodes = contextRequest.getFilters();
+        if (filterNodes != null) {
+            data.setFilteringResults(new HashMap<>());
+            for (PersonalizationService.PersonalizedContent personalizedContent : sanitizePersonalizedContentObjects(filterNodes)) {
+                data.getFilteringResults()
+                        .put(personalizedContent.getId(), personalizationService.filter(profile, session, personalizedContent));
+            }
+        }
+
+        List<PersonalizationService.PersonalizationRequest> personalizations = contextRequest.getPersonalizations();
+        if (personalizations != null) {
+            data.setPersonalizations(new HashMap<>());
+            for (PersonalizationService.PersonalizationRequest personalization : sanitizePersonalizations(personalizations)) {
+                PersonalizationResult personalizationResult = personalizationService.personalizeList(profile, session, personalization);
+                changes.setChangeType(changes.getChangeType() | personalizationResult.getChangeType());
+                data.getPersonalizations()
+                        .put(personalization.getId(), personalizationResult.getContentIds());
+            }
+        }
+

Review comment:
       Yes no problem for merging this first. And we will do the additional work in a separate PR as it was not the goal of the current PR.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@unomi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [unomi] sergehuber merged pull request #368: UNOMI-537 Add control groups to personalizations

Posted by GitBox <gi...@apache.org>.
sergehuber merged pull request #368:
URL: https://github.com/apache/unomi/pull/368


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@unomi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org