systopia / de.systopia.xcm

CiviCRM Extended Contact Matcher
Other
5 stars 11 forks source link

Improve Name Extraction in Banking Matcher Plugin #112

Closed MarcMichalsky closed 4 months ago

MarcMichalsky commented 7 months ago

This commit improves the name extraction for the db mode.

Comparison of the results

/**
 * Dummy function
 */
private function isDBFirstName($name_bit) {
  $fistnames = ['John', 'Jane', 'Alice', 'Bob', 'Arthur'];
  return in_array($name_bit, $fistnames);
}

Original function

Name: John Doe, First names: John, Last names: Doe
Name: Jane Alice Doe, First names: Jane Alice, Last names: Doe
Name: Arthur Smith, First names: Arthur, Last names: Smith
Name: Alice Jane Arthur, First names: Alice Jane Arthur, Last names: 
Name: Bob King Arthur, First names: Bob Arthur, Last names: King

Modified function

Name: John Doe, First names: John, Last names: Doe
Name: Jane Alice Doe, First names: Jane Alice, Last names: Doe
Name: Arthur Smith, First names: Arthur, Last names: Smith
Name: Alice Jane Arthur, First names: Alice Jane, Last names: Arthur
Name: Bob King Arthur, First names: Bob, Last names: King Arthur
jensschuppe commented 7 months ago

I'm pretty sure @bjendres would like this to depend on a configuration option for the matcher plugin with a default fallback to the current behavior in case someone relies on it.

MarcMichalsky commented 7 months ago

Well, we could of course just add another mode.

bjendres commented 7 months ago

I'm pretty sure @bjendres would like this to depend on a configuration option for the matcher plugin with a default fallback to the current behavior in case someone relies on it.

I don't think that's necessary, since @MarcMichalsky introduced a new name_mode called db2.

jensschuppe commented 7 months ago

I don't think that's necessary, since @MarcMichalsky introduced a new name_mode called db2.

Yep, after I raised that concern … well, actually still your concern I guess ;-)

@MarcMichalsky thanks, that was quick!

MarcMichalsky commented 7 months ago

Yes, I did that because of @jensschuppe's comment.

Sometimes I lack the perspective of a service provider who serves many customers. I usually only look at problems like this from our perspective. 🙈

As soon as I have time, I'll be happy to write a test for this.

bjendres commented 7 months ago

As soon as I have time, I'll be happy to write a test for this.

We'll wait for that, then. But if it becomes clear you won't be able to in the near future, give us a shout.

MarcMichalsky commented 6 months ago

Added more logic to cover the common case of <lastname>, <firstname> pattern.

jensschuppe commented 4 months ago

Merged, thanks!

Let's add docs for those CiviBanking plugins, I created #114 as a follow-up.