Go Back   Forum Care Forums > Development Reference Area > Php Development

Reply
 
LinkBack Thread Tools Display Modes
find (matching) person in other table
Old
  (#1)
Afan Pasalic
Guest
 
Posts: n/a
Default find (matching) person in other table - 06-02-2007, 08:56 PM

hi,
the code I'm working on has to compare entered info from registration
form with data in members table and list to administrator (my client)
all "matching" people. admin then has to decide is person who registered
already in database and ***ign his/her member_id or the registered
person is new one and ***ign new member_id.

I was thinking to ***ign points (percentage) to matching fields (last
name, first name, email, phone, city, zip, phone) and then list people
with more than 50%. e.g., if first and last name match - 75%, if only
email match - 85%, if first name, last name and email match - 100%, if
last name and phone match - 50%... etc.

does anybody have any experience with such a problem? or something similar?

thanks for any help.

-afan
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: [PHP] find (matching) person in other table
Old
  (#2)
Richard Lynch
Guest
 
Posts: n/a
Default Re: [PHP] find (matching) person in other table - 06-02-2007, 08:56 PM

On Wed, May 30, 2007 3:30 pm, Afan Pasalic wrote:
> hi,
> the code I'm working on has to compare entered info from registration
> form with data in members table and list to administrator (my client)
> all "matching" people. admin then has to decide is person who
> registered
> already in database and ***ign his/her member_id or the registered
> person is new one and ***ign new member_id.
>
> I was thinking to ***ign points (percentage) to matching fields (last
> name, first name, email, phone, city, zip, phone) and then list people
> with more than 50%. e.g., if first and last name match - 75%, if only
> email match - 85%, if first name, last name and email match - 100%, if
> last name and phone match - 50%... etc.
>
> does anybody have any experience with such a problem? or something
> similar?


I've played this game several times.

You generally have to have a human override, because it will never be
perfect, no mater how much you tweak it -- I mean, let the admin also
just "search" for whatever they want to match up the new registration
with the old person.

You may have only the first name matching on somebody who got married
and moved that won't score well...

But you'll have 10 John Smith's in there.

You can do it fairly easily building the query dynamically:

<?php
//find possible duplicates/existing members:
$query = "select member_id, name, address, phone, etc ";
//all members get 0 points to start:
$query .= " 0 ";
//add 5 points for last name matching:
$query .= " + 5 * (last_name = '$last_name') ";
//add 1 point for first name matching:
$query .= " + (first_name = '$first_name') ";
//and so on
$query .= " as score ";
$query .= " from member ";
//maybe this has to be: HAVING score > 0
$query .= " where score > 0 ";
?>

You can play all kinds of games with the numbers and weighting various
bits of data -- but complicating it too much beyond the obvious
natural choice rarely improves the success rate very much...

A simple checkbox on the form:
Are you already a member: ____
will help provide an invaluable cross-check as to whether there SHOULD
be a member record....

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: [PHP] find (matching) person in other table
Old
  (#3)
Afan Pasalic
Guest
 
Posts: n/a
Default Re: [PHP] find (matching) person in other table - 06-02-2007, 08:56 PM

Richard Lynch wrote:
> On Wed, May 30, 2007 3:30 pm, Afan Pasalic wrote:
>
>> hi,
>> the code I'm working on has to compare entered info from registration
>> form with data in members table and list to administrator (my client)
>> all "matching" people. admin then has to decide is person who
>> registered
>> already in database and ***ign his/her member_id or the registered
>> person is new one and ***ign new member_id.
>>
>> I was thinking to ***ign points (percentage) to matching fields (last
>> name, first name, email, phone, city, zip, phone) and then list people
>> with more than 50%. e.g., if first and last name match - 75%, if only
>> email match - 85%, if first name, last name and email match - 100%, if
>> last name and phone match - 50%... etc.
>>
>> does anybody have any experience with such a problem? or something
>> similar?
>>

>
> I've played this game several times.
>
> You generally have to have a human override, because it will never be
> perfect, no mater how much you tweak it -- I mean, let the admin also
> just "search" for whatever they want to match up the new registration
> with the old person.
>

yes. that's the plan. to show all "matching" people and admin will then
decide who is REALLY the match (if any).

> You may have only the first name matching on somebody who got married
> and moved that won't score well...
>

right. I forgot about this possibility :-(


> But you'll have 10 John Smith's in there.
>
> You can do it fairly easily building the query dynamically:
>
> <?php
> //find possible duplicates/existing members:
> $query = "select member_id, name, address, phone, etc ";
> //all members get 0 points to start:
> $query .= " 0 ";
> //add 5 points for last name matching:
> $query .= " + 5 * (last_name = '$last_name') ";
> //add 1 point for first name matching:
> $query .= " + (first_name = '$first_name') ";
> //and so on
> $query .= " as score ";
> $query .= " from member ";
> //maybe this has to be: HAVING score > 0
> $query .= " where score > 0 ";
> ?>
>
> You can play all kinds of games with the numbers and weighting various
> bits of data -- but complicating it too much beyond the obvious
> natural choice rarely improves the success rate very much...
>
> A simple checkbox on the form:
> Are you already a member: ____
> will help provide an invaluable cross-check as to whether there SHOULD
> be a member record....
>

good point too!
;-)

thanks.

-afan

   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Contact Us - Forum Care Forums - Archive - Top