File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -83,12 +83,16 @@ WITH ht_in AS
8383 subject_id
8484 -- extract the time of the note from the text itself
8585 -- add this to the structured date in the chartdate column
86- , PARSE_DATETIME(' %b-%d-%Y%H:%M' ,
87- CONCAT(
88- FORMAT_DATE(" %b-%d-%Y" , chartdate),
89- REGEXP_EXTRACT(ne .text , ' Date/Time: [\\ [\\ ]0-9*-]+ at ([0-9:]+)' )
90- )
91- ) AS charttime
86+ , CASE
87+ WHEN REGEXP_EXTRACT(ne .text , ' Date/Time: [\\ [\\ ]0-9*-]+ at ([0-9:]+)' ) IS NOT NULL
88+ THEN PARSE_DATETIME(' %b-%d-%Y%H:%M' ,
89+ CONCAT(
90+ FORMAT_DATE(" %b-%d-%Y" , chartdate),
91+ REGEXP_EXTRACT(ne .text , ' Date/Time: [\\ [\\ ]0-9*-]+ at ([0-9:]+)' )
92+ )
93+ )
94+ ELSE NULL
95+ END AS charttime
9296 -- sometimes numeric values contain de-id numbers, e.g. [** Numeric Identifier **]
9397 -- this case is used to ignore that text
9498 , case
You can’t perform that action at this time.
0 commit comments