Skip to content

Check codelists for inactive SNOMED CT codes with usage - #174

Open
milanwiedemann wants to merge 12 commits into
mainfrom
add-cli-codelists-check
Open

milanwiedemann wants to merge 12 commits into
mainfrom
add-cli-codelists-check

Conversation

@milanwiedemann

@milanwiedemann milanwiedemann commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

SNOMED CT codes can become inactive and be replaced by new codes, but GP EHR (software) may still use both. In our PROMs study we missed codes this way. This PR adds an experimental check that finds old and new codes with GP usage that may be missing from a codelist. A flagged code is something to review, might not always be a mistake.

What this adds

  • check_codelists(), check_codelists_dir() and check_codelists_url() run the check in R
  • opencodecounts codelists check CLI runs it in the terminal. This needs the newest version of the opencodecounts package and Rapp::install_pkg_cli_apps("opencodecounts"))
  • read_codelists() reads the CSV files from opensafely codelists update
  • A new app tab shows linked codes that aren't selected
  • App links can open with codes or a codelist already loaded (Add URL parameter support for automatic codelist loading #115)
  • Codelist CSVs with an unnamed index column now work (Counts for a codelist from OpenCodelists aren't showing #165)
  • New logos and icons

How it works

Old and new code pairs come from a table on NHS TRUD: SNOMED CT UK Query Table and History Substitution Table
. We publish it as a GitHub release and through a (currently) hidden function opencodecounts::get_snomed_history(), usage comes from get_gp_snomed().

Known limitations

  • Pairs that TRUD flags as ambiguous are left out, and we haven't reviewed them yet
  • A pair is only checked if the codelist has at least one of its two codes
  • Usage covers all years, including years before a codelist version was made (or after a codelist may have been intended to be used)
  • We've only used and looked at the October 2026 TRUD release

@milanwiedemann
milanwiedemann marked this pull request as ready for review November 2, 2026 16:32

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant