QRISK3: Difference between revisions

From Endeavour Knowledge Base
 
(97 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''''Please note that at this current time, these services are not available for use in a live environment and must not be used. The following information is made available in advance of go-live'''''
Endeavour Predict is a manufacturer of EP QRISK3 Engine which is the implementation of QRISK3 by Endeavour Predict.
 
The EP QRISK3 Engine, with both a Web API and local run time components are now registered as a class 1 device with the MHRA and available for use.


== Background ==
== Background ==
Information about QRISK3 and the free to use Web site can be viewed https://qrisk.org
Information about the research and algorithms that resulted in QRISK3, as well as  the free to use Web site can be viewed at https://qrisk.org and a related presentation, a CVD lifetime risk at https://qrisk.org/lifetime/index.php
 
== Predict Services ==
QRISK3 risk score can be calculated using  Endeavour Predict services, which consist of:
 
# A set of Web based APIs for submitting requests for a prediction and receiving a response, the response including a risk score, and other score specific information for example in QRISK3, a heart age , as well as information relating to the calculation of the scores.
# A local run time C# or Java jar version for integration into local systems that prefer not to use a web UI.
# A set of FHIR APIS to enable system suppliers to know which Snomed-CT concepts should be used when deriving information from records. These are part of the Endeavour information model services.
# A REST API for deriving a Townsend deprivation score from a post code, the Townsend score being then submitted as part of the QRISK request payload.
 
== Concept (Value) sets and FHIR API ==
Draft versions of value sets are available via the Endeavour API dev portal at https://dev.endeavourpredict.org/apis, which is a self sign up process, enabling access to a number of the public APIs. The concept sets are available as FHIR value sets at the self sign up developer portal
 
In line with FHIR an semantic web standards, each set is given a unique IRI and it is the IRI that is used as identifiers in the API call.
 
the QRISK3 superset iri is http://apiqcodes.org/qcodes#QPredict_331  which includes the subsets. The score level concepts sets contain subsets so that recursive calls can be made to obtain each set.  Alternatively, using the $expand operation, the entire subset can be obtained as one.
 
The sets can also be independently examined or obtained via the information manager, selecting the hierarchy option to view the subsets.https://im.endeavourhealth.net/#/directory/folder/http:%2F%2Fapiqcodes.org%2Fqcodes%23QPredict_331 . The concept sets can be downloaded from the IM application in excel CSV , or TSV
 
Within Endeavour each concept is given a unique identifier or IRI in line with semantic Web. Users will be more familiar with the use of the concept's code and this is provided as well as maps to alternative code schemes.
== APIs (Web and local) ==
A developer portal for qrisk3 is available at [https://dev.endeavourpredict.org/ https://dev.endeavourpredict.org/apis]
 
The algorithms are available over the internet via REST API calls or a locally deployed .NET assembly, or a locally deployed Java jar. In all 3 variations the input format (JSON) and parameters are the same and the result format (JSON) is the same. Consequently suppliers using local versions may use the developer portal to test input and output formats.
 
When using a locally deployed implementation, a test pack SDK is provided to enable unit and integration testing by end suppliers.
 
== Intended use ==
EP - QRISK3 Engine is a clinical decision support tool intended to facilitate individualised discussions between medically trained professionals and patients about their individual risk of heart attacks or stroke taking account of their demographic and medical profile.
 
This will enable shared decision making, allowing patients to understand their risk and discuss actions that could be taken in the context of other important factors to reduce their risk.
 
EP - QRISK3 Engine has been developed for both public health purposes as well as individual therapeutic or health care decisions.
 
EP - QRISK3 Engine has been developed so that it can either run as a standalone process, with data being submitted and results returned in batch file format, or it can be integrated as a component or module to an interactive web-based tool, to allow data to be inputted and processed on a single individual at a time.
 
It is therefore also intended that EP - QRISK3 Engine will be licensed to other medical device manufacturers, so they can produce their own websites/front ends including QRISK3 Engine as a component.
 
== Safety information and cautions ==
EP- QRISK3 Engine cannot take the place of clinical assessment. No medical decision should be based solely on results provided by the risk calculator. This is a labelled misuse of the QRISK3 Engine.
 
When developing implementations of EP- QRISK3 Engine, licensees should review relevant research paper to ensure that implementations and any system generated recommendations to clinicians/users based on the output is in line with the original intended use. Licensees may be required to CA or CE mark individual implementations as medical devices depending on the output/decision provided by the software based on a particular risk score. This may require additional clinical investigations and may result in being a higher class of device than EP-QRISK3 Engine.
 
Clinicians are expected to apply their own clinical judgement to further risk stratify patients and are not expected to rely solely on the output from QRISK3® (via licensed implementations) in order to appropriately manage and advise their patients regarding their risk.
 
== Instructions for use ==
The REST API instructions are available at a Swagger at [https://dev.endeavourpredict.org/ https://dev.endeavourpredict.org/apis]
 
To the local batch processor the instructions for Windows are:
 
# Unzip the published pack to any folder
# Unzip the test data to another folder
 
To test
 
# Take a copy of the test data and place in another folder
# using the windows command line execute the EP_QRisk3.Batch.exe with a parameter pointing to the test folder
# Note that the output is regenerated as output files. The can, if wished be compared against the original provided result files as they should be identical


== Integration with systems ==
To run


# Generate source data as JSON files in the format as provided (which is the same as the API format)
# Using the command console, execute the EP_QRisk3.Batch.exe with a parameter pointing to the source folder.


Systems may have access to longitudinal health records, in particular those held in General Practice. In that case those systems may elect to use QRISK in a way that provides likely values for the variables used in the algorithm, those values being derived from the records.  
== Query Rules  for health records ==
Systems may have access to longitudinal health records, in particular those held in General Practice. In that case those systems may elect to query the health record data  in a way that provides likely values for the variables, passed to the function as parameters to the QRISK function.


That being the case, a set of query criteria and rules are applied to the record entries and the values of the variables derived. These are then presented to a user for confirmation, or amendment before being submitted as a set of parameters to the function via an API.
In this case, a set of query criteria and rules are applied to the record entries and the values of the variables derived from those entries. These are then presented to a user for confirmation or amendment before being submitted via the API.


It is strongly recommended that for any individual decision, or potential entry of the risk score in the record, that each set of assumptions are confirmed. Purely automated calculations may be used for population based risk stratification in order to plan interventions.
It is strongly recommended that for any individual decision, or when an entry of a risk score is into a record is being considered, that each set of assumptions are confirmed by the user. However,  purely automated calculations may be used for population based risk stratification.


=== Reference date ===
=== Reference date ===
Scores may be calculated retrospectively. The reference date (current date or past date) is used for all values i.e. what those values were on the reference date. For example when looking for dates within 6 months this means 6 months prior to a reference date
Scores may be calculated in real time or retrospectively. The reference date (current date or past date) is used for all time dependent values,  which means  values as they would have been on the reference date. For example when looking for dates within 6 months this means 6 months prior to, or at the time of, the reference date and all entries subsequent are ignored.


=== Patient inclusion criteria ===
=== Patient inclusion criteria ===
This section documents the criteria for a person suitable for the application of QRISK3
This section documents the criteria for a person suitable for the application of QRISK3


All dates are relative to the time at which the algorithm is applied to the patient and is referred to as the reference date.
* Aged between 25 and 84 inclusive at the reference date


* Aged between 25 and 84 inclusive at the reference date
• Free from a diagnosis of cardiovascular disease (qr: group 411 see below) on or before the reference date


• Free from a diagnosis of cardiovascular disease on or before the reference date
=== Independent variables as function parameters ===
QRISK® operates as a function whose parameters represent independent variables. The API accepts these arguments as JSON key value pairs (or lists) in the payload of the request.


=== Variables and function parameters ===
The values of those variables, when used in the algorithm are derived in one of two ways
QRISK® operates as a function whose parameters represent independent variables. The values of those variables, when used in the algorithm are derived in one of two ways


a) By direct entry by a user
a) By direct entry by a user
Line 32: Line 94:
b) By a query of a health record.
b) By a query of a health record.


When passed into the algorithms as arguments to the function, the values are presented either as a double, an integer, a boolean 1 or 0,  or a character. The client must convert to these formats before submitting as arguments (e.g. as case statement)
When passed into the algorithms as arguments to the function, the values are presented either enumerators (e.g. heavy Smoker) as a double (e.g. BMI), an integer (e.g. Systolic BP) or , a boolean true or false. The enumerator text values are documented in the API swagger and are the same for the local run time


If variables are unknown (missing) or their values are out of range, the algorithm may either reject the request, provide a default value, or adjust the out of range value to an outer limit.  
If variables are unknown (missing) or their values are out of range, the algorithm may either reject the request, provide a default value for the parameter, or adjust an  out of range value to an outer limit. The way the algorithm handles these parameters are documented below in the relevant parameter.  


Each concept set has an IRI and the iri namespace is [http://apiqcodes.org/qcodes#QCodeGroup_16779 http://apiqcodes.org/qcodes#]. Which uses the iri prefix qr in the following table
Health records contain entries that have a property of a main concept (e.g. a systolic blood pressure), an effective date (the date of relevance to the observation or action), and a numeric value.  For the purposes of these rules, concepts are grouped into named sets.
 
'''It should be noted that Drug sets are not supported currently.  ('''Suppliers implement drug knowledge bases that are proprietary and may have different sets for different conceptual definitions such as antihypertensive drugs)'''.'''
 
clinical sets can be examined at https://im.endeavourhealth.net/#/directory/folder/http:%2F%2Fapiqcodes.org%2Fqcodes%23QPredict_331
 
Each concept set is universally identified with an RDF IRI (which is in the format of a URL) and the base iri namespace for Q concept sets is  
 
"<nowiki>http://apiqcodes.org/qcodes#QCodeGroup_</nowiki>" thus in the below table the numbers following this base IRI are used for brevity
 
When querying records it is assumed that a '''reference date''' is used and that entry dates are relative to the ''reference date'' and that any entry after the reference date is ignored.


Input parameters needed to calculate a QRISK3® score and their handling are as follows:
Input parameters needed to calculate a QRISK3® score and their handling are as follows:


==== Row ID ====
{| class="wikitable"
Optional Integer. Used by the client as a reference when a batch API is used. i.e. returned by the result. It has no scope beyond the API request/response
|+
!Parameter
!Type
!Values
!Description and query definition
|-
|Row id
|integer
|
|Used by the client as a reference when a batch API is used. i.e. returned by the result.
It has no scope beyond the API request/response
|-
|Age
|integer
|
|Age of the person in years at the reference date
|-
|Gender
|Character
|Male - M
Female - F
|The Gender of the patient. Note that the risk following gender
transition is unknown, and thus a clinical judgement as to whether


==== Age ====
to use the category of male or category of female.
Mandatory Integer. Age of the person in years at the reference date
|-
|Cardiovascular disease
|boolean
|true
false
|Cardiovascular disease prior to the reference date
This is an inclusion criteria and should therefore be false. A valid RISK score
requires absence of cardiovascular disease. Query defined as


==== Gender ====
<b>Condition with concept of code group 411
Mandatory Character 'M' or 'F'. Male or female.
|-
|Atrial fibrillation
|boolean
|true
false
|Atrial fibrillation at any time prior to reference date.
QRisk does not differentiate a single one off AF event from chronic or intermittent AF. Clinical interpretation may be required for those with a single event many years ago. Query defined as


Binary values only accepted. QRISK does not have information on transgender or indeterminate gender risks at this stage. It is the responsibility of the requester as to whether to apply the higher risk M gender e.g. For Trans Women and to explain the rationale.
<b>Observation with concept of code group 24
|-
|Erectile impotence
|boolean
|true
false
|A diagnosis of Erectile dysfunction or at least 2 prescriptions for drugs for dysfunction, one of which is within 28 days
Note that this factor is associated with a diagnosis as recorded in GP health records, and may or may not be valid as a response to a question. Query defined as
<b> Condition with code group 59


==== Cardiovascular disease ====
or (
Optional Boolean 1 or 0 . Cardiovascular disease prior to the reference date
Drugs such as Alprostadil, Tadalafil, Sildenafil, Vardenafil, Avanafil, Yohimbine, Aviptadil


This is an inclusion criteria and should therefore be 0. The request will be rejected if this is set t
the latest of which is within the last 28 days


==== Atrial fibrillation ====
)
Mandatory Boolean 1 or 0. Atrial fibrillation at any time prior to reference date.
|-
|Atypical anti psychotics
|boolean
|true or false
|Second generation ‘atypical’ antipsychotic - prescribed two or more issues in the previous 6 months (includes amisulpride, aripiprazole, clozapine, lurasidone, olanzapine, paliperidone, quetiapine, risperidone, sertindole, or zotepine). Query defined as
<b> 2 or more Prescriptions for code group 1169 within the last 6 months
 
|-
|Systemic corticosteriods
|boolean
|true or false
|Patient taking systemic corticosteroids. Query definition


QRisk does not differentiate a single one off AF event from chronic or intermittent AF. Clinical interpretation may be required for those with a single event many years ago.
<b> 2 or more prescriptions for oral corticosteroids such as Hydrocortisone, Betamethasone, Deflazacort, Dexamethasone, Methylprednisolone, Prednisolone
|-
|Migraine
|boolean
|true or false
|Diagnosis of migraine i.e. a diagnosis of migraine recorded in health records. Self reported migraines not resulting in a health record entered diagnosis is not evaluated. Query definition


Rule : Observation concept qr:24, effective date < reference date
<b> Condition with concept group 39
{| class="wikitable"
|-
|+
|Rheumatoid arthritis
!Code group
|boolean
!Maps to
|true or false
|Diagnosis of Rheumatoid arthritis. Query definition is
 
<b> Condition with concept group 58
|-
|Chronic renal disease
|boolean
|true or false
|Diagnosis of chronic renal disease. Query definition is:
 
<b> Condition with concept group of 322
|-
|Severe mental Illness
|boolean
|true or false
|Diagnosis of severe mental illness (psychosis, severe depression, manic depression, schizophrenia). Query definition is
 
<b> Condition with concept group 3187
|-
|-
|qr:24
|Systemic lupus erythematosus
|1
|boolean
|}
|true or false
 
|Diagnosis of Systemic Lupus erythematosus. Query definition is :


==== Atypical anti psychotics ====
<b> Condition with code group 70
Mandatory Boolean 1 or 0.  
|-
|Treated hypertension
|boolean
|true or false
|Diagnosis of hypertension at any time in the patient’s records AND On antihypertensive treatment if 1 or more prescriptions within the last 6 months. Query definition as follows


Second generation ‘atypical’ antipsychotic - prescribed two or more issues in the previous 6 months (includes amisulpride, aripiprazole, clozapine, lurasidone, olanzapine, paliperidone, quetiapine, risperidone, sertindole, or zotepine)
<b> Condition with concept group 21


Rule
and
Medication request medication in qr:1169, effective date >=- 6 months relative to reference date
Count(entries)>=2


1 or more Prescriptions for anti hypertensive drugs


{| class="wikitable"
within the last 6 months
|+
!Code Group
!Map
|-
|-
|qr:1169
|Body mass index
!1
|double
|}
|
|The most recently recorded body mass index within the last 5 years. Query definition is


==== Systemic corticosteriods ====
<b> Latest Observation with code group 200 within the last 5 years
Mandatory Boolean 0 or 1


Systemic corticosteroids –prescribed two or more issues in the previous 6 months
Out of range values handled by the engine are


Rule
<18 is set to 18, >47 is set to 47
|-
|Diabetes Category
|Enumerated
|None, type1, type2
|Diagnosis of diabetes mapped to a category. Note that resolved diabetes or well controlled diabetes) is not accounted for in the algorithm. Judgement should be used as to how the risk is applied. Query definition as follows


Medication requests, medication in qr: 1194, effective date >=- 6 months relative to reference date
<b> From latest diagnosis of code groups 1913,2411


Count(entries) >=2
Map code group 1913  Type1


{| class="wikitable"
Map code group 2411 Type2
|+
!Code Group
!Map
|-
|-
|qr:1194
|Ethnicity
!1
|Enumerated
|}
|NotRecorded, British,
 
Irish, OtherWhiteBackground,
 
WhiteAndBlackCaribbeanMixed,
 
WhiteAndBlackAfricanMixed,
 
WhiteAndAsianMixed, OtherMixed,
 
Indian, Pakistani,
 
Bangladeshi, OtherAsian,
 
Caribbean, BlackAfrican,
 
OtherBlack, Chinese,
 
OtherEthnicGroup, NotStated
|Most recent ethnicity. Query definition is
 
<b> latest entry for code groups 17071, 17072, 17073, 17074, 17075,17076,
 
&nbsp;&nbsp;&nbsp;17077, 17089, 17079, 17080, 17081, 17090, 17985,17086, 17087)
 
Maps
 
17071 White british
 
17072 White Irish
 
17073 Other White Background
 
17074 White & Black Caribbean
 
17075 White & Black African
 
17076 White & Asian
 
17077 other mixed
 
17089 Indian
 
17079 Pakistani
 
17080 Bangladeshi
 
17081 Other Asian
 
17090 Caribbean
 
17083 Black African
 
17091 Other Black
 
17985 Chinese


==== Migraine ====
17086 Other ethnic group
Mandatory boolean 0 or 1
Diagnosis of migraine prior to the reference date


Rule
qr:17087 Not stated and not classified
Observation concept in qr:39, effective date <= reference date
{| class="wikitable"
|+
!Code Group
!Map
|-
|-
|qr:39
|Family history of Coronary heart disease
!1
|boolean
|}
|true or false
|Family history of coronary heart disease in a first degree relative under the age of 60 years. Query definition is


==== Rheumatoid arthritis ====
<b> Entry for concept group 404
Mandatory boolean 1 or 0
Diagnosis of Rheumatoid arthritis prior to the reference date
Rule
Observation concept in qr:58, effective date <=reference date
{| class="wikitable"
|+
!Code Group
!Map
|-
|-
|qr:58
|Total cholesterol HDL ratio
!1
|double
|}
|
|The latest ratio of total serum cholesterol/HDL recorded in the last 5 years. The ratio is either directly directly recorded can be calculated using total cholesterol  divided by hdl. Query definition is:


<b>latest Observation with concept group 16 (TC)
   
Latest concept group 367 (HDL)
         


==== Chronic renal disease ====
Latest concept group 405 (TCHDL)
Mandatory boolean 1 or 0
     
Chronic renal disease at any time prior to the reference date
Rule
Observation concept in qr:322, effective date <= reference date
{| class="wikitable"
|+
!Code Group
!Map
|-
|qr:322
!1
|}


If TCHDL effective date > TC effective date  OR TCHDL effective date >HDL effective date
     
&nbsp;&nbsp;&nbsp;then value= TCHDL numeric value


==== Severe mental Illness ====
else if TC effective date > TCHDL AND HDL effective date >TCHDL effective date
Mandatory boolean 1 or 0
Diagnosis of severe mental illness (psychosis, severe depression, manic depression, schizophrenia) at any time prior to the reference date
Rule
Observation concept in qr:3187 ,effective date <=reference date




{| class="wikitable"
&nbsp;&nbsp;&nbsp;then value = TC / HDL
|+
!Code Group
!Map
|-
|qr:3187
!1
|}


else


==== Systemic lupius erythematosis ====
&nbsp;&nbsp;&nbsp;value = null
Diagnosis of systemic lupus erythematosis at any time prior to the reference date
Rule
Observation concept in qr:70, effective date <= reference date




{| class="wikitable"
Handling of out of range values by calculator
|+
<1 is set to 1, >12 is set to 12
!Code Group
!Map
|-
|-
|qr:3187
|Smoking category
!1
|Enumerated
|}
| NonSmoker, ExSmoker,
 
LightSmoker, ModerateSmoker,
 
HeavySmoker, NotKnown
| The most recently recorded smoking status with 5 levels


This categorisation has one group for ex-smokers rather than trying to distinguish between ex light, ex moderate and ex heavy smokers.


==== Treated hypertension ====
This categorisation does not distinguish between cigarette/cigar and pipe smokers
Mandatory boolean 1 or 0
Diagnosis of hypertension at any time in the patient’s records AND On antihypertensive treatment if 1 or more medication requests within 6 months prior to the reference date. 1 or 0 (hypertension qr:21) (hypertension effective date prior to refence date) Assumes 0 by default


Special consideration should be given to records that contain both numeric values for the number of cigarettes smoked, and concepts that categorise into light moderate or heavy.


The logic on non smoker is that from the entry of the most recent if it has a numeric value or if there other codes on the same day with numerics take the numeric value on the same day as the most recent, unless the most recent is non smoker


Query definition is


<b>
Observation with concept group,2239 -(NONE), 2238 (EX)


&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2244 (LIGHT), 2242 (MODERATE),2243 (HEAVY) as ENTRIES


GET latest from ENTRIES with Numeric Value >0 (LATESTWITHVALUE)


GET latest from ENTRIES (LATESTSMOKING)


IF Date of LATESTWITHVALUE == Date of LATESTSMOKING


&nbsp;&nbsp;&nbsp;use SmokingValueMap


ELSE


nbsp;&nbsp;&nbsp;use Smoking concept group Map




nteger (nullable)
Smoking concept Map


The most recent systolic blood pressure prior to search date recorded in the last 5 years
2239 None smoker


198
2238 Ex Smoker


n/a
2244 light smoker


sbps5
2242 Moderate smoker


Double (nullable)
2243 Heavy smoker


Standard deviation of all of the available systolic blood pressures prior to the search date recorded in the last 5 years
Numeric value map
0-9 Light Smoker


198
10-19 Moderate smoker


n/a
>=20  Heavy smoker


town


Double (nullable)
|-
|Systolic blood pressure
|integer
|
| The most recent systolic blood pressure within 5 years. Query definition is


The Townsend score associated with the output area of a patient’s postcode based on the 2001 census data.


n/a
<b>  Numeric value of Most recent Observation with concept group 198 within the last 5 years and numeric value not null
   
</b>


n/a
Handling of values out of range


postcode
<70 is set to 70, >210 is set to 210
|-
| Standard deviation of systolic blood pressures
|double
|
| The SAMPLE style Standard deviation of all of the available systolic blood pressures prior to the reference date  recorded in the last 5 years. Note that EP QRISK3 will calculate the spb 5 from a list of values. Query definition is


String
<b>  Observation with concept group 198 and numerivc value not null
 


Patient’s postcode. This can be missing if Townsend score is supplied.
Return  Standard deviation (sample) (Systolics) or list of values
|-
|Townsend score
|double
|
|The Townsend score associated with the output area of a patient’s postcode based on the 2001 census data.


n/a
Available via API


n/
Default handling of unknown is 0  (the mean of the national scores)
|-
|}

Latest revision as of 08:49, 6 April 2024

Endeavour Predict is a manufacturer of EP QRISK3 Engine which is the implementation of QRISK3 by Endeavour Predict.

The EP QRISK3 Engine, with both a Web API and local run time components are now registered as a class 1 device with the MHRA and available for use.

Background

Information about the research and algorithms that resulted in QRISK3, as well as the free to use Web site can be viewed at https://qrisk.org and a related presentation, a CVD lifetime risk at https://qrisk.org/lifetime/index.php

Predict Services

QRISK3 risk score can be calculated using Endeavour Predict services, which consist of:

  1. A set of Web based APIs for submitting requests for a prediction and receiving a response, the response including a risk score, and other score specific information for example in QRISK3, a heart age , as well as information relating to the calculation of the scores.
  2. A local run time C# or Java jar version for integration into local systems that prefer not to use a web UI.
  3. A set of FHIR APIS to enable system suppliers to know which Snomed-CT concepts should be used when deriving information from records. These are part of the Endeavour information model services.
  4. A REST API for deriving a Townsend deprivation score from a post code, the Townsend score being then submitted as part of the QRISK request payload.

Concept (Value) sets and FHIR API

Draft versions of value sets are available via the Endeavour API dev portal at https://dev.endeavourpredict.org/apis, which is a self sign up process, enabling access to a number of the public APIs. The concept sets are available as FHIR value sets at the self sign up developer portal

In line with FHIR an semantic web standards, each set is given a unique IRI and it is the IRI that is used as identifiers in the API call.

the QRISK3 superset iri is http://apiqcodes.org/qcodes#QPredict_331 which includes the subsets. The score level concepts sets contain subsets so that recursive calls can be made to obtain each set. Alternatively, using the $expand operation, the entire subset can be obtained as one.

The sets can also be independently examined or obtained via the information manager, selecting the hierarchy option to view the subsets.https://im.endeavourhealth.net/#/directory/folder/http:%2F%2Fapiqcodes.org%2Fqcodes%23QPredict_331 . The concept sets can be downloaded from the IM application in excel CSV , or TSV

Within Endeavour each concept is given a unique identifier or IRI in line with semantic Web. Users will be more familiar with the use of the concept's code and this is provided as well as maps to alternative code schemes.

APIs (Web and local)

A developer portal for qrisk3 is available at https://dev.endeavourpredict.org/apis

The algorithms are available over the internet via REST API calls or a locally deployed .NET assembly, or a locally deployed Java jar. In all 3 variations the input format (JSON) and parameters are the same and the result format (JSON) is the same. Consequently suppliers using local versions may use the developer portal to test input and output formats.

When using a locally deployed implementation, a test pack SDK is provided to enable unit and integration testing by end suppliers.

Intended use

EP - QRISK3 Engine is a clinical decision support tool intended to facilitate individualised discussions between medically trained professionals and patients about their individual risk of heart attacks or stroke taking account of their demographic and medical profile.

This will enable shared decision making, allowing patients to understand their risk and discuss actions that could be taken in the context of other important factors to reduce their risk.

EP - QRISK3 Engine has been developed for both public health purposes as well as individual therapeutic or health care decisions.

EP - QRISK3 Engine has been developed so that it can either run as a standalone process, with data being submitted and results returned in batch file format, or it can be integrated as a component or module to an interactive web-based tool, to allow data to be inputted and processed on a single individual at a time.

It is therefore also intended that EP - QRISK3 Engine will be licensed to other medical device manufacturers, so they can produce their own websites/front ends including QRISK3 Engine as a component.

Safety information and cautions

EP- QRISK3 Engine cannot take the place of clinical assessment. No medical decision should be based solely on results provided by the risk calculator. This is a labelled misuse of the QRISK3 Engine.

When developing implementations of EP- QRISK3 Engine, licensees should review relevant research paper to ensure that implementations and any system generated recommendations to clinicians/users based on the output is in line with the original intended use. Licensees may be required to CA or CE mark individual implementations as medical devices depending on the output/decision provided by the software based on a particular risk score. This may require additional clinical investigations and may result in being a higher class of device than EP-QRISK3 Engine.

Clinicians are expected to apply their own clinical judgement to further risk stratify patients and are not expected to rely solely on the output from QRISK3® (via licensed implementations) in order to appropriately manage and advise their patients regarding their risk.

Instructions for use

The REST API instructions are available at a Swagger at https://dev.endeavourpredict.org/apis

To the local batch processor the instructions for Windows are:

  1. Unzip the published pack to any folder
  2. Unzip the test data to another folder

To test

  1. Take a copy of the test data and place in another folder
  2. using the windows command line execute the EP_QRisk3.Batch.exe with a parameter pointing to the test folder
  3. Note that the output is regenerated as output files. The can, if wished be compared against the original provided result files as they should be identical

To run

  1. Generate source data as JSON files in the format as provided (which is the same as the API format)
  2. Using the command console, execute the EP_QRisk3.Batch.exe with a parameter pointing to the source folder.

Query Rules for health records

Systems may have access to longitudinal health records, in particular those held in General Practice. In that case those systems may elect to query the health record data in a way that provides likely values for the variables, passed to the function as parameters to the QRISK function.

In this case, a set of query criteria and rules are applied to the record entries and the values of the variables derived from those entries. These are then presented to a user for confirmation or amendment before being submitted via the API.

It is strongly recommended that for any individual decision, or when an entry of a risk score is into a record is being considered, that each set of assumptions are confirmed by the user. However, purely automated calculations may be used for population based risk stratification.

Reference date

Scores may be calculated in real time or retrospectively. The reference date (current date or past date) is used for all time dependent values, which means values as they would have been on the reference date. For example when looking for dates within 6 months this means 6 months prior to, or at the time of, the reference date and all entries subsequent are ignored.

Patient inclusion criteria

This section documents the criteria for a person suitable for the application of QRISK3

  • Aged between 25 and 84 inclusive at the reference date

• Free from a diagnosis of cardiovascular disease (qr: group 411 see below) on or before the reference date

Independent variables as function parameters

QRISK® operates as a function whose parameters represent independent variables. The API accepts these arguments as JSON key value pairs (or lists) in the payload of the request.

The values of those variables, when used in the algorithm are derived in one of two ways

a) By direct entry by a user

b) By a query of a health record.

When passed into the algorithms as arguments to the function, the values are presented either enumerators (e.g. heavy Smoker) as a double (e.g. BMI), an integer (e.g. Systolic BP) or , a boolean true or false. The enumerator text values are documented in the API swagger and are the same for the local run time

If variables are unknown (missing) or their values are out of range, the algorithm may either reject the request, provide a default value for the parameter, or adjust an out of range value to an outer limit. The way the algorithm handles these parameters are documented below in the relevant parameter.

Health records contain entries that have a property of a main concept (e.g. a systolic blood pressure), an effective date (the date of relevance to the observation or action), and a numeric value. For the purposes of these rules, concepts are grouped into named sets.

It should be noted that Drug sets are not supported currently. (Suppliers implement drug knowledge bases that are proprietary and may have different sets for different conceptual definitions such as antihypertensive drugs).

clinical sets can be examined at https://im.endeavourhealth.net/#/directory/folder/http:%2F%2Fapiqcodes.org%2Fqcodes%23QPredict_331

Each concept set is universally identified with an RDF IRI (which is in the format of a URL) and the base iri namespace for Q concept sets is

"http://apiqcodes.org/qcodes#QCodeGroup_" thus in the below table the numbers following this base IRI are used for brevity

When querying records it is assumed that a reference date is used and that entry dates are relative to the reference date and that any entry after the reference date is ignored.

Input parameters needed to calculate a QRISK3® score and their handling are as follows:

Parameter Type Values Description and query definition
Row id integer Used by the client as a reference when a batch API is used. i.e. returned by the result.

It has no scope beyond the API request/response

Age integer Age of the person in years at the reference date
Gender Character Male - M

Female - F

The Gender of the patient. Note that the risk following gender

transition is unknown, and thus a clinical judgement as to whether

to use the category of male or category of female.

Cardiovascular disease boolean true

false

Cardiovascular disease prior to the reference date

This is an inclusion criteria and should therefore be false. A valid RISK score requires absence of cardiovascular disease. Query defined as

Condition with concept of code group 411

Atrial fibrillation boolean true

false

Atrial fibrillation at any time prior to reference date.

QRisk does not differentiate a single one off AF event from chronic or intermittent AF. Clinical interpretation may be required for those with a single event many years ago. Query defined as

Observation with concept of code group 24

Erectile impotence boolean true

false

A diagnosis of Erectile dysfunction or at least 2 prescriptions for drugs for dysfunction, one of which is within 28 days

Note that this factor is associated with a diagnosis as recorded in GP health records, and may or may not be valid as a response to a question. Query defined as

Condition with code group 59

or ( Drugs such as Alprostadil, Tadalafil, Sildenafil, Vardenafil, Avanafil, Yohimbine, Aviptadil

the latest of which is within the last 28 days

)

Atypical anti psychotics boolean true or false Second generation ‘atypical’ antipsychotic - prescribed two or more issues in the previous 6 months (includes amisulpride, aripiprazole, clozapine, lurasidone, olanzapine, paliperidone, quetiapine, risperidone, sertindole, or zotepine). Query defined as

2 or more Prescriptions for code group 1169 within the last 6 months

Systemic corticosteriods boolean true or false Patient taking systemic corticosteroids. Query definition

2 or more prescriptions for oral corticosteroids such as Hydrocortisone, Betamethasone, Deflazacort, Dexamethasone, Methylprednisolone, Prednisolone

Migraine boolean true or false Diagnosis of migraine i.e. a diagnosis of migraine recorded in health records. Self reported migraines not resulting in a health record entered diagnosis is not evaluated. Query definition

Condition with concept group 39

Rheumatoid arthritis boolean true or false Diagnosis of Rheumatoid arthritis. Query definition is

Condition with concept group 58

Chronic renal disease boolean true or false Diagnosis of chronic renal disease. Query definition is:

Condition with concept group of 322

Severe mental Illness boolean true or false Diagnosis of severe mental illness (psychosis, severe depression, manic depression, schizophrenia). Query definition is

Condition with concept group 3187

Systemic lupus erythematosus boolean true or false Diagnosis of Systemic Lupus erythematosus. Query definition is :

Condition with code group 70

Treated hypertension boolean true or false Diagnosis of hypertension at any time in the patient’s records AND On antihypertensive treatment if 1 or more prescriptions within the last 6 months. Query definition as follows

Condition with concept group 21

and

1 or more Prescriptions for anti hypertensive drugs

within the last 6 months

Body mass index double The most recently recorded body mass index within the last 5 years. Query definition is

Latest Observation with code group 200 within the last 5 years

Out of range values handled by the engine are

<18 is set to 18, >47 is set to 47

Diabetes Category Enumerated None, type1, type2 Diagnosis of diabetes mapped to a category. Note that resolved diabetes or well controlled diabetes) is not accounted for in the algorithm. Judgement should be used as to how the risk is applied. Query definition as follows

From latest diagnosis of code groups 1913,2411

Map code group 1913 Type1

Map code group 2411 Type2

Ethnicity Enumerated NotRecorded, British,

Irish, OtherWhiteBackground,

WhiteAndBlackCaribbeanMixed,

WhiteAndBlackAfricanMixed,

WhiteAndAsianMixed, OtherMixed,

Indian, Pakistani,

Bangladeshi, OtherAsian,

Caribbean, BlackAfrican,

OtherBlack, Chinese,

OtherEthnicGroup, NotStated

Most recent ethnicity. Query definition is

latest entry for code groups 17071, 17072, 17073, 17074, 17075,17076,

   17077, 17089, 17079, 17080, 17081, 17090, 17985,17086, 17087)

Maps

17071 White british

17072 White Irish

17073 Other White Background

17074 White & Black Caribbean

17075 White & Black African

17076 White & Asian

17077 other mixed

17089 Indian

17079 Pakistani

17080 Bangladeshi

17081 Other Asian

17090 Caribbean

17083 Black African

17091 Other Black

17985 Chinese

17086 Other ethnic group

qr:17087 Not stated and not classified

Family history of Coronary heart disease boolean true or false Family history of coronary heart disease in a first degree relative under the age of 60 years. Query definition is

Entry for concept group 404

Total cholesterol HDL ratio double The latest ratio of total serum cholesterol/HDL recorded in the last 5 years. The ratio is either directly directly recorded can be calculated using total cholesterol divided by hdl. Query definition is:

latest Observation with concept group 16 (TC)

Latest concept group 367 (HDL)


Latest concept group 405 (TCHDL)


If TCHDL effective date > TC effective date OR TCHDL effective date >HDL effective date

   then value= TCHDL numeric value

else if TC effective date > TCHDL AND HDL effective date >TCHDL effective date


   then value = TC / HDL

else

   value = null


Handling of out of range values by calculator <1 is set to 1, >12 is set to 12

Smoking category Enumerated NonSmoker, ExSmoker,

LightSmoker, ModerateSmoker,

HeavySmoker, NotKnown

The most recently recorded smoking status with 5 levels

This categorisation has one group for ex-smokers rather than trying to distinguish between ex light, ex moderate and ex heavy smokers.

This categorisation does not distinguish between cigarette/cigar and pipe smokers

Special consideration should be given to records that contain both numeric values for the number of cigarettes smoked, and concepts that categorise into light moderate or heavy.

The logic on non smoker is that from the entry of the most recent if it has a numeric value or if there other codes on the same day with numerics take the numeric value on the same day as the most recent, unless the most recent is non smoker

Query definition is

Observation with concept group,2239 -(NONE), 2238 (EX)

      2244 (LIGHT), 2242 (MODERATE),2243 (HEAVY) as ENTRIES

GET latest from ENTRIES with Numeric Value >0 (LATESTWITHVALUE)

GET latest from ENTRIES (LATESTSMOKING)

IF Date of LATESTWITHVALUE == Date of LATESTSMOKING

   use SmokingValueMap

ELSE

nbsp;  use Smoking concept group Map


Smoking concept Map

2239 None smoker

2238 Ex Smoker

2244 light smoker

2242 Moderate smoker

2243 Heavy smoker

Numeric value map 0-9 Light Smoker

10-19 Moderate smoker

>=20 Heavy smoker


Systolic blood pressure integer The most recent systolic blood pressure within 5 years. Query definition is


Numeric value of Most recent Observation with concept group 198 within the last 5 years and numeric value not null

Handling of values out of range

<70 is set to 70, >210 is set to 210

Standard deviation of systolic blood pressures double The SAMPLE style Standard deviation of all of the available systolic blood pressures prior to the reference date recorded in the last 5 years. Note that EP QRISK3 will calculate the spb 5 from a list of values. Query definition is

Observation with concept group 198 and numerivc value not null


Return Standard deviation (sample) (Systolics) or list of values

Townsend score double The Townsend score associated with the output area of a patient’s postcode based on the 2001 census data.
Available via API

Default handling of unknown is 0 (the mean of the national scores)