syntax = "proto3";
package cdm;
option java_package = "com.kitware.physiology.cdm";

import "cdm/Properties.proto";

/** @brief Data used to configure the patient.  */
message PatientData
{
  /** @brief Enumeration for patient sex */
  enum eSex
  {
    Male=0;
    Female=1;
  }
  
  /* @brief Enumeration for states the patient can enter and exit out of. */
  enum eEvent
  {
    Antidiuresis                     = 0; /**<< @brief Low urine flow. */
    Asystole                         = 1; /**<< @brief Represents no cardiac electrical activity. */
    Bradycardia                      = 2; /**<< @brief The heart rate is slowed to below 60 beats per minute. */
    Bradypnea                        = 3; /**<< @brief The state at which the respiratory rate has fallen 10 breaths per minute. */     
    BrainOxygenDeficit               = 4; /**<< @brief A lack of oxygen in the brain. Death will occur ~30min*/
    CardiacArrest                    = 5; /**<< @brief Sudden, unexpected loss of heart function, breathing, and consciousness.*/
    CardiogenicShock                 = 6; /**<< @brief Inadequate blood circulation due to failure of the heart ventricles (Cardiac Index < 2.2 L/min m2).*/
    CriticalBrainOxygenDeficit       = 7; /**<< @brief A critical lack of oxygen in the brain. Death in under 10min*/
    Dehydration                      = 8; /**<< @brief A loss of more fluid than is taken in (More than 3% loss of resting fluid mass). */
    Diuresis                         = 9; /**<< @brief High urine flow.*/
    Fasciculation                    = 10;/**<< @brief Brief spontaneous contractions of muscle fibers. */
    Fatigue                          = 11;/**<< @brief The body is using energy above the Basal Metabolic Rate. */
    FunctionalIncontinence           = 12;/**<< @brief Uncontrolled bladder release due to a full bladder. */
    Hypercapnia                      = 13;/**<< @brief State at which the arterial carbon dioxide partial pressure has exceeded 60 mmHg. */
    Hyperglycemia                    = 14;/**<< @brief An excess of glucose in the bloodstream (> 200 mg/dL). */
    Hyperthermia                     = 15;/**<< @brief The condition of having a body temperature greatly above normal (> 38° C). */
    Hypoglycemia                     = 16;/**<< @brief Low glucose in the bloodstream (< 70 mg/dL). */
    Hypothermia                      = 17;/**<< @brief The condition of having a body temperature greatly below normal (< 35° C). */
    Hypoxia                          = 18;/**<< @brief State at which the arterial oxygen partial pressure has fallen below 65 mmHg. */       
    HypovolemicShock                 = 19;/**<< @brief The blood volume has dropped below 65% of its normal value. */
    IntracranialHypertension         = 20;/**<< @brief Intracranial pressure is greater than 25 mmHg. */
    IntracranialHypotension          = 21;/**<< @brief Intracranial pressure is lower than 7 mmHg. */
    IrreversibleState                = 22;/**<< @brief An unrecoverable patient state. The engine will cease calculating when this event occurs. */
    Ketoacidosis                     = 23;/**<< @brief A form of metabolic acidosis where the anion gap is driven by the rise in ketones. */
    LacticAcidosis                   = 24;/**<< @brief A form of metabolic acidosis where the blood lactate concentration rises. */
    MaximumPulmonaryVentilationRate  = 25;/**<< @brief The maximum pulmonary ventilation rate has been reached. */
    MetabolicAcidosis                = 26;/**<< @brief A condition where the body is producing excess acids. (pH < 7.35). */
    MetabolicAlkalosis               = 27;/**<< @brief A condition where the body is producing excess bases. (pH > 7.45). */
    MildAcuteRespiratoryDistress     = 28;/**<< @brief Mild imparement of the alveoli, reducing gas exchange within the lungs. (CarricoIndex [201,300] mmHg) */
    ModerateAcuteRespiratoryDistress = 29;/**<< @brief Moderate imparement of the alveoli, reducing gas exchange within the lungs. (CarricoIndex [101,200] mmHg)*/
    MyocardiumOxygenDeficit          = 30;/**<< @brief The myocardium oxygen level has decreased below 5 mmHg. */
    Natriuresis                      = 31;/**<< @brief Sodium excreation above normal levels. */
    NutritionDepleted                = 32;/**<< @brief The stomach is empty. */
    PulselessRhythm                  = 33;/**<< @brief The state at which the heart has stopped beating.*/
    RenalHypoperfusion               = 34;/**<< @brief Low blood flow to the kidneys. */
    RespiratoryAcidosis              = 35;/**<< @brief An increase of CO2 concentration in the bloodstream and a decrease in blood pH. */
    RespiratoryAlkalosis             = 36;/**<< @brief An decrease of CO2 concentration in the bloodstream and a increase in blood pH. */
    StartOfCardiacCycle              = 37;/**<< @brief The Patient is starting a new heart beat. */
    StartOfExhale                    = 38;/**<< @brief Patient is starting to exhale. */
    StartOfInhale                    = 39;/**<< @brief Patient is starting to inhale. */
    SevereAcuteRespiratoryDistress   = 40;/**<< @brief Severe imparement of the alveoli, reducing gas exchange within the lungs. (CarricoIndex [0,100] mmHg)*/
    Tachycardia                      = 41;/**<< @brief The heart rate is elevated above 100 beats per minute. */
    Tachypnea                        = 42;/**<< @brief A breathing rate above 20 breaths per minute. */ 
  }
  
  /** @brief An active patient event, and how long it has been active */
  message ActiveEventData
  {
    eEvent Event                 = 1; /**<< @brief The active event. */
    ScalarFrequencyData Duration = 2; /**<< @brief The duration since last activated. */
  }
  
  /** Physical Characteristics */
  string                   Name                                  = 1; /**<< @brief Patient Identifier. */
  eSex                     Sex                                   = 2; /**<< @brief @copybrief Patient_enumSex */
  ScalarTimeData           Age                                   = 3; /**<< @brief Patient age. */
  ScalarMassData           Weight                                = 4; /**<< @brief Patient weight. */
  ScalarLengthData         Height                                = 5; /**<< @brief Patient height. */
  ScalarMassPerVolumeData  BodyDensity                           = 6; /**<< @brief  The mass of the body divided by the volume of the body. */
  Scalar0To1Data           BodyFatFraction                       = 7; /**<< @brief Total mass of fat divided by total body mass; body fat includes essential body fat and storage body fat. */
  ScalarMassData           LeanBodyMass                          = 8; /**<< @brief Component of body composition after subtracting body fat weight. */
  /** Physical Characteristics that can change and should be change due to a condition */
  ScalarAreaData           AlveoliSurfaceArea                    = 9; /**<< @brief The surface area of the alveoli for gas diffusion */
  Scalar0To1Data           RightLungRatio                        = 10;/**<< @brief The ratio of total lung surface area that is associated with the right lung. */
  ScalarAreaData           SkinSurfaceArea                       = 11;/**<< @brief The surface area of the skin surface of the body. */
  /** Systemic Targets to tune the engine to */
  ScalarPowerData          BasalMetabolicRate                    = 12;/**<< @brief The life-sustaining metabolic rate. */
  ScalarVolumeData         BloodVolumeBaseline                   = 13;/**<< @brief The total volume of fluid within the cardiovascular system. */
  ScalarPressureData       DiastolicArterialPressureBaseline     = 14;/**<< @brief The starting minimum pressure in the aorta over the course of a cardiac cycle. */
  ScalarFrequencyData      HeartRateBaseline                     = 15;/**<< @brief The resting heart rate. */
  ScalarPressureData       MeanArterialPressureBaseline          = 16;/**<< @brief The resting mean arterial pressure. */
  ScalarFrequencyData      RespirationRateBaseline               = 17;/**<< @brief The resting respiration rate. */
  ScalarPressureData       SystolicArterialPressureBaseline      = 18;/**<< @brief The starting maximum pressure in the aorta over the course of a cardiac cycle. */
  ScalarVolumeData         TidalVolumeBaseline                   = 19;/**<< @brief The starting volume of air moved into or out of the lungs during normal respiration. */
  /** Cardiovascular Systemic Bounds, generally computed based on physical characteristics */
  ScalarFrequencyData      HeartRateMaximum                      = 20;/**<< @brief The maximum heart rate the patient can withstand. */
  ScalarFrequencyData      HeartRateMinimum                      = 21;/**<< @brief The minimum heart rate the patient can withstand. */
  /** Respiratory Systemic Bounds, generally computed based on physical characteristics */
  ScalarVolumeData         ExpiratoryReserveVolume               = 22;/**<< @brief The maximum amount of air that can be exhaled from the end-expiratory position. */
  ScalarVolumeData         FunctionalResidualCapacity            = 23;/**<< @brief The volume of air remaining in the lungs after a passive expiration. */
  ScalarVolumeData         InspiratoryCapacity                   = 24;/**<< @brief The sum of IRV and TV. */
  ScalarVolumeData         InspiratoryReserveVolume              = 25;/**<< @brief The maximal volume that can be inhaled from the end-inspiratory level. */
  ScalarVolumeData         ResidualVolume                        = 26;/**<< @brief The volume of air remaining in the lungs after a maximal exhalation. */
  ScalarVolumeData         TotalLungCapacity                     = 27;/**<< @brief The volume of air in the lungs at maximal inflation. */
  ScalarVolumeData         VitalCapacity                         = 28;/**<< @brief The maximum amount of air a person can expel from their lungs after a maximum inhalation. */
  
  repeated ActiveEventData ActiveEvent                           = 29;/**<< @brief Active Patient Events and their duration. */
}