Importing data - bennettoxford/openprescribing GitHub Wiki

Importing data

To import the data for a given month, start a screen session on largeweb2 as the hello user:

screen -S import_{year}_{month}

Then run:

cd /webapps/openprescribing/openprescribing/
. ../.venv/bin/activate
python manage.py fetch_and_import {year} {month}

Manual fetches

Fetching BNF code data requires solving a captcha. When prompted:

Success

When the pipeline has finished (after about 24 hours) a message will be sent to Slack.

Failure

If the import fails, a message will be sent to Slack.

You should reconnect to the screen session:

screen -r import_{year}_{month}

There should be a traceback which will help you understand the problem. The traceback will also be recorded in the formatted_tb attribute of the corresponding TaskLog object. Once you've understood and fixed the problem, you should add a comment to https://github.com/ebmdatalab/openprescribing/issues/571.

You should then re-run the fetch_and_import command, which will re-run the failed task and then continue. Note that many tasks are not idempotent and so you may need to delete some data or fudge the command.

⚠️ **GitHub.com Fallback** ⚠️