Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add site classification helper #16

Merged
merged 5 commits into from
May 9, 2023
Merged

Conversation

arunshenoy99
Copy link
Member

@arunshenoy99 arunshenoy99 commented Apr 28, 2023

  1. Adds a SiteClassification helper class. Currently, for use in Implement Site Classification API (Backend Controller) wp-module-onboarding#220
  2. Adds a HiiveWorker helper class.

Edit:

  1. Adds SiteClassification, PrimaryType, SecondaryType and an abstract Types class for storing code common in both classes (also gives us an opportunity to add more types if needed in the future).
  2. Falls back to a static JSON file in Data/Static/site-classification.json when it cannot fetch data from the worker, this static data is cached only for an hour, it also adds a static property to the data before caching and returning it.
  3. PrimaryType and SecondaryType help in managing primary and secondary selections respectively, which includes validating, saving and fetching the data to/from the option.

@arunshenoy99 arunshenoy99 marked this pull request as ready for review April 28, 2023 15:30
@wpscholar
Copy link
Member

@arunshenoy99 I don't have any background on the Site Classification functionality. Can you provide more details about what it is, how it works, why it needs to go in the data module, etc.?

@0aveRyan
Copy link
Member

0aveRyan commented May 4, 2023

@wpscholar As you and I discussed on a call earlier this week after your last comment, this is an API is shared between multiple products. A number of months back in a PRESS1/2/4 sync we agreed it would go in here. Instead of returning an empty array we will commit a static/stale JSON file and return that data if the live API isn't returning a valid response and in a separate PR there will be shared getter/setters for those multiple products to classify a site. I will own updating that static JSON as the API data changes and in time the parser will use an action to deploy the live API and commit the static backup JSON into this repo.

@arunshenoy99 arunshenoy99 requested a review from officiallygod May 4, 2023 12:56
Copy link
Member

@officiallygod officiallygod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wpscholar wpscholar merged commit 8b6ac0f into main May 9, 2023
@wpscholar wpscholar deleted the add/site-classification-helper branch May 9, 2023 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants