[ 
https://issues.apache.org/jira/browse/UNOMI-366?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17558137#comment-17558137
 ] 

Serge Huber edited comment on UNOMI-366 at 6/23/22 3:39 PM:
------------------------------------------------------------

After some review and testing the following problems were found so we are 
reopening this ticket : 

- The name of the constants don't make any sense
- The interestsAsMap variable should be renamed to incrementsAsMap
- The interests should not be stored in the same property as existing interests 
as the calculation is different. It should instead be called "cdpInterests" or 
something equivalent
- The calculation is very strange because we always divide after incrementing, 
meaning that we don't really divide properly.
- The automated tests don't test increments from initial values, only from 
zero. Instead they should check that multiple increments attain the desired 
values.
- Remove OSGI conf and use action parameter instead
- use properly the action param: eventInterestProperty that contains the target 
event property that do contains the increments values. Currently it’s used to 
read directly the increments values from the action parameter witch doesn’t 
make sense.


was (Author: shuber):
After some review and testing the following problems were found so we are 
reopening this ticket : 

- The name of the constants don't make any sense
- The interestsAsMap variable should be renamed to incrementsAsMap
- The interests should not be stored in the same property as existing interests 
as the calculation is different. It should instead be called "cdpInterests" or 
something equivalent
- The calculation is very strange because we always divide after incrementing, 
meaning that we don't really divide properly.
- The automated tests don't test increments from initial values, only from 
zero. Instead they should check that multiple increments attain the desired 
values.



> Implement increment interest event type & action
> ------------------------------------------------
>
>                 Key: UNOMI-366
>                 URL: https://issues.apache.org/jira/browse/UNOMI-366
>             Project: Apache Unomi
>          Issue Type: Sub-task
>            Reporter: Serge Huber
>            Assignee: Serge Huber
>            Priority: Major
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> Currently interests are incremented in a custom rule such as : 
> {code}
> {
>   "metadata": {
>     "id": "_ynqbd6g4t_incrementInterests",
>     "name": "Increment profile interests",
>     "description": "Increment profile interests when a page is viewed"
>   },
>   "raiseEventOnlyOnceForSession": true,
>   "condition": {
>     "parameterValues": {
>       "subConditions": [
>         {
>           "type": "pageViewEventCondition",
>           "parameterValues": {
>           }
>         },
>         {
>           "type": "eventPropertyCondition",
>           "parameterValues": {
>             "propertyName": "target.properties.interests",
>             "comparisonOperator": "exists"
>           }
>         }
>       ],
>       "operator": "and"
>     },
>     "type": "booleanCondition"
>   },
>   "actions": [
>     {
>       "parameterValues": {
>         "setPropertyName": "properties.interests",
>         "setPropertyValue": "script::r = profile.properties['interests']; 
> foreach(interest : event.target.properties['interests'].entrySet()) { if (r 
> == null) { r = [interest.key: interest.value] } else if (r[interest.key] != 
> null) { r[interest.key] = r[interest.key] + interest.value } else { 
> r[interest.key] = interest.value } } r",
>         "storeInSession": false
>       },
>       "type": "setPropertyAction"
>     }
>   ]
> }
> {code}
> We should replace this with a new replace the script with a new 
> IncrementInterestAction that would do the following:
> - (optional) check if topic exists to allow enforcement of only accepting 
> existing topics
> - increment the interest
> Interests inside profiles:
> {code}
> properties : {
>   interests : {
>     topic1 : 30.0,
>     topic2: 20.0
>   }
> } 
> {code}
> Global configuration setting in 
> https://github.com/apache/unomi/blob/master/package/src/main/resources/etc/custom.system.properties
>  to setup min/max and relative value
> {code}
> org.apache.unomi.interests.min_value = ${env:UNOMI_INTERESTS_MIN_VALUE:-0.0}
> org.apache.unomi.interests.max_value = ${env:UNOMI_INTERESTS_MAX_VALUE:-150.0}
> org.apache.unomi.interests.divider_value = 
> ${env:UNOMI_INTERESTS_DIVIDER_VALUE:-100.0}
> {code}
> and then in OSGI blueprint files, retrieve the values as such:
> So to calculate a cdp_interests we would to :
> {code}
> CDP_Profile.cdp_interests.topic1.score = min(properties.interests.topic1, 
> divider_interest_value) / divider_interest_value
> {code}
> Incrementing / decrementing interest values should be capped by min_value and 
> max_value
> {code}
> r = profile.properties['interests']; 
> foreach(interest : event.target.properties['interests'].entrySet()) { 
>   if (r == null) { 
>     r = [interest.key: interest.value] 
>   } else if (r[interest.key] != null) { 
>     r[interest.key] = r[interest.key] + interest.value 
>   } else { 
>     r[interest.key] = interest.value 
>   }
>   r[interest.key] = max(min(r[interest.key], max_interest_value), 
> min_interest_value)
> }
> {code}
> Example of eventInterestProperty :
> "eventInterestProperty" : "eventProperty::target.properties.interests" 



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to