-
Notifications
You must be signed in to change notification settings - Fork 2
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
DIG-1582: Implement overview thresholds & DIG-1533: Change cancer_type to primary_site #205
Conversation
- Introduced threshold for small counts to display masked values, e.g., <5. - Rewrite queries for masking and performance. - Updated return types from int to str to cope with "<5" - Update schema return structure for new queries
…G/katsu into sonchau/overview_threshold
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #205 +/- ##
===========================================
+ Coverage 95.11% 96.69% +1.57%
===========================================
Files 34 35 +1
Lines 3503 3570 +67
===========================================
+ Hits 3332 3452 +120
+ Misses 171 118 -53 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved! I was able to spin up the environment and test some of the calls. The results return as expected, showing the new AGGREGATE_COUNT_THRESHOLD <5
Getting an error on the frontpage with this PR, from Katsu's logs:
|
I can confirm this bug, looking into it |
fixed. Can you check it again @OrdiNeu ? |
I've rebuilt a few times with the latest changes but still get the same error listed above. For reference, I'm just visiting the frontpage and checking the logs -- it's a request straight to Katsu's |
@OrdiNeu Have you added To avoid this in the future, I have added the code to check if any .env is missing. Let me know if it works for you. |
Oh, that sort of works now. Getting a new error now though, on
|
- fix the bug where AGGREGATE_COUNT_THRESHOLD read as a str in docker env - should show 0 instead of <5 for value 0
I fixed the bug where AGGREGATE_COUNT_THRESHOLD is not an int. Accidentally, I found a bug with cache but I will address it in another ticket |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, well-written ✔️
The latest fix made it work for me
"REDIS_PASSWORD_FILE", | ||
] | ||
|
||
missing_vars = [var for var in required_env_vars if not os.getenv(var)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file switches between using os.getenv()
and os.environ[]
in several places -- I'd recommend sticking to one or the other (as far as I understand it, one's a wrapper of the other)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a slight difference, and it's on purpose. os.getenv
returns None if the variable is not found, allowing me to catch it and throw an exception.
Why not use os.getenv
below? If it returns None for a missing variable, it can cause the bug we encountered before. If I (or someone else) tries to get a new variable but forgets to add it to required_vars, it will crash instead of causing a subtle bug, making it easier to catch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see -- perhaps it would be best if lines 34-36 used os.getenv
then, rather than os.environ.get()
? For consistency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh thank you for the eagle eye! There was a merge conflict and I used the upstream code without realized it
""" | ||
|
||
|
||
class OverviewTestCase(BaseTestCase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests are well-written 👍
} | ||
date_of_birth = factory.LazyFunction( | ||
lambda: { | ||
"month_interval": random.randint(0, 1000), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this make the month_interval and day_interval not line up? E.g. you could have a day_interval of 0 and a month_interval of 1000.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct, but I'm not testing the date logic here. I agree that a more realistic generator would be better, but these mock data serve my purpose for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me -- maybe document this discrepancy in the Note: at the top of this file. Otherwise it looks good ✔️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
NB: we should probably hold on updating the submodule version on CanDIGv2's |
- don't use get
What's new
discover_cancer_type_count
todiscover_primary_site_count
Types of Change(s)
Which other services does it affect?
Has it been tested for:
How to test
AGGREGATE_COUNT_THRESHOLD=${AGGREGATE_COUNT_THRESHOLD}
and run test-integration