How to use the retentioneering.visualization.cloud_logger.MongoLoader function in retentioneering

To help you get started, we’ve selected a few retentioneering examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github retentioneering / retentioneering-tools / retentioneering / visualization / plot.py View on Github external
plot_name = path + '/' + plot_name
        vis_object.title = idx

        print("You can save plot as SVG or PNG by open three-dotted button at right =>")
        watermark = alt.Chart().mark_text(
            align='center', baseline='top', dy=vis_object.height // 2 + 30, fontSize=32, fontWeight=200,
            color='#d3d3d3', text='Retentioneering'
        )
        vis_object.save(plot_name)
        if kwargs.get('interactive', True):
            alt.renderers.enable('notebook')
            display(vis_object + watermark)

        if cfg.get('mongo_client') is not None:
            print(f'DB {idx}')
            ml = MongoLoader(cfg.get('mongo_client'), collection=cfg.get('mongo_user'))
            ml.put(plot_name if '.' in plot_name else plot_name + '.svg', idx.split(' ')[1])
        return res
    return altair_save_plot_wrapper
github retentioneering / retentioneering-tools / retentioneering / visualization / plot.py View on Github external
if len(res) == 2:
            (vis_object, name), res, cfg = res, None, None
        elif len(res) == 3:
            (vis_object, name, res), cfg = res, None
        else:
            vis_object, name, res, cfg = res
        idx = 'id: ' + str(int(datetime.now().timestamp()))
        coords = vis_object.axis()
        if '_3d_' not in name:
            vis_object.text((coords[0] - (coords[1] - coords[0]) / 10),
                            (coords[3] + (coords[3] - coords[2]) / 10), idx, fontsize=8)
            vis_object.text(0, 0.05, 'Retentioneering', fontsize=50, color='gray', va='bottom', alpha=0.1)
        vis_object.get_figure().savefig(name, bbox_inches="tight", dpi=cfg.get('save_dpi') or 200)
        if cfg.get('mongo_client') is not None:
            print(f'DB {idx}')
            ml = MongoLoader(cfg.get('mongo_client'), collection=cfg.get('mongo_user'))
            ml.put(name if '.' in name else name + '.png', idx.split(' ')[1])
            if '.html' in name:
                ml.put(vis_object.get_raw(name), idx.split(' ')[1] + '_config')
        return res
    return save_plot_wrapper