From d5e52b0a4e5dbffbe215ff63d2a3fc3b4dc7e48c Mon Sep 17 00:00:00 2001 From: Tristan Naumann Date: Mon, 6 Apr 2020 11:41:10 -0700 Subject: [PATCH] Replaces REGEXP_CONTAINS with ~ in pivoted-gcs.sql Rewrite `REGEXP_CONTAINS(nursingchartvalue, '^[-]?[0-9]+[.]?[0-9]*$')` as `nursingchartvalue ~ '^[-]?[0-9]+[.]?[0-9]*$'` for compatibility with Postgres. --- concepts/pivoted/pivoted-gcs.sql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/concepts/pivoted/pivoted-gcs.sql b/concepts/pivoted/pivoted-gcs.sql index 8eff9ee..52caadc 100644 --- a/concepts/pivoted/pivoted-gcs.sql +++ b/concepts/pivoted/pivoted-gcs.sql @@ -6,12 +6,12 @@ select , min(case when nursingchartcelltypevallabel = 'Glasgow coma score' and nursingchartcelltypevalname = 'GCS Total' - and REGEXP_CONTAINS(nursingchartvalue, '^[-]?[0-9]+[.]?[0-9]*$') + and nursingchartvalue ~ '^[-]?[0-9]+[.]?[0-9]*$' and nursingchartvalue not in ('-','.') then cast(nursingchartvalue as numeric) when nursingchartcelltypevallabel = 'Score (Glasgow Coma Scale)' and nursingchartcelltypevalname = 'Value' - and REGEXP_CONTAINS(nursingchartvalue, '^[-]?[0-9]+[.]?[0-9]*$') + and nursingchartvalue ~ '^[-]?[0-9]+[.]?[0-9]*$' and nursingchartvalue not in ('-','.') then cast(nursingchartvalue as numeric) else null end) @@ -19,7 +19,7 @@ select , min(case when nursingchartcelltypevallabel = 'Glasgow coma score' and nursingchartcelltypevalname = 'Motor' - and REGEXP_CONTAINS(nursingchartvalue, '^[-]?[0-9]+[.]?[0-9]*$') + and nursingchartvalue ~ '^[-]?[0-9]+[.]?[0-9]*$' and nursingchartvalue not in ('-','.') then cast(nursingchartvalue as numeric) else null end) @@ -27,7 +27,7 @@ select , min(case when nursingchartcelltypevallabel = 'Glasgow coma score' and nursingchartcelltypevalname = 'Verbal' - and REGEXP_CONTAINS(nursingchartvalue, '^[-]?[0-9]+[.]?[0-9]*$') + and nursingchartvalue ~ '^[-]?[0-9]+[.]?[0-9]*$' and nursingchartvalue not in ('-','.') then cast(nursingchartvalue as numeric) else null end) @@ -35,7 +35,7 @@ select , min(case when nursingchartcelltypevallabel = 'Glasgow coma score' and nursingchartcelltypevalname = 'Eyes' - and REGEXP_CONTAINS(nursingchartvalue, '^[-]?[0-9]+[.]?[0-9]*$') + and nursingchartvalue ~ '^[-]?[0-9]+[.]?[0-9]*$' and nursingchartvalue not in ('-','.') then cast(nursingchartvalue as numeric) else null end) @@ -68,4 +68,4 @@ WHERE gcs IS NOT NULL OR gcsmotor IS NOT NULL OR gcsverbal IS NOT NULL OR gcseyes IS NOT NULL -ORDER BY patientunitstayid \ No newline at end of file +ORDER BY patientunitstayid