opensafely-core / opensafely-core/opencodelists
Remove `Codelist.tags` property and related stuff
Nobody has claimed this yet.
- 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
tagsproperty from theCodelistmodel. - Generating a migration to drop the
taggit*tables. The property has adjango-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
taggitdependency. - Removing the
add_codelist_tagaction. - Removing the reference to
tagsand Interactive fromcodelists/api.pycodelists_getmethod. - Removing associated test code and fixture properties for the above.
- Checking for any other references to
tagsor any of the above.
This probably fits in one PR.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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