Mapping from dm d objects to BNF codes - bennettoxford/openprescribing GitHub Wiki
Background
In a call with the BSA, we learnt:
- The BSA have two systems that contain BNF codes and SNOMED codes
- There is a legacy system and a new system
- They are able to generate mappings between BNF code and SNOMED codes from each system, but the mappings are slightly different in each case
- The mapping from the new system is reckoned to be more accurate
- The mapping available on the website is generated by the legacy system
- The mapping that we have been sent by email is generated by the new system
- The monthly prescribing data (the BSA call this the Detailed Prescribing Information dataset) currently uses BNF codes from the legacy system
- The BSA plan to start using BNF codes for the new system in the monthly prescribing data in six months or so, but this is not a firm commitment
- In the legacy system, most BNF codes map to products (VMPs or AMPs) but some map to product packs (VMPPs or AMPPs)
- In the new system, all BNF codes will map to products
- In the new system, BNF names that contain pack sizes will be changed to remove the pack sizes
- BNF codes that mapped to product packs in the legacy system will either be retired or repurposed to map to products in the new system
- Since the monthly prescribing data uses BNF codes from the old system, it will reference BNF codes that are missing from the new mapping
Our goal
We get our prescribing information from the Detailed Prescribing Information dataset, which identifies presentations by BNF code. We want to be able to map between BNF codes and SNOMED codes so that we can use the richer metadata in dm+d to provide better information on the site.
- Anywhere that we display information about presentations (ie everywhere!) we want where possible to use the nice names in dm+d over the truncated BNF names
- We want to display metadata from dm+d against presentations in the prescribing data
- For instance, on our PPU by presentation pages we want to show a presentation's tariff category, availability restrictions, and prescribability status, all of which come from dm+d
- We want to be able to allow analysing prescription trends by metadata in dm+d
- We want to accurately link presentations to the Drug Tariff and NCSO concessions
- When displaying information about dm+d objects, we want to accurately link to the analyse page for the corresponding presentations
The mapping spreadsheet
In December 2018, the BSA sent us a spreadsheet containing a mapping between BNF codes and dm+d objects. This comes from the new system.
The spreadsheet has one row per dm+d item, and includes the following columns:
Presentation / Pack Level
VMP / AMP
SNOMED Code
BNF Code
Presentation / Pack Level
and VMP / AMP
combine to indicate whether the row is for a VMP, VMPP, AMP, or AMPP, and SNOMED Code
identifies the dm+d object.
Using the mapping in this spreadsheet, we are able to assign BNF codes to a significant proportion of the dm+d objects in our database. See import_snomed_mapping
.
Visualising the mapping
We have found the easiest way to understand the relationship between a family of dm+d objects (that is, a VMP, all its VMPPs and AMPs, and all their AMPPs) is to arrange them in a table, with VMPPs as column headings, AMPs as row headings, and AMPPs in the cells. This allows us to see at a glance how many VMPPs and AMPs a family has, and how AMPPs are distributed between VMPPs and AMPs.
Additionally, we have found it helpful to colour cells in the table according to the BNF code in the mapping.
For example, consider Dapoxetine 30mg tablets.
This shows that the VMP has a BNF code, and that members of the family have 3 BNF codes. There are 3 VMPPs and 4 AMPs, with 6 AMPPs between them. 1 AMP and its AMPP do not have BNF codes, while the other AMPs do have BNF codes. One of those AMPs shares its BNF code with the VMP. For the AMPPs that do have BNF codes, their BNF code matches that of their AMP.
Interpreting the mapping
BNF codes are designed to be for products (VMPs and AMPs) and not for product packs, and so we want to be able to map a BNF code to one or more VMPs or AMPs.
In the vast majority of cases, if an AMPP has a BNF code, then this will be the same as the AMPP's AMP's BNF code. There are number of patterns here:
- Products where only generic forms of the VMP are available
- eg Salicylic acid powder
- The whole family share the VMP's BNF code
- Products where the VMP apparently lacks a BNF code (should these be corrected?)
- eg Noradrenaline (base) 2mg/2ml solution for infusion ampoules
- The VMP has no BNF code, but the rest of the family share a BNF code
- Or similar examples where there is a mix of branded generics and generics
- eg Sodium fluoride 0.05% mouthwash sugar free
- The VMP has no BNF code, but several AMPs share one BNF code, and others have their own distinct BNF code
- Products where branded generics and generics all share a VMP
- eg Prazosin 2mg tablets
- Several AMPs share a the VMP's BNF code, and others have their own distinct BNF code
- The AMPs that share the VMP's BNF code are generics, while the others are branded generics (https://openprescribing.net/dmd/vmp/35927011000001100/relationships/)
- The AMPs that share the the BNF code are likely generic, while the others are branded
- Products where only branded generics are available
- eg Levodopa 125mg / Carbidopa 31.25mg / Entacapone 200mg tablets
- Each AMP has its own distinct BNF code
- Products with more than one generic BNF code (should these be corrected?)
- eg Clobazam 10mg tablets
- eg Doxorubicin 50mg/25ml solution for injection vials
- That is, there are multiple BNF codes shared between multiple AMPs
Problems interpreting the mapping
There are around 200 VMP families for which it is not the case that if an AMPP has a BNF code, then it will be the same as the AMPP's AMP's (as derived from DM+D) BNF code. We have observed some patterns here. For instance:
- There are two BNF codes for the same VMP, and one is retired
- eg Zinc oxide 15% and Ichthammol 1% in Yellow soft paraffin
- This seems to only be the case for special orders
- There are at least 23 examples of this
- There are two BNF codes for the same VMP, and one includes "Oral Susp" in its name, and the other contains "Oral Soln"
- eg Isoniazid 50mg/5ml oral solution
- Again, this only seems to be the case for special orders
- There are at least 26 examples of this
- Each AMPP has the same BNF code as its VMPP
- eg Absorbent cotton gauze type 13 light BP 1988 sterile 90cm
- That is, these BNF codes map to product packs and not to products
- There are 7 examples of this, and we understand from the BSA that BNF codes that mapped to product packs in the legacy system will either be retired or repurposed to map to products in the new system
- AMPPs with generic names have the same BNF code as the corresponding VMP, while AMPPs with branded names have their own BNF code
- eg Beclometasone 100micrograms/dose inhaler
- This seems to particularly affect inhalers
- Here are some other examples, where in each case the BNF codes all include pack information (eg size or flavour), and there are no VMP/AMPs:
In each case, we'd like to know how the problem would be resolved, and ideally when we can expect this to happen. We can easily provide a full list of problem VMPs if requested.
Generic BNF codes and the mapping
We have assumed that
- a VMP corresponds to a generic presentation (and conversely, that only AMPs correspond to branded presentations)
- if an AMP corresponds to a generic presentation, its VMP will correspond to the same generic presentation
However, this is not always reflected in the BNF codes from the mapping.
There are 3204 VMPs with branded BNF codes. In all of these cases, all of the VMP's AMPs also have branded BNF codes. For example, this Lucozade drink is mapped to a VMP although it is a brand. Its VMP name is, confusingly, "Generic Lucozade Energy Original oral solution". Is this going to remain the case? What does this mean?
There are 8346 VMPs with AMPs with generic BNF codes, and for 7766 of these, the BNF codes of AMPs with generic BNF codes match that of the VMP. These are (presumably) what we call "ghost-branded" generics.
But there are 580 VMPs where an AMP has a generic BNF code which does not match the VMP's BNF code, broken down as follows:
- VMP BNF code is generic
- Single AMP has generic BNF code
- This is not the VMP's BNF code (26)
- Some AMPs have generic BNF codes
- Only some AMPs with generic BNF codes have the VMP's BNF code (51)
- No AMPs with generic BNF codes have the VMP's BNF code (38)
- All AMPs have generic BNF codes
- Only some AMPs have the VMP's BNF code (29)
- Single AMP has generic BNF code
- VMP has no BNF code
- Some AMPs have generic BNF codes (283)
- All AMPs have generic BNF codes (114)
- Single AMP has generic BNF code (39)