dynobase-icon
Dynobase

Hospital: DynamoDB Single-Table Design Example

Patients, Admissions, Rooms

All single-table examples · Open interactive viewer

How this model is organized

Patients, Admissions, Rooms. This reference model by Rick Houlihan contains 8 entity types and 5 index definitions. Use the keys and access patterns below to understand how its records fit together before exploring the interactive viewer.

Entities and key templates

Each entity defines the attributes stored on its items. Key templates show how attribute values are combined; when no template is defined, the key value comes from the item itself.

  • doctor: type, PK, SK, PK1, SK1, PK2, SK2, __id.
    • PK: Provided by the item
    • SK: Provided by the item
    • PK1: Provided by the item
    • SK1: Provided by the item
    • PK2: Provided by the item
    • SK2: Provided by the item
  • nurse: type, PK, SK, PK1, SK1, __id.
    • PK: Provided by the item
    • SK: Provided by the item
    • PK1: Provided by the item
    • SK1: Provided by the item
  • patient: type, PK, SK, __id.
    • PK: Provided by the item
    • SK: Provided by the item
  • treatment: type, PK, SK, timestamp, treatmentId, PK1, SK1, PK2, SK2, __id.
    • PK: Provided by the item
    • SK: ${SK1}#${treatmentId}
    • PK1: Provided by the item
    • SK1: Provided by the item
    • PK2: Provided by the item
    • SK2: Provided by the item
  • medicine: type, PK, SK, PK1, SK1, PK2, SK2, medicineId, __id.
    • PK: Provided by the item
    • SK: ${SK1}#${medicineId}
    • PK1: Provided by the item
    • SK1: Provided by the item
    • PK2: Provided by the item
    • SK2: Provided by the item
  • admission: type, PK, SK, timestamp, roomId, PK1, SK1, PK2, SK2, PK3, SK3, PK4, SK4, condition, __id.
    • PK: Provided by the item
    • SK: ${SK1}#${PK3}
    • PK1: Provided by the item
    • SK1: Provided by the item
    • PK2: Provided by the item
    • SK2: Provided by the item
    • PK3: Provided by the item
    • SK3: Provided by the item
    • PK4: Provided by the item
    • SK4: Provided by the item
  • activity: type, PK, SK, PK1, SK1, activityId, __id.
    • PK: Provided by the item
    • SK: ${SK1}#${activityId}
    • PK1: Provided by the item
    • SK1: Provided by the item
  • room: type, PK, SK, PK3, SK3, __id.
    • PK: Provided by the item
    • SK: Provided by the item
    • PK3: Provided by the item
    • SK3: Provided by the item

Index keys

  • primary: partition key PK; sort key SK.
  • GSI1: partition key PK1; sort key SK1.
  • GSI2: partition key PK2; sort key SK2.
  • GSI3: partition key PK3; sort key SK3.
  • GSI4: partition key PK4; sort key SK4.

Example access patterns

These named queries are included in the model. Open the viewer to inspect their sample values and any filters.

  • Get Doctor: Query on primary (Equal).
  • Get Room's details: Query on primary (Equal).
  • Get Nurse: Query on primary (Equal).
  • Get Patient: Query on primary (Equal).
  • Get Patient's events after Nov 2020: Query on primary (Begins with).
  • Get Patients Medicine in 2020 and after: Query on primary (Begins with).
  • Get Treatments by Doctor in 2020: Query on GSI1 (Begins with).
  • Get meds prescribed by Doctor in 2020: Query on GSI1 (Begins with).
  • Get Doctors with a speciality in X: Query on GSI2 (Equal).
  • Get admissions in room R1 in 2020: Query on GSI3 (Begins with).
  • Get admissions in 2020 in hospital X: Query on GSI4 (Begins with).
  • Get all normal admissions: Query on GSI2 (Equal).

Explore and adapt the example

Download the model JSON to inspect the full schema and sample records. Compare its access patterns with your application's requirements before adapting the design. For a guided editing workflow, see the single-table design tool.

Product Features

Download
/
Changelog
/
Pricing
/
Member Portal
/
Privacy
/
EULA
/
Twitter
© 2026 Dynobase