You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by "Serge Huber (Jira)" <ji...@apache.org> on 2022/06/24 12:55:00 UTC
[jira] [Updated] (UNOMI-366) Implement increment interest event type
[ https://issues.apache.org/jira/browse/UNOMI-366?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Serge Huber updated UNOMI-366:
------------------------------
Summary: Implement increment interest event type (was: Implement increment interest event type & action)
> Implement increment interest event type
> ---------------------------------------
>
> 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
> Fix For: 2.0.0
>
> 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)