-
Notifications
You must be signed in to change notification settings - Fork 4
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
Improve aggregated data loading speed #44
Comments
@jkleiber migration tool repository is here: https://github.com/linglejack06/average-integration |
@linglejack06 is there any value in adding that into our repo here in a utility folder or something? |
@jkleiber it would be useful for when we run into issues with internet and have to QR code scan the data into scout data table. All you'd have to do is run it for that event after all data is loaded into scout data and it would recalculate all averages. |
Yeah could we add it to the site as a page that you can go to if you know the route? But not included in the title bar so people aren't accidentally clicking it and getting lost |
Yeah as like a /api/updateAverage/:eventName And just an empty post route or post with the data? |
Yeah that makes sense to me |
@jkleiber I went ahead and built an express server to post to /updateAverages. It is not connected to the scouting app ( as with the way react app was designed it would be hard to connect express). But it is currently deployed seperately through https://copperscoututil.onrender.com to update averages one would POST to https://copperscoututil.onrender.com/updateaverages/{event name} |
Summary
The aggregated data page is good, but it takes a long time to load. We should try to make this faster by keeping track of event averages in a separate table. Here are a couple strategies that we could use to accomplish this:
Strategy 1
Recompute a specific team's averages whenever a scouting form is uploaded (or whenever new data is submitted from local sync). This way the event page is fast to load, and the scouting form doesn't take forever to submit since it is only recomputing a single team's data. Additionally, the database would always be up to date.
The downside of this solution is that when data is uploaded in batches (see #23), we would be bottle-necked by each submission needing to update the database
Strategy 2
Maintain another table for the last time an event was updated (or the most recent primary key in the data table that was used to compute the averages in the averages table). Then, whenever the event data page is loaded we would pull any new scouting data, update the averages table for any applicable rows, and update the latest time/primary key in the table tracking data staleness. This way we would not need to change anything about the scouting form, but the event data page will load a lot faster since the number of rows to process will be way less. This would also be easier to test with VABLA data since it fulfills the requirement of having a way to manually refresh up to the current newest data.
The downside of this solution is that the data in the database is not up to date unless a user tries to view it. Sort of a Schrodinger's cat thing here, plus there's a chance that we somehow fail to keep the primary key up to date, causing missing data in the averages, or slow load times.
Scope
The text was updated successfully, but these errors were encountered: