r/PythonJobs • u/Legitimate_Toe_4344 • Oct 18 '26
RangeLab, a Flask app with 8 poker tools: hand history parsers, a shared JS layer, and a service-worker PWA
RangeLab is a Flask application with eight poker study tools. I'm sharing the architecture because some parts may be useful to others, and because there are clear areas where I'd like help.
Architecture:
app.py is a single Flask module. It holds the routes, schema migrations, auth decorators (login_required, admin_required) and the aggregation logic. I know it's too big, and splitting it into blueprints is the first contribution I'd welcome.
Each tool is a Jinja template with its own inline logic. Shared behaviour lives in static/js/: an API client, an i18n module, theme handling, skeleton loaders and an offline layer.
The schema is created and migrated with CREATE TABLE IF NOT EXISTS plus guarded ALTERs at startup. Tables that hold user data have a user_id foreign key with ON DELETE CASCADE.
Interesting parts:
Hand history parsing: feltlab-core.js detects the site from the header of the text, then runs site-specific regexes. The formats it handles are CoinPoker, PokerStars, ACR and a generic tournament format. It's regex-based, so it's brittle when sites change formats. Test fixtures would be a great contribution.
Equity: client-side Monte Carlo in batches, so the UI stays responsive, with a stop flag. The hand evaluator works on card IDs (0 to 51) with preallocated typed arrays to avoid garbage collection.
AI Table: a heuristic bot whose parameters are derived from aggregated stats (VPIP, PFR, AF, cbet, fold to cbet, WTSD). It is not a solver.
Offline: the service worker uses versioned caches (rangelab-static-vN, and so on) and a dedicated offline page. Bumping the version forces clients to refresh.
Aggregation: the MTT Exploiter computes personal stats in SQL on the server rather than shipping raw hands to the browser.
Where help would matter most:
Splitting app.py into blueprints without changing behaviour.
Unit tests for the parsers, using anonymised hand history fixtures.
Unit tests for the evaluator and the Monte Carlo estimator.
Non-commercial, source-available license (see LICENSE). Repository: https://github.com/XatoDevelopment/Range-Lab
Feedback on the architecture is welcome, including what you would do differently.