Package: analyzere-extras
An extension to the analyzere python library that facilitates “extras”
including visualizations of Analyze Re LayerView objects.Installationpip install analyzere_extrasGraphing OptionsThis graphing utility provides some methods of controlling the style and format of the rendered image.rankdir=’XX’Option that controls the orientation of the graph. Options include:‘BT’ bottom to top (default)‘TB’ top to bottom‘LR’ left to right‘RL’ right to leftcompact=True|FalseControls if duplicate nodes should be omitted (default=True).  This option tends to produce smaller graphs, which should be easier to read.with_terms=True|FalseSpecify that a Layer’s terms are included in each node of the graph (default=True).warnings=True|FalseHighlight nodes with suspicious terms by coloring the node red. Warning nodes are generated when any of the following conditions are true:participation = 0.0invert = trueandfilters = []attachmentoraggregate_attachment= unlimitedmax_depth=0The maximum depth of the graph to process.  For very deeply nested structures this can reduce the size.  (default=0 == all levels).max_sources=0The maximum number of Loss sources to graph in detail for a single node. (default=0 == all sources).colors=[1-12]The number of colors to be used when coloring nodes and edges. (default=1 == black, max=12).color_mode=[‘breadth’|’depth’]The mode to use when applying colors. Options include: [‘breadth’, ‘depth’], default: ‘breadth’.Sample LayerView Images:LayerViewDigraph(lv,...)render(...)compact=with_terms=warnings=rankdir='BT'rankdir='LR'TrueTrueTrueTrueTrueFalseTrueFalseTrueFalseFalseFalseColorization:LayerViewDigraph(lv,...)render(...)compact=colors=color_mode=rankdir='BT'True4breadthTrue4depthFalse4breadthFalse4depthUsageIn order to make use of the tools in theanalyzere_extrasmodule you will need to import theanalyzeremodule.You will need to define your connection information:import analyzere
analyzere.base_url = '<your server url>'
analyzere.username = '<your userid>'
analyzere.password = '<your password>'VisualizationTo make use of the visualization tool, you will need to query a LayerView
that you would like to graph:from analyzere import LayerView

lv = analyzere.LayerView.retrieve('011785b1-203b-696e-424e-7da9b0ec779a')Now you can generate a graph of your LayerView:from analyzere_extras.visualizations import LayerViewDigraph

g = LayerViewDigraph(lv)  # defaults: with_terms=True, compact=True, rankdir='TB', warnings=True
g = LayerViewDigraph(lv, with_terms=False)  # omit Layer terms from nodes
g = LayerViewDigraph(lv, compact=False) # graph duplicate nodes
g = LayerViewDigraph(lv, rankdir='LR')  # render the graph from Left to Right
g = LayerViewDigraph(lv, warnings=False)  # disable error node highlightingThen to render your graph:g.render()  # defaults: filename=None, view=True, format=None, rankdir=None
g.render(filename='mygraph') # write graph to 'mygraph'
g.render(view=True)     # attempt to auto display the graph
g.render(format='pdf')  # change the output format 'pdf'
g.render(rankdir='LR')  # render the graph from Left to RightShortcut: generate a graph for a given LayerView Id:graph = LayerViewDigraph.from_id('011785b1-203b-696e-424e-7da9b0ec779a')ELT CombinationTo make use of the ELT combiner tool, you will need to define the list of
uuids representing the resources with ELTs that you would like to combine:uuid_list = ['26a8f73b-0fbb-46c7-8dcf-f4de1e222994', 'cd67ba03-302b-45e5-9341-a4267875c1f8']You will need to indicate which catalog these ELTs correspond to:catalog_uuid = '61378251-ce85-4b6e-a63c-f5d67c4e4877'Then to combine the ELTs into a single ELT:from analyzere_extras.combine_elts import ELTCombiner

elt_combiner = ELTCombiner()

combined_elt = elt_combiner.combine_elts_from_resources(
  uuid_list,
  catalog_uuid,
  uuid_type='all',
  description='My Combined ELT'
)uuid_typespecifies which the type of resources inuuid_list. Valid
values foruuid_typeare:'Portfolio''PortfolioView''Layer''LayerView''LossSet''all'Ifuuid_type='all'is set, then the resources inuuid_listcan be a mix
of Portfolios, PortfolioViews, Layers, LayerViews, and LossSets. The default
value ofuuid_typeis'all'.descriptiondefines the description for the uploaded combined ELT. If not
set, the default is'analyzere-python-extras:Combined ELT'.TestingWe currently commit to being compatible with Python 2.7 and Python 3.4 to 3.7.
In order to run tests against against each environment we usetoxandpy.test. You’ll
need an interpreter installed for each of the versions of Python we test.
You can find these via your system’s package manager oron the Python site.To start, install tox:pip install toxThen, run the full test suite:toxTo run tests for a specific module, test case, or single test, you can pass
arguments to py.test through tox with--. E.g.:tox -- tests/test_base_resources.py::TestReferences::test_known_resourceSeetox--helpandpy.test--helpfor more information.PublishingInstalltwineandwheel:pip install twine wheelIncrement version number insetup.pyaccording toPEP 440.Commit your change tosetup.pyand create a tag for it with the version
number. e.g.:git tag 0.1.0
git push origin 0.1.0Package source and wheel distributions:python setup.py sdist bdist_wheelUpload to PyPI with twine:twine upload dist/*