opensafely-core / opensafely-core/opencodelists

Automated detection for use of legally restricted codes

Open
#1,961 7 comments 0 reactions 1 assignee View on GitHub

@HelenCEBM is already working on this.

Since Jun 3, 2024.

Dominant language
Python
Stars
60
Forks
16
Avg merge
4d 12h
Merged PRs (30d)
17

Description

There are approximately 6 legally restricted code groups that cannot be returned in OpenSAFELY data (referenced in the DPIA), e.g. for termination of pregnancy.
However, this is not yet well documented for users, and it's easy to create codelists that contain these codes and run a query, without any warning that some codes will not be matched against any results. These might produce a surprise zero-matches result that is noticed but will usually fail silently, i.e. produce an incomplete result that can go unnoticed.

If an application clearly depends on the use of these codes it will be picked up at that stage, but it several groups have tried to use these codes as a part of a wider study without realising they are restricted.

Possible solutions:

  1. Load the restricted code groups into OpenCodelists and allow users to diff them with each of their codelists if they think they might be using some of them.
  • Pros: easy
  • Cons: very manual for users; users may not be aware when to do this and may miss it in docs even if it applies to them.
  • NB we haven't yet documented the diff feature afaik
  1. As (1), but add: give users a warning in OpenCodelists when they create a codelist that has any matches with a legally restricted codelist.
  • Pros: more automated for users
  • Cons: Reusing an existing codelist won't prompt a warning; may be irrelevant or confusing for people using OC for non-OS purposes.
  1. Give users a warning in the OpenSAFELY interface e.g. when updating codelists - to give a warning about matches with restricted codes.
  • Pros: all users will get the warning and be made aware of these otherwise silent errors with their codelists.
  • Cons: Most complicated solution to implement?

Notes

For all of the solutions, the restricted codelists that we create on OC will require regular (automated) checking to make sure they're kept up to date.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.