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

[BUG] cohort incidence may report incidence rate = infinity #1062

Closed
gowthamrao opened this issue Jul 5, 2023 · 2 comments · Fixed by #1069
Closed

[BUG] cohort incidence may report incidence rate = infinity #1062

gowthamrao opened this issue Jul 5, 2023 · 2 comments · Fixed by #1069
Labels
bug Something isn't working

Comments

@gowthamrao
Copy link
Member

I observed values of 'Inf' in the output file. This should not happen. Its happening when a persons denominator start_date = end_date make denominator = 0

SUM(CAST(DATEDIFF(DAY, start_date, end_date) AS BIGINT)) / 365.25 AS person_years

I think we should add where clause to remove records that are contributing 0 to the denominator? Plus, if the start_date - end_date then they probably cannot contribute to rate

@gowthamrao gowthamrao added the bug Something isn't working label Jul 5, 2023
@azimov
Copy link
Collaborator

azimov commented Aug 28, 2023

I agree that the result returned should never be inf but the datediff function should always return a number and the rate is fixed to 365.25. 0/365 = 0 - which is 0 - not undefined so this is a really result weird. The only way this ratio can result in Inf is if the DATEDIFF is Inf - which i can believe happens on some platforms if one of the dates is null maybe?

Is this on redshift or another platform?

@gowthamrao
Copy link
Member Author

redshift

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants