$ show anishathalye/gavel
Gavel is a Flask-based web application designed for ranking projects at events like hackathons using pairwise comparisons. The system presents judges with pairs of projects to compare, updating rankings in real-time via a Bayesian inference algorithm. Key components include a custom SQLAlchemy class for serializable transaction isolation, a standalone ranking algorithm module (crowd_bt.py), and utility functions for data handling and security. The application uses PostgreSQL for data storage, Celery for asynchronous email tasks, and relies on Redis as a message broker. Admin interfaces allow managing projects, judges, and global settings, with real-time updates to project rankings displayed via the Mu parameter.
The LLM identified 3 files worth highlighting for reuse:
Implements a self-contained Bayesian inference algorithm for updating rankings based on pairwise comparisons. The module depends only on NumPy and SciPy, making it easily extractable for any project requiring comparative ranking. It demonstrates non-obvious skill by translating a research paper's algorithm into efficient, production-ready code.
Contains generic utility functions for generating cryptographically secure secrets (gen_secret), converting data to/from CSV format (data_to_csv_string, data_from_csv_string), and parsing text into paragraphs (get_paragraphs). These functions are framework-independent and rely only on standard library modules, allowing easy reuse in other projects after removing app-specific email-related code.
Defines a SerializableAlchemy class that extends Flask-SQLAlchemy to enforce SERIALIZABLE transaction isolation, preventing anomalies in concurrent environments. This component can be extracted with minimal modification (removing unused imports) and reused in any Flask-SQLAlchemy application requiring strict transaction consistency for high-concurrency scenarios.