Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truncate data refresh percent change report to 3 digits after the decimal #1581

Closed
1 task
AetherUnbound opened this issue Sep 20, 2022 · 3 comments · Fixed by #4065
Closed
1 task

Truncate data refresh percent change report to 3 digits after the decimal #1581

AetherUnbound opened this issue Sep 20, 2022 · 3 comments · Fixed by #4065
Assignees
Labels
📄 aspect: text Concerns the textual material in the repository ✨ goal: improvement Improvement to an existing user-facing feature good first issue New-contributor friendly help wanted Open to participation from the community 🟩 priority: low Low priority and doesn't need to be rushed 🧱 stack: catalog Related to the catalog and Airflow DAGs 🔧 tech: airflow Involves Apache Airflow 🐍 tech: python Involves Python
Projects

Comments

@AetherUnbound
Copy link
Contributor

Description

PR WordPress/openverse-catalog#636 added a count difference reporting message after the data refresh has been run. Part of this count is the percent change, which is given as a float. The difficulty with printing a straight float is that the numbers after the decimal can vary wildly. Here are a few examples:

Record count difference for audio: 174,290 → 817,198
Change: +642,908 (+368.8725687073269% Δ)

Record count difference for image: 563,561,088 → 564,775,616
Change: +1,214,528 (+0.21550955625949816% Δ)

Record count difference for image: 579,553,984 → 579,554,880
Change: +896 (+0.0001546016462204149% Δ)

We have a wide range of potential digits (in the hundreds to hundredths of a percent) and it can be hard to capture the level of information we would like for all cases. I think it would be best for us to have 3 significant digits after the decimal or closest zero, rounded up. This would mean for the above three cases the output would be:

  • 368.8725687073269 -> 368.873
  • 0.21550955625949816 -> 0.216
  • 0.0001546016462204149 -> 0.000155

Alternatives

Leave as is, or do some basic string truncation which could leave us with values like 0.000%.

Implementation

  • 🙋 I would be interested in implementing this feature.
@AetherUnbound AetherUnbound added good first issue New-contributor friendly help wanted Open to participation from the community ✨ goal: improvement Improvement to an existing user-facing feature 🐍 tech: python Involves Python 📄 aspect: text Concerns the textual material in the repository 🟩 priority: low Low priority and doesn't need to be rushed labels Sep 20, 2022
@ozgvr
Copy link

ozgvr commented Sep 21, 2022

Hello, I've worked on this issue and written a function to truncate changes to 3 significant digits after the decimal and produces output exactly as the examples given.
But for very long decimals like 0.000001432153 the result gets rounded like 0.000001. Is this acceptable?

@AetherUnbound
Copy link
Contributor Author

AetherUnbound commented Sep 21, 2022

That is more than acceptable in my opinion! Would you like to contribute the code? I can assign this issue to you if so 😄

@obulat obulat added the 🧱 stack: catalog Related to the catalog and Airflow DAGs label Feb 23, 2023
@AetherUnbound AetherUnbound added the 🔧 tech: airflow Involves Apache Airflow label Mar 20, 2023
@obulat obulat transferred this issue from WordPress/openverse-catalog Apr 17, 2023
@mattfergoda
Copy link
Contributor

I'll work on this one!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📄 aspect: text Concerns the textual material in the repository ✨ goal: improvement Improvement to an existing user-facing feature good first issue New-contributor friendly help wanted Open to participation from the community 🟩 priority: low Low priority and doesn't need to be rushed 🧱 stack: catalog Related to the catalog and Airflow DAGs 🔧 tech: airflow Involves Apache Airflow 🐍 tech: python Involves Python
Projects
Archived in project
Openverse
  
Backlog
4 participants