Skip to content

Add historic package lists - #133

Open
andrewnaessens wants to merge 27 commits into
fedora-eln:masterfrom
andrewnaessens:feature/provide-history-record-#25
Open

andrewnaessens wants to merge 27 commits into
fedora-eln:masterfrom
andrewnaessens:feature/provide-history-record-#25

Conversation

@andrewnaessens

@andrewnaessens andrewnaessens commented Aug 19, 2026 •

Copy link
Copy Markdown

Add daily package list snapshots with browse and compare UI features

Add daily snapshots of each view's package lists and counts. Package lists are viewable from chart data points and with browse and compare calendar date pickers.

Resolves #25

Summary

  • Add daily snapshots with per view SRPM lists and counts
  • Split daily snapshots into two separate snapshots:
    • package lists (browse/compare)
    • counts (chart)
  • Add calendar date pickers for browsing and comparing package lists
  • Add messaging for package list load failures
  • Use DataTables table for compare results
  • Plot weekly and daily counts on a single chart
  • Scale chart x-axis by date for relative spacing
  • Add click chart data points to reveal package lists
  • Move generate_historic_data() before generate_pages() so date list is available to templates
  • Remove weekly snapshot save (keeps read for historical weekly snapshot data)

@coderabbitai

coderabbitai Bot commented Aug 19, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4f18a8a2-a44d-4c99-a440-b073855d4770
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@yselkowitz yselkowitz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be some boilerplate-like code here, is there an opportunity to create some functions which can be reused in multiple places?

Comment thread content_resolver/historia_data.py Outdated
Comment on lines +113 to +118
history_data = {}
history_data["date"] = str(now.strftime("%Y-%m-%d"))
history_data["workloads"] = {}
history_data["envs"] = {}
history_data["repos"] = {}
history_data["views"] = {}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC we've settled on an initialization syntax for these.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to dict literal syntax in save_current_historic_data_daily.

Comment thread content_resolver/historia_data.py Outdated
Comment on lines +721 to +722
# Generate daily Chart.js JSON — same chart types as _generate_chartjs_data
# but reading from daily snapshots instead of weekly

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need both? Or can we just use daily throughout?

@andrewnaessens andrewnaessens Sep 3, 2026 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed _generate_chartjs_data_daily and chart toggle. Chart is now generated from weekly snapshots for previous historic data and daily snapshots going forward.

Comment thread templates/layout.html Outdated
Comment on lines +31 to +32
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">
<script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be like the others, with a version-specific src and integrity, and also make sure it's covered by the update checking workflow.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pinned to v4.6.13 with SRI and added to check_cdn_updates.py.

@yselkowitz

Copy link
Copy Markdown
Member

Also, could the exisitng weekly data be of any use to "backfill" the daily data?

@andrewnaessens

Copy link
Copy Markdown
Author

There seems to be some boilerplate-like code here, is there an opportunity to create some functions which can be reused in multiple places?

Extracted listLinks(), fetchViewData(), datePicker(), and showMessage() helpers to reduce duplication.

@andrewnaessens

Copy link
Copy Markdown
Author

Also, could the exisitng weekly data be of any use to "backfill" the daily data?

Existing weekly counts are displayed on the chart alongside new daily counts. Package lists are not captured in existing weekly snapshots so browse/compare feature will only contain package lists from the point it is introduced.

@andrewnaessens
andrewnaessens marked this pull request as ready for review October 9, 2026 13:22
@yselkowitz
yselkowitz requested a review from bhoy-troy October 16, 2026 10:50

@bhoy-troy bhoy-troy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a couple of minor things to improve it.

Comment thread content_resolver/historia_data.py Outdated

# Sorted for consistent output
view_pkgs = {
"all_source_names": sorted(list(all_source_names)),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to use list(), sorted already returns a list.

There are a number of instances of this, and others that have been there long before we arrived 😃

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed list().

Comment thread content_resolver/historia_data.py Outdated
filename = f"historic_data_pkgs-{year}-day_{day_of_year}.json"
output_dir = os.path.join(query.settings["output"], "history")
os.makedirs(output_dir, exist_ok=True)
file_path = os.path.join(output_dir, filename)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block is duplicated in _save_current_historic_data_daily and _save_current_historic_data_daily_pkgs. There are also other modules that use similar style, that have been there a long time.

Can this be put into a function that can be reused to reduce duplication?

We can update the other modules at a later date when the need arises.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extracted helper function _daily_snapshot_file_path to reduce duplication.

Comment thread content_resolver/historia_data.py Outdated

merged = {}

for entry in historic_data_weekly.values():

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be replaced with a dict comprehension

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced with dict comprehension.

Comment thread content_resolver/historia_data.py Outdated
# Filter for daily files only (not weekly)
all_filenames = os.listdir(directory)
valid_filenames = []
for filename in all_filenames:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use a more Pythonic approach with a comprehension.

valid_filenames = sorted(
      f for f in os.listdir(directory)
      if re.match()
  )

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used suggested pythonic approach.

Comment thread content_resolver/historia_data.py Outdated
all_filenames = os.listdir(directory)
valid_filenames = []
for filename in all_filenames:
if bool(re.match(r"historic_data-....-day_....json", filename)):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the . in .json isn't escaped; it works as it's just interpreted by the regex as any char

Also consider using something like r"historic_data-\d{4}-day_\d{3}\.json" if you expect the characters to be digits only.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improved regex:
_read_historic_data - r"historic_data-\d{4}-week_\d{2}\.json"
_read_historic_data_daily - r"historic_data-\d{4}-day_\d{3}\.json"

@bhoy-troy
bhoy-troy self-requested a review October 20, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide history record.

3 participants