At the Bennett Institute we get asked if we have a way of converting BNF codes (which are used in the NHS Business Services Authority (NHSBSA) data that we use to power to dm+d codes.

The tables that allow us to do this are in our back-end SQL server. Although we haven’t previously attempted to make them available to users, we thought we would take the opportunity to see if a) they are fit for purpose, and b) could be shared openly.

We are aware that NHSBSA do provide a BNF code to dm+d map, but one of our users had specifically asked whether we could also provide a map from BNF codes to Virtual Therapeutic Moieties (VTM), which the NHSBSA doesn’t currently include.

We have created a map in the form of a CSV file, which is available to freely download here. Please read on for more information on how the map was developed, and caveats in its use.


We have written in detail about the structures of the BNF code, dm+d, and how they differ from each other. Below is a brief summary.

BNF coding

BNF code: a hierarchical 15 digit code, based on the legacy version of the British National Formulary (BNF) hierarchy.


Virtual Therapeutic Moiety (abstract) — VTM

VTM is the highest level within dm+d. It is an abstract representation of a medicine or device. It is just the chemical name without any mention of the strength or formulation. Example: Amoxicillin

Virtual Medicinal Product (abstract) — VMP

VMP describes the abstract or generic medicinal product. Example: amoxicillin 250mg capsules

Actual Medicinal Product (real product) — AMP

AMP provides a unique description of a medicine or device that has been made available by a manufacturer or supplier but does not describe the pack size or the quantity of the medicine or device. Example: Amoxicillin 250mg capsules — Actavis UK Ltd

Although there are more granular levels of dm+d (virtual and actual medicinal product packs, VMPP/AMPP), BNF codes do not have this level of detail, and map to AMP/VMP level.

Creating the map

We created the BNF code to dm+d map using a Jupyter Notebook. You can find the full notebook on our GitHub page, but below is a brief description of what we did, and what we found out.

We created a map of BNF code to VMP/AMP and VTM using existing tables on our BigQuery server, which we obtain weekly from the NHS TRUD service, and then tested this using 12 months of prescribing data (September 2022 - August 2023, the most recent available) to check whether there were any issues for unmapped prescribed medicines.

dmd type (AMP/VMP) AMP/VMP code dm+d name VTM code VTM name BNF Code Previous VMP code Previous VMP date
vmp 6259002 Hydrogen peroxide 3% solution 31231007 Hydrogen peroxide 1311060I0AAABAB 4224911000000000 15/08/2005
vmp 68461003 Lubricant gels NaN NaN NaN 3485311000000000 04/01/2006
vmp 134460003 Irbesartan 300mg / Hydrochlorothiazide 12.5mg tablets 398914000 Irbesartan + Hydrochlorothiazide 0205052A0AAABAB NaN NaN
vmp 134461004 Irbesartan 150mg / Hydrochlorothiazide 12.5mg tablets 398914000 Irbesartan + Hydrochlorothiazide 0205052A0AAAAAA NaN NaN
vmp 134463001 Telmisartan 20mg tablets 129487008 Telmisartan 0205052Q0AAACAC NaN NaN

Figure 1: sample output from BNF code to VMP/AMP and VTM map

Products with either a missing AMP or VMP code

We filtered the results to find any prescribed products that didn’t have a corresponding VMP or AMP code:

dmd type (AMP/VMP) AMP/VMP code dm+d name VTM code VTM name BNF Code Previous VMP code Previous VMP date BNF name Prescription Items (Sep 22 - Aug 23)
NaN NaN NaN NaN NaN 190201000AABLBL NaN NaT Exception Handler Unspecified Item 314805
NaN NaN NaN NaN NaN 190201000AABPBP NaN NaT Exception Handler High Volume Unspecified Item 184530
NaN NaN NaN NaN NaN 190201000AABNBN NaN NaT Exception Handler Discount Not Deducted Item 20008
NaN NaN NaN NaN NaN 0913261J0BCAAAB NaN NaT ProZero liquid 4549
NaN NaN NaN NaN NaN 090402000BDFHA0 NaN NaT Fresubin Energy tube feed liquid unflavoured 205

Figure 2: Top 5 prescribed products with no mapped AMP/VMP code

We can see from the above there are very few items apart from “unspecified items”, which by definition cannot have a BNF code. Therefore we can be confident that the vast majority of items prescribed in primary care have a corresponding AMP or VMP code.

Product mapping to VTM

We next checked to see whether there were any prescribed products which didn’t map to an appropriate VTM code.

BNF name Prescription Items (Sep 22 - Aug 23)
Laxido Orange oral powder sachets sugar free 2655605
FreeStyle Libre 2 Sensor 2150585
Macrogol compound oral powder sachets NPF sugar free 1917581
Dermol 500 lotion 1821608
Otomize ear spray 1404453
Epimax original cream 1216588
Vitamin B compound strong tablets 1038779
GlucoRx Nexus testing strips 1020083
Medi Derma-S barrier cream 780871

Figure 3: Top 10 prescribed products with no mapped VTM code

There appeared to be a significant number of items prescribed which did not have a corresponding VTM code.

On further investigation we found that this consisted of three main groups of preparations:

  • Devices (for example Freestyle Libre 2 sensor), for which there is no chemical ingredient, and therefore does not have a VTM
  • Medicine preparations which have more than 3 ingredients listed on dm+d. For example Macrogol compound oral powder sachets NPF sugar free has 5 separate ingredients: Macrogol ‘3350’, Bicarbonate, Potassium, Chloride, and Sodium.
  • Combination products, for example Evorel Sequi patches which have two different patch types in the pack, and Microgynon 30 ED, which has a placebo tablet as well as an active tablet.

None of the products listed above will have a corresponding VTM code.


We are confident that the BNF code to dm+d (including VTM) is accurate and as complete as possible, with the following caveats:

  • It is current as of November 2023
  • No medicines with more than three listed ingredients, in a combination pack, or devices will have a VTM code

We have also included previous VMP codes - this is important as changes to the VMP codes happen quite frequently, and some codelists may contain previous versions.

The BNF to dm+d code map is freely available as a CSV file for anyone to download from here. See below for fields:

Field Description
type Type of dm+d code (AMP or VMP)
id dm+d code (AMP or VMP)
nm dm+d name
vtm VTM code
vtm_nm VTM name
bnf_code BNF code
vmp_previous Previous VMP code
Vmp_previous_date Date of previous VMP code change