Skip to content

Instantly share code, notes, and snippets.

@docsteveharris
Last active November 25, 2019 12:27
Show Gist options
  • Save docsteveharris/10b170fb135252a848d1b52aba931567 to your computer and use it in GitHub Desktop.
Save docsteveharris/10b170fb135252a848d1b52aba931567 to your computer and use it in GitHub Desktop.
Parse error log for the task transforming data in EMAP star to EMAP ops (OMOP) #uclh #emap
select * from (
select 0 as id, 'INFO' as type , 'Number of runs' as note, count(*)
from omop_live.etl_error_log
where error_message like 'Finishe%'
union
select 1 as id, 'INFO' as type , 'live patients' as note , count(*)
from live.person
union
select 2, 'INFO' as type, 'processed patients' as note, count(*)
from omop_live.person
union
select 3, 'INFO' as type, 'processed measurements' as note, count(*)
from omop_live.measurement
union
select 4, 'INFO' as type, 'processed observations' as note, count(*)
from omop_live.observation
union
select 5, 'ERRORS' as type, error_message as note, count(*) from omop_live.etl_error_log
where error_level = 'FAIL' and error_message not like 'The following error has occurred uk%'
group by error_message
) as a order by id asc
---- Labs fail
select error_message , count(*)
from omop_live.etl_error_log
where error_message like 'No labs%'
group by error_message
order by count desc
----- Units fail
select error_message , count(*)
from omop_live.etl_error_log
where error_message like 'Unable to look%'
group by error_message
order by count desc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment