1

Ajoute l'agrégation annuelle des palettes de couleurs

This commit is contained in:
2025-12-01 22:40:56 +01:00
parent f8a2464447
commit fb2ef5f16f
4 changed files with 267 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
"""Calcule l'évolution annuelle des palettes de couleurs."""
from pathlib import Path
from lib.rebrickable.colors_timeline import (
build_year_color_matrix,
compute_yearly_stats,
load_colors_by_set,
write_year_color_matrix,
write_yearly_stats,
)
COLORS_BY_SET_PATH = Path("data/intermediate/colors_by_set.csv")
TIMELINE_PATH = Path("data/intermediate/colors_timeline.csv")
MATRIX_PATH = Path("data/intermediate/colors_year_color_matrix.csv")
def main() -> None:
"""Construit les agrégats annuels et la matrice année × couleur."""
colors_by_set = load_colors_by_set(COLORS_BY_SET_PATH)
timeline = compute_yearly_stats(colors_by_set)
matrix = build_year_color_matrix(colors_by_set)
write_yearly_stats(TIMELINE_PATH, timeline)
write_year_color_matrix(MATRIX_PATH, matrix)
if __name__ == "__main__":
main()