Long any-DR model on 2019- archive pages: all years vs 1 year backtest
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+3
-3
@@ -213,7 +213,7 @@ fn chart_artists(s: &str, names: &HashMap<String, Vec<usize>>) -> Vec<usize> {
|
||||
found
|
||||
}
|
||||
|
||||
fn chart_states(db: &Db, weeks: &[NaiveDate], names: &HashMap<String, Vec<usize>>, n_artists: usize) -> Result<Vec<Chart>> {
|
||||
pub(crate) fn chart_states(db: &Db, weeks: &[NaiveDate], names: &HashMap<String, Vec<usize>>, n_artists: usize) -> Result<Vec<Chart>> {
|
||||
struct Entry { monday: NaiveDate, t40: bool, rank: u8, new: bool, song: String }
|
||||
let mut by_artist: Vec<Vec<Entry>> = (0..n_artists).map(|_| Vec::new()).collect();
|
||||
let mut mondays: [BTreeSet<NaiveDate>; 2] = [BTreeSet::new(), BTreeSet::new()];
|
||||
@@ -273,7 +273,7 @@ fn chart_states(db: &Db, weeks: &[NaiveDate], names: &HashMap<String, Vec<usize>
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
fn load_releases(db: &Db, id_of: &HashMap<String, usize>, n: usize) -> Result<Vec<Option<Vec<NaiveDate>>>> {
|
||||
pub(crate) fn load_releases(db: &Db, id_of: &HashMap<String, usize>, n: usize) -> Result<Vec<Option<Vec<NaiveDate>>>> {
|
||||
let mut out: Vec<Option<Vec<NaiveDate>>> = vec![None; n];
|
||||
let exists: i64 = db.conn.query_row("SELECT count(*) FROM sqlite_master WHERE name = 'deezer_artists'", [], |r| r.get(0))?;
|
||||
if exists == 0 { return Ok(out); }
|
||||
@@ -321,7 +321,7 @@ fn load_long_history(db: &Db, id_of: &HashMap<String, usize>, names: &HashMap<St
|
||||
/// NMF Denmark placements per DR artist: the artist's SuperFridayChart placements, confirmed on the
|
||||
/// track page (country Denmark, with position), or for Danish acts not yet read on the track page,
|
||||
/// one playlist the size of NMF Denmark that Friday.
|
||||
fn load_nmf_dk(db: &Db, id_of: &HashMap<String, usize>, artists: &[Artist]) -> Result<Vec<Vec<(NaiveDate, Option<i64>)>>> {
|
||||
pub(crate) fn load_nmf_dk(db: &Db, id_of: &HashMap<String, usize>, artists: &[Artist]) -> Result<Vec<Vec<(NaiveDate, Option<i64>)>>> {
|
||||
let mut out: Vec<Vec<(NaiveDate, Option<i64>)>> = vec![Vec::new(); artists.len()];
|
||||
let has = |t: &str| -> Result<bool> { Ok(db.conn.query_row("SELECT count(*) FROM sqlite_master WHERE name = ?1", [t], |r| r.get::<_, i64>(0))? > 0) };
|
||||
if !has("nmf_artist_tracks")? || !has("nmf_additions")? { return Ok(out); }
|
||||
|
||||
Reference in New Issue
Block a user