Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions concepts/pivoted/pivoted-gcs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,36 @@ 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)
as gcs
, 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)
as gcsmotor
, 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)
as gcsverbal
, 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)
Expand Down Expand Up @@ -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
ORDER BY patientunitstayid