NFDI4BIOIMAGE / training

https://nfdi4bioimage.github.io/training
Creative Commons Attribution 4.0 International
10 stars 7 forks source link

Three most downloaded zenodo records #358

Closed haesleinhuepf closed 52 minutes ago

haesleinhuepf commented 2 hours ago

git-bob think about how we can modify highlights-download-statistics.py so that the three most downloaded records are added to the readme.md and not just the single one most downloaded record.

github-actions[bot] commented 2 hours ago

This message was generated by git-bob (version: 0.12.0, model: github_models:gpt-4o, log), an experimental AI-based assistant. It can make mistakes and has limitations. Check its messages carefully.

To address the request of adding the three most downloaded Zenodo records to the README.md instead of just the single most downloaded record, you can modify the script to identify the top three records by download difference and update the README accordingly. Here's a suggestion for refactoring the relevant part of the script:

# Find the top three records with the highest download difference
top_three_records = merged_data.nlargest(3, 'download_difference')

# Print the results
print("Top three downloaded records in the last week:")
print(top_three_records[['url', 'download_difference']])

# Update README.md with the three most downloaded records
update_readme(folder, top_three_records)

# Modify the update_readme function to handle multiple records
def update_readme(folder, top_records):
    """
    Update the README.md file with the top three downloaded records.
    """
    readme_path = "docs/readme.md"

    highlights = []
    for _, record in top_records.iterrows():
        license_info = download_first_file_from_zenodo(folder, record['url'].split('/')[-1])
        title = get_title_of_zenodo_record(record['url'])
        record_highlight = f"""- [{title}]({record['url']}) by {record['authors_current']} ({record['download_difference']} downloads)."""

        if license_info == "cc-by-4.0":
            latest_png = get_latest_png_filename(folder)
            if os.path.isfile(latest_png):
                record_highlight += f" ![latest PNG]({latest_png.replace('docs/', '')})"

        highlights.append(record_highlight)

    highlight_text = "\n".join(highlights)

    # Read and update README.md
    ...
    # Assume similar logic to existing code for replacing content in README

This will allow the README to show detailed information for the top three most downloaded records.

haesleinhuepf commented 2 hours ago

Ok cool. git-bob implement this!