pdstools 4.6.2__tar.gz → 4.7.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pdstools-4.6.2 → pdstools-4.7.1}/PKG-INFO +5 -5
- {pdstools-4.6.2 → pdstools-4.7.1}/pdstools.egg-info/PKG-INFO +5 -5
- {pdstools-4.6.2 → pdstools-4.7.1}/pdstools.egg-info/SOURCES.txt +10 -10
- {pdstools-4.6.2 → pdstools-4.7.1}/pdstools.egg-info/requires.txt +4 -4
- {pdstools-4.6.2 → pdstools-4.7.1}/pyproject.toml +8 -4
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/__init__.py +1 -1
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/adm/Plots.py +56 -1
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/adm/Reports.py +15 -15
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/app/decision_analyzer/Home.py +36 -4
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/app/decision_analyzer/da_streamlit_utils.py +26 -28
- pdstools-4.6.2/python/pdstools/app/decision_analyzer/pages/11_Arbitration_Distribution.py → pdstools-4.7.1/python/pdstools/app/decision_analyzer/pages/10_Arbitration_Distribution.py +2 -2
- pdstools-4.7.1/python/pdstools/app/decision_analyzer/pages/11_Single_Decision.py +610 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/app/decision_analyzer/pages/12_About.py +1 -1
- pdstools-4.6.2/python/pdstools/app/decision_analyzer/pages/3_Overview.py → pdstools-4.7.1/python/pdstools/app/decision_analyzer/pages/2_Overview.py +6 -1
- pdstools-4.6.2/python/pdstools/app/decision_analyzer/pages/4_Action_Distribution.py → pdstools-4.7.1/python/pdstools/app/decision_analyzer/pages/3_Action_Distribution.py +2 -2
- pdstools-4.6.2/python/pdstools/app/decision_analyzer/pages/5_Action_Funnel.py → pdstools-4.7.1/python/pdstools/app/decision_analyzer/pages/4_Action_Funnel.py +2 -2
- pdstools-4.6.2/python/pdstools/app/decision_analyzer/pages/6_Global_Sensitivity.py → pdstools-4.7.1/python/pdstools/app/decision_analyzer/pages/5_Global_Sensitivity.py +2 -2
- pdstools-4.6.2/python/pdstools/app/decision_analyzer/pages/7_Win_Loss_Analysis.py → pdstools-4.7.1/python/pdstools/app/decision_analyzer/pages/6_Win_Loss_Analysis.py +2 -2
- pdstools-4.6.2/python/pdstools/app/decision_analyzer/pages/8_Optionality_Analysis.py → pdstools-4.7.1/python/pdstools/app/decision_analyzer/pages/7_Optionality_Analysis.py +3 -3
- pdstools-4.6.2/python/pdstools/app/decision_analyzer/pages/9_Offer_Quality_Analysis.py → pdstools-4.7.1/python/pdstools/app/decision_analyzer/pages/8_Offer_Quality_Analysis.py +2 -2
- pdstools-4.6.2/python/pdstools/app/decision_analyzer/pages/10_Thresholding_Analysis.py → pdstools-4.7.1/python/pdstools/app/decision_analyzer/pages/9_Thresholding_Analysis.py +61 -39
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/app/health_check/pages/2_Reports.py +2 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/cli.py +21 -1
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/decision_analyzer/DecisionAnalyzer.py +125 -102
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/decision_analyzer/plots.py +20 -1
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/decision_analyzer/utils.py +176 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/explanations/Aggregate.py +53 -49
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/explanations/ExplanationsUtils.py +45 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/explanations/Plots.py +59 -70
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/explanations/Reports.py +12 -9
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/reports/HealthCheck.qmd +18 -3
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/reports/ModelReport.qmd +1 -1
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/utils/cdh_utils.py +2 -2
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/utils/report_utils.py +24 -77
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/utils/streamlit_utils.py +13 -0
- pdstools-4.6.2/python/pdstools/app/decision_analyzer/pages/2_Global_Data_Filters.py +0 -112
- {pdstools-4.6.2 → pdstools-4.7.1}/LICENSE +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/README.md +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/pdstools.egg-info/dependency_links.txt +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/pdstools.egg-info/entry_points.txt +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/pdstools.egg-info/top_level.txt +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/adm/ADMDatamart.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/adm/ADMTrees.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/adm/Aggregates.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/adm/BinAggregator.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/adm/Schema.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/adm/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/app/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/app/assets/pega-logo.svg +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/app/decision_analyzer/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/app/decision_analyzer/pages/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/app/health_check/Home.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/app/health_check/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/app/health_check/pages/1_Data_Filters.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/app/health_check/pages/3_About.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/app/health_check/pages/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/app/impact_analyzer/Home.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/app/impact_analyzer/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/app/impact_analyzer/ia_streamlit_utils.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/app/impact_analyzer/pages/1_Overall_Summary.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/app/impact_analyzer/pages/2_Trend.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/app/impact_analyzer/pages/3_About.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/app/impact_analyzer/pages/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/decision_analyzer/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/decision_analyzer/column_schema.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/decision_analyzer/data_read_utils.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/decision_analyzer/stage_grouping.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/explanations/Explanations.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/explanations/FilterWidget.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/explanations/Preprocess.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/explanations/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/explanations/resources/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/explanations/resources/queries/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/explanations/resources/queries/create.sql +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/explanations/resources/queries/model_contexts.sql +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/explanations/resources/queries/numeric.sql +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/explanations/resources/queries/numeric_overall.sql +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/explanations/resources/queries/symbolic.sql +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/explanations/resources/queries/symbolic_overall.sql +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/ih/Aggregates.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/ih/IH.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/ih/Plots.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/ih/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/impactanalyzer/ImpactAnalyzer.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/impactanalyzer/Plots.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/impactanalyzer/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/client.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/internal/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/internal/_auth.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/internal/_base_client.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/internal/_constants.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/internal/_exceptions.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/internal/_pagination.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/internal/_resource.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/resources/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/resources/knowledge_buddy/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/resources/knowledge_buddy/knowledge_buddy.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/resources/prediction_studio/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/resources/prediction_studio/base.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/resources/prediction_studio/local_model_utils.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/resources/prediction_studio/model_security.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/resources/prediction_studio/types.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/resources/prediction_studio/v24_1/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/resources/prediction_studio/v24_1/prediction.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/resources/prediction_studio/v24_1/prediction_studio.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/resources/prediction_studio/v24_1/repository.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/resources/prediction_studio/v24_2/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/resources/prediction_studio/v24_2/champion_challenger.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/resources/prediction_studio/v24_2/datamart_export.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/resources/prediction_studio/v24_2/model.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/resources/prediction_studio/v24_2/model_upload.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/resources/prediction_studio/v24_2/prediction.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/resources/prediction_studio/v24_2/prediction_studio.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/infinity/resources/prediction_studio/v24_2/repository.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/pega_io/API.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/pega_io/Anonymization.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/pega_io/File.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/pega_io/S3.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/pega_io/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/prediction/Prediction.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/prediction/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/py.typed +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/reports/GlobalExplanations/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/reports/GlobalExplanations/_quarto.yml +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/reports/GlobalExplanations/assets/templates/all_context_content.qmd +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/reports/GlobalExplanations/assets/templates/all_context_header.qmd +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/reports/GlobalExplanations/assets/templates/context.qmd +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/reports/GlobalExplanations/assets/templates/getting-started.qmd +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/reports/GlobalExplanations/assets/templates/overview.qmd +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/reports/GlobalExplanations/scripts/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/reports/GlobalExplanations/scripts/generate_report.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/reports/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/reports/assets/pega-report-overrides.css +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/resources/MetricLimits.csv +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/resources/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/utils/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/utils/color_mapping.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/utils/datasets.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/utils/errors.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/utils/metric_limits.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/utils/namespaces.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/utils/number_format.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/utils/pega_outcomes.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/utils/pega_template.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/utils/plot_utils.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/utils/polars_ext.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/utils/progress_utils.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/utils/show_versions.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/utils/table_definitions.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/utils/types.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/valuefinder/Aggregates.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/valuefinder/Plots.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/valuefinder/Schema.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/valuefinder/ValueFinder.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/valuefinder/__init__.py +0 -0
- {pdstools-4.6.2 → pdstools-4.7.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pdstools
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.7.1
|
|
4
4
|
Summary: Open source tooling that helps Data Scientists to analyze Pega models and conduct impactful analyses.
|
|
5
5
|
Author-email: Stijn Kas <stijn.kas@pega.com>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -15,9 +15,8 @@ Classifier: Programming Language :: Python :: 3
|
|
|
15
15
|
Requires-Python: <3.14,>=3.10
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
License-File: LICENSE
|
|
18
|
-
Requires-Dist: polars!=1.35.1,<=1.
|
|
18
|
+
Requires-Dist: polars!=1.35.1,<=1.39.3,>=1.30
|
|
19
19
|
Requires-Dist: typing_extensions
|
|
20
|
-
Requires-Dist: humanize>=4.0.0
|
|
21
20
|
Provides-Extra: adm
|
|
22
21
|
Requires-Dist: plotly[express]>=6.0; extra == "adm"
|
|
23
22
|
Requires-Dist: pydot; extra == "adm"
|
|
@@ -46,11 +45,12 @@ Requires-Dist: ipywidgets; extra == "explanations"
|
|
|
46
45
|
Provides-Extra: app
|
|
47
46
|
Requires-Dist: pdstools[healthcheck]; extra == "app"
|
|
48
47
|
Requires-Dist: streamlit>=1.45; extra == "app"
|
|
49
|
-
Requires-Dist: polars[rt64]!=1.35.1,<=1.
|
|
48
|
+
Requires-Dist: polars[rt64]!=1.35.1,<=1.39.3,>=1.30; extra == "app"
|
|
49
|
+
Requires-Dist: humanize>=4.0.0; extra == "app"
|
|
50
50
|
Provides-Extra: onnx
|
|
51
51
|
Requires-Dist: scikit-learn>=1.6.1; extra == "onnx"
|
|
52
52
|
Requires-Dist: skl2onnx>=1.19.1; extra == "onnx"
|
|
53
|
-
Requires-Dist: onnx<1.
|
|
53
|
+
Requires-Dist: onnx<1.22,>=1.18; extra == "onnx"
|
|
54
54
|
Requires-Dist: pdstools[api]; extra == "onnx"
|
|
55
55
|
Requires-Dist: onnxruntime<1.24,>=1.22; extra == "onnx"
|
|
56
56
|
Requires-Dist: scipy>=1.15.3; extra == "onnx"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pdstools
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.7.1
|
|
4
4
|
Summary: Open source tooling that helps Data Scientists to analyze Pega models and conduct impactful analyses.
|
|
5
5
|
Author-email: Stijn Kas <stijn.kas@pega.com>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -15,9 +15,8 @@ Classifier: Programming Language :: Python :: 3
|
|
|
15
15
|
Requires-Python: <3.14,>=3.10
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
License-File: LICENSE
|
|
18
|
-
Requires-Dist: polars!=1.35.1,<=1.
|
|
18
|
+
Requires-Dist: polars!=1.35.1,<=1.39.3,>=1.30
|
|
19
19
|
Requires-Dist: typing_extensions
|
|
20
|
-
Requires-Dist: humanize>=4.0.0
|
|
21
20
|
Provides-Extra: adm
|
|
22
21
|
Requires-Dist: plotly[express]>=6.0; extra == "adm"
|
|
23
22
|
Requires-Dist: pydot; extra == "adm"
|
|
@@ -46,11 +45,12 @@ Requires-Dist: ipywidgets; extra == "explanations"
|
|
|
46
45
|
Provides-Extra: app
|
|
47
46
|
Requires-Dist: pdstools[healthcheck]; extra == "app"
|
|
48
47
|
Requires-Dist: streamlit>=1.45; extra == "app"
|
|
49
|
-
Requires-Dist: polars[rt64]!=1.35.1,<=1.
|
|
48
|
+
Requires-Dist: polars[rt64]!=1.35.1,<=1.39.3,>=1.30; extra == "app"
|
|
49
|
+
Requires-Dist: humanize>=4.0.0; extra == "app"
|
|
50
50
|
Provides-Extra: onnx
|
|
51
51
|
Requires-Dist: scikit-learn>=1.6.1; extra == "onnx"
|
|
52
52
|
Requires-Dist: skl2onnx>=1.19.1; extra == "onnx"
|
|
53
|
-
Requires-Dist: onnx<1.
|
|
53
|
+
Requires-Dist: onnx<1.22,>=1.18; extra == "onnx"
|
|
54
54
|
Requires-Dist: pdstools[api]; extra == "onnx"
|
|
55
55
|
Requires-Dist: onnxruntime<1.24,>=1.22; extra == "onnx"
|
|
56
56
|
Requires-Dist: scipy>=1.15.3; extra == "onnx"
|
|
@@ -23,17 +23,17 @@ python/pdstools/app/assets/pega-logo.svg
|
|
|
23
23
|
python/pdstools/app/decision_analyzer/Home.py
|
|
24
24
|
python/pdstools/app/decision_analyzer/__init__.py
|
|
25
25
|
python/pdstools/app/decision_analyzer/da_streamlit_utils.py
|
|
26
|
-
python/pdstools/app/decision_analyzer/pages/
|
|
27
|
-
python/pdstools/app/decision_analyzer/pages/
|
|
26
|
+
python/pdstools/app/decision_analyzer/pages/10_Arbitration_Distribution.py
|
|
27
|
+
python/pdstools/app/decision_analyzer/pages/11_Single_Decision.py
|
|
28
28
|
python/pdstools/app/decision_analyzer/pages/12_About.py
|
|
29
|
-
python/pdstools/app/decision_analyzer/pages/
|
|
30
|
-
python/pdstools/app/decision_analyzer/pages/
|
|
31
|
-
python/pdstools/app/decision_analyzer/pages/
|
|
32
|
-
python/pdstools/app/decision_analyzer/pages/
|
|
33
|
-
python/pdstools/app/decision_analyzer/pages/
|
|
34
|
-
python/pdstools/app/decision_analyzer/pages/
|
|
35
|
-
python/pdstools/app/decision_analyzer/pages/
|
|
36
|
-
python/pdstools/app/decision_analyzer/pages/
|
|
29
|
+
python/pdstools/app/decision_analyzer/pages/2_Overview.py
|
|
30
|
+
python/pdstools/app/decision_analyzer/pages/3_Action_Distribution.py
|
|
31
|
+
python/pdstools/app/decision_analyzer/pages/4_Action_Funnel.py
|
|
32
|
+
python/pdstools/app/decision_analyzer/pages/5_Global_Sensitivity.py
|
|
33
|
+
python/pdstools/app/decision_analyzer/pages/6_Win_Loss_Analysis.py
|
|
34
|
+
python/pdstools/app/decision_analyzer/pages/7_Optionality_Analysis.py
|
|
35
|
+
python/pdstools/app/decision_analyzer/pages/8_Offer_Quality_Analysis.py
|
|
36
|
+
python/pdstools/app/decision_analyzer/pages/9_Thresholding_Analysis.py
|
|
37
37
|
python/pdstools/app/decision_analyzer/pages/__init__.py
|
|
38
38
|
python/pdstools/app/health_check/Home.py
|
|
39
39
|
python/pdstools/app/health_check/__init__.py
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
polars!=1.35.1,<=1.
|
|
1
|
+
polars!=1.35.1,<=1.39.3,>=1.30
|
|
2
2
|
typing_extensions
|
|
3
|
-
humanize>=4.0.0
|
|
4
3
|
|
|
5
4
|
[adm]
|
|
6
5
|
plotly[express]>=6.0
|
|
@@ -18,7 +17,8 @@ anyio
|
|
|
18
17
|
[app]
|
|
19
18
|
pdstools[healthcheck]
|
|
20
19
|
streamlit>=1.45
|
|
21
|
-
polars[rt64]!=1.35.1,<=1.
|
|
20
|
+
polars[rt64]!=1.35.1,<=1.39.3,>=1.30
|
|
21
|
+
humanize>=4.0.0
|
|
22
22
|
|
|
23
23
|
[dev]
|
|
24
24
|
pre-commit
|
|
@@ -58,7 +58,7 @@ ipykernel
|
|
|
58
58
|
[onnx]
|
|
59
59
|
scikit-learn>=1.6.1
|
|
60
60
|
skl2onnx>=1.19.1
|
|
61
|
-
onnx<1.
|
|
61
|
+
onnx<1.22,>=1.18
|
|
62
62
|
pdstools[api]
|
|
63
63
|
onnxruntime<1.24,>=1.22
|
|
64
64
|
scipy>=1.15.3
|
|
@@ -32,9 +32,8 @@ keywords = [
|
|
|
32
32
|
]
|
|
33
33
|
requires-python = ">=3.10,<3.14"
|
|
34
34
|
dependencies = [
|
|
35
|
-
"polars>=1.30,!=1.35.1,<=1.
|
|
35
|
+
"polars>=1.30,!=1.35.1,<=1.39.3",
|
|
36
36
|
'typing_extensions',
|
|
37
|
-
'humanize>=4.0.0',
|
|
38
37
|
]
|
|
39
38
|
|
|
40
39
|
[tool.setuptools.dynamic]
|
|
@@ -50,11 +49,16 @@ pega_io = ['aioboto3', 'polars_hash']
|
|
|
50
49
|
api = ['httpx', 'pydantic', 'anyio']
|
|
51
50
|
healthcheck = ['pdstools[adm]', 'great_tables>=0.13', 'quarto', 'papermill', 'xlsxwriter>=3.0', 'pydot', 'ipykernel']
|
|
52
51
|
explanations = ['duckdb', "plotly[express]", "pyarrow", "pyyaml", "ipywidgets"]
|
|
53
|
-
app = [
|
|
52
|
+
app = [
|
|
53
|
+
'pdstools[healthcheck]',
|
|
54
|
+
'streamlit>=1.45',
|
|
55
|
+
"polars[rt64]>=1.30,!=1.35.1,<=1.39.3",
|
|
56
|
+
'humanize>=4.0.0',
|
|
57
|
+
]
|
|
54
58
|
onnx = [
|
|
55
59
|
'scikit-learn>=1.6.1',
|
|
56
60
|
'skl2onnx>=1.19.1', # Updated to be compatible with onnx 1.19.0+
|
|
57
|
-
'onnx>=1.18,<1.
|
|
61
|
+
'onnx>=1.18,<1.22', # Using ONNX 1.18.x specifically
|
|
58
62
|
'pdstools[api]',
|
|
59
63
|
"onnxruntime>=1.22,<1.24",
|
|
60
64
|
"scipy>=1.15.3",
|
|
@@ -20,6 +20,7 @@ from typing_extensions import ParamSpec
|
|
|
20
20
|
from typing import Concatenate
|
|
21
21
|
|
|
22
22
|
from ..utils import cdh_utils
|
|
23
|
+
from ..utils.metric_limits import MetricLimits
|
|
23
24
|
from ..utils.namespaces import LazyNamespace
|
|
24
25
|
from ..utils.plot_utils import get_colorscale
|
|
25
26
|
from ..utils.types import QUERY
|
|
@@ -136,7 +137,7 @@ def fig_update_facet(
|
|
|
136
137
|
n_rows = max(math.ceil(len(fig.layout.annotations) / n_cols), 1)
|
|
137
138
|
height = base_height + (n_rows * step_height)
|
|
138
139
|
return fig.for_each_annotation(
|
|
139
|
-
lambda a: a.update(text=a.text.split("=")[1]),
|
|
140
|
+
lambda a: a.update(text=a.text.split("=")[1]) if "=" in a.text else a,
|
|
140
141
|
).update_layout(autosize=True, height=height)
|
|
141
142
|
|
|
142
143
|
|
|
@@ -177,6 +178,46 @@ def add_bottom_left_text_to_bubble_plot(
|
|
|
177
178
|
return fig
|
|
178
179
|
|
|
179
180
|
|
|
181
|
+
def add_metric_limit_lines(
|
|
182
|
+
fig: Figure,
|
|
183
|
+
metric_id: str = "ModelPerformance",
|
|
184
|
+
scale: float = 100.0,
|
|
185
|
+
orientation: str = "vertical",
|
|
186
|
+
) -> Figure:
|
|
187
|
+
"""Add dashed lines at MetricLimits thresholds (red=hard, green=best practice)."""
|
|
188
|
+
limits = MetricLimits.get_limit_for_metric(metric_id)
|
|
189
|
+
if not limits:
|
|
190
|
+
return fig
|
|
191
|
+
|
|
192
|
+
add_line = fig.add_vline if orientation == "vertical" else fig.add_hline
|
|
193
|
+
pos_key = "x" if orientation == "vertical" else "y"
|
|
194
|
+
|
|
195
|
+
line_specs = [
|
|
196
|
+
("minimum", "rgba(255, 69, 0, 0.5)", "Min"),
|
|
197
|
+
("best_practice_min", "rgba(0, 128, 0, 0.5)", "Good"),
|
|
198
|
+
("best_practice_max", "rgba(0, 128, 0, 0.5)", "Good"),
|
|
199
|
+
("maximum", "rgba(255, 69, 0, 0.5)", "Max"),
|
|
200
|
+
]
|
|
201
|
+
|
|
202
|
+
for limit_key, color, label in line_specs:
|
|
203
|
+
value = limits.get(limit_key)
|
|
204
|
+
if value is not None:
|
|
205
|
+
scaled = value * scale
|
|
206
|
+
add_line(
|
|
207
|
+
**{pos_key: scaled},
|
|
208
|
+
line_dash="dash",
|
|
209
|
+
line_width=1,
|
|
210
|
+
line_color=color,
|
|
211
|
+
layer="below",
|
|
212
|
+
annotation_text=f"{label} ({scaled:.0f})",
|
|
213
|
+
annotation_position="top" if orientation == "vertical" else "right",
|
|
214
|
+
annotation_font_size=9,
|
|
215
|
+
annotation_font_color=color,
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
return fig
|
|
219
|
+
|
|
220
|
+
|
|
180
221
|
def distribution_graph(df: pl.LazyFrame, title: str):
|
|
181
222
|
plot_df = df.collect()
|
|
182
223
|
fig = make_subplots(specs=[[{"secondary_y": True}]])
|
|
@@ -224,6 +265,7 @@ class Plots(LazyNamespace):
|
|
|
224
265
|
query: QUERY | None = None,
|
|
225
266
|
facet: str | pl.Expr | None = None,
|
|
226
267
|
color: str | None = "Performance",
|
|
268
|
+
show_metric_limits: bool = False,
|
|
227
269
|
return_df: bool = False,
|
|
228
270
|
):
|
|
229
271
|
"""The Bubble Chart, as seen in Prediction Studio
|
|
@@ -238,6 +280,9 @@ class Plots(LazyNamespace):
|
|
|
238
280
|
The query to apply to the data, by default None
|
|
239
281
|
facet : Optional[Union[str, pl.Expr]], optional
|
|
240
282
|
Column name or Polars expression to facet the plot into subplots, by default None
|
|
283
|
+
show_metric_limits : bool, optional
|
|
284
|
+
Whether to show dashed vertical lines at the ModelPerformance
|
|
285
|
+
metric limit thresholds (from MetricLimits.csv), by default False
|
|
241
286
|
return_df : bool, optional
|
|
242
287
|
Whether to return a dataframe instead of a plot, by default False
|
|
243
288
|
|
|
@@ -302,6 +347,8 @@ class Plots(LazyNamespace):
|
|
|
302
347
|
labels={"LastUpdate": "Last Updated"},
|
|
303
348
|
)
|
|
304
349
|
fig = add_bottom_left_text_to_bubble_plot(fig, df, 1)
|
|
350
|
+
if show_metric_limits:
|
|
351
|
+
fig = add_metric_limit_lines(fig)
|
|
305
352
|
fig.update_traces(marker=dict(line=dict(color="black")))
|
|
306
353
|
fig.update_yaxes(tickformat=".3%")
|
|
307
354
|
return fig
|
|
@@ -318,6 +365,7 @@ class Plots(LazyNamespace):
|
|
|
318
365
|
cumulative: bool = True,
|
|
319
366
|
query: QUERY | None = None,
|
|
320
367
|
facet: str | None = None,
|
|
368
|
+
show_metric_limits: bool = False,
|
|
321
369
|
return_df: bool = False,
|
|
322
370
|
):
|
|
323
371
|
"""Statistics over time
|
|
@@ -337,6 +385,10 @@ class Plots(LazyNamespace):
|
|
|
337
385
|
The query to apply to the data, by default None
|
|
338
386
|
facet : Optional[str], optional
|
|
339
387
|
Whether to facet the plot into subplots, by default None
|
|
388
|
+
show_metric_limits : bool, optional
|
|
389
|
+
Whether to show dashed horizontal lines at the metric limit
|
|
390
|
+
thresholds (from MetricLimits.csv), by default False.
|
|
391
|
+
Only applies when metric is "Performance".
|
|
340
392
|
return_df : bool, optional
|
|
341
393
|
Whether to return a dataframe instead of a plot, by default False
|
|
342
394
|
|
|
@@ -447,6 +499,9 @@ class Plots(LazyNamespace):
|
|
|
447
499
|
fig.update_yaxes(tickformat=".2%")
|
|
448
500
|
fig.update_layout(yaxis={"rangemode": "tozero"})
|
|
449
501
|
|
|
502
|
+
if show_metric_limits and metric == "Performance":
|
|
503
|
+
fig = add_metric_limit_lines(fig, orientation="horizontal")
|
|
504
|
+
|
|
450
505
|
return fig
|
|
451
506
|
|
|
452
507
|
@requires({"ModelID", "Name"})
|
|
@@ -4,7 +4,7 @@ import os
|
|
|
4
4
|
import shutil
|
|
5
5
|
from os import PathLike
|
|
6
6
|
from pathlib import Path
|
|
7
|
-
from typing import TYPE_CHECKING
|
|
7
|
+
from typing import TYPE_CHECKING
|
|
8
8
|
from collections.abc import Callable
|
|
9
9
|
|
|
10
10
|
import polars as pl
|
|
@@ -50,8 +50,7 @@ class Reports(LazyNamespace):
|
|
|
50
50
|
model_file_path: PathLike | None = None,
|
|
51
51
|
predictor_file_path: PathLike | None = None,
|
|
52
52
|
qmd_file: PathLike | None = None,
|
|
53
|
-
|
|
54
|
-
| None = "cdn", # TODO: temporary default to support DJS use cases
|
|
53
|
+
full_embed: bool = False,
|
|
55
54
|
) -> Path:
|
|
56
55
|
"""Generates model reports for Naive Bayes ADM models.
|
|
57
56
|
|
|
@@ -87,10 +86,11 @@ class Reports(LazyNamespace):
|
|
|
87
86
|
qmd_file : Union[str, Path, None], optional
|
|
88
87
|
Optional path to the Quarto file to use for the model report.
|
|
89
88
|
If None, defaults to "ModelReport.qmd".
|
|
90
|
-
|
|
91
|
-
When
|
|
92
|
-
|
|
93
|
-
When
|
|
89
|
+
full_embed : bool, default=False
|
|
90
|
+
When True, fully embeds all JavaScript libraries (Plotly, itables,
|
|
91
|
+
etc.) into the HTML output (larger file, requires esbuild).
|
|
92
|
+
When False, loads JavaScript libraries from CDN (smaller, requires
|
|
93
|
+
internet). See issue #620.
|
|
94
94
|
|
|
95
95
|
Returns
|
|
96
96
|
-------
|
|
@@ -162,7 +162,7 @@ class Reports(LazyNamespace):
|
|
|
162
162
|
},
|
|
163
163
|
temp_dir=temp_dir,
|
|
164
164
|
verbose=verbose,
|
|
165
|
-
|
|
165
|
+
full_embed=full_embed,
|
|
166
166
|
)
|
|
167
167
|
output_path = temp_dir / output_filename
|
|
168
168
|
if verbose or not output_path.exists():
|
|
@@ -218,8 +218,7 @@ class Reports(LazyNamespace):
|
|
|
218
218
|
predictor_file_path: PathLike | None = None,
|
|
219
219
|
prediction_file_path: PathLike | None = None,
|
|
220
220
|
qmd_file: PathLike | None = None,
|
|
221
|
-
|
|
222
|
-
| None = "cdn", # TODO: temporary default to support DJS use cases
|
|
221
|
+
full_embed: bool = False,
|
|
223
222
|
) -> Path:
|
|
224
223
|
"""Generates Health Check report for ADM models, optionally including predictor and prediction sections.
|
|
225
224
|
|
|
@@ -256,10 +255,11 @@ class Reports(LazyNamespace):
|
|
|
256
255
|
qmd_file : Union[str, Path, None], optional
|
|
257
256
|
Optional path to the Quarto file to use for the health check report.
|
|
258
257
|
If None, defaults to "HealthCheck.qmd".
|
|
259
|
-
|
|
260
|
-
When
|
|
261
|
-
|
|
262
|
-
When
|
|
258
|
+
full_embed : bool, default=False
|
|
259
|
+
When True, fully embeds all JavaScript libraries (Plotly, itables,
|
|
260
|
+
etc.) into the HTML output (larger file, requires esbuild).
|
|
261
|
+
When False, loads JavaScript libraries from CDN (smaller, requires
|
|
262
|
+
internet). See issue #620.
|
|
263
263
|
|
|
264
264
|
Returns
|
|
265
265
|
-------
|
|
@@ -327,7 +327,7 @@ class Reports(LazyNamespace):
|
|
|
327
327
|
},
|
|
328
328
|
temp_dir=temp_dir,
|
|
329
329
|
verbose=verbose,
|
|
330
|
-
|
|
330
|
+
full_embed=full_embed,
|
|
331
331
|
)
|
|
332
332
|
|
|
333
333
|
# TODO why not print paths earlier, before the quarto call?
|
|
@@ -10,6 +10,7 @@ from pdstools.app.decision_analyzer.da_streamlit_utils import (
|
|
|
10
10
|
)
|
|
11
11
|
from pdstools.decision_analyzer.DecisionAnalyzer import DEFAULT_SAMPLE_SIZE
|
|
12
12
|
from pdstools.decision_analyzer.utils import (
|
|
13
|
+
parse_filter_specs,
|
|
13
14
|
parse_sample_flag,
|
|
14
15
|
prepare_and_save,
|
|
15
16
|
should_cache_source,
|
|
@@ -17,6 +18,7 @@ from pdstools.decision_analyzer.utils import (
|
|
|
17
18
|
)
|
|
18
19
|
from pdstools.utils.streamlit_utils import (
|
|
19
20
|
get_data_path,
|
|
21
|
+
get_filter_specs,
|
|
20
22
|
get_sample_limit,
|
|
21
23
|
get_temp_dir,
|
|
22
24
|
show_sidebar_branding,
|
|
@@ -130,7 +132,32 @@ def _is_capacity_error(exc: BaseException) -> bool:
|
|
|
130
132
|
# Pre-ingestion data preparation (sampling or caching)
|
|
131
133
|
# Only apply --sample flag when loading from --data-path (not for file uploads)
|
|
132
134
|
sample_limit_raw = get_sample_limit() if data_source_path else None
|
|
135
|
+
filter_specs_raw = get_filter_specs() if data_source_path else None
|
|
133
136
|
if raw_data is not None:
|
|
137
|
+
if filter_specs_raw:
|
|
138
|
+
# Filter mode — apply before sampling
|
|
139
|
+
try:
|
|
140
|
+
filter_expr = parse_filter_specs(
|
|
141
|
+
filter_specs_raw,
|
|
142
|
+
available_columns=set(raw_data.collect_schema().names()),
|
|
143
|
+
)
|
|
144
|
+
except ValueError as e:
|
|
145
|
+
st.error(f"Invalid --filter value: {e}")
|
|
146
|
+
st.stop()
|
|
147
|
+
|
|
148
|
+
filter_desc = " AND ".join(filter_specs_raw)
|
|
149
|
+
with st.spinner(f"Filtering data: {filter_desc}"):
|
|
150
|
+
# Collect filtered data so we can check for empty results and
|
|
151
|
+
# avoid re-executing the filter scan during subsequent sampling.
|
|
152
|
+
filtered_df = raw_data.filter(filter_expr).collect(engine="streaming")
|
|
153
|
+
filter_row_count = len(filtered_df)
|
|
154
|
+
if filter_row_count == 0:
|
|
155
|
+
st.warning(f"Filter matched 0 rows: {filter_desc}. Check your filter values.")
|
|
156
|
+
st.stop()
|
|
157
|
+
raw_data = filtered_df.lazy()
|
|
158
|
+
|
|
159
|
+
st.info(f"🔍 Pre-ingestion filter applied: **{filter_desc}**. **{filter_row_count:,}** rows matched.")
|
|
160
|
+
|
|
134
161
|
if sample_limit_raw:
|
|
135
162
|
# Sampling mode
|
|
136
163
|
try:
|
|
@@ -187,7 +214,7 @@ if raw_data is not None:
|
|
|
187
214
|
else:
|
|
188
215
|
st.info(f"📉 Sampling requested (**{label}**) but data already within limit — using full dataset.")
|
|
189
216
|
|
|
190
|
-
elif should_cache_source(data_source_path):
|
|
217
|
+
elif filter_specs_raw or should_cache_source(data_source_path):
|
|
191
218
|
# Caching mode - save 100% of data from non-parquet sources
|
|
192
219
|
with st.spinner("Caching data for faster reloading..."):
|
|
193
220
|
raw_data, sample_path = prepare_and_save(
|
|
@@ -229,9 +256,14 @@ def _show_data_summary(da):
|
|
|
229
256
|
sample_pct = sample_metadata["sample_percentage"]
|
|
230
257
|
source_file = sample_metadata.get("source_file", "unknown")
|
|
231
258
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
)
|
|
259
|
+
# Skip the "100% of original" message when filter was applied —
|
|
260
|
+
# the filter info banner already explains what happened, and
|
|
261
|
+
# "100%" is misleading (it's 100% of the filtered data, not the original).
|
|
262
|
+
if sample_pct < 100.0:
|
|
263
|
+
st.info(
|
|
264
|
+
f"📊 This data represents **{sample_pct:.2f}%** of the original dataset. "
|
|
265
|
+
f"Original source: `{source_file}`"
|
|
266
|
+
)
|
|
235
267
|
|
|
236
268
|
|
|
237
269
|
if has_new_data and raw_data is not None:
|
{pdstools-4.6.2 → pdstools-4.7.1}/python/pdstools/app/decision_analyzer/da_streamlit_utils.py
RENAMED
|
@@ -20,10 +20,24 @@ from pdstools.utils.streamlit_utils import (
|
|
|
20
20
|
)
|
|
21
21
|
|
|
22
22
|
|
|
23
|
+
def show_cli_filter_banner():
|
|
24
|
+
"""Show active CLI --filter specs in the sidebar if any are set."""
|
|
25
|
+
from pdstools.utils.streamlit_utils import get_filter_specs
|
|
26
|
+
|
|
27
|
+
filter_specs = get_filter_specs()
|
|
28
|
+
if not filter_specs:
|
|
29
|
+
return
|
|
30
|
+
with st.sidebar:
|
|
31
|
+
st.caption("**Active CLI filters:**")
|
|
32
|
+
for spec in filter_specs:
|
|
33
|
+
st.caption(f" `{spec}`")
|
|
34
|
+
|
|
35
|
+
|
|
23
36
|
def ensure_data():
|
|
24
37
|
"""Guard: stop if decision data is not loaded."""
|
|
25
38
|
_apply_sidebar_logo()
|
|
26
39
|
ensure_session_data("decision_data", "Please upload your data in the Home page.")
|
|
40
|
+
show_cli_filter_banner()
|
|
27
41
|
|
|
28
42
|
|
|
29
43
|
def _apply_stage_level():
|
|
@@ -168,34 +182,6 @@ def _persist_widget_value(filter_type: str, column: str, regex: str = ""):
|
|
|
168
182
|
st.session_state[dst] = st.session_state[src]
|
|
169
183
|
|
|
170
184
|
|
|
171
|
-
def serialize_filters(filters: list[pl.Expr]) -> str:
|
|
172
|
-
"""Serialize a list of polars filter expressions to a JSON string."""
|
|
173
|
-
import json
|
|
174
|
-
|
|
175
|
-
serialized = {}
|
|
176
|
-
for i, expr in enumerate(filters):
|
|
177
|
-
serialized[i] = json.loads(expr.meta.serialize(format="json"))
|
|
178
|
-
return json.dumps(serialized)
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
def deserialize_filters(json_str: str) -> list[pl.Expr]:
|
|
182
|
-
"""Deserialize a JSON string back into a list of polars filter expressions."""
|
|
183
|
-
import io
|
|
184
|
-
import json
|
|
185
|
-
|
|
186
|
-
data = json.loads(json_str)
|
|
187
|
-
return [pl.Expr.deserialize(io.StringIO(json.dumps(v)), format="json") for v in data.values()]
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
def reset_filter_state(filter_type: str):
|
|
191
|
-
"""Remove all session-state keys for the given filter type prefix."""
|
|
192
|
-
keys_to_remove = [k for k in st.session_state.keys() if k.startswith(filter_type) and k != "filters"]
|
|
193
|
-
for k in keys_to_remove:
|
|
194
|
-
del st.session_state[k]
|
|
195
|
-
# Clear the persistent filter store
|
|
196
|
-
st.session_state.pop("_applied_filters_json", None)
|
|
197
|
-
|
|
198
|
-
|
|
199
185
|
def _clean_unselected_filters(to_filter_columns: list[str], filter_type: str):
|
|
200
186
|
"""Remove session-state keys for columns no longer in the filter list."""
|
|
201
187
|
keys_to_remove = []
|
|
@@ -719,6 +705,18 @@ def _update_channel_filter():
|
|
|
719
705
|
st.session_state.page_channel_expr = pl.col("Channel") == selected
|
|
720
706
|
|
|
721
707
|
|
|
708
|
+
def contextual_filters():
|
|
709
|
+
"""Render the universal contextual filter section in the sidebar.
|
|
710
|
+
|
|
711
|
+
Adds a visual divider and section header, then renders all contextual
|
|
712
|
+
filters (currently Channel/Direction). Every analysis page should call
|
|
713
|
+
this as the last sidebar item to maintain a consistent layout.
|
|
714
|
+
"""
|
|
715
|
+
st.divider()
|
|
716
|
+
st.caption("**Filters**")
|
|
717
|
+
channel_direction_selector()
|
|
718
|
+
|
|
719
|
+
|
|
722
720
|
def channel_direction_selector():
|
|
723
721
|
"""Render channel/direction selector in sidebar.
|
|
724
722
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import polars as pl
|
|
3
3
|
import streamlit as st
|
|
4
4
|
from da_streamlit_utils import (
|
|
5
|
-
|
|
5
|
+
contextual_filters,
|
|
6
6
|
ensure_data,
|
|
7
7
|
get_current_index,
|
|
8
8
|
stage_level_selector,
|
|
@@ -57,7 +57,7 @@ with st.session_state["sidebar"]:
|
|
|
57
57
|
index=scope_index,
|
|
58
58
|
key="scope",
|
|
59
59
|
)
|
|
60
|
-
|
|
60
|
+
contextual_filters()
|
|
61
61
|
|
|
62
62
|
# Apply channel filter to sample data
|
|
63
63
|
filtered_data = st.session_state.decision_data.filtered_sample
|