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

Replace covid19-data json for Django API endpoint #231

Merged
merged 152 commits into from
May 22, 2024

Conversation

p3rcypj
Copy link

@p3rcypj p3rcypj commented Mar 27, 2024

📌 References

📝 Implementation

This PR aims to no longer need the famous covid19-data.json JSON file to load Covid19 Structural Hub, making the entries table to load instantly on the Main app (Ruby); and to no longer rely on manual updates of the file. For now, some requests are still a bit slow, but we should be focusing on the next iteration (I suggest creating a new PR for the optimization changes https://app.clickup.com/t/86942378n, and some other subtasks remaining).

  • Modified already existing BWS endpoint: /pdbentry
    • Added props we were using by the JSON file into the API response
    • Added filtering (django), sorting (django), and querying (elasticsearch)
  • Created new BWS endpoint for search: /complete/search
    • Autocomplete endpoint elasticsearch), this request is instantly made after key down on the search bar
    • Results format is different than we had before, aimed how Search Engines (Google, Bing) autocomplete works
  • Removed JSON file (some code remaining for reference purposes)
  • Request timeout increased to 75 seconds instead of 20 (@adrianq do you agree on this?)
  • Dynamic dev BWS API by .env
  • Removed exact match notation " " because elasticsearch's default behavior is to exact match.
  • Fuzziness not applied (@adrianq do we want it?)
  • Moved Presentation Logic previous code on StructuresTable.tsx to useHooks
  • If the page size is more than 25, the request can be canceled
  • If the request is made after some previous request and the previous one was not loaded yet, the previous request is canceled (request cancellation not working for Django by the way, at least in dev environment)

UI changes

  • Pagination doesn't update till the request finishes
  • Added "Go to page" functionality
  • Search bar no longer performs the request after key down, instead, Enter or click on the search icon is required
  • Added snackbar
  • If the page size is more than 25, a message will be shown to the user for the first time indicating request could take longer
  • Tweaked Autocomplete component
  • Added Skeleton on the first load to reduce the user's waiting sensation
  • Added CircularProgress next to the filter button, cancel option appears if page size more than 25
  • Added LinearProgress at the bottom pagination
  • Added sorting by "release date" (descendent) if no sort is being applied

🔥 Testing

Add REACT_APP_BWS_HOST to your .env.local, for now, you can use percy.uk.to:8000. We will be able to use rinchen host after machine upgrades 👾💯

@p3rcypj
Copy link
Author

p3rcypj commented Apr 23, 2024

@tokland I did notice there was a bug changing the page size. The request was made two times because first, it made the request on changePageSize and later, on changePage because pageSize was a dependency. So I changed pageSize to a useRef. Does that happen to sound right to you?

@p3rcypj p3rcypj requested a review from tokland April 23, 2024 14:35
Copy link

@tokland tokland left a comment

Choose a reason for hiding this comment

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

All good, just a very minor comment, trivial to fix.

@adrianq adrianq changed the base branch from development to feature/upgrade-ruby May 22, 2024 09:14
@adrianq adrianq merged commit 1d68eeb into feature/upgrade-ruby May 22, 2024
1 check failed
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