# First approach to modeling

After first discussion with the experts I’ve come to a conclusion that the domain has to be separated into two modules – patient and diet.
In the first stage of development I’ll focus on modeling the patient module.

Here is a short version of my dialog with the expert
(P – programmer {me}), E – expert):
P: First – let’s talk about patients data. Based on my observation it could be split into two groups – personal data (first name, last name, email, phone) and body data – (height, weight). Is it everything, or should we know something else?
E: We should also know body fat percentage, waist hips ratiobasal metabolic rate (BMR), sex, birth date and total metabolic rate. The latter is calculated by multiplying BMR by factor defined by patient’s physical activity. We should also have macronutrients in diet ratio.
P: Ok, but I think macronutrients are the part included in specific diet, not the patient? Is it possible for one patient to have more than one diet? For example patient has exacerbation of his disease, and therefore has to be on a really strict diet. Then after a few weeks he can eat more things and his diet can be changed? Also is a diet made only for one patient, or it can be shared by two patients?
E: Macronutrients are specific for diet, not for patient. Every diet is created individually so it cannot be shared. Yes, one patient can have more than one diet.
P: Let’s talk about BMR and total metabolic rate. It should be calculated by program, or you would like to input it manually?
E: For BMR – program should calculate it. There is equation based on sex, weight, height and age. I’ll give you formulas. About total metabolic rate. When I have BMR I’ll input factor based on physical activity then app should calculate it.

My conclusions:

I have to write Patient Entity with Contact data, and Body data value object. All classes should be bound in Aggregate with Patient Entity as aggregate root. It is possible that body data is also entity and can change over time. If it is true we should track changes history. I’have to ask expert about that. Body data will be created by factory which will use BMRCalculator and as input retrieve data needed for equations. I’ll add link to pull request later.