The Interactive Interview
The same decision tables that run a batch job can now run as a conversation. DTRules
executes the rules and, whenever it reaches a collect field
you didn't supply, it stops and asks for it — in the terminal or in the browser.
Batch execution is unchanged and pays zero overhead.
How the Interview Works
You don't write a form or a wizard. You write rules. The engine derives the questions from what it actually needs to reach a decision.
Mark fields collectible
In the EDD, a field gains collect="true" plus question
metadata. No extra rules, no UI code.
Run the rules
As the engine evaluates conditions it reaches a collect field that has no value, so it pauses and asks the question — only for fields the path actually touches.
Continue to a decision
Your answer feeds straight back into execution. The interview is just the rule engine running with a human in the loop.
Typed questions
Each collect field declares how it should be asked. The same metadata drives both the CLI prompt and the web form, so the question is authored once.
- multiple_choice — a fixed list of options
- ascii — free-text input
- number — numeric input, optionally with a reference range
- date — a calendar date
<field name="creatinine"
type="double"
collect="true"
question="Serum creatinine?"
question_type="number"
units="mg/dL"
ref_low="0.7"
ref_high="1.3" /> Reference ranges, like a lab report
Number questions can carry a reference range — ref_low,
ref_high, and units.
The interview shows the range as guidance and flags the answer
High or Low when
it falls outside, the way a lab result is annotated.
Out-of-range values are flagged, never rejected. The human stays in control; the engine simply surfaces the context.
Two ways to run it
The same rules, the same questions — on the terminal or in the browser.
CLI interview
dtrules run --interactive Prompts for each reached collect field right in the terminal — ideal for scripts, agents, and quick experiments.
Web interview
dtrules run --web
Serves a self-contained web form for the same questions. The
pkg/dtrules/web package powers the
live Sinusitis demo.
Collect → save → replay / review
Collect answers once, then replay them non-interactively or review what was decided.
--save Persist collected answers to a data file.
--data Replay saved answers — no prompting.
--review Walk back through the questions and answers.
Batch execution is unchanged
The interview is a mode, not a rewrite. When every input is supplied up front, the engine never pauses and the interview machinery adds zero overhead. The same rule set serves both a high-throughput batch job and a one-patient-at-a-time conversation.
See it answer a real case
The SinusitisTherapy sample runs as a live web interview: it asks for the patient details it needs, then recommends a drug, dose, and renal adjustment with plain-English rationale.