View Source On this day ♫

Mix.install(
  [{:coda, "~> 0.1"}, {:kino_explorer, "~> 0.1.8"}],
  config: [
    lastfm_archive: [
      data_dir: "./lastfm_data/",
      user: ""
    ]
  ]
)

alias Coda.OnThisDay
dataframe = OnThisDay.data_frame()

:ok

Introduction

Analytics of all music played on this day, today in this past. This Livebook is based on data created by lastfm_archive.

Prerequisite

  • Columnar data transforms: please create an archive suitable for analytics workloads, in Apache Arrow format, i.e. transform with format: :ipc_stream option

Requirement

  • install and run this Livebook
  • configure this guide as instructued below, click on Notebook dependencies and setup, Setup (above)

Configuration

lastfm_archive has been configured as a dependency in Setup above, modify the following config:

Most played

dataframe
|> tap(fn df -> OnThisDay.render_overview(df) |> Kino.render() end)
|> OnThisDay.render_most_played()

Explore the data

In due course, further analytics and visualisation will be presented. These include newly discovered and most frequently played music on this day over the years. Meanwhile you can interactively delve into the data using Kino explorer below.

require Explorer.DataFrame

dataframe
|> Explorer.DataFrame.to_lazy()
|> Explorer.DataFrame.group_by(["track", "artist", "album"])
|> Explorer.DataFrame.collect()
|> Explorer.DataFrame.filter(year == 2023)
|> Explorer.DataFrame.summarise(id_count: count(id))
|> Explorer.DataFrame.arrange(desc: id_count)