Channel affinity (share of the artist's DR plays per station before t, never played there) and genre fit (DR genre x station) in the per-station rows; Best week: any date range up to 12 months
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+14
-3
@@ -167,6 +167,8 @@ svg text { fill: var(--muted); font-size: 11px; }
|
||||
<div class="ctl">Station
|
||||
<select id="bw-ch"><option value="any">Any DR station</option><option value="P3">P3</option><option value="P4">P4 (best region)</option><option value="P5">P5</option><option value="P6">P6 Beat</option><option value="P8">P8 Jazz</option></select>
|
||||
</div>
|
||||
<div class="ctl">From <input type="date" id="bw-from"></div>
|
||||
<div class="ctl">To <input type="date" id="bw-to"></div>
|
||||
<div class="ctl">Added within
|
||||
<select id="bw-w"><option value="2">2 weeks</option><option value="4">4 weeks</option><option value="6">6 weeks</option><option value="8" selected>8 weeks</option><option value="10">10 weeks</option><option value="12">12 weeks</option></select>
|
||||
</div>
|
||||
@@ -471,7 +473,16 @@ async function loadBest() {
|
||||
if (!bestId) return;
|
||||
const w = $('bw-w').value, nmf = $('bw-nmf').value, ch = $('bw-ch').value;
|
||||
$('bw-out').innerHTML = '<p class="empty">Loading…</p>';
|
||||
const r = await fetch(`${BASE}/api/bestweek?id=${encodeURIComponent(bestId)}&w=${w}&nmf=${nmf}`);
|
||||
// Dates: from next week, at most 12 months.
|
||||
const next = windowStart(0);
|
||||
if (!$('bw-from').value) $('bw-from').value = next;
|
||||
if ($('bw-from').value < next) $('bw-from').value = next;
|
||||
const maxTo = new Date($('bw-from').value + 'T00:00:00Z'); maxTo.setUTCFullYear(maxTo.getUTCFullYear() + 1);
|
||||
if (!$('bw-to').value) { const d = new Date($('bw-from').value + 'T00:00:00Z'); d.setUTCDate(d.getUTCDate() + 7 * 25); $('bw-to').value = d.toISOString().slice(0, 10); }
|
||||
if ($('bw-to').value > maxTo.toISOString().slice(0, 10)) $('bw-to').value = maxTo.toISOString().slice(0, 10);
|
||||
if ($('bw-to').value < $('bw-from').value) $('bw-to').value = $('bw-from').value;
|
||||
$('bw-from').min = next; $('bw-to').min = $('bw-from').value; $('bw-to').max = maxTo.toISOString().slice(0, 10);
|
||||
const r = await fetch(`${BASE}/api/bestweek?id=${encodeURIComponent(bestId)}&w=${w}&nmf=${nmf}&from=${$('bw-from').value}&to=${$('bw-to').value}`);
|
||||
if (r.status === 503) { $('bw-out').innerHTML = '<p class="empty">The model is still loading on the server; try again in a minute.</p>'; return; }
|
||||
const b = await r.json();
|
||||
if (b.error) { $('bw-out').innerHTML = `<p class="empty">${esc(b.error)}</p>`; return; }
|
||||
@@ -489,10 +500,10 @@ async function loadBest() {
|
||||
<div class="cal">${b.weeks.map(x => { const v = val(x); return `<div class="day ${x.too_soon ? 'soon' : 'lvl' + level(v)} ${x === best && spread >= 0.03 ? 'best' : ''}" title="Release the week of ${fmtDate(x.week)}">
|
||||
<div class="d">Week of ${fmtDate(x.week)}</div><div class="v">${x.too_soon ? 'too soon' : pct(v)}</div>${x.christmas ? '<span class="tag" title="Christmas weeks">🎄</span>' : ''}</div>`; }).join('')}</div>
|
||||
<p class="note">Each tile: if ${esc(b.name)} releases a new song that week, the chance DR puts it into rotation within ${w} weeks. ${b.last_release ? `Their last release: ${fmtDate(b.last_release)}; weeks less than 6 weeks after it are "too soon" (the model only learned from releases with a clear gap).` : ''} The new song's NMF Denmark placement: ${nmf === 'auto' ? `as often as their releases were placed (${pct(b.p_nmf)})` : nmf === 'yes' ? 'placed' : 'not placed'}. What moves the numbers from week to week: time since their last release and last DR add, Christmas, and their NMF history; their current airplay is taken as it is now.</p>`
|
||||
: `<h2>${esc(b.name)}</h2><p class="empty">No week in the next 26 has an estimate.</p>`;
|
||||
: `<h2>${esc(b.name)}</h2><p class="empty">No week in this period has an estimate.</p>`;
|
||||
}
|
||||
$('bw-q').addEventListener('change', () => { const id = artistByName.get($('bw-q').value); if (id) { bestId = id; loadBest(); } });
|
||||
['bw-w', 'bw-nmf', 'bw-ch'].forEach(id => $(id).addEventListener('change', loadBest));
|
||||
['bw-w', 'bw-nmf', 'bw-ch', 'bw-from', 'bw-to'].forEach(id => $(id).addEventListener('change', loadBest));
|
||||
$('q').addEventListener('input', () => { shown = 100; render(); });
|
||||
$('more').addEventListener('click', () => { shown += 100; render(); });
|
||||
$('rows').addEventListener('click', e => { const tr = e.target.closest('tr[data-id]'); if (tr) showArtist(tr.dataset.id); });
|
||||
|
||||
Reference in New Issue
Block a user