opensafely-core / opensafely-core/opencodelists
Proposal: generate `codelists.txt` file from selected codelists
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 60
- Forks
- 16
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 17
Description
Background
For studies in OpenSAFELY it is almost always necessary to create a codelists.txt file which lists each codelist required from OpenCodelists, including the organisation/user name and version number. Example:

Proposal
Rather than copying and pasting each codelist manually into the file, it would be helpful if users could create this file in OpenCodelists. E.g.
- select a variety of codelists in OpenCodelists (e.g. through checkboxes or an "add to basket" button on each codelist page),
- add them to a list/collection (akin to a shopping basket)
- review the basket (the codelists should ideally be clickable links, and ideally show whether the latest version of each codelist is selected or not).
- edit the basket (e.g. remove items)
- save the basket for later
- export the basket as a ready-made
codelists.txtfile (or part thereof, from which text could be copied into an existing file e.g. from a similar study)
Questions
- Do others think this would be useful?
- Can users have more than one basket at one time (e.g. for two studies)?
- Can users share baskets?
- It may also be useful if other information can (optionally?) be viewed/downloaded, such as the coding system, which is required for each codelist to be used in a study, normally specified in a
codelists.pyfile. Example:

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
No files, tests, or entry points are named. Start by reviewing the existing codelist selection and export flows, then clarify whether baskets, version handling, sharing, and coding-system output are in scope. Done should include an agreed design and an implemented way to save, edit, and export selected codelists as codelists.txt.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- full-stack
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 15/100