Page MenuHomePhabricator

Backend - Create MW API to expose employer data
Closed, ResolvedPublic

Description

  • Decide on a file format to store a list of IDs and names that can be deployed via the settings repo
    • Some IDs will repeat as we want to list all subsidiaries with the parent company's ID
    • Decide on a caching strategy (memcache?) to cache either the whole list or specific lookups

Event Timeline

jgleeson created this task.Apr 27 2020, 9:26 PM
jgleeson removed jgleeson as the assignee of this task.Apr 28 2020, 4:38 PM

Change 594330 had a related patch set uploaded (by Jgleeson; owner: Jgleeson):
[mediawiki/extensions/DonationInterface@master] WIP: Create MW API to expose employer data

https://gerrit.wikimedia.org/r/594330

jgleeson added a comment.EditedMay 8 2020, 8:20 PM

To test this patch:

  1. Add a csv to a location accessible form within your paymentswiki install and populate it with rows of company data consisting of 'id,name' format. (no single quotes)
  2. Add $wgDonationInterfaceEmployersListDataFileLocation to your LocalSettings.php and set it to the full path of the file you've just created.

You can then jump right in and test with the API Explorer via this URL (vagrant users):
https://payments.wiki.local.wmftest.net:4430/w/index.php?title=Special:ApiSandbox#action=employerSearch&format=json&employer=abc

Or you can also pull down the frontend patch here and then:

  1. Open up a donation form and append '&variant=employer' to the URL
mepps added a subscriber: mepps.May 12 2020, 3:40 PM

@jgleeson thanks for the clear test instructions!

mepps added a comment.May 12 2020, 3:56 PM

I went ahead and tested it and it works! I'm curious though what the plans are for testing and adding caching. If it's outside the scope of this ticket, I'm probably good to +2 after a closer line reading of the code, but just wanted to check what we're thinking there.

mepps added a comment.May 12 2020, 5:56 PM

From @jgleeson in irc chat: hey mepps thanks for reminded me about caching them employers data. It looks like we missed that part off the tech-talk idea that I was working from but now looking at the code I think it would benefit from some type of in-memory cache. we did chat about redis as an alternative to the csv but I guess we could also use them together to compliment each other. I'm gonna look at how that'll work.

@jgleeson I made a small code recommendation on the task but went ahead and +2ed it.

Change 594330 merged by jenkins-bot:
[mediawiki/extensions/DonationInterface@master] Create MW API to expose employer data

https://gerrit.wikimedia.org/r/594330

Change 605633 had a related patch set uploaded (by AndyRussG; owner: AndyRussG):
[mediawiki/extensions/DonationInterface@master] Doc and default value for wgDonationInterfaceEmployersListDataFileLocation

https://gerrit.wikimedia.org/r/605633

Change 605633 merged by jenkins-bot:
[mediawiki/extensions/DonationInterface@master] Doc and default value for $wgDonationInterfaceEmployersListDataFileLocation

https://gerrit.wikimedia.org/r/605633

DStrine closed this task as Resolved.Jun 23 2020, 8:15 PM