BACKEND & DATA OPTIMIZATION

Hospital API Patient Lookup Optimization.

The Hospital API faced critical performance bottlenecks, where slow retrieval of patient data was actively affecting care coordination efficiency in urgent scenarios. I spearheaded the optimization of the backend service, introducing advanced filtering mechanisms and database query optimization.

EXECUTIVE SUMMARY

The Hospital API faced critical performance bottlenecks, where slow retrieval of patient data was actively affecting care coordination efficiency in urgent scenarios. I spearheaded the optimization of the backend service, introducing advanced filtering mechanisms and database query optimization.

KEY CONTRIBUTION

"Implemented a compound indexing strategy combined with Redis-based query caching that brought P99 response times for complex patient history lookups down from 3 seconds to under 200ms."

API ARCHITECTURE

High-level overview of the control and data plane components.

LOGIC LAYER

Query Optimization

Compound indexing & query generation

Advanced Formatting

Data transformation and hydration

DATA LAYER

Database

Main analytical patient records storage

Cache

Redis-based query caching layer

ENGINEERING STACK

High-reliability healthcare backend systems.

BACKEND

GoGingRPCGraphQL

DATABASE

PostgreSQLRedisElasticsearch

INFRASTRUCTURE

AWS EKSTerraformDocker

TECHNICAL DECISIONS

Documenting the trade-offs and architectural shifts during development.

Caching Strategy

Time-based Expiration (TTL)
Event-driven Invalidation
Rationale: Patient health records are highly sensitive to staleness. Relying on TTL caching was deemed a clinical risk. We implemented a Postgres trigger system that emits an event to our Go service, actively invalidating the exact Redis keys affected by any write or update.

MEASURABLE IMPACT

Impact on clinical data retrieval speed.

QUERY LATENCY
200 ms
⚡ Down from 3000ms
DATA RETRIEVAL
60 %
⚡ Faster overall lookup

POSTMORTEM & LEARNINGS

Reflections on mission-critical medical systems.

Offloading the full-text search requirements from Postgres `LIKE` queries to a dedicated Elasticsearch cluster immediately stabilized our primary database CPU utilization, preventing cascading timeouts during peak operational hours.

Transitioning the monolithic Go service into domain-driven microservices (e.g., separating patient ingest from historical read models) using CQRS patterns to further isolate fault domains.