OpenCodelists is a rapidly-changing work in progress. It will be a platform for the development and dissemination of codelists for use in medical research.
It is part of the OpenSAFELY project, and is currently served from codelists.opensafely.org.
It hosts codelists used in our paper on factors associated with COVID-19-related hospital death in the linked electronic health records of 17 million adult NHS patients.
There are the usual config files in the root of the repo.
The "project root", containing settings.py
etc. Also an app, with models for users, organisations, and projects.
The app with models and views for viewing, downloading, creating, and updating codelists.
A directory containing one app per coding system. Each of these apps will have a common structure, which has not yet been codified.
A directory containing one app per mapping between coding systems. Each of these apps will have a common structure, which has not yet been codified.
Templates.
Resources for deployment. Deployment is via Fabric.
A place to put scripts to be run via runscript.
To install dependencies:
- Run
pip install -r requirements.txt
- Run
npm install
To update dependencies:
- Edit
requirements.in
and runpip-compile
- Run
npm --save[-dev] ...
To build JS:
- Run
npm run watch
To run tests:
pytest
(or./manage.py test
)npm run test
To check formatting:
make format lint sort
To fix formatting:
make fix
To set up tooling via a pre-commit hook:
pre-commit install
To use Django Debug Toolbar in development, set DDT_ENABLED
.
It is not enabled by default because it adds tens of seconds to the load time of some pages.
OpenCodelists is currently deployed to smallweb1. Deployment is with fabric:
fab deploy
You will need to configure SSH agent forwarding in your ~/.ssh/config
, e.g.
Host smallweb1.ebmdatalab.net
ForwardAgent yes
User <your user on smallweb1>
macOS users will need to configure their SSH Agent to add their key by default as per GitHub's Docs.
On the server, use with_environment.sh
to run a management command in the virtual environment with the correct settings:
./with_environment.sh ./manage.py shell