Note that there are some explanatory texts on larger screens.

plurals
  1. PODDD and distinction between Entity and Value object. Choosing the aggregate root
    primarykey
    data
    text
    <p>I am design and EMR. I have determined the central object to the domain is the <code>Patient</code>. The patient must have the following a <code>Doctor</code> and Medical Records. Medical Records is a grouping term refering to the collective of Encounters, Labs, XRays, Prescriptions.... </p> <p>I am new to DDD and I am having trouble with a couple of concepts and my understanding of DDD. Below is a code sample which shows an <code>Encounter</code> class. <code>Encounter</code> contains a couple of propertiees and it also references another class <code>Vitals</code>. </p> <p><code>Vitals</code> has no significance outside of the <code>Patient</code>. I still identify vitals in the database with its own key. I am not sure if that qualifies <code>Vitals</code> as being an entity. Currently I have <code>Vitals</code> as a value object. </p> <p>Second, the way my model is built, I have <code>Encounter</code> defined as an <code>Aggregate</code> root. Through an <code>Encounter</code>, a doctor could order labs, xrays and prescribe medicine. Basically the <code>Encounter</code> documents the reason why such items are being ordered. </p> <p>A problem exist in the sense that I would also need to retrieve these items outside the context of an <code>Encounter</code>, therfore does that mean <code>Encounter</code> is not an Aggregate Root. An item such as <code>Vitals</code> is that just a value object. </p> <p>This is my code...</p> <pre><code>public class Encounter { String ChiefComplaint {get; set;} string Plan {get; set;} string Assessment {get; set;} Vital PatientVital {get; set;} } public class Vital { public float Temperature { get; private set; } public BloodPressure BP { get; private set; } public int Pulse { get; private set; } public int Respiratory { get; private set; } internal Vital(float temperature, int systolic, int diastolic, int pulse, int respiratory) { this.Temperature = temperature; BloodPressure bp = new BloodPressure(); bp.Systolic = systolic; bp.Diastolic = diastolic; this.Respiratory = respiratory; this.BP = bp; } public void AddBP(int systolic, int diastolic) { BloodPressure bp = new BloodPressure(); bp.Systolic = systolic; bp.Diastolic = diastolic; this.BP = bp; } } public struct BloodPressure { public BloodPressure(int systolic, int diastolic){ Systolic = systolic; Diastolic = diastolic; } public int Systolic { get; private set; } public int Diastolic { get; private set; } public string bloodPressure { get { return this.Systolic.ToString() + "/" + this.Diastolic.ToString(); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload