Skip to content

Commit

Permalink
fix legacy download counts for updated legacy models
Browse files Browse the repository at this point in the history
  • Loading branch information
FynnBe committed Jun 11, 2024
1 parent d7b1eb7 commit 4b6993c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bioimageio_collection_backoffice/remote_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@

yaml = YAML(typ="safe")

# TODO: add nicknames of legacy models
LEGACY_DOWNLOAD_COUNTS = {
"affable-shark": 70601,
"emotional-cricket": 36653,
"10.5281/zenodo.10366411": 632,
"10.5281/zenodo.10391887": 754,
"10.5281/zenodo.10405148": 566,
Expand Down Expand Up @@ -1102,21 +1105,20 @@ def maybe_swap_with_thumbnail(
for d in [v.client.load_file(v.rdf_path) for v in versions]
]
entry_dois = [v.doi for v in versions]
legacy_download_count = LEGACY_DOWNLOAD_COUNTS.get(rdf["id"], 0) # TODO: add download count from versions

if rdf["id"].startswith("10.5281/zenodo."):
# legacy models
concept_end = rdf["id"].rfind("/")
concept_doi = rdf["id"][:concept_end]
entry_id = concept_doi
legacy_download_count: int = LEGACY_DOWNLOAD_COUNTS.get(concept_doi, 0)
for v in LEGACY_VERSIONS.get(concept_doi, []):
entry_versions.append(f"{concept_doi}/{v}")
versions_sha256.append(None)
entry_dois.append(f"10.5281/zenodo.{v}")
else:
concept_doi = rv.concept_doi
entry_id = rdf["id"]
legacy_download_count = 0

# TODO: read new download count
download_count = "?" if legacy_download_count == 0 else legacy_download_count
Expand Down

0 comments on commit 4b6993c

Please sign in to comment.