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

[Issue #1543] Update opportunity factories to use more varied data #1601

Merged
merged 3 commits into from
Apr 5, 2024

Conversation

chouinar
Copy link
Collaborator

@chouinar chouinar commented Apr 2, 2024

Summary

Fixes #1543

Time to review: 5 mins

Changes proposed

Updated our factories to generate more varied data in several important fields

Updated the relationship setup for the link tables to make usage of them simpler

Context for reviewers

The additional info section shows some example data generated before & after this change to help showcase it.

While some of our data was pretty varied before, there were a lot of key fields that just looked too static whenever we demoed it. For example, previously every single opportunity title was Research into <job> industry which made the example search results look off. This approach adds quite a bit more variety and sets us up to easily add even more if desired.

This is mostly done by creating a new faker "Provider" in which I implemented several of our fields as functions. These functions can do the following:

  1. Choose from a set of pre-defined patterns
  2. Automatically set integer/character values
  3. Automatically call other providers to get their configured values

With this approach, we can add a lot more variety with minimal additional effort.

Additional information

TableBeforeAfter
Opportunity

Screenshot 2024-04-02 at 12 39 32 PM

Screenshot 2024-04-02 at 12 39 02 PM

Opportunity Summary

Screenshot 2024-04-02 at 12 46 20 PM

Screenshot 2024-04-02 at 12 45 51 PM

# Ideally use agencies here that actually exist so anyone
# using data generated by this for front-end dev actually
# has valid values
AGENCIES = ["USAID", "ARPAH", "DOC", "DOC-EDA"]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@rylew1 / @andycochran - FYI updating the factories so that we don't generate the US-ABC agencies anymore. Should align with actual values

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks - looks like this matches some of the choices we already have on the agency filter. 🚀

Copy link
Contributor

Choose a reason for hiding this comment

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

Longer term nits since already approved this pr:

  • Would you eventually pull all the actual values or define a type or enum?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure how we'll manage Agency long-term in the API. But when the front-end has more agencies in its list, we can add a bunch more here uneventfully regardless of approach.

Copy link
Contributor

@rylew1 rylew1 left a comment

Choose a reason for hiding this comment

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

Looks good! 🚀

@chouinar chouinar merged commit 0a240c1 into main Apr 5, 2024
8 checks passed
@chouinar chouinar deleted the chouinar/1543-factory-variety branch April 5, 2024 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Update opportunity factories to have more realistic data
2 participants