Sha256: 1d3d96374e1d12092a15625bdef7044cef983a4399118a41e243b71642a0816e

Contents?: true

Size: 1.72 KB

Versions: 108

Compression:

Stored size: 1.72 KB

Contents

-- A pathology report to help identify any HL7/delayed_job issues
-- the name of the view (the filename here) is significant as we'll compile all reporting_daily_*
-- views into a daily digest email
select
  (select count(*) from delayed_jobs) as delayed_jobs_total,
  (select count(*) from delayed_jobs where attempts = 0) as delayed_jobs_unprocessed,
  (select count(*) from delayed_jobs where last_error is not null and failed_at is null ) as delayed_jobs_retrying,
  (select count(*) from delayed_jobs where last_error is not null and failed_at is not null ) as delayed_jobs_failed,
  (select max(created_at) from delayed_jobs) as delayed_jobs_latest_entry,
  (select count(*) from delayed_jobs where created_at >= now()::date) as delayed_jobs_added_today,
  (select json_object_agg(priority, count) from (select priority, count(*) from delayed_jobs group by priority ) query) as delayed_jobs_priority_counts,
  (select json_object_agg(coalesce(queue, 'unset'), count) from (select queue, count(*) from delayed_jobs group by queue ) query) as delayed_jobs_queue_counts,
  (select json_object_agg(attempts, count) from (select attempts, count(*) from delayed_jobs group by attempts ) query) as delayed_jobs_attempts_counts,
  (select count(*) from feed_messages) as feed_messages_total,
  (select count(*) from feed_messages where created_at >= now()::date) as feed_messages_added_today,
  (select max(created_at) from feed_messages) as feed_messages_added_latest_entry, -- will be slow, needs index on feed_messages.created_at
  (select count(*) from pathology_observations where created_at::date >= now()::date) as pathology_observations_added_today,
  (select max(observed_at) from pathology_observations) as pathology_observations_latest_observed_at;

Version data entries

108 entries across 108 versions & 1 rubygems

Version Path
renalware-core-2.0.127 db/views/reporting_daily_pathology_v02.sql
renalware-core-2.0.126 db/views/reporting_daily_pathology_v02.sql
renalware-core-2.0.125 db/views/reporting_daily_pathology_v02.sql
renalware-core-2.0.124 db/views/reporting_daily_pathology_v02.sql
renalware-core-2.0.123 db/views/reporting_daily_pathology_v02.sql
renalware-core-2.0.121 db/views/reporting_daily_pathology_v02.sql
renalware-core-2.0.120 db/views/reporting_daily_pathology_v02.sql
renalware-core-2.0.119 db/views/reporting_daily_pathology_v02.sql
renalware-core-2.0.118 db/views/reporting_daily_pathology_v02.sql
renalware-core-2.0.117 db/views/reporting_daily_pathology_v02.sql
renalware-core-2.0.116 db/views/reporting_daily_pathology_v02.sql
renalware-core-2.0.115 db/views/reporting_daily_pathology_v02.sql
renalware-core-2.0.113 db/views/reporting_daily_pathology_v02.sql
renalware-core-2.0.112 db/views/reporting_daily_pathology_v02.sql
renalware-core-2.0.111 db/views/reporting_daily_pathology_v02.sql
renalware-core-2.0.110 db/views/reporting_daily_pathology_v02.sql
renalware-core-2.0.109 db/views/reporting_daily_pathology_v02.sql
renalware-core-2.0.108 db/views/reporting_daily_pathology_v02.sql
renalware-core-2.0.106 db/views/reporting_daily_pathology_v02.sql
renalware-core-2.0.105 db/views/reporting_daily_pathology_v02.sql