Radar Code Base Development
Holding page for RaDaR Development documentation
Development
Please, refer to the documentation on the radar api and radar client github pages.
Development Notes
The easiest way is to look at some existing pages and copy accordingly. Roughly on the backend side that involves:
create/update radar models
run alembic to create migration
$ alembic revision --autogenerate -m "Added/modified table/column, etc."
- check created migration file (modify if needed) and migrate
$ alembic upgrade head
- create/update serializer(s), view(s). If it is completely new model/view, register it in
radar/api/views/__init__.py
On the frontend:
- create component directive
- create component html page with three (or two if list is not needed) sections - editing, viewing, neither (meaning list view)
Deployment
There are multiple servers:
- nww.radar.nhs.uk - main national radar.
- nww.staging.radar.nhs.uk - staging radar, for testing if everything is working fine. It should have very similar setup to live, including UKRDC feeds.
- demo.radar.nhs.uk - demo site, used for demo and training purposes.
- internationalradar.org - international radar site.
National Radar instances should be built using national
branch - git checkout national && git merge master
. Then follow instructions on github page. International radar needs to be build from international
branch - git checkout international && git merge master
. Building on national or international branches overwrite existing build archive, therefore once the build is made, it needs to be deployed to the right instances.
To build a backend archive which then can be deployed to one of the servers:
fab -H root@10.229.247.20 --prompt-for-login-password build # this is systems-live
If building using platter then use this command.
platter build --virtualenv-version 15.1.0 -p python3 -r requirements.txt .
To deploy:
fab -H root@nww.staging.radar.nhs.uk --prompt-for-login-password deploy # staging radar fab -H root@demo.radar.nhs.uk --prompt-for-login-password deploy # demo radar fab -H root@internationalradar.org --prompt-for-login-password deploy # international radar fab -H root@nww.radar.nhs.uk --prompt-for-login-password deploy # national radar
Frontend can be built locally with (remember to switch to the correct branch):
git checkout national && git merge master ./build.sh
That will produce a tar.gz archive, which then can be deployed the same way as backend:
fab -H root@nww.radar.nhs.uk --prompt-for-login-password deploy # national radar
In order for the above command to work, one needs to take fab installation either from radar backend repo, or create a virtualenv inside client package and install fabric.