Debugging
Systems Thinking
Medicine × Engineering
Observability
Governance

The Doctor Who Codes: Diagnosing Software Bugs with Clinical Precision

November 25, 2025
5 min read
By Mohamed Fakhry, M.B.B.Ch.
The Doctor Who Codes: Diagnosing Software Bugs with Clinical Precision

I spent seven years training to listen to irregular heartbeats. Today, I listen to irregular server logs.

The tools changed, from stethoscope to terminal, but the mission remains the same: keep the system alive.

My world for years was the government ER in Cairo. Queues, uncertainty, split-second decisions. I lived in the clinic by sunlight, but the moment the shift ended, I was back at a keyboard, building systems one line at a time.

Eventually the dual life collapsed into one trajectory: I hung up the stethoscope and became founding CEO of SpiderSEO, then AI engineer at Boubyan Digital Factory. But I never really stopped being a doctor. I just changed patients.

Software systems, like human bodies, are complex, interconnected, and inevitably prone to failure.
They have organs (microservices), a nervous system (APIs), and when they get sick, they present symptoms.

Differential Diagnosis: Debugging is Not Guessing

In the ER, when someone clutches their chest, you don’t shout “Heart attack!” and wheel them to surgery. You build a differential:

  • Myocardial Infarction
  • Pulmonary Embolism
  • Pericarditis
  • Acid Reflux
  • Anxiety

Then you rule them out systematically with history, exam, ECG, troponin.

Most junior developers treat bugs like a panicked bystander: random code changes, restarts, “let’s just increase the timeout.” That’s not engineering. It’s gamble medicine.

try {
  var response = UrlFetchApp.fetch(endpoint, options);
  if (response.getResponseCode() === 200) {
    // Healthy patient
  } else {
    // Diagnose the exact pathology
    Logger.log("API returned " + response.getResponseCode());
    // 401 → Authentication Failure
    // 429 → Rate Limit (Overload)
    // 500 → External Organ Failure
  }
} catch (error) {
  Logger.log("Exception: " + error.toString());
}

By capturing getResponseCode() I turned “it’s broken” into a precise, actionable diagnosis. That’s clinical debugging.

Vital Signs: Observability as an ICU Monitor

In the ICU you never treat blind. You have a monitor showing HR, BP, SpO₂ in real time. If it’s off, the patient can crash silently.

Most companies run million-dollar automations with zero vitals. Silence = assumed health. That’s malpractice in both medicine and engineering.

The Client Panel → The Patient Chart

Clients were anxious relatives in the waiting room. I built a live “chart” using GAS HTML Service: secure login → real-time view of their project vitals (active products, delivered content, optimization status).

The Admin Panel → The Business ECG

Revenue vs Cost rendered as an interactive google.visualization.LineChart. One glance showed financial arrhythmia before it became cardiac arrest.

Code that works silently is good.
Code that proves it’s working is professional engineering.

Triage: Handling “Code Blue” in Operations

A major Saudi flower e-commerce client was crashing, demanding refund, trashing us publicly on Salla & Zid forums.

This wasn’t a support ticket. This was cardiac arrest.

I didn’t panic. I triaged.
I took the case personally, arranged a meeting with Zid officials present, listened without defensiveness, and prescribed a transparent recovery plan.

Outcome: the client not only stayed. He became our loudest advocate, explicitly crediting me, not the company.

Panic kills patients. And projects.

Preventative Medicine: Governance as Immunity

Treating outbreaks is expensive. Vaccinating is cheap.

Same with data: letting garbage in → ICU firefighting.
Building an immune system → peace.

Protection → Digital Antibodies

var sheetsProtectionData = [
  {
    name: "PM1",
    protections: [
      { range: "E2:E", editors: ["[email protected]"] }, // Only managers
      { range: "F:F", editors: [] },                      // System-locked
    ]
  }
];
// Script runs nightly → removes anyone not on the whitelist
protection.removeEditors(editorsToRemove);

Validation → Automated Screening

contentcPanel scans every row for symptoms:

  • Missing URLs (project exists but no target)
  • Empty delivery timestamps (content marked done but no proof)
  • Inconsistent statuses

Errors are quarantined before they infect downstream AI workflows.

Final Diagnosis

I never stopped being a doctor. I just switched from treating biological bodies to treating organizational and digital ones.

They have organs that must harmonize.
Immune systems that reject bad data.
Circulatory systems that keep cash flowing.

If you want to solve a problem permanently,
don’t just manage it. Engineer it.

Currently practicing clinical engineering at enterprise scale

Applying differential diagnosis, observability, and preventative governance to AI systems at Boubyan Digital Factory.

If your systems are slipping into quiet failures, unexplained outages, or operational arrhythmias, it’s time to talk.

Building clinical AI that has to be right?

I'm Mohamed Fakhry, a physician-engineer (M.B.B.Ch., Cairo University) working on clinical AI architecture, engineering and reliability. I help HealthTech teams find and fix reliability problems in RAG, evaluation, and safety before they reach clinicians.

Mohamed Fakhry

Physician-Engineer working on clinical AI architecture, engineering and reliability, and on healthcare software that has to hold up in real-world use.

Physician-Engineer (M.B.B.Ch.) • Clinical AI Engineering • Former CEO

Connect

Building reliable, production-grade healthcare AI systems.

© 2026 Mohamed Fakhry. All rights reserved.

Built with care using modern web technologies