Reports are regularly updated outputs related to the COVID-19 pandemic, created with the OpenSAFELY platform.
This service is currently in a pilot phase for external users.
They are hosted on the reports site.
To ensure that the file is self-contained, all images must be in-line rather than published as separate files. OpenSAFELY Reports only supports using one file for a report, in-lining images will allow you to use them within a report. Images should be bitmaps rather than in vector graphics formats, PNG is suggested as a good option.
All styling is applied by OpenSAFELY Reports; any styles included in the file will be stripped out.
OpenSAFELY Reports is designed to work with Jupyter notebooks. It has automatic styling for the standard markup that Jupyter produces. These guidelines for writing notebooks makes them consistent with the requirements in the section above.
- Render matplotlib charts inline with this directive:
- Configure matplotlib to output PNG charts with this directive:
- Do not add interactivity features to your charts.
- Convert your notebook to HTML using
nbconvert, with the
basictemplate, like this:
nbconvert my-notebook.ipynb --execute --to html --template basic.
- If your notebook writes text using Python's
print()function, it will be rendered in the final report as "preformatted" text, that is with a monospaced font. This may not be what you want and is inappropriate for body text. Instead you should use the
Markdown()functions from the
IPython.displaypackage, like this:
display(Markdown("Some text which can be Markdown formatted.")).