You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To add a codelist from OpenCodelists to a study a user currently has to:
Identify the codelist required on OpenCodelists
Copy the part of the URL after https://www.opencodelists.org/codelist/ being sure not to include the trailing /
Paste into codelists/codelists.txt
Run opensafely codelists update
Note the path of the codelist csv that has been downloaded by this command
Inspect the csv/the codelist on OpenCodelist to note the key field name(s)
Use the codelist_from_csv() function in their ehrQL with the field name(s) and csv file path
That's rather a lot of steps, and opportunities for things to go wrong.
Improvement of 5-7 could require changes to ehrQL or perhaps generation of code snippets, but I feel 2-4 are ripe for some simplification by changing the behaviour of the CLI.
The text was updated successfully, but these errors were encountered:
For a while I've thought we could provide an easier means of adding codelists, perhaps via an add command, and @lucyb appears to have reached a similar thought so I propose this as a potential implementation of this.
In my proposed implementation the user:
doesn't need to modify the opencodelists URL
doesn't need to modify the codelists.txt file
only needs to call one CLI command
The last of those may require some further thought as there are sometimes-unexpected implications/side-effects of calling opensafely codelists update e.g. updating previously-downloaded codelists, and removing and local codelists which may have (erroneously) been placed in the codelists/ folder. However, I cannot imagine a circumstance in which a user would add a codelist to codelists.txt and not then run opensafely codelists update.
To add a codelist from OpenCodelists to a study a user currently has to:
https://www.opencodelists.org/codelist/
being sure not to include the trailing/
codelists/codelists.txt
opensafely codelists update
codelist_from_csv()
function in their ehrQL with the field name(s) and csv file pathThat's rather a lot of steps, and opportunities for things to go wrong.
Improvement of 5-7 could require changes to ehrQL or perhaps generation of code snippets, but I feel 2-4 are ripe for some simplification by changing the behaviour of the CLI.
The text was updated successfully, but these errors were encountered: