The current version av Mortchartgen causes segfaults with Julia 1.x earlier than 1.1.0-DEV.199, which seems to be related to a bug with array deserialization.
This package can be used to generate charts of mortality trends from the WHO Mortality Database, as well as web templates and documentation for these charts. It is a reimplementation of the mortchartgen program, which uses Python and R for chart generation. I use the package the generate my site with mortality charts, which is available in English and Swedish versions.
Besides the Julia requirements, generation of the site requires the following:
- Access to a MySQL/MariaDB database server for storing the WHO data.
- The Python Bokeh library, which is used to generate interactive charts.
- The Haskell Hakyll library, which is used to generate the site with documentation.
- ODBC with a MySQL driver has to be installed in the system. Note that the MySQL queries currently use ODBC.jl instead of MySQL.jl, because the latter has unsolved issues with memory leaks in queries with many columns.
In order to generate the site in a given language (
sv are currently
defined in the configuration file):
- Run the
script in order to set up the database, e.g.
mysql --defaults-extra-file=tableimp.cnf < setupdb.sql. The tableimp.cnf file should be edited before the script is run, in order to suit your MySQL configuration.
- Call the functions
wpp_convertin Download.jl. This downloads and imports the WHO data into a MySQL database, and also downloads data from the UN World Population Projections, which is used to calculate mortality rates for some countries where population is lacking in WHO Mortality Database for recent years, and converts this data so that it can be merged with the population data frame created in the next step.
- Append the contents in
$HOME/.odbc.ini. You may have to edit the settings to suit your MySQL configuration.
- Save the frames with aggregated causes of death and population in CSV files, by calling
Mortchartgen.save_frames(cgen_frames())in Mortchartgen.jl. The saved frame can then be reloaded with
- Generate the site files by calling
writeplotsitewith loaded frames, language and output directory, e.g.
Mortchartgen.writeplotsite(frames, "en", normpath(Mortchartgen.mainpath, "mortchart-site-en")).
- Compile the site generator from the
site.hsfile in the output directory. Using the Glasgow Haskell Compiler, you can run
ghc --make sitefrom the shell.
- Generate the site itself by running
./site buildin the output directory. The site will be placed in the
_sitedirectory under the output directory.