Open gowthamrao opened 1 year ago
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?
redshift
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
https://github.com/OHDSI/CohortDiagnostics/blob/ea6b5f8994cf2b493aa4c6c534397ffe8808ac8e/inst/sql/sql_server/ComputeIncidenceRates.sql#L47
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