← Back to prototypes
Workflow

Type 2 Diabetes Risk Assessment

Clinical decision support that scores Type 2 Diabetes risk from patient data using deterministic ADA criteria, grounds it in retrieved guidance and live evidence, and withholds any conclusion it is not confident enough to make.

Try Workflow

Workflow Architecture

Inputs
AgeGenderSymptomsMedical HistorySocial Factors
Pipeline
01
Intake Structurer
Extracts labs, history and social factors into structured fields, flagging what is missing
02
Risk Calculator
Deterministic score from HbA1c, fasting glucose, BMI, age, family history and social factors
03
Guideline Retrieval
Retrieves the ADA guidance matching the computed risk band
04
Clinical Evidence Agent
Calls MCP tools for supporting evidence, interactions and next-step guidance
05
Reasoning Engine
Synthesises a diagnosis with a 0–10 confidence score and a physician checklist
complete & confident?
One route with three exits: missing data, confident, or not confident enough
Outcomes
Needs More Data
Asks for the missing labs and restarts the assessment
Diagnostic Report
Risk factors, social determinants, ADA citations, next steps
Provisional Report
States the uncertainty and lists the tests that would resolve it
Automated flow
Decision gate
Conditional route
Human in the loop
5 InputsPatient profile
5 StagesScore → evidence → reasoning
1 GateData and confidence
3 OutcomesReport, provisional, more data

Key Components

Dify Workflow Engine
Orchestration and routing
Deterministic Risk Scorer
Python rules over ADA criteria
ADA Guideline Retrieval
RAG over clinical guidance
MCP Evidence Agent
Live evidence and interactions

Security & Safety

Confidence-gated review
Below 8 of 10 never issues a conclusion
Source citations
ADA guideline citations on every report
Deterministic scoring
The risk band is computed by rules, not the model
Decision support
Assists a physician; it does not diagnose

Context

Type 2 Diabetes diagnosis relies on multiple data sources—lab values, patient history, social factors, and clinical guidelines—that are typically fragmented across systems. Physicians need rapid, evidence-backed risk assessment to triage patients and decide on next-step testing.

What I built

Created a diagnostic workflow in Dify that combines rule-based risk scoring with multi-agent clinical reasoning. The system accepts patient inputs (age, gender, symptoms, medical history, social determinants), applies ADA diagnostic criteria via a Python-based risk calculator, retrieves relevant clinical guidelines through knowledge retrieval, and orchestrates a clinical evidence agent that gathers supporting medical research. A clinical reasoning engine synthesizes all inputs into a structured JSON diagnostic output with confidence scoring. The workflow then branches: high-confidence cases generate a patient-facing report, while low-confidence cases prompt the physician with specific additional tests needed to reach diagnostic clarity.