Skip to content
This repository has been archived by the owner on Aug 4, 2023. It is now read-only.

Add Rawpixel to image popularity recalculation logic #897

Merged
merged 2 commits into from
Dec 2, 2022

Conversation

AetherUnbound
Copy link
Contributor

Description

This is a follow up to #795 which adds the Rawpixel popularity metric to the python logic steps. It was added to the DDL as part of #795, but it was not added to the table itself and said table gets updated in Python as part of the image popularity constant recalculation step once monthly. Even if it was added directly to the table, it wouldn't get updated if it were adjusted later down the line.

I also added a test which ensures that each of the values defined in the python logic are present in the DDL, and vice versa. This actually identified that Freesound was missing from the DDL, which I added in this PR.

We can either add Rawpixel's metric to the table directly after this, or we can wait until the next full popularity recalculation.

⚠️ After merging this PR one of the above actions should be taken ⚠️

Testing Instructions

Tests should be sufficient!

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@AetherUnbound AetherUnbound requested a review from a team as a code owner November 30, 2022 03:38
@AetherUnbound AetherUnbound added 💻 aspect: code Concerns the software code in the repository 🛠 goal: fix Bug fix 🟨 priority: medium Not blocking but should be addressed soon labels Nov 30, 2022
Copy link
Member

@zackkrida zackkrida left a comment

Choose a reason for hiding this comment

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

The new test is great!

("0007_openledger_audio_view.sql", sql.AUDIO_POPULARITY_METRICS),
],
)
def test_ddl_matches_definitions(ddl_filename, metrics):
Copy link
Contributor

Choose a reason for hiding this comment

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

So cool!

Copy link
Member

Choose a reason for hiding this comment

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

Awesome!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! I always think of adding it to the SQL file but I didn't even remember the logic file existed 😅

@@ -9,7 +9,8 @@ INSERT INTO public.audio_popularity_metrics (
provider, metric, percentile
) VALUES
('wikimedia_audio', 'global_usage_count', 0.85),
('jamendo', 'listens', 0.85);
('jamendo', 'listens', 0.85),
('freesound', 'num_downloads', 0.85);
Copy link
Member

Choose a reason for hiding this comment

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

Nice catch! Perhapsfreesound should be included in the title too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just the SQL DDL, which is only used locally. Since Freesound was present in logic file, it was added (either manually or automatically) to the appropriate table quite a while ago. Confirmed in production:

deploy@localhost:openledger> select * from audio_popularity_metrics;
+-----------------+--------------------+------------+
| provider        | metric             | percentile |
|-----------------+--------------------+------------|
| jamendo         | listens            | 0.85       |
| wikimedia_audio | global_usage_count | 0.85       |
| freesound       | num_downloads      | 0.85       |
+-----------------+--------------------+------------+
SELECT 3
Time: 0.098s

So this is more a bookkeeping change than anything 😄

("0007_openledger_audio_view.sql", sql.AUDIO_POPULARITY_METRICS),
],
)
def test_ddl_matches_definitions(ddl_filename, metrics):
Copy link
Member

Choose a reason for hiding this comment

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

Awesome!

@AetherUnbound AetherUnbound merged commit 0728cdb into main Dec 2, 2022
@AetherUnbound AetherUnbound deleted the feature/rawpixel-popularity branch December 2, 2022 01:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
💻 aspect: code Concerns the software code in the repository 🛠 goal: fix Bug fix 🟨 priority: medium Not blocking but should be addressed soon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants