Build Medical Software From Evidence to Software Lesson 4 of 5 intermediate 8 min read

Build the Clinical Engine Before the Interface

A reliable clinical application separates guideline logic from presentation, tests expected behavior, and carries provenance into every recommendation.

In This Lesson

Read with a defined objective.

View the complete course

Learning objectives

  • Separate a clinical engine from presentation and interaction code.
  • Return reason, source, and scope alongside a recommendation.
  • Use AI coding assistance without delegating clinical validation.

Prerequisites

  • An auditable logic sheet and boundary cases from Lesson 3.

Build Medical Software From Evidence to Software

Listen to this post

Build the Clinical Engine Before the Interface

0:00 / 0:00
A transparent clinical application showing a tested logic engine beneath a restrained interface
On this page6 sections

FGRManager began with a clinical problem, not a framework decision.

The problem was bounded: operationalize surveillance and delivery-timing recommendations for fetal growth restriction without asking a clinician to hold the entire decision tree in working memory. The useful question was not whether to use React, Python, or vanilla JavaScript. The useful question was whether the logic faithfully represented the source guideline.

That ordering protects the application.

The Clinical Engine

The clinical engine is the part of the application that accepts validated inputs and returns an output, a reason, a source, and a status. It should not depend on button colors, page layout, or which screen happens to collect the data.

Separate it from the interface.

When logic and presentation are mixed together, a redesign can alter behavior. Testing becomes harder. A mobile version and a web version can quietly produce different answers. The clinical rule becomes trapped inside event handlers and display code.

Return More Than an Answer

A clinical engine should not return only 37 weeks or eligible.

Return structured output:

{
  "status": "recommendation",
  "result": "example output",
  "reason": "rule and patient inputs used",
  "source": "guideline section and version",
  "review": "clinical factors not evaluated by this tool"
}

The exact fields will vary. The principle does not. An answer without provenance and scope encourages automation bias.

Use AI After the Logic Is Explicit

An AI coding assistant can translate a logic sheet into functions, generate a form, propose tests, explain an unfamiliar error, and help deploy a prototype. This is useful leverage.

It is not clinical validation.

Give the system the inputs, units, branches, exceptions, expected outputs, and test cases. Ask it to preserve the clinical engine as a separate module. Then review the implementation rule by rule.

AI can help write the code. The physician must validate the clinical logic.

Make Expected Behavior Executable

Turn every boundary triplet into an automated test. Add tests for missing data, impossible values, excluded populations, conflicting conditions, and source-version metadata.

The test suite is the executable form of the clinical agreement. It tells the next developer what must remain true after a refactor. It also tells the physician reviewer where the tool claims certainty.

Do not ask only whether the page loads. Ask whether the encoded recommendation survives the edge cases.

Version the Evidence and the Software

Store at least four dates:

  • source guideline publication;
  • local clinical review;
  • software release;
  • next evidence review.

A software version without a guideline version is incomplete. When the evidence changes, the team needs to identify which rules changed, which tests must change, and which deployed versions remain in use.

That is not maintenance after the clinical work. It is clinical work.

Your Exercise

Build the smallest prototype that can execute the logic sheet from the prior lesson.

Keep the engine separate from the interface. Return the result, reason, source, and review boundary. Run the boundary tests before improving the design. Then ask another clinician to compare the output against the source protocol without reading your code.

Software delivers the logic. Testing proves what it delivered.

Share this article

Share X / Twitter Bluesky LinkedIn

Related articles

A physician and patient evaluating a translucent software recommendation together at the bedside
Clinical Software

The Last Step Is Not Software. It Is Judgment.

Clinical software can execute protocol logic perfectly and still be wrong for the patient. The physician checkpoint must remain part of the architecture.

· 8 min read
clinical judgmentclinical decision supportautomation bias
A precise clinical protocol grid bending around a complex patient silhouette without enclosing it
Clinical Software

A Protocol Is a Memory System, Not a Patient

Clinical protocols reduce avoidable variation, but software must preserve their population boundaries, exceptions, provenance, and judgment points.

· 7 min read
clinical protocolsclinical decision supportevidence-based medicine
Clinical research papers narrowing toward a bedside monitor while uncertainty remains visible around the patient
Clinical Software

Evidence Is Not Yet a Clinical Instruction

Clinical evidence describes populations. Physician-developers must preserve its limits before translating it into protocol logic or software.

· 7 min read
evidence-based medicineclinical protocolsclinical software
Chukwuma Onyeije, MD, FACOG

Chukwuma Onyeije, MD, FACOG

Maternal-Fetal Medicine Specialist

MFM specialist at Atlanta Perinatal Associates. Founder of CodeCraftMD and OpenMFM.org. I write about building physician-owned AI tools, clinical software, and the case for doctors who code.