Added new feature: Contest Percentile graph, showing plots for each t…#8
Open
rahulharpal1603 wants to merge 1 commit intoApoorvaRajBhadani:mainfrom
Open
Conversation
Author
|
@ApoorvaRajBhadani Please review the above Pull Request. |
Author
|
@ApoorvaRajBhadani Is this PR ok? |
Owner
|
Have not yet checked the code completely. Will set up some time with you. |
Author
Okay 👍 |
Author
|
@ApoorvaRajBhadani My winter break is going on, so I will always be available to discuss it whenever you are available. |
Author
|
@ApoorvaRajBhadani sir please review this😅 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Description: Contest Percentiles Feature
Demo Video for Google Chrome and Firefox: Link
(Video is Unlisted on YouTube)
This pull request introduces a feature to display contest percentiles for Codeforces users. The percentile data for each division (D1, D1+2, D2, ED2, D3, D4) is retrieved from the Codeforces API and supplemented with participant count data from a JSON file hosted on this repository.
Percentile of a user is simply calculated using this formula:
100 - ((rankInContest/totalParticipantsInContest) *100)We have plotted separate line for each division because the user can compare the his/her performance across divisions, higher the percentile, better the performance. The tooltips you see in the video when we hover over a data point is coded so that it displays different time in accordance with different time zones i.e if a user lives in India (Time Zone: GMT+5:30), he will be shown a different time than some user living in Moscow (Time Zone: GMT+3)
The resulting percentiles are plotted on a line chart with time (contest start date) on the x-axis and percentile on the y-axis. Initially, only the division with the most contests is visible, while other divisions can be toggled for viewing.
Summary of Changes:
Why a separate file for Participant Count?
It is not possible to get the number of participants in a contest from the CF API. Because of this, we have to use the CLIST API to retrieve data for participant count. Also, CLIST does not allow API requests without an API Key, so I have set up our own JSON File, which is updated with contest data every hour (if any updates are there). We can easily access this JSON file in the extension without any API Key.
The
filtered_data.jsonis present in this repository, which stores Codeforces contest data, including participant counts, contest names, divisions, and start times. A Python script automatically updates this file every hour by:This ensures the contest data is always up to date for percentile calculations.
NOTE: The huge number of insertions (5800+) is due to the addition of a library called Moment.js to plot the graph where the x-axis is time.