opensafely-core / opensafely-core/opencodelists

Remove `Codelist.tags` property and related stuff

Open
#2,649 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Why are we doing this?

Codelist.tags was a property added for the benefit of OpenSAFELY interactive in Job Server. OSI has been removed. We don't have any prospecitve use for this feature and it is was never very developed. We should remove it to simplify the codebase and make maintenance easier.

Further background

Codelist objects can have one or more tags added by the add_codelist_tag action. This was added in this commit.

I can't find any code that calls the add_codelist_tag action in any commit or the current codebase (git log -S'add_codelist_tag' --). However it does seem to have been used at some point because in the taggit_tag table there is one entry: allowed-for-opensafely-interactive and there are entries in taggit_taggeditem, presumably references to such codelists. Looking back at Job Server before we removed OSI I can't see where these tags are referred to. But anyway we removed OSI.

The codelists/api.py codelists_get method could filter by those tags.

How will we know when it's done?

The property and related code, dependencies, and DB entries have been removed.

What are we doing?

  • Removing the tags property from the Codelist model.
  • Generating a migration to drop the taggit* tables. The property has a django-taggit-defined manager which stores data in its own tables. Unclear if removing the property will allow Django to auto-generate the migration to remove them or if we'll do it manually.
  • Removing the taggit dependency.
  • Removing the add_codelist_tag action.
  • Removing the reference to tags and Interactive from codelists/api.py codelists_get method.
  • Removing associated test code and fixture properties for the above.
  • Checking for any other references to tags or any of the above.

This probably fits in one PR.


Defining delivery tasks guidance

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.

Research direction

Start in codelists/models.py and codelists/api.py, then search the repository for Codelist.tags, add_codelist_tag, taggit, and Interactive references. Review the migration, tests, and fixtures involved before checking how Django handles dropping the taggit tables. Done means the property, action, dependency, API references, related test data, and database entries are removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend, database
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.