You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@unomi.apache.org by Michael Ghen <mi...@mikeghen.com> on 2018/11/06 16:38:06 UTC

Merge Profiles based on Multiple Properties

Hello again,

I am trying to set up Unomi so that profiles are merged based on first
name, last name, and SSN. I'm not finding a clear example for exactly how
to do this. I would like to get an example working and add it to this
tutorial I have going.

It looks like I need to set up a rule for this, I'm thinking I can use the
profileUpdatedEventCondition. What I'm confused about is what the action
should look like? I see the note in the documentation
about MergeProfileOnPropertyAction. I'm just not sure how the rule JSON
should look.

Also, it seems like only 1 property can be used for merging profiles, is
that correct?

Re: Merge Profiles based on Multiple Properties

Posted by Serge Huber <sh...@apache.org>.
I was more suggesting you bump the level.

The merge is happening in the following file :
https://github.com/apache/incubator-unomi/blob/a171e3d8f6fee354285768e112b27c6c3ebd8d2a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/MergeProfilesOnPropertyAction.java

If you managed to connect the debugger you can put breakpoints in it
and start looking at the values you receive in the event.

Regards,
  Serge...
On Fri, Nov 9, 2018 at 12:21 AM Michael Ghen <mi...@mikeghen.com> wrote:
>
> Thanks Serge, always appreciate your guidance.
>
> I tried the debugger, I'm not to familiar with that but I got intellij setup and was able to connect to it so I will rerun the test and let you know what I see.
>
> When you say "activate some logging," is that like a log level? I was exploring the code and found where it looks like the merge happens. Are you suggesting I add some logging or can I bump up the log level and see more of what's going on?
>
>
> On Thu, Nov 8, 2018 at 2:56 AM Serge Huber <sh...@apache.org> wrote:
>>
>> Hello Michael,
>>
>> I would suggest that you either try to activate some logging or
>> connect a debugger. That's what I usually do when trying to figure out
>> those types of issues.
>>
>> You can launch Karaf in debugging simply by using the command line :
>> ./karaf debug
>>
>> And then connect a remote debugging session on port 5005.
>>
>> I hope this helps,
>> Regards,
>>   Serge...
>>
>> On Wed, Nov 7, 2018 at 5:55 PM Michael Ghen <mi...@mikeghen.com> wrote:
>> >
>> > It looks like this rule is working just not as I expected it to.
>> >
>> > I have to profiles that share the same properties.ssn. When I update a property in one of the profiles (the one created last), it updates the property of the other profile. Seems like the two profiles are in a one-way sync, changes on one profile are reflected on the other.
>> >
>> > Unfortunately, the mergedWith property is still null. I would expect that when the profiles are merged based on the rule, it would set the mergedWith to the itemId of the merged profile. Am I missing something to get this mergedWith property to be set?
>> >
>> > On Tue, Nov 6, 2018 at 2:24 PM Michael Ghen <mi...@mikeghen.com> wrote:
>> >>
>> >> Here is the rule I created, after I run this I then create two profiles with the same SSN. Unfortunately, I see the mergedWith attribute is null for both profiles.
>> >>
>> >> require 'httparty'
>> >> require 'json'
>> >>
>> >> rule = {
>> >>   metadata: {
>> >>     id: "exampleMerger",
>> >>     name: "Example Merger",
>> >>     description: "Dedup on SSN"
>> >>   },
>> >>   condition: {
>> >>     type: "profileUpdatedEventCondition",
>> >>     parameterValues: { }
>> >>   },
>> >>   actions: [
>> >>     {
>> >>       parameterValues: {
>> >>         mergeProfilePropertyValue: "eventProperty::target.properties(ssn)",
>> >>         mergeProfilePropertyName: "mergeIdentifier"
>> >>       },
>> >>       type: "mergeProfilesOnPropertyAction"
>> >>     }
>> >>   ]
>> >> }
>> >>
>> >> request = HTTParty.post("http://127.0.0.1:8181/cxs/rules",
>> >>   body: rule.to_json,
>> >>   basic_auth: { username: "karaf", password: "karaf" },
>> >>   headers: {
>> >>     "Content-Type" => "application/json"
>> >>   })
>> >>
>> >> if request.code != 200
>> >>   raise "Unable to create rule: #{request}"
>> >> end
>> >>
>> >> Even though I get a 204 response, I see the rule is created in /cxs/rules.
>> >>
>> >> On Tue, Nov 6, 2018 at 11:38 AM Michael Ghen <mi...@mikeghen.com> wrote:
>> >>>
>> >>> Hello again,
>> >>>
>> >>> I am trying to set up Unomi so that profiles are merged based on first name, last name, and SSN. I'm not finding a clear example for exactly how to do this. I would like to get an example working and add it to this tutorial I have going.
>> >>>
>> >>> It looks like I need to set up a rule for this, I'm thinking I can use the profileUpdatedEventCondition. What I'm confused about is what the action should look like? I see the note in the documentation about MergeProfileOnPropertyAction. I'm just not sure how the rule JSON should look.
>> >>>
>> >>> Also, it seems like only 1 property can be used for merging profiles, is that correct?
>> >>>
>> >>>

Re: Merge Profiles based on Multiple Properties

Posted by Michael Ghen <mi...@mikeghen.com>.
Thanks Serge, always appreciate your guidance.

I tried the debugger, I'm not to familiar with that but I got intellij
setup and was able to connect to it so I will rerun the test and let you
know what I see.

When you say "activate some logging," is that like a log level? I was
exploring the code and found where it looks like the merge happens. Are you
suggesting I add some logging or can I bump up the log level and see more
of what's going on?


On Thu, Nov 8, 2018 at 2:56 AM Serge Huber <sh...@apache.org> wrote:

> Hello Michael,
>
> I would suggest that you either try to activate some logging or
> connect a debugger. That's what I usually do when trying to figure out
> those types of issues.
>
> You can launch Karaf in debugging simply by using the command line :
> ./karaf debug
>
> And then connect a remote debugging session on port 5005.
>
> I hope this helps,
> Regards,
>   Serge...
>
> On Wed, Nov 7, 2018 at 5:55 PM Michael Ghen <mi...@mikeghen.com> wrote:
> >
> > It looks like this rule is working just not as I expected it to.
> >
> > I have to profiles that share the same properties.ssn. When I update a
> property in one of the profiles (the one created last), it updates the
> property of the other profile. Seems like the two profiles are in a one-way
> sync, changes on one profile are reflected on the other.
> >
> > Unfortunately, the mergedWith property is still null. I would expect
> that when the profiles are merged based on the rule, it would set the
> mergedWith to the itemId of the merged profile. Am I missing something to
> get this mergedWith property to be set?
> >
> > On Tue, Nov 6, 2018 at 2:24 PM Michael Ghen <mi...@mikeghen.com> wrote:
> >>
> >> Here is the rule I created, after I run this I then create two profiles
> with the same SSN. Unfortunately, I see the mergedWith attribute is null
> for both profiles.
> >>
> >> require 'httparty'
> >> require 'json'
> >>
> >> rule = {
> >>   metadata: {
> >>     id: "exampleMerger",
> >>     name: "Example Merger",
> >>     description: "Dedup on SSN"
> >>   },
> >>   condition: {
> >>     type: "profileUpdatedEventCondition",
> >>     parameterValues: { }
> >>   },
> >>   actions: [
> >>     {
> >>       parameterValues: {
> >>         mergeProfilePropertyValue:
> "eventProperty::target.properties(ssn)",
> >>         mergeProfilePropertyName: "mergeIdentifier"
> >>       },
> >>       type: "mergeProfilesOnPropertyAction"
> >>     }
> >>   ]
> >> }
> >>
> >> request = HTTParty.post("http://127.0.0.1:8181/cxs/rules",
> >>   body: rule.to_json,
> >>   basic_auth: { username: "karaf", password: "karaf" },
> >>   headers: {
> >>     "Content-Type" => "application/json"
> >>   })
> >>
> >> if request.code != 200
> >>   raise "Unable to create rule: #{request}"
> >> end
> >>
> >> Even though I get a 204 response, I see the rule is created in
> /cxs/rules.
> >>
> >> On Tue, Nov 6, 2018 at 11:38 AM Michael Ghen <mi...@mikeghen.com> wrote:
> >>>
> >>> Hello again,
> >>>
> >>> I am trying to set up Unomi so that profiles are merged based on first
> name, last name, and SSN. I'm not finding a clear example for exactly how
> to do this. I would like to get an example working and add it to this
> tutorial I have going.
> >>>
> >>> It looks like I need to set up a rule for this, I'm thinking I can use
> the profileUpdatedEventCondition. What I'm confused about is what the
> action should look like? I see the note in the documentation about
> MergeProfileOnPropertyAction. I'm just not sure how the rule JSON should
> look.
> >>>
> >>> Also, it seems like only 1 property can be used for merging profiles,
> is that correct?
> >>>
> >>>
>

Re: Merge Profiles based on Multiple Properties

Posted by Serge Huber <sh...@apache.org>.
Hello Michael,

I would suggest that you either try to activate some logging or
connect a debugger. That's what I usually do when trying to figure out
those types of issues.

You can launch Karaf in debugging simply by using the command line :
./karaf debug

And then connect a remote debugging session on port 5005.

I hope this helps,
Regards,
  Serge...

On Wed, Nov 7, 2018 at 5:55 PM Michael Ghen <mi...@mikeghen.com> wrote:
>
> It looks like this rule is working just not as I expected it to.
>
> I have to profiles that share the same properties.ssn. When I update a property in one of the profiles (the one created last), it updates the property of the other profile. Seems like the two profiles are in a one-way sync, changes on one profile are reflected on the other.
>
> Unfortunately, the mergedWith property is still null. I would expect that when the profiles are merged based on the rule, it would set the mergedWith to the itemId of the merged profile. Am I missing something to get this mergedWith property to be set?
>
> On Tue, Nov 6, 2018 at 2:24 PM Michael Ghen <mi...@mikeghen.com> wrote:
>>
>> Here is the rule I created, after I run this I then create two profiles with the same SSN. Unfortunately, I see the mergedWith attribute is null for both profiles.
>>
>> require 'httparty'
>> require 'json'
>>
>> rule = {
>>   metadata: {
>>     id: "exampleMerger",
>>     name: "Example Merger",
>>     description: "Dedup on SSN"
>>   },
>>   condition: {
>>     type: "profileUpdatedEventCondition",
>>     parameterValues: { }
>>   },
>>   actions: [
>>     {
>>       parameterValues: {
>>         mergeProfilePropertyValue: "eventProperty::target.properties(ssn)",
>>         mergeProfilePropertyName: "mergeIdentifier"
>>       },
>>       type: "mergeProfilesOnPropertyAction"
>>     }
>>   ]
>> }
>>
>> request = HTTParty.post("http://127.0.0.1:8181/cxs/rules",
>>   body: rule.to_json,
>>   basic_auth: { username: "karaf", password: "karaf" },
>>   headers: {
>>     "Content-Type" => "application/json"
>>   })
>>
>> if request.code != 200
>>   raise "Unable to create rule: #{request}"
>> end
>>
>> Even though I get a 204 response, I see the rule is created in /cxs/rules.
>>
>> On Tue, Nov 6, 2018 at 11:38 AM Michael Ghen <mi...@mikeghen.com> wrote:
>>>
>>> Hello again,
>>>
>>> I am trying to set up Unomi so that profiles are merged based on first name, last name, and SSN. I'm not finding a clear example for exactly how to do this. I would like to get an example working and add it to this tutorial I have going.
>>>
>>> It looks like I need to set up a rule for this, I'm thinking I can use the profileUpdatedEventCondition. What I'm confused about is what the action should look like? I see the note in the documentation about MergeProfileOnPropertyAction. I'm just not sure how the rule JSON should look.
>>>
>>> Also, it seems like only 1 property can be used for merging profiles, is that correct?
>>>
>>>

Re: Merge Profiles based on Multiple Properties

Posted by Michael Ghen <mi...@mikeghen.com>.
It looks like this rule is working just not as I expected it to.

I have to profiles that share the same properties.ssn. When I update a
property in one of the profiles (the one created last), it updates the
property of the other profile. Seems like the two profiles are in a one-way
sync, changes on one profile are reflected on the other.

Unfortunately, the mergedWith property is still null. I would expect that
when the profiles are merged based on the rule, it would set the
mergedWith to the itemId of the merged profile. Am I missing something to
get this mergedWith property to be set?

On Tue, Nov 6, 2018 at 2:24 PM Michael Ghen <mi...@mikeghen.com> wrote:

> Here is the rule I created, after I run this I then create two profiles
> with the same SSN. Unfortunately, I see the mergedWith attribute is null
> for both profiles.
>
> require 'httparty'
> require 'json'
>
> rule = {
>   metadata: {
>     id: "exampleMerger",
>     name: "Example Merger",
>     description: "Dedup on SSN"
>   },
>   condition: {
>     type: "profileUpdatedEventCondition",
>     parameterValues: { }
>   },
>   actions: [
>     {
>       parameterValues: {
>         mergeProfilePropertyValue: "eventProperty::target.properties(ssn)",
>         mergeProfilePropertyName: "mergeIdentifier"
>       },
>       type: "mergeProfilesOnPropertyAction"
>     }
>   ]
> }
>
> request = HTTParty.post("http://127.0.0.1:8181/cxs/rules",
>   body: rule.to_json,
>   basic_auth: { username: "karaf", password: "karaf" },
>   headers: {
>     "Content-Type" => "application/json"
>   })
>
> if request.code != 200
>   raise "Unable to create rule: #{request}"
> end
>
> Even though I get a 204 response, I see the rule is created in /cxs/rules.
>
> On Tue, Nov 6, 2018 at 11:38 AM Michael Ghen <mi...@mikeghen.com> wrote:
>
>> Hello again,
>>
>> I am trying to set up Unomi so that profiles are merged based on first
>> name, last name, and SSN. I'm not finding a clear example for exactly how
>> to do this. I would like to get an example working and add it to this
>> tutorial I have going.
>>
>> It looks like I need to set up a rule for this, I'm thinking I can use
>> the profileUpdatedEventCondition. What I'm confused about is what the
>> action should look like? I see the note in the documentation
>> about MergeProfileOnPropertyAction. I'm just not sure how the rule JSON
>> should look.
>>
>> Also, it seems like only 1 property can be used for merging profiles, is
>> that correct?
>>
>>
>>

Re: Merge Profiles based on Multiple Properties

Posted by Michael Ghen <mi...@mikeghen.com>.
Here is the rule I created, after I run this I then create two profiles
with the same SSN. Unfortunately, I see the mergedWith attribute is null
for both profiles.

require 'httparty'
require 'json'

rule = {
  metadata: {
    id: "exampleMerger",
    name: "Example Merger",
    description: "Dedup on SSN"
  },
  condition: {
    type: "profileUpdatedEventCondition",
    parameterValues: { }
  },
  actions: [
    {
      parameterValues: {
        mergeProfilePropertyValue: "eventProperty::target.properties(ssn)",
        mergeProfilePropertyName: "mergeIdentifier"
      },
      type: "mergeProfilesOnPropertyAction"
    }
  ]
}

request = HTTParty.post("http://127.0.0.1:8181/cxs/rules",
  body: rule.to_json,
  basic_auth: { username: "karaf", password: "karaf" },
  headers: {
    "Content-Type" => "application/json"
  })

if request.code != 200
  raise "Unable to create rule: #{request}"
end

Even though I get a 204 response, I see the rule is created in /cxs/rules.

On Tue, Nov 6, 2018 at 11:38 AM Michael Ghen <mi...@mikeghen.com> wrote:

> Hello again,
>
> I am trying to set up Unomi so that profiles are merged based on first
> name, last name, and SSN. I'm not finding a clear example for exactly how
> to do this. I would like to get an example working and add it to this
> tutorial I have going.
>
> It looks like I need to set up a rule for this, I'm thinking I can use the
> profileUpdatedEventCondition. What I'm confused about is what the action
> should look like? I see the note in the documentation
> about MergeProfileOnPropertyAction. I'm just not sure how the rule JSON
> should look.
>
> Also, it seems like only 1 property can be used for merging profiles, is
> that correct?
>
>
>