Learn about Clinical Coded Phenotypes

What are Phenotypes?

A Phenotype is an observable and measurable piece of information that is relevant to health or healthcare. For example, it can be a disease (e.g. type 2 diabetes), a blood pressure measurement, a blood sugar value or a prescription of antibiotics.

Phenotyping algorithms are special tools that enable researchers to extract Phenotypes from complex, and often messy data that get generated during routine interactions within the healthcare system. They identify and extract data from medical records using clinical codes which are the building block of how information is recorded in healthcare (for example ICD-10). Using these specialised algorithms, researchers and clinicians can maximise the value of patient data contained in medical records and answer important questions that can improve health and healthcare.

Clinical Coded Phenotypes

Clinical Coded Phenotype are Phenotype definitions that are applied to structured health data and involve the use of clinical code lists. A Clinical Coded Phenotype may have one or more code lists, referred to as a “Concept”.

Concepts

Each Concept defines a single code list using a single clinical coding system, and having a particular meaning.

Different concepts may define the Phenotype in different contexts: for example, an asthma Phenotype may have a Concept defining asthma in secondary care using ICD-10, and another Concept defining asthma in primary care using SNOMED-CT.

Concepts may also define different attributes or events associated with a Phenotype. For example, a depression Phenotype may have a Concept defining depression symptoms, another defining a diagnosis of depression, and a third defining antidepressant medication.

Defining Concepts with Rules

The codes within a Concept are defined using one or more rules. The rules are as follows:

  • Search: use a search term or regular expression to identify codes. This can be based on the code itself (for example, all ICD10 codes that start with “A1”), or the description (such as all Read codes that mention “diabetes”). If the regular expression option is selected, Perl compatible regular expressions can be used to define more complex criteria.

  • File Import: upload an existing list of codes that has been created elsewhere.

    Please note:

    • It is expected that your file contains only a single code list containing a set of codes that are only associated with a single type of clinical terminology, e.g. an ICD-10 code list.
    • It is also expected that the file is composed of at least two rows: (1)the first containing the code; and (1)the second containing the terms or description associated with that code.
      In the case of an ICD-10 code list, a row might look like this: “A00.0,Cholera due to Vibrio cholerae 01, biovar cholerae
      Note: In this example, the first column denotes the code and the second contains the description - the remaining columns, if any, would be ignored.
  • Import from another Phenotype: concepts that exist in other Phenotype in the library can be referred to and used as building blocks to create a new Phenotype. For example, a new Phenotype “Heart Conditions” could be created by combining existing definitions of heart attack, heart failure, high blood pressure, and other diseases.

Multiple inclusion rules can be used to add codes and build up the code list; additionally, exclusion rules can be used to remove codes that would otherwise be included.

Exceptions to how Rules function

There are some exceptions to the functionality of rules:

  • Excluding codes from a file upload: it is not possible to exclude codes imported with a file rule. If you encounter this, we recommend you remove that code from your code list file.

  • Custom coding systems: it is not possible to exclude custom codes - the codes must match an existing, known code list that is available from our clinical terminology repository.

  • Exclusionary types: it is not possible to exclude codes through a file upload - codes can only be excluded via search rules or imported code lists.

Accessing the creation pages

Users can access the creation page via the search page - this can be accessed by selecting the “Phenotypes“ button (marked in red) seen in the navigation bar. To begin working on a Phenotype users must click the link within the “Create a Phenotype“ card (seen below in pink).

Accessing the Create page

Selecting your template

To start creating a Phenotype the users must select the template they wish to follow. Different templates may be created for different types of algorithms, data settings, etc. Currently, two types of Phenotype are supported:

  • Clinical Coded Phenotype: Phenotypes that apply to structured health data and involve the use of clinical codes.

  • Structured data algorithm: Phenotypes that apply to structured health data, but do not relate to specific clinical codes and don’t contain any list of codes.

This tutorial relates to the process for Clinical Coded Phenotypes, though other templates will be similar. Click the appropriate template button as shown below:

Selecting a Template

The creation wizard

After the user selects their template they will be referred to the wizard page. This page describes what details the template can store, and which fields are required to continue. Any field that is mandatory will be marked with a red asterisk as highlighted below:

Required fields in the Creation Wizard

Adding Concepts

The “Clinical Code List” section allows researchers to define the Concepts and associated codes that will be used to define their Phenotype. To start, the user can either (a) create a new Concept (red) or (b) import an existing Concept from another Phenotype (pink).

Adding Concepts to your Phenotype

Creating a Concept

If the user decides to create a new Concept they will be met with the option to define the coding system that will be used to create the Concept, and to define some basic metadata such as the Concept’s name.

As seen in the image below, a coding system must be selected first before the system will allow it to add any associated rules or codes:

Adding a Coding System

To add a new rule, the user can select the “Add Rule” button in either the “Inclusion Rules” or “Exclusion Rules” section:

Adding a new Rule

After adding or modifying a rule the user will be notified of the changes made to the code list by a toast notification on the bottom right of the screen (seen below in pink).

Adding a codes with your Rule

The code list, as generated by the user’s rules, will be visible in the “code list” section. The table columns can be sorted by clicking on the header of each column.

Some important notes regarding the columns:

  • The “Final” column (red box) describes whether the code will be included or excluded from the final code list

  • The columns with names that match the given rules (pink box) describe whether that code was included or excluded by that rule, and will be blank if the code was not present in that rule

Inclusionary and Exclusionary Rules

Finalising your Concept

After finalising the Concept’s associated rules and codes, the user can click the “Confirm” button to save those changes locally. They will be prompted to do so if they try to submit the Phenotype before doing so.

If they decide to cancel these changes by clicking the “Cancel” button then the Concept will be reverted to its previous state, if any.

Finalising your Concept

Searchterm rules

Selecting the “Add Searchterm” option will add a search rule - these attempt to add codes by matching a string to one or more codes through its code’s identifier or its description.

There are search options present beneath the search input which can be used to vary the results of a given term, or to capture using patterns. We accept Regex for pattern-based search.

Using Searchterm rules

File import rules

These can be used to fulfil the need to upload code lists that have been created in the past, or can be used to support workflows where users are modifying or iterating on code lists that have been used in research papers.

Currently, only .CSV, .XLSX and OpenDocument files are supported.

Adding a file import Rule

Using Concepts as rules

Concepts from other Phenotypes can be used as rules to build up or modify a code list. This allows combining different specific concepts to create a more general one, etc.

When a Concept is added as a rule, only the final code list of that Concept is imported, and those codes are used as an inclusion or exclusion criterion in a similar manner to other rules.

If you want to add an entire existing Concept to a Phenotype and present it in its original form, do not add it as a rule, but use “Import concepts” instead (see below).

Using a Concept as a Rule

Importing Concepts

Importing a Concept from another Phenotype adds it to the new Phenotype as a top-level entity, with all its rules presented as they were in the original Phenotype.

By selecting the “Import Concepts” button, the user will be prompted by a modal to select the Concepts they would like to import.

Importing one or more Concepts

The user can select one or more Concepts to import by expanding the “Available Concepts” section and clicking each individual Concept they would like to import.

After confirming their choices, they will be met with a screen similar to this:

Imported Concepts in the viewer