Metadata-Version: 2.1
Name: dff-node-stats
Version: 0.1a3
Summary: Statistics collection extension for Dialog Flow Framework (https://github.com/deepmipt/dialog_flow_framework).
Home-page: https://github.com/kudep/dff-node-stats
Author: Denis Kuznetsov
Author-email: kuznetsov.den.p@gmail.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pandas (>=1.3.1)
Requires-Dist: dff (>=0.1a5)
Provides-Extra: all
Requires-Dist: fastapi (>=0.68.0) ; extra == 'all'
Requires-Dist: uvicorn (>=0.14.0) ; extra == 'all'
Requires-Dist: streamlit (>=1.1.0) ; extra == 'all'
Requires-Dist: graphviz (==0.17) ; extra == 'all'
Provides-Extra: api
Requires-Dist: fastapi (>=0.68.0) ; extra == 'api'
Requires-Dist: uvicorn (>=0.14.0) ; extra == 'api'
Provides-Extra: dashboard
Requires-Dist: streamlit (>=1.1.0) ; extra == 'dashboard'
Requires-Dist: graphviz (==0.17) ; extra == 'dashboard'

# Statistics collection extension for Dialog Flow Framework
dff_node_stats is package, that extends basic [dff](https://github.com/deepmipt/dialog_flow_framework) by adding statistic collection **and** dashboard for visualization.

# Installation
Installation:
```bash
# install dialog flow framework
pip install dff
# Install dff_node_stats
pip install dff-node-stats #basic
# pip install dff-node-stats[api] # version with rest-api, that provides access to stats by http requests
# pip install dff-node-stats[dashboard] # version with dashboard, that provides access to stats by web-UI
# pip install dff-node-stats[all] # version with both
```
# Code snippets

Insert stats in your dff code:
```python
# import
import dff_node_stats
# ....
# Define a plot
# Define an actor
# ....

# Define file for stats saving
stats = dff_node_stats.Stats(csv_file=STATS_FILE_PATH)
# Add handlers to actor
stats.update_actor_handlers(actor, auto_save=False)

# ....
# Handle user requests
# ....

```
Dashboard on stored data:
```python
import dff_node_stats

stats = dff_node_stats.Stats(csv_file=STATS_FILE_PATH)

stats.streamlit_run()
```

http-api on stored data:
```python
import dff_node_stats

stats = dff_node_stats.Stats(csv_file=STATS_FILE_PATH)

stats.api_run()
```


# Run Examples:
```bash
# install addition reqs
pip install tqdm
# run dff dialog bot and collect stats
python examples/1.collect_stats.py
# or this one, they have differences only in a dialog scripts
python examples/1.collect_stats_vscode_demo.py
# run dashboard and go to http://localhost:8501 to get it
streamlit run examples/2.run_dashboard_for_stats.py
# and run api and follow to swagger by http://localhost:8000/docs
python examples/2.get_stats_by_api.py
```

