SQL-Based Risk Models
SQL-based Risk Models define risk scores using custom SQL logic. They are a good fit when:
- Risk calculation requires complex logic or custom data aggregations
- Risk cannot be expressed using Populations defined in Relevant
- Technical flexibility is more important than interpretability

Note: Unlike risk factor–based Risk Models, SQL-based Risk Models do not provide a breakdown of how a patient’s risk score was calculated.
How SQL-based models calculate risk
A SQL-based Risk Model consists of a single SELECT statement that returns 1 row per patient. It should select two columns:
patient_id: this should match the primary key from thepatientstable in therdmschema.score: a numeric value representing the patient’s risk. There are no constraints on how you calculate the score
