{"id":15044016,"url":"https://github.com/baoliay2008/lccn_predictor","last_synced_at":"2025-05-15T10:06:17.881Z","repository":{"id":63199293,"uuid":"494329163","full_name":"baoliay2008/lccn_predictor","owner":"baoliay2008","description":"A fast and accurate contest rating prediction web application.","archived":false,"fork":false,"pushed_at":"2025-02-08T21:59:55.000Z","size":936,"stargazers_count":755,"open_issues_count":16,"forks_count":27,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-14T16:57:23.344Z","etag":null,"topics":["beanie","competitive-programming","contest-programming","daisyui","elo","fastapi","fft","leetcode","mongodb","prediciton","pydantic","python3","react"],"latest_commit_sha":null,"homepage":"https://lccn.lbao.site","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/baoliay2008.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-20T05:13:46.000Z","updated_at":"2025-04-14T10:42:41.000Z","dependencies_parsed_at":"2023-02-12T11:30:46.163Z","dependency_job_id":"3e2430fe-07e8-4085-a6ee-83f37d0e8d0a","html_url":"https://github.com/baoliay2008/lccn_predictor","commit_stats":{"total_commits":168,"total_committers":3,"mean_commits":56.0,"dds":"0.017857142857142905","last_synced_commit":"cad9efe500bca6977533b7c815d19cdf3c8b8ff1"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baoliay2008%2Flccn_predictor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baoliay2008%2Flccn_predictor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baoliay2008%2Flccn_predictor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baoliay2008%2Flccn_predictor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/baoliay2008","download_url":"https://codeload.github.com/baoliay2008/lccn_predictor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254319718,"owners_count":22051072,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["beanie","competitive-programming","contest-programming","daisyui","elo","fastapi","fft","leetcode","mongodb","prediciton","pydantic","python3","react"],"created_at":"2024-09-24T20:49:57.612Z","updated_at":"2025-05-15T10:06:12.833Z","avatar_url":"https://github.com/baoliay2008.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Introduction\n\nThis is a LeetCode weekly and biweekly contest rating predictor. The APP is available online at [🔗 lccn.lbao.site](https://lccn.lbao.site/)\n\nHopefully, you can get the predicted result within **15-30 minutes** after the contest has finished.\n\n## Features\n\n* ⚡️ Fast\n  * The core Elo rating algorithm is significantly enhanced by a **JIT compiler** through [Numba](https://numba.pydata.org), reducing execution time to approximately 20 seconds on a dual-core *Intel(R) Xeon(R) Platinum 8255C CPU* (@ 2.50GHz).\n  * In addition to the JIT implementation, this project incorporates a **FFT implementation**. The Elo rating system employed by LeetCode benefits significantly from the FFT algorithm, achieving speedups ranging from **65 to 1,000 times** for individual contest predictions. The most efficient FFT implementation (`EXPAND_SIZE=1`) completes predictions in under **0.25 seconds**, maintaining an impressively low MSE of approximately 0.027.\n  * **Caching** the user's latest rating before initiating the prediction process leads to a substantial reduction in the time required for data retrieval.\n  * Fully **asynchronous**, using non-blocking libraries.\n* 🎯 Accurate\n  * If there were no significant rejudges (assuming everyone's global ranking remains unchanged), it is **ensured** that the prediction error for rating deltas for **EACH** participant is within the precision limit of 0.05. As a result, the rating difference should be negligible.\n  * Please note that a normal case is that there would be some misconduct detection, so your global ranking will be slightly higher even if your submissions are not rejudged, which results in a slightly higher rating :)\n* 📱 Responsive web page\n  * Tested on phones and tablets.\n\n# Underlying Mechanism\n\n## Algorithm\n\n* [🔗 English official illustration on leetcode.com](https://leetcode.com/discuss/general-discussion/468851/New-Contest-Rating-Algorithm-(Coming-Soon))\n* 🔗 Detailed post about FFT acceleration\n  - ❤️ Special thanks to [@tiger2005](https://github.com/tiger2005) for proposing this idea in [issue #8](https://github.com/baoliay2008/lccn_predictor/issues/8)\n\n## Database\n\n* [MongoDB](https://www.mongodb.com/): NoSQL database\n* [Beanie](https://beanie-odm.dev/): ODM for MongoDB\n\n## Backend\n\n* [Numpy](https://numpy.org/) and [Numba](https://numba.pydata.org/): core prediction algorithm implementation and acceleration\n* [FastAPI](https://fastapi.tiangolo.com/): restful API\n* 🚮 ~~[Jinja](https://jinja.palletsprojects.com/): HTML templates for server-side rendering~~\n\n## Frontend\n\n* [React](https://reactjs.org/): most popular front-end library\n* [TailwindCSS](https://tailwindcss.com/) and [DaisyUI](https://daisyui.com/): modern CSS framework and its component library\n* 🚮 ~~[Materialize](https://materializecss.com/): responsive front-end framework~~\n* [Echarts](https://echarts.apache.org/en/index.html): data visualization\n\n# Development\n\n## Backend Deployment\n\n### virtualenv\n\n```shell\ngit clone git@github.com:baoliay2008/lccn_predictor.git\ncd lccn_predictor\n\n# write your mongodb environment config\ncp config.yaml.template config.yaml\nvi config.yaml\n\npython3.10 -m virtualenv venv/\nsource venv/bin/activate\n\npip3 install -r requirements.txt\n\npython main.py\nuvicorn api.entry:app --host 0.0.0.0 --port 55555\n```\n\n### Docker\n\n```shell\ngit clone git@github.com:baoliay2008/lccn_predictor.git\ncd lccn_predictor\n\n# write production environment mongodb config\ncp config.yaml.template config.yaml\nvi config.yaml\n\n# build docker image\ndocker image build -t lccn_predictor:0.2.4 .\n\n# create docker volume\ndocker volume create lccn_predictor\n\n# run container\ndocker run -d -v lccn_predictor:/lccn_predictor -p 55555:55555 --name lp lccn_predictor:0.2.4\n\ndocker exec -it lp bash\n\ndocker container stop lp\n\ndocker container start lp\n\n```\n\n## Frontend Deployment\n\n```shell\ncd client\n\n# install dependencies\nnpm install\n\n# change `baseUrl` to your local backend process\nvi src/data/constants.js\n# if you followed instruction above\n# it should be \"http://localhost:55555/api/v1\"\n\n# local test\nnpm run dev\n\n# publish\nnpm run build\n\n```\n\n## More Information\n\n* [🔗 refined-leetcode](https://github.com/XYShaoKang/refined-leetcode): A Chrome extension for leetcode.cn, created by [@XYShaoKang](https://github.com/XYShaoKang)\n\n\n# License\n\n[MIT License](LICENSE)\n\n# Changelog\n\n* v0.0.1(2022/11/14)\n  \u003e make this repo public, first release.\n* v0.0.2(2022/11/25)\n  \u003e first version in production\n* v0.1.1(2023/02/14)\n  \u003e change frontend from server-side rendering([Jinja](https://jinja.palletsprojects.com/) + [Materialize](https://materializecss.com/)) to client-side rendering([React](https://reactjs.org/)).\n* v0.1.2(2023/10/04)\n  \u003e refine backend logic to enhance robustness and clean up deprecated static site rendering code\n* v0.1.3(2023/12/28)\n  \u003e last version prior to the rewrite of the Elo rating algorithm\n* v0.2.1(2023/12/29)\n  \u003e add FFT implementation\n* v0.2.2(2024/01/12)\n  \u003e refactor to improve backend code clarity\n* v0.2.3(2024/08/31)\n  \u003e add visualization for the number of contest entrants\n* v0.2.4(2024/09/16)\n  \u003e improvement(frontend): add pageNum URL parameter\n---\n\n# Supported by\n\n[![JetBrains Logo (Main) logo](https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg)](https://jb.gg/OpenSourceSupport)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaoliay2008%2Flccn_predictor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbaoliay2008%2Flccn_predictor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaoliay2008%2Flccn_predictor/lists"}