No description
  • Python 79.2%
  • TypeScript 14.9%
  • JavaScript 2.6%
  • PowerShell 1.8%
  • CSS 0.8%
  • Other 0.7%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-07 08:25:16 +01:00
backend Preserve and validate the bounded LottoStat historical pilot 2026-11-07 08:22:09 +01:00
deploy Preserve and validate the bounded LottoStat historical pilot 2026-11-07 08:22:09 +01:00
docs Record LottoStat production comparison, acceptance and restored pilot 2026-11-07 08:25:16 +01:00
frontend Preserve and validate the bounded LottoStat historical pilot 2026-11-07 08:22:09 +01:00
scripts Preserve and validate the bounded LottoStat historical pilot 2026-11-07 08:22:09 +01:00
.dockerignore Build Lotto RNG research platform with audited ingestion and reproducible experiments 2026-11-06 12:31:30 +01:00
.env.example Deploy authenticated research lab with verified PostgreSQL history and prospective scheduling 2026-11-07 00:41:43 +01:00
.gitattributes Record LottoStat production comparison, acceptance and restored pilot 2026-11-07 08:25:16 +01:00
.gitignore Build Lotto RNG research platform with audited ingestion and reproducible experiments 2026-11-06 12:31:30 +01:00
AGENTS.md Redirect research to calibrated experiments and prospective commitments 2026-11-06 23:56:54 +01:00
compose.production.yaml Deploy durable drawing automation and versioned same-day forecasts 2026-11-07 05:41:57 +01:00
compose.yaml Deploy authenticated research lab with verified PostgreSQL history and prospective scheduling 2026-11-07 00:41:43 +01:00
README.md Preserve and validate the bounded LottoStat historical pilot 2026-11-07 08:22:09 +01:00

Lotto RNG Research Lab

The Research Intelligence workspace tracks verified publications through statistical analysis, scoring and weekly review. It exposes per-draw checkpoints, registered monitoring decisions, current training readiness and downloadable reports. Post-draw operations

The Historical Evidence & Eligibility workspace shows which of the 623 official results can answer each research question. It connects each decision to dated claims, source downloads, exclusions and chronological boundaries. Historical verification and research impact

Its LottoStat coverage view tracks secondary historical observations, archive availability, official comparisons and eligibility for descriptive research. The five-year pilot recovered three previously unavailable outcomes. LottoStat pilot and access conditions

The v3 Statistical efficiency workspace compares direct detection power, predictive scoring and historical edition transfer. Its weak-bias study reached the power target at 800 synthetic draws and missed its joint false-positive uncertainty gate. V3 findings, MDE explorer and reproducibility

A local scientific workbench for investigating Danish Lotto and Joker outcomes. It preserves provenance, excludes unknown rule periods from inference, and compares chronological prediction experiments against random selection. It makes no claim that lottery outcomes are predictable or that historical results identify an internal RNG.

The default Research findings workspace shows completed experiments, null findings, explicit strict/exploratory controls, evidence-checked format compatibility and immutable prospective commitments. Executed findings document twelve completed experiments: no corrected statistical rejection and no selected-model Brier advantage; full-pipeline null p-values are .88 and .86. Two locally committed predictions for 14 November 2026 await official results.

The authenticated Historical coverage workspace records all 623 operator-published Lotto dates from 3 January 2015 through 31 October 2026. The 304-date recovery added one directly documented drawing format. The electronic exploratory cohort contains 261 observations. Recovery, eligibility and research results

Production operators should start with the production runbook.

Run locally with Docker

Install Docker Engine/Desktop with Compose. Set a unique URL-safe POSTGRES_PASSWORD in the private .env for this development database. From the repository root:

docker compose up --build -d
docker compose run --rm --no-deps api python -m lab.users bootstrap-admin

Open the dashboard and interactive API documentation. PostgreSQL runs on the internal Compose network; only the API and frontend are bound to loopback. Exactly one worker must run. Migrations apply before API startup, and the worker waits for API health.

The app starts empty. Click Import verified probes to import the six exact API responses preserved in docs/endpoint-probe.json. “Verified probes” means network requests actually performed; it does not mean historical Lotto rules were verified. Click Open synthetic sandbox to create 520 independent synthetic draws for each game. Synthetic and observed records are always isolated.

Checksum-backed snapshots restore 623 real Lotto observations. Seven documented rule editions account for 298 draws. The largest edition has 79 draws against the default strict prediction requirement of 164. The final snapshot sorts after all earlier files so fresh installations can replay earlier records first. Original 153-date backfill · Verified offline replay

The targeted 164-draw recovery report records further archive work and the chronology constraint: none of the recovered post-2017 editions can supply 164 dates under its documented calendar before the next recovered edition. A longer primary-evidenced period would be necessary for that strict default; this recovery work is now suspended. Hypothetical calendar ceilings are never admitted as verified data.

The pre-2017 recovery continuation preserves dated Trumf-era documentation, the old official result viewer and its advertised seven-year history. No qualifying older rule interval or complete earlier number result was recovered; eligible counts are unchanged. The updated operator archive request remains unsent.

The legacy contract and May 2017 boundary report recovers the exact client lookup flow but records HTTP 404 from its candidate service route. Primary sources document a material change from 27 May while both checked results retain API version 1; version-based pooling remains disallowed.

The latest pre-2015 recovery report adds contemporary evidence that Trumf was removed from 25 October 2014. The ordinary Saturday scenario between this and the May 2017 change has only 135 candidate dates (10 before 2015 plus 125 published dates), before further exclusions. Recovering 39 older results therefore cannot alone complete that edition without crossing a material boundary. No full older results or rule edition were recovered; all eligibility safeguards and counts remain unchanged.

The earlier-edition continuation recovers one complete official result for 13 January 2007 and an older HTML viewer advertising 104 dated IDs. No full rule edition was recovered, and the observation remains outside the eligible dataset. The ordinary Trumf-era scenario has only 152 dates; pre-Trumf search windows remain separate and unverified. Archive rate-limit handling and all coverage failures are documented.

The 104-ID continuation recovers draw 864 (6 January 2007), bringing preserved outcomes to 2/104, and the complete rules effective 7 May 2006. A later 1 January 2009 edition header keeps those periods separate; ordinary-calendar scenarios have 138 and 151 dates, respectively. All 102 gaps and rate-limit checks are recorded. Database eligibility is unchanged.

Develop on Windows without Docker

Python 3.12+ and Node 22 are required. The development database defaults to SQLite. PostgreSQL is the deployment target.

python -m venv .venv
.\.venv\Scripts\python -m pip install -r backend/requirements.lock
.\.venv\Scripts\python -m pip install -e './backend[test]'
.\.venv\Scripts\alembic -c backend/alembic.ini upgrade head
.\.venv\Scripts\python -m lab.cli init
.\.venv\Scripts\python -m lab.cli import-probe
.\.venv\Scripts\python -m uvicorn lab.api:app --host 127.0.0.1 --port 8000

In a second terminal, from the repository root:

.\.venv\Scripts\python -m lab.jobs

In a third terminal:

cd frontend
npm ci
npm run dev

Optional: ./scripts/start-local.ps1 starts the three processes hidden and records their PIDs and logs under ignored artifacts/. ./scripts/stop-local.ps1 stops only those recorded processes. This script expects dependencies already installed. All backend commands run from the root so API, worker and migrations use the same SQLite file.

For PostgreSQL development, copy .env.example to .env, supply the database credentials, provision PostgreSQL, then run migrations. Never point API and worker at different databases. DATABASE_URL defaults to sqlite:///./lotto.db when no .env is present. CORS_ORIGIN controls the optional direct API origin; Vite/nginx proxy /api on the same origin.

Test and build

.\.venv\Scripts\python -m pytest backend/tests -q
.\.venv\Scripts\alembic -c backend/alembic.ini check
# With API and worker already running: isolated synthetic end-to-end checks
.\.venv\Scripts\python scripts/smoke.py
cd frontend
npm run build

The tests cover parsing, empty dates, source-date mismatches, version changes, unknown rules, deduplication/conflicts, foreign keys, hypergeometric expectations, seeded simulation, strong synthetic bias, repeated null calibration, corrected hypotheses, all ten model strategies, chronological splits, mutation-based leakage prevention, persistence, exports, and API validation/cancellation. Tests never call the external API.

Research workspaces

Workspace Functional scope
Overview Source counts, rule verification, latest result, descriptive frequencies, paged draw table
Number explorer Exact per-number binomial tests, observed/expected counts, standardized residuals, Wilson intervals, rolling presence
Randomness lab Whole-draw Monte Carlo statistics, structural distributions, permutation temporal tests, BH and Holm
Monte Carlo lab Up to five million custom-rule null drawings, bounded batches, progress, cancellation, aggregate persistence
Pattern explorer Exact expected pair/triple counts, selected descriptive combinations, co-occurrence heatmap, overlaps
Prediction lab Ten fixed strategies, distinct validation/final-test periods, walk-forward fitting and probability scores
Backtesting Training/test windows, model comparison, common random baselines, cumulative scores, calibration, audit rows
Joker lab Position-specific digit distributions and MC tests, cross-position dependence, temporal transitions, repeated digits
Data integrity Controlled synchronization, raw source responses, unknown rules, conflicting data, empty probes and job history

Python modules keep ingestion, statistics, prediction, datasets, persistence, API and worker logic separate. Long tasks return HTTP 202 and execute in a persistent SQL-backed queue. APScheduler runs optional synchronization inside the singleton worker at 03:15 Europe/Copenhagen on Sundays when SYNC_ENABLED=true. Synchronization rechecks the last two weeks, safely deduplicating. Backfills are explicit, never automatic or unlimited.

CLI research operations

# Explicit synthetic data, isolated from real observations
.\.venv\Scripts\python -m lab.cli synthetic
# Queue eight weekly Saturday probes; requires the worker
.\.venv\Scripts\python -m lab.cli probe-backwards --from-date 2020-01-04 --weeks 8
# Export provenance-bearing observations as CSV
.\.venv\Scripts\python -m lab.cli export-draws artifacts/draws.csv
# Register documentary evidence for a bounded historical rule period
.\.venv\Scripts\python -m lab.cli register-rule reviewed-rule.json

See coverage evidence, statistical methodology, reproducibility guide, architecture, and development journal.

Production deployment

The Windows deployment uses the dedicated production Compose file, a private PostgreSQL database, a single research worker and the existing Caddy HTTPS service. Follow the production runbook for the one-time interactive administrator bootstrap, updates, status, backup and rollback. The default compose.yaml remains for local development. The access guide, prospective protocol and CPU benchmarks cover operator controls and research limits.