Skip to content

Previewing, importing and retiring measures

Dave Evans edited this page Nov 6, 2024 · 10 revisions

Previewing measures

Measures can be previewed on the live site without having to merge and deploy them. These preview measures aren't shown to users by default (and they are not included in any alerts) but you can view them if you know their URL.

You can also see a list of the currently active previews by visiting: https://openprescribing.net/measure/?show_previews=true

Preview measures will be automatically rewritten so that they:

  • Start with the name "PREVIEW:"
  • Have an ID which starts preview_
  • Have all their tags removed

To preview a measure first find the version of the measure file you want on Github. You can grab this by browsing your branch or if you have a PR open you can go to the Files tab, click the three dots next to the measure filename and select 'View file'.

Then run the bennettbot command:

@bennett bot op measures preview [github_url]

This can take about 10 minutes to run. Eventually it should respond with something like:

Measure can be previewed at:
https://openprescribing.net/measure/preview_lplutein/

When you've finished remember to delete the preview with:
@bennett bot op measures delete_preview preview_lplutein

To look at a preview measure for an individual PCN or practice, use the following URL format:

  • For PCNs: https://openprescribing.net/pcn/[pcn_code]/[preview_page_name]
  • For practices: https://openprescribing.net/measure/[preview_page_name]/practice/[practice_code]/

Deploying a measure

Once you're happy with the state of the preview (and have deleted it) you can merge the PR.

This should automatically deploy. Just wait for the notification in the #technoise channel:

A #deploy just finished. Changes here: https://github.com/ebmdatalab/openprescribing/compare/...

Once the deploy has finished you can make the changes live by running:

@bennett bot op measures recalculate [measure_id]

This may take 10 or so minutes to run. If you've just made changes to the tags or description of an existing measure (i.e. nothing that would affect the calculated measure values) then you can use the much faster process:

@bennett bot op measures import [measure_id]

Retiring measures

On occasion measures may need to be retired rather than be modified. This may be due to changes in evidence, cost base or other factor.

To retire an existing measure:

  • In the measure definition file, click on "delete this file" (the rubbish bin icon)
  • Create a new branch named retire_measure__[measure_filename]
  • On the pull request page describe the rationale for retiring the measure
  • Add the label retire-measure
  • Add an appropriate reviewer
  • Create pull request (create a new PR for each measure retired)

Once the pull request has been approved, please contact a member of the tech team to delete the existing measure from the OpenPrescribing site.

Someone on the tech team will need to run:

ssh largeweb2.ebmdatalab.net
sudo su bennettbot
cd /webapps/openprescribing/openprescribing/
source ../.venv/bin/activate
./manage.py delete_measure --delete-live-measure [MEASURE_ID]

A list of retired measure PRs can be found here.