Chapter 10: Kidneys, gut, and hormones: the internal regulators

Talking track · voice bm_george · speed 1.0

1. Kidneys, gut, and hormones: the internal regulators

Welcome to chapter ten. Chapter nine ended with a one-page map of the systems the book had not yet opened. This chapter opens three of them: the kidneys and urinary tract, the digestive system, and the hormone system. They share something that matters to an engineer. They are the body's slow regulators. Nerves act in milliseconds; these systems act over minutes, hours and days, keeping water, salt, potassium, acid, glucose and calcium inside the narrow ranges that cells tolerate.

2. Why this chapter exists

You will meet these systems in three ways. As data: urine output, fluid balance, blood glucose, kidney function and hormone levels are among the most recorded numbers in medicine, and every one of them comes with units that differ between countries and laboratories. As devices: catheters, drainage bags, feeding tubes, stoma appliances, glucose meters, continuous glucose monitors and insulin pumps, used by millions of people at home. And as control systems. Hormonal regulation is feedback control with gain, delay and a set point. Automated insulin delivery is literally a control engineer's problem, and a community of patients and developers built working closed loops in open source before the first commercial system was approved.

3. The kidneys and urinary tract

We start with the kidneys: two fist-sized organs that receive about a fifth of everything the heart pumps.

4. Anatomy

The two kidneys lie against the back wall of the abdomen at about the level of the lowest ribs, each eleven or twelve centimetres long and about a hundred and fifty grams. Together they receive twenty to twenty-five percent of the cardiac output, about a litre of blood a minute, far more than their own metabolism needs. That flow is there to be processed. Each kidney drains through a ureter, a muscular tube that pushes urine down to the bladder by peristalsis rather than gravity alone. The urethra then carries it out: about four centimetres long in women and about twenty in men, a difference that shapes infection risk, catheter design and continence products.

5. The nephron: filter, then refinery

Each kidney contains around a million nephrons, and each one works in two stages. First, filtration. At the glomerulus, a knot of capillaries, blood pressure pushes water and small solutes through a filter while cells and most proteins stay behind. Across both kidneys that is about a hundred and twenty millilitres a minute, roughly a hundred and eighty litres a day. Your whole plasma volume is filtered about sixty times daily. Second, reabsorption and secretion. The filtrate contains everything the body needs, so the tubule spends most of its energy taking it back: more than ninety-nine percent of the water, all the glucose, most of the salt. Meanwhile it secretes hydrogen ions, potassium and many drugs into the urine.

6. Why such a wasteful design?

This design looks wasteful. Filter everything, then laboriously take most of it back. It is in fact robust. Anything the body has not specifically decided to keep is removed by default, including toxins and drug metabolites the kidney has never encountered. A software engineer will recognise the pattern: it is a whitelist rather than a blacklist. A blacklist has to anticipate every harmful substance. A whitelist does not.

7. What the kidneys regulate

The kidneys regulate far more than water. They vary how much water the collecting duct reclaims, under antidiuretic hormone from the pituitary. They control sodium and so blood volume, through the renin, angiotensin and aldosterone system. They set potassium, and both too much and too little disturb heart rhythm. With the lungs they manage acid and base, excreting fifty to a hundred millimoles of acid a day. They handle calcium and phosphate and activate vitamin D. They release erythropoietin when oxygen delivery falls, which is why kidney failure causes anaemia. And long-term blood pressure is largely a kidney decision.

8. Watching and measuring kidney function

The kidneys must pass at least about half a litre of urine a day to clear the day's waste at maximum concentration. That is why urine output is watched so closely in unwell people; falling output can be the first sign that the kidneys are short of blood flow, and it is often measured hourly from a catheter. Filtration itself cannot be measured at the bedside, so it is estimated, usually from the blood level of creatinine, a muscle waste product. If filtration halves, creatinine roughly doubles. The estimate, called eGFR, stages chronic kidney disease. Because creatinine comes from muscle, the estimate is least reliable in frail older people, amputees, body builders and children. And eGFR adjusts drug doses, so it feeds straight into prescribing software.

9. Continence, and where design helps

The bladder fills quietly; a first urge comes at around a hundred and fifty to two hundred and fifty millilitres and typical capacity is four to six hundred. Emptying is a reflex, permitted or postponed by the brain. So continence depends on muscles, nerves, the brain, and the ability to get to a toilet in time and manage clothing. Stress incontinence is a weak outlet; urge incontinence an overactive bladder; overflow a bladder that cannot empty. Functional incontinence is the one to notice: the urinary system works, but mobility, dexterity, vision or cognition stop the person getting there. That is a design problem. Incontinence also drives skin damage and night-time falls.

10. Catheters, and the drainage rules

A urinary catheter drains the bladder through a tube. An indwelling catheter is held in by a small water-filled balloon and drains continuously into a bag. Intermittent self-catheterisation uses a fresh catheter several times a day, a task needing dexterity, vision and privacy, and a frequent subject of adaptive aids. Indwelling catheters are among the commonest causes of infection acquired in hospital, because the tube is a highway for bacteria and biofilms grow on it. The drainage rules follow directly. Keep the system closed. Keep the bag below the bladder so urine cannot flow back. Keep it off the floor. Keep the tubing free of kinks. And empty the bag without touching its outlet to anything.

11. The digestive system

Now the gut: a tube from mouth to anus, with glands emptying into it.

12. The tube and its timings

The digestive system is a tube: mouth, pharynx, oesophagus, stomach, small intestine, large intestine, rectum and anus, with the salivary glands, liver, gallbladder and pancreas emptying into it. Strictly, food in the tube is still outside the body; only what crosses the lining is absorbed. The stomach stores, acidifies and churns for a few hours. The small intestine, three to five metres long in life, does nearly all the digestion and absorption. The large intestine recovers water and salt over one to three days. These timings vary widely between people and from day to day, so treat them as orientation only.

13. Stomach and small intestine

The stomach's acid, at a pH of roughly one and a half to three and a half, kills many microbes and starts protein digestion. For a designer it matters as the destination of feeding tubes, as an acid environment that degrades materials and drugs, and as the reason a nasogastric tube's position must be confirmed before anything goes down it. A tube in the airway delivers feed into the lungs. The small intestine receives bile and pancreatic juice and absorbs almost everything, across a lining folded three times over. How much area? Older textbooks said two to three hundred square metres, a tennis court. A careful 2014 re-measurement put it at about thirty. When a number is famous, check where it came from.

14. The fluid budget

The fluid accounting of the gut is striking. You drink and eat about two litres a day, and roughly seven more are secreted into the gut as saliva, gastric juice, bile, pancreatic juice and intestinal fluid. Normally all but a hundred or two hundred millilitres is reabsorbed. If that fails, in severe diarrhoea or from a high-output stoma, a person can lose litres of fluid and salt a day and become dangerously dehydrated within hours. The large intestine also houses most of the gut microbiome, tens of trillions of bacteria, roughly as many cells as the body itself. Antibiotics disturb them, which is one reason antibiotic use has side effects.

15. Liver, gallbladder, pancreas

The liver, about one and a half kilograms, is the largest internal organ. Most of its blood arrives through the portal vein straight from the gut, so everything absorbed passes through the liver before reaching the rest of the body. It stores glucose, makes albumin and most clotting factors, clears drugs, alcohol and toxins, and makes half a litre to a litre of bile a day to emulsify fats. Its first-pass metabolism removes much of some oral drugs before they reach the circulation. When it fails to process haemoglobin breakdown products you see jaundice. The pancreas is two organs in one: mostly digestive enzymes and bicarbonate, with small islets, one or two percent of its mass, making insulin and glucagon.

16. When the tube cannot be used normally

When the gut cannot be used normally there are three main responses. If someone cannot swallow safely, nutrition goes through a tube into the gut: through the nose, or for longer use through the abdominal wall into the stomach. That raises tube position, securing without pressure injury, and feed pumps. If the gut cannot absorb, nutrition goes into a vein, with all the infection risk of central access. And if part of the bowel is removed or rested, a stoma brings it out through the abdominal wall. Stoma appliances are adhesive, changed every day or few days, on skin that moves and changes shape: chapter five's contact problems in their hardest form.

17. The connector that cannot be connected wrongly

Feeding tubes once used the same connectors as intravenous lines, and people died when liquid feed, or drugs meant for the gut, were connected into a vein. The international response was the ISO eighty thousand three hundred and sixty-nine series of connector standards, which gives each application, enteral, respiratory, neuraxial and intravascular, a geometrically incompatible connector. The enteral one is widely known as ENFit. This is the top of the risk-control hierarchy: not a label, not a colour, but a shape that makes the error impossible. Anything you design for a feeding line must use the correct connector and must never include an adaptor that defeats it.

18. The endocrine system

Third, the hormones.

19. Hormones as a broadcast channel

A hormone is a chemical messenger released into the blood that acts on any cell carrying its receptor. Where the nervous system is a wired network sending point-to-point messages, the endocrine system is a broadcast: slow to start, slow to stop, reaching everywhere at once. Hormones also differ enormously in how long they last. Adrenaline's half-life is two or three minutes, insulin's four to six, cortisol's about an hour, and thyroxine's about a week, which is why thyroid dose changes take weeks to settle. A control engineer reads that list as time constants, and they decide how often it makes sense to measure and adjust.

20. Axes: three-level cascades with feedback

The hypothalamus, at the base of the brain, signals the pituitary gland beneath it, which in turn signals glands throughout the body. These form axes: three-level cascades with negative feedback at each level. The thyroid axis is the cleanest. The hypothalamus releases a hormone that makes the pituitary release TSH, which makes the thyroid release thyroxine, and thyroxine inhibits both levels above. Low thyroid hormone raises TSH, high suppresses it. That is why TSH is the usual first thyroid test: it is the controller's output, and it amplifies small changes. The adrenal axis has the same shape with a strong daily rhythm, so a cortisol sample's time must always be recorded.

21. Glucose: the most engineered loop in the body

The brain uses about a hundred and twenty grams of glucose a day and stores very little, so blood glucose must be held up between meals and down after them. Two opposed hormones do most of the work: insulin moves glucose into tissues and tells the liver to store it; glucagon tells the liver to release it. Fasting glucose is normally about four to six millimoles per litre. Below about four is hypoglycaemia, with sweating, confusion and, if severe, seizures. Prolonged high glucose damages vessels, nerves, eyes and kidneys. In type one diabetes the immune system destroys the controller and insulin must be replaced for life. In type two the tissues respond poorly and the pancreas cannot keep up. Both are largely self-managed at home.

22. Engineering bridge

Now the engineering bridge: four ideas that turn this physiology into numbers.

23. Clearance, and what dialysis really replaces

Clearance is the volume of plasma completely cleared of a substance per minute: urine concentration times urine flow, divided by plasma concentration. Urine creatinine of ten millimoles per litre, flow of one point two millilitres a minute, plasma creatinine of point one gives a hundred and twenty millilitres a minute, a normal filtration rate. The same equation describes an artificial kidney. Now compare totals. Healthy kidneys process about twelve hundred litres of plasma a week. Haemodialysis clearing two hundred millilitres a minute for twelve hours a week clears about a hundred and forty-four. Dialysis works, people live on it for years, but it is an order of magnitude less filtration, in pulses, with none of the kidney's hormones.

24. The glucose loop, natural and artificial

Every hormonal loop has a set point, a sensor, a controller with gain, an actuator, and delays. Delay is the enemy of control: long delay with high gain overshoots and oscillates. Compare the natural and artificial glucose loops. The pancreas senses blood directly and releases insulin into the portal vein, acting within minutes. A continuous glucose monitor senses interstitial fluid and lags blood by five to fifteen minutes. Insulin under the skin takes ten to twenty minutes to start and peaks after one to two hours. The gut warns the pancreas of meals; the user must announce them. And most systems have insulin only. Commercial algorithms are deliberately conservative, because insulin already given cannot be taken back.

25. Units: where this chapter's numbers bite

This is where the chapter's numbers bite. Glucose is reported in millimoles per litre or milligrams per decilitre, a factor of eighteen apart. A reading of six is normal in one and dangerously low in the other. Creatinine differs by a factor of eighty-eight. HbA1c has two scales with a non-linear relationship. Insulin is usually a hundred units per millilitre, but concentrated insulins exist, so a volume is not a dose unless the concentration is known. If you write software that touches any of these, store the unit with the value, reject ambiguous input, never infer the unit from the size of the number, show it every time, and treat any code that calculates a dose as a regulated medical device.

26. Where a maker fits

So where can you contribute? Physically: catheterisation and stoma trainer consumables, cast in silicone with fabric-backed abdominal pads; adaptive aids for self-catheterisation and continence, designed with an occupational therapist and the user, often sewn, bent wire, sheet metal or moulded; and bench demonstrations of diffusion and dialysis using laboratory glassware and tubing. In software: visualisation and education on synthetic or public glucose data, unit-safe data handling, and the accessibility of the diabetes apps millions rely on. And clearly not: anything that calculates a dose, connects to a pump, or sits in a feeding line.

27. Worked example: the drainage-bag hanger

A ward sister asks for a clip-on hanger so drainage bags stop ending up on the floor when patients sit out in chairs. It sounds like furniture. Work through the physiology first. The bag must stay below the bladder in every chair position, so urine cannot flow back. It must be clear of the floor, with the outlet reachable for emptying without touching anything. The tubing must have no kinks or dependent loops. The measuring scale must be readable in place, because hourly output is clinical data. It must be cleanable, free of sharp edges near fragile skin, not catch on hoists or transfers, and offer a dignity cover. Then test it on the real chairs with the staff who empty the bags.

28. Workshop exercise and exit criteria

For the exercises: calculate clearance for three invented cases, one with a plasma value entered in the wrong unit, and comment on the result. Run a bench dialysis with dialysis tubing, salt and starch, measuring conductivity over an hour, then stir, then replace the water, and explain the difference. Build a toy glucose loop in a spreadsheet or Python with sensor and actuator delays, vary the gain, and label every output as a toy model. Write a glucose type that cannot exist without a unit. To finish, draw a nephron from memory and explain the thyroid axis and the glucose loop as control systems.

29. What this chapter does not establish

The limits. You know what the tests measure, but what a result means for a person is a clinical judgement. Inserting and caring for catheters, feeding tubes and stomas are clinical and nursing skills learned under supervision. Building something people rely on to dose insulin is regulated medical-device work with a clinical and regulatory team; the open-source projects are explicit that their users take responsibility only for themselves. And your toy glucose model shows the shape of a control problem, not physiology. Next, how disease works.