Hive-Systems / pyfair

Factor Analysis of Information Risk (FAIR) model written in Python. Managed and maintained by Hive Systems
https://www.deriverisk.com
MIT License
92 stars 45 forks source link

Examples for customizing HTML Output and specific Charts #35

Open jonrau1 opened 3 years ago

jonrau1 commented 3 years ago

Not sure if this makes sense in on larger Issue but it would be good to have any examples on outputting to PDF with the specific outputs such as FairDistributionCurve or FairViolinPlot, or at least have a way to configure how the HTML report, you know how much executives love their branding :)

As an aside, is there anyway to change around the output of the Violin Chart specifically? The X Axis labels are horizontal but should ideally have a 60 or 45 degree offset, while that sound super whiny, we are building meta models from multiple scenarios per Threat Community and it usually ends up super busy and ugly. And another reason for my business leaders to sob uncontrollably in their Lambos

Thanks for any assistance in advance!

theonaunheim commented 3 years ago
  1. I will see what I can come up with this weekend on custom user reports. I made some (rather poor) design choices early on that make it difficult for someone without access to the source to easily make their own reports.
  2. As someone who has spent a large percentage of his adult life tweaking reports for no discernable purpose, I can empathize. I think it makes sense to set the rotation to 45 for the violin plots going forward.
jonrau1 commented 3 years ago

@theonaunheim awesome, I appreciate that.

Re: 1: I think something that could be interesting is an argument to specify a .css file, I took a look at it and it seems pretty simple to modify to make the colors the "right colors". To take it further, a way to provide a base HTML or better documentation on inserting HTML or otherwise into the base for the report would be good. As quantitatively minded as FAIR is, we still have to write some more qualitative risk statements / exec. summaries to accompany our various scenarios and threat communities.

Re. 2: I really appreciate that, just helps with readability but as you can empathize you already know the futility of my situation regarding this. As an aside, it seems with the violin chart and a few others as well that when writing multiple reports to HTML (we do several 100) I am getting memory issues, is there a way to configure whatever you have underneath it (matplotlib, etc) to clear out memory after each report being written? Doesn't seem there is a way I can do it on my end.

Thanks again, this is an awesome project and saved us 100s of hours trying to mess around with Monte Carlo and BetaPERT madness in Python.

theonaunheim commented 3 years ago

@jonrau1 , just FYI violin plot x-axis labels have been rotated in 0.2-beta.0.

Still working on custom user reporting and memory usage. In the mean time I've also added a Jupyter shim which may be useful: https://github.com/theonaunheim/pyfair/blob/dev/pyfair/report/jupyter.py

jonrau1 commented 3 years ago

Thanks for the update @theonaunheim will mess with the Jupyter stuff a bit when time permits