Package: bpdiag
BP Diagparses blood preasure statistics from data files, generates some
statistics and prints them toSTDERR. You can export the data (and the
gathered statistics) toJSON(dump toSTDOUT). And you can also generateSVGorPNGcharts from it.To see a list of possible command line options run:bpdiag.py --helpExamplesLets say we got a file calledbp.csvcontaining the following values:136/83/65, 132/82/70
144/82/86, 137/81/75, -,         143/80/68
131/82/60, 144/82/64, 136/79/67, 140/80/62
136/83/68, 138/80/99, -,         133/74/65
136/79/67, 131/76/64, 135/81/72, 136/75/61
127/79/72BP Diagfirst tries to split multiple entries on each line using the
string given with the--delimiteroption (default is,). Each entry
found  is then split intosys,diaandpulsevalues with the string
given with the--seperatoroption (default:/).So if we runBP Diagon the file like thisbpdiag.py bp.csv, we got
the following results:Read 17 value(s) from 1 file(s)...
Statistics (min, max, avg):
:: SYS...: 127, 144, 136
:: DIA...:  74,  83,  79
:: PULSE.:  60,  99,  69Dump JSONAs you see parsing errors are ignored. We can dump JSON with the--jsonoption. Only the JSON dump is written toSTDOUT, other output goes toSTDERR, so we can redirect the dump to a file (use--compactto
prevent spaces after,and:):bpdiag.py --json --compact bp.csv > bp.jsonThe filebp.jsonwill then contain one long line with the JSON data. You
can also dump the statistic gatherd from the data to JSON with the--json-statsoption.  Use the--sortand--indent2options if you want a
more readable output.Generate ChartsTo generate SVG charts, you need to havePyGalinstalled (see below). Other
than that, just use the--chartoption to have a chart calledbp.svggenerated in your current directory. There are more options to this, take a
look at the--helpoutput.Instead of the interactive SVG charts you can use PNG as output format. Just
use the--pngoption along with--chart. You need a couple more
dependencies for that though, take a look below.Number of measurements per linePer default all values are gathered one after the other and parsing errors are
ignored. But you can use the--entriesoption to set a fixed number of
measurements per line.What this means is that only that much values are used per line (even if there
are more) and if a line contains less thanentriesvalues, the remaining
ones are filled withNonevalues. Also values that conatin-(or any
other combination of characters that does not parse to a three integer tuple)
are not ignored but stored as aNonevalue too.This can be helpful in cases where you have a given number of measurements per
line and you want to keep them aligned even if sometimes a measurement is
skipped / missing.:bpdiag.py --json --compact --entries 4 bp.csvWill result in the following JSON:[[136,83,65],[132,82,70],null,null,[144,82,86],[137,81,75],null,[143,80,68],[131,82,60],[144,82,64],[136,79,67],[140,80,62],[136,83,68],[138,80,99],null,[133,74,65],[136,79,67],[131,76,64],[135,81,72],[136,75,61],[127,79,72],null,null,null]InstallYou can installBP Diagwithpipor from source.Install with pippipis “a tool for installing and managing Python packages”. If you don’t
have it installed, see thepip install instructions:pip install --user bpdiagInstall from sourceYou can fetch the latestsourceballfrom github and unpack it, or just clone
this repository:git clonegit://github.com/brutus/bpdiag. If you
got the source, change into the directory and usesetup.py:python setup.py installDependenciesPyGalis used to generate the charts. If you want to generate charts,
you need to install it. Withpipit’s as easy as this:pip install --user pygalIf you want to export to PNG files, you needCairoSVG,tinycssandcssselecttoo. You can install them like this:pip install --user CairoSVG tinycss cssselectBugs  and ContributionBP Diagis at home at:https://github.com/brutus/bpdiag/If you find any bugs, issues or anything, please use theissue tracker.