Skip to content
DBRaven
Concerns

Rule-based disposition: any dimension at its most severe tier caps this at “concerns” or worse. Never an averaged score.

  • Operational Readiness: Healthcare Records Platform requires expert operational expertise at 'platform engineering team' level. Current readiness estimate is 20%, critical gaps must be resolved before adoption. Consider starting with a simpler scenario and evolving toward this one.
Full ReviewModerate Readinessdraft

Architecture Review: Healthcare Records Platform

An electronic health record (EHR) architecture built around strict auditability, HIPAA compliance, and append-only correctness. Clinical records are mutable by design (amendments, addenda) but corrections must be explicitly attributed, not silently overwritten. Event sourcing provides a reconstructable audit log; PostgreSQL row-level security enforces patient-level access control at the database layer; Kafka streams HL7 FHIR events to downstream clinical systems. The architecture must support breach detection, access auditing, and state reconstruction at any historical point: not just current state retrieval.

Evidence Confidence

Moderate

strong

Executive Summary

Healthcare Records Platform carries moderate operational readiness (81% evidence confidence). 0 architectural strengths identified, 6 operational risks to manage. Primary concern: Lock Contention. Requires Advanced operational maturity.

Readiness Rationale

Overall moderate readiness across 8 dimensions. Weak: consistency. Limited: team maturity. Strong: migration, observability, failure recovery.

Key Concerns

  • !Lock Contention
  • !Replication Lag Cascade

Key Strengths

  • +Architecture is well-defined for the financial ledger problem profile

8

Assessments

2

Tradeoffs

6

Sections

12

Recommendations

Readiness Assessments

8

Governance Posture

6

Structural boundary and anti-pattern compliance: whether this architecture's topology violates documented governance policies. Distinct from operational readiness (below), which asks whether the team and infrastructure are prepared to run it.

Concerning

6 governance policy matches and 2 anti-pattern matches put Healthcare Records Platform's governance posture at concerning risk. Resilience is moderate; burden is extreme.

6

violations

2

anti-patterns

Governance Violations

Anti-Pattern Matches

Resilience

moderate

Blast radius: contained

56%

resilience score

Coupling Risks

  • ·Schema migration lock during active clinical hours: a table-level DDL lock on cl

Consistency Risks

  • ·Cross-facility patient record linkage inconsistency: when the same patient exist

Resilience Gaps

  • 3 high-exposure risk nodes increase blast radius

Operational Burden

extreme

operational burden

97%

burden index

Complexity Drivers

  • 7 architecture patterns increase configuration surface
  • HIPAA audit log gap: if the audit log write fails independently of the clinical
  • RLS policy coverage gap on new tables: every new PostgreSQL table that stores pa

Observability Burden

  • kafka: requires dedicated monitoring instrumentation
  • postgresql: requires dedicated monitoring instrumentation
  • redis: requires dedicated monitoring instrumentation

Recovery Complexity

  • 3 risk propagation path(s) complicate failure recovery

Maturity

Required

Advanced

Estimated

Established

Gap

Minor Gap

The architecture requires advanced maturity while the team is estimated at established. A minor capability gap exists: addressable through targeted learning and operational practice.

Recommended Prerequisites

  • Understand: Tier 1: Audit Log Write Throughput
  • Understand: Tier 2: Concurrent Encounter Write Lock Contention

Operational Readiness

7

Adoption readiness: whether the team, infrastructure, and observability are prepared to run this architecture safely. Distinct from governance posture (above), which asks whether the topology itself violates architectural boundaries.

Not Readyfinancial ledger

Healthcare Records Platform requires expert operational expertise at 'platform engineering team' level. Current readiness estimate is 20%, critical gaps must be resolved before adoption. Consider starting with a simpler scenario and evolving toward this one.

Readiness Score

20%

Blocking Prerequisites

4

Complexity

Expert

Confidence

Strong

Assessment derived from scenario knowledge, advisor output, topology analysis, and 7 prerequisite checks.

Prerequisite Checklist (4 blocking, 3 non-blocking)

blocking

team

Team at 'platform engineering team' maturity level

This scenario is rated 'platform engineering team' complexity.

Gap signal: Team frequently reaches for external help during incidents or struggles to debug multi-system issues independently.

blocking

process

Failure mode awareness and runbooks

The team must understand the 6 documented failure modes for this scenario: replication_lag_cascade, lock_contention, schema_migration_lock, config_drift. Each should have a documented detection procedure and runbook.

Gap signal: The team has no documented runbooks for the scenario's failure modes or cannot name them without reference material.

blocking

monitoring

Production-grade observability stack

The scenario requires real-time metrics, structured logging, and distributed tracing on all critical components. Alerting must be configured before going live.

Gap signal: No dashboards exist for the critical path metrics in the scenario.

infrastructure

Minimum team maturity: Platform Engineering Team

This scenario has expert operational complexity. It is recommended for Platform Engineering Team teams or higher.

Gap signal: The requirement 'Minimum team maturity: Platform Engineering Team' is not yet in place.

infrastructure

Runbooks and alerting for high-severity risks

4 high-severity risks identified. Each requires a documented runbook, alerting threshold, and on-call response procedure before running in production.

Gap signal: The requirement 'Runbooks and alerting for high-severity risks' is not yet in place.

infrastructure

Event stream operations expertise

This architecture includes event stream infrastructure (Kafka, Kinesis, or similar). Operations requires consumer group management, partition assignment, dead-letter handling, and lag monitoring.

Gap signal: The requirement 'Event stream operations expertise' is not yet in place.

blocking

infrastructure

Mitigation for 2 high-risk topology node(s)

Nodes with high or critical risk exposure: Write-Heavy Transactional, PostgreSQL. Each requires documented mitigation before production deployment.

Gap signal: No mitigation strategy is documented for the high-risk nodes in the topology.

Infrastructure Requirements

Apache Kafka

high burden

Distributed event streaming platform designed for high-throughput, fault-tolerant, ordered, and durable log-based messaging between producers and cons

Managed: Amazon MSK (Managed Streaming for Kafka), Confluent Cloud, Azure Event Hubs (Kafka-compatible), Redpanda Cloud

PostgreSQL

medium burden

ACID-compliant relational database with strong consistency, JSONB support, full-text search, and mature replication.

Managed: Amazon RDS for PostgreSQL, Amazon Aurora PostgreSQL, Google Cloud SQL for PostgreSQL, Azure Database for PostgreSQL, Supabase, Neon

Redis

low burden

In-memory key-value store with optional persistence, supporting strings, hashes, lists, sets, sorted sets, and pub/sub.

Managed: Amazon ElastiCache for Redis, Google Cloud Memorystore, Azure Cache for Redis, Redis Cloud, Upstash

Observability Requirements

Monitor replication lag signals

Seed 'Replication Lag Under Write Burst' identifies 4 metrics relevant to replication_lag_cascade. Execution preview confirms this risk manifests under modelled load.

Seed 'Replication Lag Under Write Burst' identifies 4 metrics relevant to replication_lag_cascade. Execution preview confirms this risk manifests under modelled load.

Monitor generic risk probe signals

Seed 'Lock Contention Risk Probe' identifies 2 metrics relevant to lock_contention.

Seed 'Lock Contention Risk Probe' identifies 2 metrics relevant to lock_contention.

Track Lock Contention exposure

Lock Contention has high exposure and affects 1 component. Affects 1 node. (Write-Heavy Transactional)

Lock Contention has high exposure and affects 1 component. Affects 1 node. (Write-Heavy Transactional)

Track Schema Migration Lock exposure

Schema Migration Lock has high exposure and affects 0 components. Affects 0 nodes

Schema Migration Lock has high exposure and affects 0 components. Affects 0 nodes

Track Deadlock exposure

Deadlock has high exposure and affects 1 component. Affects 1 node. (PostgreSQL)

Deadlock has high exposure and affects 1 component. Affects 1 node. (PostgreSQL)

Audit log table growing at > 500K rows/day; INSERT p99 on audit_log > 20ms; autovacuum unable to keep up with dead tuple

This signal indicates the architecture is approaching 'Tier 1: Audit Log Write Throughput'. Likely bottleneck: Audit log receiving one row per record access creates I/O contention with clinical record writes on the same PostgreSQL primary.

Tier 1: Audit Log Write Throughput

pg_locks showing RowExclusiveLock waits on clinical_records or encounter_notes during shift-change peak hours; write p99

This signal indicates the architecture is approaching 'Tier 2: Concurrent Encounter Write Lock Contention'. Likely bottleneck: Multiple clinical staff members writing addenda to the same encounter simultaneously, or two processes updating encounter status concurrently.

Tier 2: Concurrent Encounter Write Lock Contention

Kafka consumer lag growing on FHIR event topics; downstream clinical systems reporting stale data; outbox table accumula

This signal indicates the architecture is approaching 'Tier 3: FHIR Event Streaming Throughput'. Likely bottleneck: FHIR message transformation and Kafka publish throughput falling behind clinical event write volume.

Tier 3: FHIR Event Streaming Throughput

Readiness Action Plan

Criticalteam

Satisfy: Team at 'platform engineering team' maturity level

Effort: 1–4 weeks depending on current state · Unblocks: Adoption of Healthcare Records Platform

Criticalprocess

Satisfy: Failure mode awareness and runbooks

Effort: 1–4 weeks depending on current state · Unblocks: Adoption of Healthcare Records Platform

Criticalmonitoring

Satisfy: Production-grade observability stack

Effort: 1–4 weeks depending on current state · Unblocks: Adoption of Healthcare Records Platform

Criticalinfrastructure

Satisfy: Mitigation for 2 high-risk topology node(s)

Effort: 1–4 weeks depending on current state · Unblocks: Adoption of Healthcare Records Platform

Highmonitoring

Instrument all critical path components with metrics and alerting

Effort: 1–2 weeks · Unblocks: Safe production adoption and incident response

Highprocess

Validate adoption in a staging environment before production

Effort: 2–4 weeks for thorough staging validation · Unblocks: Production confidence and rollback preparedness

Mediuminfrastructure

Mitigate risk: Replication Lag Cascade

Effort: 1–3 weeks · Unblocks: Reduces 'Replication Lag Cascade' from blocking adoption

Mediuminfrastructure

Mitigate risk: Lock Contention

Effort: 1–3 weeks · Unblocks: Reduces 'Lock Contention' from blocking adoption

Go Signals

  • Team has hands-on experience with all 3 referenced technologies.
  • All scenario failure modes have documented runbooks and alerting coverage.
  • A staging environment that mirrors production load has been tested successfully.

No-Go Signals

  • Team cannot explain or debug any of Healthcare Records Platform's documented failure modes.
  • No observability baseline exists for the critical components.
  • Top risk is unmitigated: 'Replication Lag Cascade', do not proceed without addressing this.

Critical Gaps

  • This scenario has expert operational complexity, teams without deep production experience will struggle to operate it safely.

Team Requirements

Apache Kafka operations

Required level: proficient

Team can explain Apache Kafka's failure modes, tune configuration parameters under load, and recover from common operational issues.

PostgreSQL operations

Required level: proficient

Team can explain PostgreSQL's failure modes, tune configuration parameters under load, and recover from common operational issues.

Redis operations

Required level: proficient

Team can explain Redis's failure modes, tune configuration parameters under load, and recover from common operational issues.

Readiness assessment is derived from structured scenario and topology knowledge. It provides an evidence-grounded baseline, not a substitute for an actual team capability review or infrastructure audit. Validate each item against your specific environment.

Architectural Tradeoffs

2

Recommendations

12
High

Monitor: Replication Lag Cascade

risk_monitoring

Asynchronous replicas fall behind the primary under write load and serve reads from an older version of the data. Reads keep succeeding, so nothing errors; what breaks is one of three specific consistency guarantees (read-after-write, monotonic reads, or consistent prefix), each with a distinct user-visible anomaly.

Affects 1 node. (Read Replica)

High

Monitor: Lock Contention

risk_monitoring

Concurrent writers to the same rows serialize behind each other's row locks, so latency is set not by the work a transaction does but by how long it waits for the writers ahead of it. On a hot row the queue depth, and therefore the tail latency, grows with concurrency while throughput flattens. Blocked writers hold connections open, so a single contended row can drain the connection pool as a secondary failure.

Affects 1 node. (Write-Heavy Transactional)

High

Implement: Monitor replication lag signals

observability

Seed 'Replication Lag Under Write Burst' identifies 4 metrics relevant to replication_lag_cascade. Execution preview confirms this risk manifests under modelled load.

Metrics to instrument: replication_lag_seconds, stale_read_rate, replica_wal_apply_rate

Moderate

Mutable clinical records with application-layer audit logging → Event-sourced clinical records with atomic audit event + outbox writes

migration_planning

Trigger: HIPAA audit requirement exposed during external security review; inability to reconstruct which practitioner accessed a patient record and when; audit log gaps found during incident investigation (application-layer logging not guaranteed to capture all access paths, including background jobs and admin tools). Migrate from 'Mutable clinical records with application-layer audit logging' to 'Event-sourced clinical records with atomic audit event + outbox writes'. Define a "record_state_bootstrap" event type for all existing clinical records as of the migration cutover date. These events carry the current state with a note that pre-migration history is unavailable. This satisfies HIPAA reconstruction requirements for post-migration access while being honest about pre-migration gaps.

Historical records before the migration cutover cannot be event-sourced retroactively without synthetic "initial_state" events: document the boundary date explicitly and include it in audit reports; The transition requires a period of dual-write (old mutable path + new event path) with reconciliation to validate equivalence before decommissioning the mutable-only path

Moderate

Inline Kafka publish inside clinical transaction (dual-write) → Outbox pattern with CDC relay for FHIR event delivery

migration_planning

Trigger: FHIR events being published to Kafka but corresponding clinical record transactions rolling back, resulting in phantom events being consumed by downstream clinical systems; or Kafka publish failures causing clinical transactions to roll back and block charting workflows. Migrate from 'Inline Kafka publish inside clinical transaction (dual-write)' to 'Outbox pattern with CDC relay for FHIR event delivery'. The outbox pattern is non-negotiable for FHIR delivery. The dual-write pattern creates phantom clinical events when transactions roll back: in a healthcare context, a phantom "medication_administered" event on a downstream system is a patient safety incident. The outbox guarantees at-least-once delivery aligned with transaction commit; downstream consumers must dedupe on event ID so replays do not create duplicate clinical events.

Outbox relay introduces delivery lag (< 5s under normal load): downstream systems must tolerate this latency and must not assert synchronous availability of FHIR events as part of the clinical transaction commit path; FHIR message construction errors in the relay must dead-letter and alert rather than silently dropping: a lost FHIR event can mean a downstream system has no record of a clinical event

Moderate

Prepare runbook for: Burst Traffic Cold Cache Stampede

simulation_preparedness

Simulation demonstrates critical degradation of redis, postgresql

Without a runbook, recovery from this failure mode will be ad-hoc

Moderate

Prepare runbook for: Connection Pool Exhaustion with Horizontal User Scale

simulation_preparedness

Simulation demonstrates critical degradation of postgresql

Without a runbook, recovery from this failure mode will be ad-hoc

Moderate

Plan evolution: OLTP Analytics Queries → OLTP + OLAP Separation

evolution_planning

Evolution from Unified OLTP + Analytics on PostgreSQL → Separated OLTP (PostgreSQL) + OLAP (ClickHouse/Snowflake)

Migration complexity: medium. Rollback: always.

Moderate

Plan evolution: Single Cache Layer → Distributed Cache

evolution_planning

Evolution from Single Redis Node / Sentinel Cluster → Distributed Redis Cluster (Consistent Hash Ring)

Migration complexity: medium. Rollback: complex.

Moderate

Cache-outage database fallback load

caching

'Healthcare Records Platform' includes a cache in its topology. If the cache becomes unavailable, the primary database receives the cache's full request load until the cache recovers.

Capacity-plan the primary database for this fallback load, not only for the steady-state cached load.

Moderate

Cache invalidation ownership

caching

Cache invalidation for Healthcare Records Platform is event-driven: kafka refreshes or invalidates redis. This couples cache freshness to consumer lag on that event stream, not to the primary write path directly.

If the event-stream consumer falls behind, the cache serves stale data until it catches up -- monitor consumer lag as a cache-freshness signal, not only a backlog signal.

Low

Monitor threshold: Tier 1: Audit Log Write Throughput

scaling_monitoring

Signal: Audit log table growing at > 500K rows/day; INSERT p99 on audit_log > 20ms; autovacuum unable to keep up with dead tuple accumulation from UPDATE operations on the audit log's index pages

Bottleneck: Audit log receiving one row per record access creates I/O contention with clinical record writes on the same PostgreSQL primary. Evolution: Partition the audit_log table by month using PostgreSQL declarative partitioning; child partitions allow VACUUM to operate on bounded table segments without scanning the entire history; index each partition independently to keep index size proportional to partition row count rather than total log size

Scaling Pressure Signals

8

Audit log table growing at > 500K rows/day; INSERT p99 on audit_log > 20ms; autovacuum unable to keep up with dead tuple accumulation from UPDATE operations on the audit log's index pages

Threshold

Tier 1: Audit Log Write Throughput

Likely Bottleneck

Audit log receiving one row per record access creates I/O contention with clinical record writes on the same PostgreSQL primary

Recommended Evolution

Partition the audit_log table by month using PostgreSQL declarative partitioning; child partitions allow VACUUM to operate on bounded table segments without scanning the entire history; index each partition independently to keep index size proportional to partition row count rather than total log size

pg_locks showing RowExclusiveLock waits on clinical_records or encounter_notes during shift-change peak hours; write p99 > 100ms; occasional deadlock errors in application logs correlated with concurrent addenda writes to the same encounter

Threshold

Tier 2: Concurrent Encounter Write Lock Contention

Likely Bottleneck

Multiple clinical staff members writing addenda to the same encounter simultaneously, or two processes updating encounter status concurrently

Recommended Evolution

Implement optimistic locking with an encounter version column; reject concurrent writes with a conflict error and require the client to reload and retry; this eliminates lock waits by failing fast rather than waiting; ensure the application presents a clear conflict resolution UI: in a clinical context, silent overwrites of concurrent edits are a patient safety risk, not just a data integrity issue

Kafka consumer lag growing on FHIR event topics; downstream clinical systems reporting stale data; outbox table accumulating unprocessed rows > 10,000 at rest

Threshold

Tier 3: FHIR Event Streaming Throughput

Likely Bottleneck

FHIR message transformation and Kafka publish throughput falling behind clinical event write volume

Recommended Evolution

Increase outbox relay consumer parallelism; partition Kafka FHIR topics by patient_id to maintain per-patient event ordering while enabling parallel processing; profile FHIR message construction for CPU-intensive transformation paths (e.g., terminology code mapping) and consider caching terminology lookups in Redis

Evidence:kafka-consumer-lag-cascadepartition-hotspot-amplification

PostgreSQL primary I/O > 70% from read queries during morning rounds (when all staff are querying overnight encounter summaries simultaneously); read replica replication lag > 5s during peak read periods

Threshold

Tier 4: Multi-Facility Read Replica Distribution

Likely Bottleneck

Read-heavy clinical summary queries competing with event write volume on the shared primary

Recommended Evolution

Direct all clinical summary and dashboard reads to the read replica via CQRS routing; ensure read replica has synchronous_standby_names configured to receive writes at most 5 seconds behind primary; audit queries specifically should read from primary (not replica) to guarantee audit log completeness is not affected by replication lag

Evidence:kafka-consumer-lag-cascadepartition-hotspot-amplification

Audit log table growing at > 500K rows/day; INSERT p99 on audit_log > 20ms; autovacuum unable to keep up with dead tuple accumulation from UPDATE operations on the audit log's index pages

Threshold

Escalation trigger: Audit log receiving one row per record access creates I/O contention with clinical record writes on the same PostgreSQL primary

Likely Bottleneck

Tier 1: Audit Log Write Throughput

Recommended Evolution

Monitor: replication_lag_seconds, stale_read_rate, replica_wal_apply_rate

pg_locks showing RowExclusiveLock waits on clinical_records or encounter_notes during shift-change peak hours; write p99 > 100ms; occasional deadlock errors in application logs correlated with concurrent addenda writes to the same encounter

Threshold

Escalation trigger: Multiple clinical staff members writing addenda to the same encounter simultaneously, or two processes updating encounter status concurrently

Likely Bottleneck

Tier 2: Concurrent Encounter Write Lock Contention

Recommended Evolution

Monitor: replication_lag_seconds, stale_read_rate, replica_wal_apply_rate

Kafka consumer lag growing on FHIR event topics; downstream clinical systems reporting stale data; outbox table accumulating unprocessed rows > 10,000 at rest

Threshold

Escalation trigger: FHIR message transformation and Kafka publish throughput falling behind clinical event write volume

Likely Bottleneck

Tier 3: FHIR Event Streaming Throughput

Recommended Evolution

Monitor: replication_lag_seconds, stale_read_rate, replica_wal_apply_rate

PostgreSQL primary I/O > 70% from read queries during morning rounds (when all staff are querying overnight encounter summaries simultaneously); read replica replication lag > 5s during peak read periods

Threshold

Escalation trigger: Read-heavy clinical summary queries competing with event write volume on the shared primary

Likely Bottleneck

Tier 4: Multi-Facility Read Replica Distribution

Recommended Evolution

Monitor: replication_lag_seconds, stale_read_rate, replica_wal_apply_rate

Migration Readiness

12

Migration Stages

3
Stage

Mutable clinical records with application-layer audit logging → Event-sourced clinical records with atomic audit event + outbox writes

info

Migration trigger: HIPAA audit requirement exposed during external security review; inability to reconstruct which practitioner accessed a patient record and when; audit log gaps found during incident investigation (application-layer logging not guaranteed to capture all access paths, including background jobs and admin tools)

Stage

Inline Kafka publish inside clinical transaction (dual-write) → Outbox pattern with CDC relay for FHIR event delivery

info

Migration trigger: FHIR events being published to Kafka but corresponding clinical record transactions rolling back, resulting in phantom events being consumed by downstream clinical systems; or Kafka publish failures causing clinical transactions to roll back and block charting workflows

Stage

All facilities sharing a single PostgreSQL cluster → Per-facility database with cross-facility patient index and record linkage

info

Migration trigger: Facility acquisition or merger; compliance requirement for data residency (state or country-level); single-cluster I/O saturation as facility count grows beyond 5–10 concurrent clinical sites

!

Risks

9
Risk

Historical records before the migration cutover cannot be ev

warning

Historical records before the migration cutover cannot be event-sourced retroactively without synthetic "initial_state" events: document the boundary date explicitly and include it in audit reports

Risk

The transition requires a period of dual-write (old mutable

warning

The transition requires a period of dual-write (old mutable path + new event path) with reconciliation to validate equivalence before decommissioning the mutable-only path

Risk

Outbox relay introduces delivery lag (< 5s under normal load

warning

Outbox relay introduces delivery lag (< 5s under normal load): downstream systems must tolerate this latency and must not assert synchronous availability of FHIR events as part of the clinical transaction commit path

Risk

FHIR message construction errors in the relay must dead-lett

warning

FHIR message construction errors in the relay must dead-letter and alert rather than silently dropping: a lost FHIR event can mean a downstream system has no record of a clinical event

Risk

Cross-facility patient record linkage is the highest-risk op

warning

Cross-facility patient record linkage is the highest-risk operation : an incorrect merge that combines two different patients' records under one identity is a critical patient safety incident requiring immediate rollback and incident reporting

Risk

Schema migrations must now be applied to N facility database

warning

Schema migrations must now be applied to N facility databases with coordinated rollout: the migration tooling must be tested against the full fleet before any clinical migration window

Risk

Projection lag creates a read-after-write window where users

critical

Projection lag creates a read-after-write window where users see stale data after their own writes. Mitigation: Route immediate post-write reads to the write store (session-scoped write token); accept eventual consistency only for non-user-initiated reads

direct-db-to-cqrs
Risk

Projection rebuild after schema change can take hours or day

critical

Projection rebuild after schema change can take hours or days on large datasets. Mitigation: Design blue/green projection deployment: build new projection in parallel before switching traffic; test rebuild time in staging

direct-db-to-cqrs
Risk

Cross-service workflows that previously used database transa

critical

Cross-service workflows that previously used database transactions now require Saga orchestration. Mitigation: Design idempotent event handlers; implement compensating transactions for every multi-step workflow; test failure injection in staging

modular-monolith-to-event-driven

Review Sections

6

Referenced Intelligence

Architecture Review: Healthcare Records Platform: DBRaven