Need to decide on file format, most likely csv.
Description
Details
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
Command to check matching gifts employer data file | wikimedia/fundraising/crm | master | +333 -0 |
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Resolved | None | T228765 Epic: matching gifts HEP integration (was employer field V2) | |||
Resolved | jgleeson | T251201 Create job to update/generate employer dataset for usage within paymentswiki |
Event Timeline
Due to us needing to search this data with substring queries we probably wanna put this data into secondary location capable of supporting that feature (e.g SQLite import)
It looks like there's a builtin php function that could help here: https://www.php.net/manual/en/function.preg-grep.php
With preg_grep, we could just cache the big array of id->name in memcache, snag that, and grep it.
My current thinking on this is for generating the file we can either:
- Add a new drupal module command called something like civicrm-employers-export maybe to the wmf_civicrm module that we call via process-control
- OR we could do a similar sorta thing inside the python fundraising-tools project which already has scripts for building csv files from MySQL database tables.
I guess the drupal upgrade on the horizon might make option 1 less favourable if it will need refactoring although the option 2 fundraising-tools project is also kinda legacyee so we might wanna not put it there?
What do other @fr-tech folks think?
@jgleeson this commit creates an API call within the new Matching Gifts civi extension: https://gerrit.wikimedia.org/r/607633
once you've installed the extension, added the credentials and called MatchingGiftPolicies.Sync, just call this to create the new file:
drush cvapi MatchingGiftPolicies.Export path=/tmp/newEmployers.csv
So I think the work in this task would be to configure a wrapper script that calls the new cvapi call, diffs the new CSV with the previous one, emails if there is a change, then probably moves the new file to the old file path.
@Ejegg do you see the sync and export processes running in tandem here or would there be a case to have the sync running independently to keep things fresh elsewhere and then we just call the export action to "get the latest" at that point in time.
Change 608089 had a related patch set uploaded (by Jgleeson; owner: Jgleeson):
[wikimedia/fundraising/crm@master] WIP: Command to diff matching gifts employer data file
The directory for storing these downloads has been added to the civicrm role manifests. A puppet run on both hosts has created the directory.
[frack::puppet] 5ee37ccf Add matching gifts employer for HEPdata download
To Test:
- pull down https://gerrit.wikimedia.org/r/608089
- connect to Wikimedia VPN
- run drush dis wmf_civicrm
- run drush en wmf_civicrm, wmf_communication, exchange_rates, queue2civicrm, wmf_audit, adyen_audit, amazon_audit, astropay_audit, banner_history, ingenico_audit, thank_you, large_donation, offline2civicrm, orphan_slayer, recurring, recurring_globalcollect, wmf_campaigns, wmf_ct_qc, wmf_eoy_receipt, wmf_fredge_qc, wmf_optin_qc, wmf_refund_qc, wmf_unsubscribe_qc
- open http://crm.local.wmftest.net:8080/#overlay=admin/config/wmf_civicrm/matching_gifts and set path to /tmp/employers.csv and save
- run drush cc all
- run drush cvmgc (this is the new command)
- update notifications emails should be visible in mailcatcher http://localhost:1080/
Change 608089 merged by jenkins-bot:
[wikimedia/fundraising/crm@master] Command to check matching gifts employer data file