top of page

Healthcare Data Modeling and Storage

Healthcare data is voluminous and complex; managing it effectively presents considerable challenges. Systems like Epic, more or less the de facto standard of EHR systems, use hierarchical database technologies. In this model, data is structured in a nested or tree-like fashion: a Patient record might contain multiple Encounter records (representing doctor visits or hospital stays); each of those could, in turn, hold various Lab Result records. This hierarchical approach was a sensible and efficient solution during Epic's early development around 1979: it made the most of limited computing power, allowing data to be retrieved quickly along predefined pathways.

The rub here is the impedance mismatch between the data's rigid, tree-like structure and the flexible, dynamic queries healthcare practitioners need to make sense of their patients' data. Consider a clinical researcher aiming to identify all patients exhibiting a specific lab result trend over several years. This search might span diverse encounter types and require correlation with a particular medication whose record is not directly nested within those encounters. Strictly hierarchical systems make querying such multifaceted information cumbersome. The Patient → Encounter → Lab pathway is efficient for its original design, but it becomes a significant constraint for these broader analytical needs.

Domain-Driven Design (DDD) offers a valuable alternative. DDD aims to create an accurate and rich model based on nouns, without stipulating a particular database structure. In healthcare, the intricacies of Patients, Appointments, TreatmentPlans are modeled using the language commonly spoken by clinicians. Its primary objective is to develop a robust model that describes a domain naturally to the people who use it daily.

The choice of data storage strategy is crucial when applying DDD. This choice helps overcome the limitations of older hierarchical systems, especially for enabling flexible reporting and insightful analysis:

  1. DDD with carefully designed relational database management:

    Relational databases (e.g., PostgreSQL, SQL Server) can effectively implement DDD, supporting the domain model and its complex querying requirements, and not just creating normalized tables. Techniques include:

    • Developing database views that pre-join or aggregate data. This simplifies access for common reports and reduces query complexity.

    • Strategically employing materialized views. These are useful for performance-critical queries needing frequent access to combined data.

    • Carefully considering tactical denormalization (selectively relaxing normalization rules) where appropriate. This can optimize query performance for specific, high-demand domain use cases. The database structure and its features should proactively serve the information retrieval needs defined by the domain model.

  2. DDD with Graph Databases:

    Graph databases (like Neo4j or Amazon Neptune) are a particularly compelling option for healthcare data when using DDD. Healthcare data is inherently rich in relationships: between patients and providers, diagnoses and treatments, or medications and potential interactions.

    • Graph databases treat these relationships as first-class citizens; this contrasts with other database models where relationships are often implied. Relationships can be directly modeled, stored, and queried with ease. A Patient node, for example, can have direct, meaningful links (edges) to Condition nodes, Medication nodes, and Appointment nodes.

    • This architecture makes querying complex networks of connections significantly more intuitive and often more performant. For instance, finding all patients with a specific comorbidity, treated by a particular group of specialists, and experiencing a known side effect from a common medication, becomes a more natural graph traversal.

    • A well-constructed DDD model, with its emphasis on entities and their interrelations, aligns exceptionally well with the strengths and structure of a graph database.

Hierarchical database systems have a long, remarkable history of support for high-volume, high-stakes data, but they introduce considerable friction with today's demands for flexible data analysis and comprehensive reporting. Domain-Driven Design is a robust framework for accurately modeling the business domain. Pairing DDD with thoughtful relational database management or with graph databases allows organizations to create systems that more intuitively reflect how practitioners speak and write about their patients.

© 2025 by 22 Paths, LLC. 

bottom of page