Enable importing of BNF data releases using the new ODP CSV format - #3177
Open
KatieB5 wants to merge 2 commits into
Open
Enable importing of BNF data releases using the new ODP CSV format#3177KatieB5 wants to merge 2 commits into
KatieB5 wants to merge 2 commits into
Conversation
Previously, we imported BNF data from ZIP archives downloaded from the NHSBSA Information Services Portal (ISP). The ISP is no longer available, and BNF releases are now published via the NHSBSA Open Data Portal (ODP). The ODP provides BNF releases as CSV files rather than ZIP archives, with an additional MONTH_YEAR column and updated column naming convention. This change makes the minimum updates required to support importing the latest BNF releases from the ODP while preserving the existing import workflow described in `coding_systems/bnf/README.md`. Importer updates - import BNF releases directly from CSV files - normalise CSV headers to support the new ODP column naming convention - remove ZIP extraction from the BNF import path Test updates - update the BNF import fixture to match the test CSV data to the new ODP CSV format - update the import tests to use the new CSV fixture
KatieB5
force-pushed
the
KatieB5/get-bnf-updates-from-odp-api
branch
from
August 3, 2026 11:46
f681e12 to
f6bee3f
Compare
KatieB5
marked this pull request as ready for review
August 3, 2026 11:56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses steps 1 and 2 listed in #3167
Previously, we imported BNF data from ZIP archives downloaded from the NHSBSA Information Services Portal (ISP).
The ISP is no longer available, and BNF releases are now published as CSV files via the NHSBSA Open Data Portal (ODP).
Due to this change, our existing BNF data import process no longer works, and we cannot update the BNF data in production. This is blocking a user’s research work (Slack thread).
This PR makes the minimum updates required to support importing the latest BNF releases from the ODP
while preserving the existing import workflow described in
coding_systems/bnf/README.md.Importer updates
Test updates
**Local testing**
Assess current local state of BNF data:
What does the most current release look like:
just manage shellRun local dev server:
just runCheck what we can see for MontyTest3 BNF codelist in the browser:

Locally run the import:
python manage.py import_coding_system_data bnf /home/katie/opencodelists-bnf-data/bnf_code_current_202503_version_88.csv --release "88 (2025-03-01)" --valid-from 2025-03-01 --import-ref bnf_code_current_202503_version_88.csvPost-import checks:
just manage shellTry and create a codelist in the browser and check its made with the newly imported BNF Coding system release:

We can cehck for a Latest compatible release for the MontyTest3 codelist, which is showing as the newly imported BNF Coding system release:

To note