Skip to main content

Refresh reporting views

Outcome

The 6 (+ EVV) materialized views in the reporting schema stay fresh enough for the dashboards to be trustworthy, with manual refresh available for incident recovery.

Prerequisites

  • reports.write for the manual REST endpoint.
  • DB access to inspect pg_matviews for freshness.

Views in the reporting schema

Manual refresh

SELECT reporting.fn_refresh_reporting_views();

This refreshes concurrently (no read locks):

  • reporting.mv_ar_aging_by_payer
  • reporting.mv_claim_status_summary
  • reporting.mv_denial_rate_by_category
  • reporting.mv_revenue_by_facility_month
  • reporting.mv_authorization_utilization
  • reporting.mv_clean_claim_rate

EVV compliance is non-concurrent (a separate refresh path) — see fn_refresh_evv_compliance.

Day-to-day

Views refresh via ReportingService.refreshAll() on every claim-status change, so operators normally don't need to touch them. Use the manual refresh when:

  • Seeding demo data.
  • Recovering from a stuck aggregator.
  • Right after a bulk import where you want immediate dashboard accuracy.

The REST endpoint:

curl -X POST -H "Authorization: Bearer $TOKEN" \
$RCM_CORE_URL/api/v1/ledger/reporting/refresh

(reports.write required.)

If event-driven refresh is disabled or unreliable, fall back to:

ViewFrequencyRationale
AR agingDaily (off-peak)Financial reporting accuracy
Claim statusEvery 4 hoursOperational dashboard
Denial rateDailyDenial trend monitoring
Revenue by facilityDailyFinancial reporting
Auth utilizationEvery 4 hoursAuthorization tracking
Clean claim rateDailyQuality metrics

Verify freshness

SELECT schemaname, matviewname, last_refresh
FROM pg_catalog.pg_matviews
WHERE schemaname = 'reporting'
ORDER BY matviewname;
last_refresh lagSeverity
< 5 minHealthy (event-driven path is working)
5 min – 1 hWatch — likely a quiet period
> 1 h sustainedInvestigate — refreshAll() may be stuck

Validation

CheckExpected
Manual refresh succeedsNo exceptions
pg_matviews.last_refreshWithin recommended window
Dashboard widgetsReflect recent activity

Troubleshooting

SymptomCauseFix
Refresh fails with concurrent refresh requires unique indexView dropped or index missingRe-run the migration that created the view.
Dashboards show stale data despite recent activityEvent-driven path stalledManual refresh; check rcm-core logs for refreshAll errors.
Refresh blocks for minutesUnusually large data setRun during off-peak; for very large tables, consider partitioning.

Cross-references

Next

7.4 — Dashboard reporting + scheduled email