OHDSI/Achilles — pull request #17 by toanong (2014-07-02 19:15:37+00:00)
Title: Postgres Missing CAST in Join and CAST Error Resolution

The current pull request aims to resolve the following two issues:

1. In the sqlAgeAtFirstDiagnosis.sql file there is a missing (CAST as INT) in a join condition (line 12) which causes the join to fail in Postgres 9.1 due to a type mismatch error.

2. In the TestAchillesCode.R we noticed that there is code written to test Achilles on PostgreSQL, but when we tried to use Achilles with PostgreSQL 9.1 data we ran into CAST errors. The Postgres ROUND function expects ROUND(numeric,int) but there are two instances of ROUND(CAST as FLOAT, int) which causes PG to throw an illegal data type error. When changed to ROUND(CAST as NUMERIC(8,6), int), these statements work correctly.