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

CPHEAPM-26 - Add ToxRefDB vocab fixture and display #1066

Merged
merged 13 commits into from
Sep 9, 2024

Conversation

ZindahFarhaICF
Copy link
Collaborator

Changes

  • Added vocab fixture and migration
  • Updated tests to include new vocab namespace and page: {baseurl}/vocab/toxref

@ZindahFarhaICF ZindahFarhaICF requested a review from DookTibs July 3, 2024 15:34
@ZindahFarhaICF ZindahFarhaICF marked this pull request as ready for review July 15, 2024 18:21
@ZindahFarhaICF
Copy link
Collaborator Author

Hi @shapiromatron, marking this as ready for review.

@shapiromatron shapiromatron self-assigned this Jul 16, 2024
Copy link
Owner

@shapiromatron shapiromatron left a comment

Choose a reason for hiding this comment

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

Fantastic job! I made some edits, but nothing too major. See my individual comments and then the diffs for the commits below; I tried to separate independent changes so you can hopefully follow along...

  • 7754a21 cleanup abstract class (9 seconds ago)
  • b6c44dd switch to guard check to return bad case, instead of check in component (20 minutes ago)
  • f8cf5bb a few updates from testing (23 minutes ago)
  • b9b742b remove script (move to another repo) (29 minutes ago)
  • 89f0cff rename Toxref to ToxRefDB (2 hours ago)
  • 238ca3c update migrations to be consistent with current main (2 hours ago)
  • 868d8ac lazily generate large vocab dataframes instead of on app startup (2 hours ago)
  • f95099d Merge branch 'main' into ICF-CPHEAPM26-toxref-vocab (4 hours ago)

render() {
const tables = {ehv: EhvTable, toxrefdb: ToxRefDBTable},
Table = tables[this.props.store.config.vocab];
if (_.isUndefined(Table)) {
Copy link
Owner

Choose a reason for hiding this comment

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

I changed this to guard (return w/ a different condition if we're not on the happy path)

@@ -12,15 +13,17 @@
from . import constants, models, serializers


class EhvTermViewSet(viewsets.GenericViewSet):
class VocabTermViewSet(viewsets.GenericViewSet):
Copy link
Owner

Choose a reason for hiding this comment

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

nice job generalizing this. With your initial approach, the data was loaded every time the server restarted, which is all the time in development mode, since it was a class-level property on the class. I changed it to be a callable method, so it's only fetched when needed. I did the same for the view too.

@shapiromatron shapiromatron merged commit 1f33679 into main Sep 9, 2024
6 checks passed
@shapiromatron shapiromatron deleted the ICF-CPHEAPM26-toxref-vocab branch September 9, 2024 21:48
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.

3 participants