opensafely-actions / cohort-report

Cohort-report generates a report for each variable in an input file
MIT License
0 stars 0 forks source link

Empty charts #20

Closed iaindillingham closed 3 years ago

iaindillingham commented 3 years ago

The attached report was generated by test-reusable-actions. It reports on three variables: sex, age, age_band, and has_copd. The table and chart for age are redacted. The tables and charts for the remainder are not. However, the charts are empty. I was also expecting to see axes for bar charts rather than histograms, as these are categorical variables. (I've included a screenshot of the report, because GH doesn't allow uploading HTML files.)

Screenshot 2021-09-27 at 16-22-37 Cohort Report

iaindillingham commented 3 years ago

This affects cohort-report when run within the Python runtime; passing the same input file and configuration to cohort-report locally gives the expected charts (e.g. python -m cohortreport.__main__ --config config.json input.csv).

Diffing the files produced by each approach shows that the <script> blocks are different, which isn't surprising: the Python runtime is running Plotly v4.5.0 (Plotly.js v1.52.1); locally, I'm running Plotly v5.2.1 (Plotly.js v2.3.1).

If I downgrade to Plotly v4.5.0 locally, then the charts for the unredacted variables are empty.


As an aside, this is a case of "It might never happen" happening. To develop reusable actions locally, we read from python-docker's requirements.in. (You'll recall that the Python runtime is built from python-docker.) We don't read from requirements.txt, because pip can't resolve click. (See opensafely-actions/python-action-template#24.) This means that whilst the local development environment will have the same packages as the Python runtime, it won't necessarily have the same versions of the same packages.