
Implementor, Consultant, Designer, Trainer
Elev8brand
CiviCRM is an solid and feature rich web based CRM that supports an organization or non-profit's ability to service its members. In a recent implementation for client they are using CiviCRM as an association management tool for memberships and event registrations. Associations are a huge area for growth in the CiviCRM market, and the ability for an organization to own and control their own data via an open source platform is a liberating experience. Coupled with Drupal and/or Wordpress makes CiviCRM and ideal combination for ANY non-profit or association.


Web developer
Freeform Solutions
Freeform Solutions uses CiviCRM to help the non-profit organizations we develop sites for to manage information about their members, volunteers, activists, donors, employees and other contacts, and to handle donations, correspondence, mailings and more. We support the CiviCRM community by contributing documentation, patches, modules and code, and are a silver sponsor of CiviCon 2013.


Core Team Member, Developer, Implementor
CiviCRM, Caltha
I've always been passionate about what non-profits and advocacy groups can achieve using technology. For me, CiviCRM shows an essential example of how non-profit and technology worlds can come together to provide real change - working as community, creating value for yourself, but also for others in non-profit sector.


Developer
Semper IT Inc.
I help non-profit organizations optimize workflows by creating interactive Drupal/CiviCRM websites for them.

Consultant, Implementor and End-user
Circle Interactive
We help many not for profits implement CiviCRM through consultancy, training, configuration and custom development. Many of them come from a painful world of old Access databases, multiple spreadsheets and even paper. It's really satisfying to
help people move on with a system that's so much in tune with their own ethics of sharing and collaboration. We also 'eat our own dog food' and use Civi in-house for our client records because we love the flexibility and control it gives us.
For us it's important to share code and advice with other members of the community when we can because we know we get it back in help at other times. The community really is awesome and one of the friendliest and undaunting I've come across. We appreciate the huge value of the software to us and our clients so we try to contribute back and make it even better.


Ally, FanBoy
Aspiration
By giving the nonprofit sector a values-driven, free/open source solution for CRM needs!


Implementor
Ginkgo Street Labs
CiviCRM enables me to empower my clients with a database that suits their unique needs.


DEVELOPER
EMPHANOS
I'm quite impressed with the responsiveness of the CiviCRM community, both from the core developers and many experienced users who have quickly provided answers and ideas in areas where I just needed that extra insight, or where we needed to do something totally new. After several years working with open source software, I'm finding the CiviCRM community to be the most responsive and helpful I've seen.
We make CiviCRM one of our primary offerings because it just provides so much right out of the box that our clients need, without a line of custom code. And when we need to extend it for the clients' unique needs, the APIs and programming hooks let us add in features that would be impossible in some other systems. This means we can provide great value to our clients with quick turnaround times and reasonable budgets, which is great for our clients and for us.


Developer
Donor Depot
CiviCRM community is a very dedicated group of professionals who deeply care about causes that care about the causes of charitable organizations.

User, Administrator
Biodynamic Farming & Gardening Association
Online and offline membership sign-up and renewal,donations and event registration, integrated with our Drupal website. Directory for members, group and bulk emails, renewal reminder emails. Exciting to have complex conference registration within our CRM. Impressed with the Civi community and ongoing development of new features and improvements.


Consultant
nfpservices
We use CiviCRM for our own business functions. Nfpservices participate in the development of CiviCRM and contribute enhanced functionality to the community.


Implementor, Developer
AGH Strategies
CiviCRM allows our clients to have a robust tool for tracking and engaging their supporters that can grow with them. I began as an end user, and now I work with CiviCRM full-time.


Comments
already exists
this already exists (though slightly different than your suggestion:
* This hook allows modification of the queries constructed from dupe rules.
* @param string $obj object of rulegroup class
* @param string $type type of queries e.g table / threshold
* @param array $query set of queries
*
* @access public
*/
static function dupeQuery( $obj, $type, &$query ) {...
we use it extensively, and it works much like your initial suggestion -- the hook receives the rules defined in a rule group, and allows you to reconstruct/enhance them.
the one weakness is as you describe toward the end -- it uses the "hijack" method, which means there needs to be a rule group with at least one rule defined in the system. for our purposes, we will create a basic group that has a single rule with weight 1 and threshold 1. those values can be set within the hook, so they only exist in the db for the sake of registering the rule in the system so it can be modified in the hook.
we're doing some nice algorithms in the hook, such as normalizing the street address (strip spaces, remove ordinals, condense street name suffix (street > st, road > rd, etc), removed punctuation, etc.) -- which has helped up pick up quite a few more dupes.
there are a couple gotchas with the hook, such as making sure its not run on user account creation, and you need to construct the queries differerntly to account for when the rule is run during import vs. when the rule is run from the interface. but it gives you the access you're looking for.
sample code
here is what we are doing with that hook:
https://github.com/nysenatecio/Bluebird-CRM/blob/master/modules/nyss_dedupe/nyss_dedupe.module
Great idea
I like the second option (being able to introduce new rules) better as well, mostly because it means being able to choose it explicitely (eg. in the import).
Modifying the query for dedupe is quite a hidden feature where the rule as displayed isn't the one applied (eg. you can change the threshold and add more fields matching without any impact). This is likely to confuse the users, isn't it?
And it seems that (according to brian's example) that you match on the dedupe name to know when to apply. using as a key something users can change is recipes for interesting issues ;)
Otherwise, the module introduces nice features (eg st == street), looks great.
X+
i think the id is passed
i think the rule group ID is passed in the object. and we should probably alter to use the id at some point in our implementation.
i agree that it would be useful to have the flexibility to dynamically create a rule group, and perhaps change the interface so the rule group is not editable. but maybe that should be handled with a new hook. so one hook can create the rule group, and a second alters the queries. the only gotcha with doing that is the dedupe code handles three scenarios right now -- user account creation, import, and find dupes interface -- each of which constructs queries in slightly different ways because of the different data being compared. the fact that you currently have to construct a dummy group/rule in the system before modifying it with the hook, provides something of a fallback should you not account for all three scenarios.
another comment about our implementation --
the way the dedupe works on import (which was our primary usage), it compares the incoming file row (converted to an array) with the table in the db. implementing data normalization to the array is fairly straightfoward. but is a bit of a pain with the mysql side. we accomplished with a cyclical REPLACE on the fields in question, which is fairly inefficient (though functional).
we've recently installed a regex library into mysql, with the goal of improving some of our algorithms further -- both in terms of flexibility and efficiency. might be nice to figure out a better way to structure some of the dedupe code so that we have more flexibility to perform the data conversion strictly in PHP.
Great Stuff
lcdweb: this is great stuff, I really appreciate you sharing your code. I'm going to give implimenting the existing hook a try before spouting off any more about creating a new one. I do agree that having a query already constructed is nice so your hook has the option to do nothing.
I also agree about the pain of replacing strings in mysql. My phone number stripping query looks like this: "LEFT(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(phone.phone, '.', ''), ' ', ''), '-', ''), '(', ''), ')', ''), 10) = '%s'" yep, it's ugly. Let me know how your regex experiments go.
I wonder why Lobo didn't mention the existing hook when he told me to go write a blog article about this...
Lobo's getting old ..
and his brain seems to have developed a few too many memory leaks :(
sorry about making u do the work, but on the flip side a good discussion was had by all!
lobo
And if we could end up with this hook documented in the wiki
That would be another nice outcome of this discussion.
Might even possibly somewhat balance the terrible discovery that lobo isn't omniscient (or that marmite is his kryptonite ;)
X+
Ahh, that's why
Ahh, that's why I didn't know about it. OK, I don't feel so foolish now.
As soon as I get a better understanding of it, I'll be happy to add this hook to the wiki documentation.
Incidentally, are there any other useful hooks out there that are "unlisted" on the wiki?