UXInteract / task_028 /instruction.md
DojiSum's picture
Publish the current 141-task UXInteract release
ef987bb verified
|
Raw History Blame Contribute Delete
2.74 kB

Spotify song trends and charts

Read the supplied spotify_songs.csv using the Python standard library. Run with python3 solve.py in the project root, without network access. Write all outputs there and recompute them on each run.

CSV outputs

Parse release_year as an integer from the first four characters of track_album_release_date; retain only rows from 2000 onward.

File Contract
filtered_songs.csv Keep original columns and row order; append release_year and activity_score. Calculate activity_score = (energy + valence) / 2, formatted to four decimal places.
top_5_activity_songs.csv Up to five retained songs, ordered by unrounded score descending, retaining source order for ties. Include at least track_name,track_artist,release_year,activity_score; format scores to four decimals.
annual_counts.csv Exact header release_year,count; one row per observed retained year, ascending.
genre_danceability.csv Exact header playlist_genre,mean_danceability; one row per observed retained genre, in lexicographic order, with mean to four decimals.
tempo_bins.csv Exact header bin_start,bin_end,count; 10 BPM bins, left-closed and right-open. Start at floor(min(tempo)/10)*10 through the bin containing the maximum. Use integer endpoints, include empty bins, and sort ascending.

If no songs survive filtering, write only the headers in the CSVs.

Report

Create a directly openable report.html listing the top song titles and artists and the filtered “Tempo mean” and “Tempo median” when data is available. Display those statistics to at least three decimal places. Label the three inline SVG charts with their subject (release year counts, mean danceability by genre and tempo distribution) and data-chart="annual", "genre", and "tempo" respectively. Use one <rect> per aggregate with data-key (year, genre or bin start), numeric data-value and numeric width and height attributes. Width is positive and height is proportional to value within the chart (zero for value zero). Show the corresponding numeric label as visible SVG <text data-value-label="key">. Keep bars and labels in the visible chart; colors and styles are unrestricted.

Acceptance Checklist

  • Filtering, tie ordering, score precision, grouped averages/counts and bin boundaries are derived from current data. An empty filtered set still produces valid header-only CSVs.
  • The report visibly lists the top songs and accurate tempo statistics. All three charts have correct keyed values, proportional bars and readable value labels.
  • A rerun on changed input regenerates the tables and charts without fixed rankings or decorative stand-ins.