MIT-LCP / mimic-code

MIMIC Code Repository: Code shared by the research community for the MIMIC family of databases
https://mimic.mit.edu
MIT License
2.43k stars 1.5k forks source link

`DATETIME_DIFF` implementation varies between postgres and bigquery #1549

Open alistairewj opened 1 year ago

alistairewj commented 1 year ago

As raised in #1529, DATETIME_DIFF in PostgreSQL calculates a fractional number, whereas DATETIME_DIFF in BigQuery returns a whole number. This results in a subtle divergence of the concepts in the two dialects. urine_output_rate may be affected as various comparisons expected fractional values to be returned:

https://github.com/MIT-LCP/mimic-code/blob/a8308706d8f2bf3bbf42f5e7065094c648f64576/mimic-iv/concepts/measurement/urine_output_rate.sql#L44-L53

Easiest fix is to (1) update postgres-functions.sql and (2) update the UO query to take a similar approach to the kdigo_uo query.