mcli-framework 7.12.0__py3-none-any.whl → 7.12.3__py3-none-any.whl
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.
Potentially problematic release.
This version of mcli-framework might be problematic. Click here for more details.
- mcli/app/__init__.py +0 -2
- mcli/app/commands_cmd.py +19 -23
- mcli/app/completion_helpers.py +5 -5
- mcli/app/init_cmd.py +10 -10
- mcli/app/lock_cmd.py +82 -27
- mcli/app/main.py +4 -50
- mcli/app/model/model.py +5 -10
- mcli/app/store_cmd.py +8 -8
- mcli/app/video/__init__.py +0 -2
- mcli/app/video/video.py +1 -14
- mcli/chat/chat.py +90 -108
- mcli/chat/command_rag.py +0 -4
- mcli/chat/enhanced_chat.py +32 -41
- mcli/chat/system_controller.py +37 -37
- mcli/chat/system_integration.py +4 -5
- mcli/cli.py +2 -3
- mcli/lib/api/api.py +4 -9
- mcli/lib/api/daemon_client.py +19 -20
- mcli/lib/api/daemon_client_local.py +1 -3
- mcli/lib/api/daemon_decorator.py +6 -6
- mcli/lib/api/mcli_decorators.py +4 -8
- mcli/lib/auth/__init__.py +0 -1
- mcli/lib/auth/auth.py +4 -5
- mcli/lib/auth/mcli_manager.py +7 -12
- mcli/lib/auth/token_util.py +5 -5
- mcli/lib/config/__init__.py +29 -1
- mcli/lib/config/config.py +0 -1
- mcli/lib/custom_commands.py +1 -1
- mcli/lib/discovery/command_discovery.py +15 -15
- mcli/lib/erd/erd.py +7 -7
- mcli/lib/files/files.py +1 -1
- mcli/lib/fs/__init__.py +31 -1
- mcli/lib/fs/fs.py +12 -13
- mcli/lib/lib.py +0 -1
- mcli/lib/logger/logger.py +7 -10
- mcli/lib/performance/optimizer.py +25 -27
- mcli/lib/performance/rust_bridge.py +22 -27
- mcli/lib/performance/uvloop_config.py +0 -1
- mcli/lib/pickles/__init__.py +0 -1
- mcli/lib/pickles/pickles.py +0 -2
- mcli/lib/secrets/commands.py +0 -2
- mcli/lib/secrets/manager.py +0 -1
- mcli/lib/secrets/repl.py +2 -3
- mcli/lib/secrets/store.py +1 -2
- mcli/lib/services/data_pipeline.py +34 -34
- mcli/lib/services/lsh_client.py +38 -40
- mcli/lib/shell/shell.py +2 -2
- mcli/lib/toml/__init__.py +0 -1
- mcli/lib/ui/styling.py +0 -1
- mcli/lib/ui/visual_effects.py +33 -41
- mcli/lib/watcher/watcher.py +0 -1
- mcli/ml/__init__.py +1 -1
- mcli/ml/api/__init__.py +1 -1
- mcli/ml/api/app.py +8 -9
- mcli/ml/api/middleware.py +10 -10
- mcli/ml/api/routers/__init__.py +1 -1
- mcli/ml/api/routers/admin_router.py +3 -3
- mcli/ml/api/routers/auth_router.py +17 -18
- mcli/ml/api/routers/backtest_router.py +2 -2
- mcli/ml/api/routers/data_router.py +2 -2
- mcli/ml/api/routers/model_router.py +14 -15
- mcli/ml/api/routers/monitoring_router.py +2 -2
- mcli/ml/api/routers/portfolio_router.py +2 -2
- mcli/ml/api/routers/prediction_router.py +10 -9
- mcli/ml/api/routers/trade_router.py +2 -2
- mcli/ml/api/routers/websocket_router.py +6 -7
- mcli/ml/api/schemas.py +2 -2
- mcli/ml/auth/__init__.py +1 -1
- mcli/ml/auth/auth_manager.py +22 -23
- mcli/ml/auth/models.py +17 -17
- mcli/ml/auth/permissions.py +17 -17
- mcli/ml/backtesting/__init__.py +1 -1
- mcli/ml/backtesting/backtest_engine.py +31 -35
- mcli/ml/backtesting/performance_metrics.py +12 -14
- mcli/ml/backtesting/run.py +1 -2
- mcli/ml/cache.py +35 -36
- mcli/ml/cli/__init__.py +1 -1
- mcli/ml/cli/main.py +21 -24
- mcli/ml/config/__init__.py +1 -1
- mcli/ml/config/settings.py +28 -29
- mcli/ml/configs/__init__.py +1 -1
- mcli/ml/configs/dvc_config.py +14 -15
- mcli/ml/configs/mlflow_config.py +12 -13
- mcli/ml/configs/mlops_manager.py +19 -21
- mcli/ml/dashboard/__init__.py +4 -4
- mcli/ml/dashboard/app.py +20 -30
- mcli/ml/dashboard/app_supabase.py +16 -19
- mcli/ml/dashboard/app_training.py +11 -14
- mcli/ml/dashboard/cli.py +2 -2
- mcli/ml/dashboard/common.py +2 -3
- mcli/ml/dashboard/components/__init__.py +1 -1
- mcli/ml/dashboard/components/charts.py +13 -11
- mcli/ml/dashboard/components/metrics.py +7 -7
- mcli/ml/dashboard/components/tables.py +12 -9
- mcli/ml/dashboard/overview.py +2 -2
- mcli/ml/dashboard/pages/__init__.py +1 -1
- mcli/ml/dashboard/pages/cicd.py +15 -18
- mcli/ml/dashboard/pages/debug_dependencies.py +7 -7
- mcli/ml/dashboard/pages/monte_carlo_predictions.py +11 -18
- mcli/ml/dashboard/pages/predictions_enhanced.py +24 -32
- mcli/ml/dashboard/pages/scrapers_and_logs.py +22 -24
- mcli/ml/dashboard/pages/test_portfolio.py +3 -6
- mcli/ml/dashboard/pages/trading.py +16 -18
- mcli/ml/dashboard/pages/workflows.py +20 -30
- mcli/ml/dashboard/utils.py +9 -9
- mcli/ml/dashboard/warning_suppression.py +3 -3
- mcli/ml/data_ingestion/__init__.py +1 -1
- mcli/ml/data_ingestion/api_connectors.py +41 -46
- mcli/ml/data_ingestion/data_pipeline.py +36 -46
- mcli/ml/data_ingestion/stream_processor.py +43 -46
- mcli/ml/database/__init__.py +1 -1
- mcli/ml/database/migrations/env.py +2 -2
- mcli/ml/database/models.py +22 -24
- mcli/ml/database/session.py +14 -14
- mcli/ml/experimentation/__init__.py +1 -1
- mcli/ml/experimentation/ab_testing.py +45 -46
- mcli/ml/features/__init__.py +1 -1
- mcli/ml/features/ensemble_features.py +22 -27
- mcli/ml/features/recommendation_engine.py +30 -30
- mcli/ml/features/stock_features.py +29 -32
- mcli/ml/features/test_feature_engineering.py +10 -11
- mcli/ml/logging.py +4 -4
- mcli/ml/mlops/__init__.py +1 -1
- mcli/ml/mlops/data_versioning.py +29 -30
- mcli/ml/mlops/experiment_tracker.py +24 -24
- mcli/ml/mlops/model_serving.py +31 -34
- mcli/ml/mlops/pipeline_orchestrator.py +27 -35
- mcli/ml/models/__init__.py +5 -6
- mcli/ml/models/base_models.py +23 -23
- mcli/ml/models/ensemble_models.py +31 -31
- mcli/ml/models/recommendation_models.py +18 -19
- mcli/ml/models/test_models.py +14 -16
- mcli/ml/monitoring/__init__.py +1 -1
- mcli/ml/monitoring/drift_detection.py +32 -36
- mcli/ml/monitoring/metrics.py +2 -2
- mcli/ml/optimization/__init__.py +1 -1
- mcli/ml/optimization/optimize.py +1 -2
- mcli/ml/optimization/portfolio_optimizer.py +30 -32
- mcli/ml/predictions/__init__.py +1 -1
- mcli/ml/preprocessing/__init__.py +1 -1
- mcli/ml/preprocessing/data_cleaners.py +22 -23
- mcli/ml/preprocessing/feature_extractors.py +23 -26
- mcli/ml/preprocessing/ml_pipeline.py +23 -23
- mcli/ml/preprocessing/test_preprocessing.py +7 -8
- mcli/ml/scripts/populate_sample_data.py +0 -4
- mcli/ml/serving/serve.py +1 -2
- mcli/ml/tasks.py +17 -17
- mcli/ml/tests/test_integration.py +29 -30
- mcli/ml/tests/test_training_dashboard.py +21 -21
- mcli/ml/trading/__init__.py +1 -1
- mcli/ml/trading/migrations.py +5 -5
- mcli/ml/trading/models.py +21 -23
- mcli/ml/trading/paper_trading.py +16 -13
- mcli/ml/trading/risk_management.py +17 -18
- mcli/ml/trading/trading_service.py +25 -28
- mcli/ml/training/__init__.py +1 -1
- mcli/ml/training/train.py +0 -1
- mcli/public/oi/oi.py +1 -2
- mcli/self/completion_cmd.py +6 -10
- mcli/self/logs_cmd.py +19 -24
- mcli/self/migrate_cmd.py +22 -20
- mcli/self/redis_cmd.py +10 -11
- mcli/self/self_cmd.py +62 -18
- mcli/self/store_cmd.py +10 -12
- mcli/self/visual_cmd.py +9 -14
- mcli/self/zsh_cmd.py +2 -4
- mcli/workflow/daemon/async_command_database.py +23 -24
- mcli/workflow/daemon/async_process_manager.py +27 -29
- mcli/workflow/daemon/client.py +27 -33
- mcli/workflow/daemon/daemon.py +32 -36
- mcli/workflow/daemon/enhanced_daemon.py +24 -33
- mcli/workflow/daemon/process_cli.py +11 -12
- mcli/workflow/daemon/process_manager.py +23 -26
- mcli/workflow/daemon/test_daemon.py +4 -5
- mcli/workflow/dashboard/dashboard_cmd.py +0 -1
- mcli/workflow/doc_convert.py +15 -17
- mcli/workflow/gcloud/__init__.py +0 -1
- mcli/workflow/gcloud/gcloud.py +11 -8
- mcli/workflow/git_commit/ai_service.py +14 -15
- mcli/workflow/lsh_integration.py +9 -11
- mcli/workflow/model_service/client.py +26 -31
- mcli/workflow/model_service/download_and_run_efficient_models.py +10 -14
- mcli/workflow/model_service/lightweight_embedder.py +25 -35
- mcli/workflow/model_service/lightweight_model_server.py +26 -32
- mcli/workflow/model_service/lightweight_test.py +7 -10
- mcli/workflow/model_service/model_service.py +80 -91
- mcli/workflow/model_service/ollama_efficient_runner.py +14 -18
- mcli/workflow/model_service/openai_adapter.py +23 -23
- mcli/workflow/model_service/pdf_processor.py +21 -26
- mcli/workflow/model_service/test_efficient_runner.py +12 -16
- mcli/workflow/model_service/test_example.py +11 -13
- mcli/workflow/model_service/test_integration.py +3 -5
- mcli/workflow/model_service/test_new_features.py +7 -8
- mcli/workflow/notebook/converter.py +1 -1
- mcli/workflow/notebook/notebook_cmd.py +5 -6
- mcli/workflow/notebook/schema.py +0 -1
- mcli/workflow/notebook/validator.py +7 -3
- mcli/workflow/openai/openai.py +1 -2
- mcli/workflow/registry/registry.py +4 -1
- mcli/workflow/repo/repo.py +6 -7
- mcli/workflow/scheduler/cron_parser.py +16 -19
- mcli/workflow/scheduler/job.py +10 -10
- mcli/workflow/scheduler/monitor.py +15 -15
- mcli/workflow/scheduler/persistence.py +17 -18
- mcli/workflow/scheduler/scheduler.py +37 -38
- mcli/workflow/secrets/__init__.py +1 -1
- mcli/workflow/sync/test_cmd.py +0 -1
- mcli/workflow/wakatime/__init__.py +5 -9
- mcli/workflow/wakatime/wakatime.py +1 -2
- {mcli_framework-7.12.0.dist-info → mcli_framework-7.12.3.dist-info}/METADATA +1 -1
- mcli_framework-7.12.3.dist-info/RECORD +279 -0
- mcli_framework-7.12.0.dist-info/RECORD +0 -279
- {mcli_framework-7.12.0.dist-info → mcli_framework-7.12.3.dist-info}/WHEEL +0 -0
- {mcli_framework-7.12.0.dist-info → mcli_framework-7.12.3.dist-info}/entry_points.txt +0 -0
- {mcli_framework-7.12.0.dist-info → mcli_framework-7.12.3.dist-info}/licenses/LICENSE +0 -0
- {mcli_framework-7.12.0.dist-info → mcli_framework-7.12.3.dist-info}/top_level.txt +0 -0
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
"""Trading dashboard page for portfolio management and trade execution"""
|
|
1
|
+
"""Trading dashboard page for portfolio management and trade execution."""
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
4
|
import warnings
|
|
5
|
-
from datetime import datetime, timedelta
|
|
6
|
-
from typing import Dict, List, Optional
|
|
7
5
|
from uuid import UUID
|
|
8
6
|
|
|
9
7
|
import pandas as pd
|
|
@@ -20,7 +18,7 @@ warnings.filterwarnings("ignore", message=".*to view this Streamlit app.*")
|
|
|
20
18
|
|
|
21
19
|
# Try to import trading dependencies with fallbacks
|
|
22
20
|
try:
|
|
23
|
-
|
|
21
|
+
pass
|
|
24
22
|
|
|
25
23
|
from mcli.ml.database.session import get_session
|
|
26
24
|
from mcli.ml.trading.models import (
|
|
@@ -87,7 +85,7 @@ logger = logging.getLogger(__name__)
|
|
|
87
85
|
|
|
88
86
|
|
|
89
87
|
def show_trading_dashboard():
|
|
90
|
-
"""Main trading dashboard page"""
|
|
88
|
+
"""Main trading dashboard page."""
|
|
91
89
|
st.title("📈 Trading Dashboard")
|
|
92
90
|
st.markdown("Manage your portfolios and execute trades based on politician trading insights")
|
|
93
91
|
|
|
@@ -163,7 +161,7 @@ def show_trading_dashboard():
|
|
|
163
161
|
|
|
164
162
|
|
|
165
163
|
def show_trading_overview():
|
|
166
|
-
"""Show trading overview with key metrics"""
|
|
164
|
+
"""Show trading overview with key metrics."""
|
|
167
165
|
st.header("📊 Trading Overview")
|
|
168
166
|
|
|
169
167
|
try:
|
|
@@ -300,7 +298,7 @@ def show_trading_overview():
|
|
|
300
298
|
|
|
301
299
|
|
|
302
300
|
def show_portfolios_page():
|
|
303
|
-
"""Show portfolios management page"""
|
|
301
|
+
"""Show portfolios management page."""
|
|
304
302
|
st.header("💼 Portfolio Management")
|
|
305
303
|
|
|
306
304
|
try:
|
|
@@ -308,7 +306,7 @@ def show_portfolios_page():
|
|
|
308
306
|
trading_service = TradingService(db)
|
|
309
307
|
|
|
310
308
|
# Create new portfolio section
|
|
311
|
-
with st.expander("➕ Create New Portfolio", expanded=False):
|
|
309
|
+
with st.expander("➕ Create New Portfolio", expanded=False): # noqa: SIM117
|
|
312
310
|
with st.form("create_portfolio"):
|
|
313
311
|
col1, col2 = st.columns(2)
|
|
314
312
|
|
|
@@ -400,12 +398,12 @@ def show_portfolios_page():
|
|
|
400
398
|
col1, col2, col3 = st.columns(3)
|
|
401
399
|
|
|
402
400
|
with col1:
|
|
403
|
-
if st.button(
|
|
401
|
+
if st.button("View Details", key=f"view_{portfolio.id}"):
|
|
404
402
|
st.session_state.selected_portfolio = portfolio.id
|
|
405
403
|
st.session_state.trading_page = "trading"
|
|
406
404
|
|
|
407
405
|
with col2:
|
|
408
|
-
if st.button(
|
|
406
|
+
if st.button("Sync with Alpaca", key=f"sync_{portfolio.id}"):
|
|
409
407
|
with st.spinner("Syncing with Alpaca..."):
|
|
410
408
|
success = trading_service.sync_portfolio_with_alpaca(portfolio)
|
|
411
409
|
if success:
|
|
@@ -415,7 +413,7 @@ def show_portfolios_page():
|
|
|
415
413
|
st.error("Failed to sync portfolio")
|
|
416
414
|
|
|
417
415
|
with col3:
|
|
418
|
-
if st.button(
|
|
416
|
+
if st.button("Performance", key=f"perf_{portfolio.id}"):
|
|
419
417
|
st.session_state.selected_portfolio = portfolio.id
|
|
420
418
|
st.session_state.trading_page = "performance"
|
|
421
419
|
|
|
@@ -427,7 +425,7 @@ def show_portfolios_page():
|
|
|
427
425
|
|
|
428
426
|
|
|
429
427
|
def show_trading_page():
|
|
430
|
-
"""Show trading interface page"""
|
|
428
|
+
"""Show trading interface page."""
|
|
431
429
|
st.header("🎯 Trading Interface")
|
|
432
430
|
|
|
433
431
|
try:
|
|
@@ -565,7 +563,7 @@ def show_trading_page():
|
|
|
565
563
|
|
|
566
564
|
|
|
567
565
|
def show_performance_page():
|
|
568
|
-
"""Show portfolio performance analytics"""
|
|
566
|
+
"""Show portfolio performance analytics."""
|
|
569
567
|
st.header("📊 Performance Analytics")
|
|
570
568
|
|
|
571
569
|
try:
|
|
@@ -668,7 +666,7 @@ def show_performance_page():
|
|
|
668
666
|
|
|
669
667
|
|
|
670
668
|
def show_signals_page():
|
|
671
|
-
"""Show trading signals page"""
|
|
669
|
+
"""Show trading signals page."""
|
|
672
670
|
st.header("🎯 Trading Signals")
|
|
673
671
|
|
|
674
672
|
try:
|
|
@@ -724,15 +722,15 @@ def show_signals_page():
|
|
|
724
722
|
col1, col2, col3 = st.columns(3)
|
|
725
723
|
|
|
726
724
|
with col1:
|
|
727
|
-
if st.button(
|
|
725
|
+
if st.button("Execute Trade", key=f"execute_{signal.id}"):
|
|
728
726
|
st.info("Trade execution would be implemented here")
|
|
729
727
|
|
|
730
728
|
with col2:
|
|
731
|
-
if st.button(
|
|
729
|
+
if st.button("View Details", key=f"details_{signal.id}"):
|
|
732
730
|
st.info("Signal details would be shown here")
|
|
733
731
|
|
|
734
732
|
with col3:
|
|
735
|
-
if st.button(
|
|
733
|
+
if st.button("Dismiss", key=f"dismiss_{signal.id}"):
|
|
736
734
|
st.info("Signal would be dismissed here")
|
|
737
735
|
|
|
738
736
|
st.divider()
|
|
@@ -743,7 +741,7 @@ def show_signals_page():
|
|
|
743
741
|
|
|
744
742
|
|
|
745
743
|
def show_settings_page():
|
|
746
|
-
"""Show trading settings page"""
|
|
744
|
+
"""Show trading settings page."""
|
|
747
745
|
import os
|
|
748
746
|
|
|
749
747
|
st.header("⚙️ Trading Settings")
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"""Workflow Management Dashboard"""
|
|
1
|
+
"""Workflow Management Dashboard."""
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
4
|
import os
|
|
5
5
|
from datetime import datetime, timedelta
|
|
6
|
-
from typing import
|
|
6
|
+
from typing import Optional
|
|
7
7
|
|
|
8
8
|
import pandas as pd
|
|
9
9
|
import plotly.express as px
|
|
@@ -12,34 +12,24 @@ import streamlit as st
|
|
|
12
12
|
|
|
13
13
|
# Import components
|
|
14
14
|
try:
|
|
15
|
-
from ..components.charts import
|
|
16
|
-
|
|
17
|
-
create_status_pie_chart,
|
|
18
|
-
create_timeline_chart,
|
|
19
|
-
render_chart,
|
|
20
|
-
)
|
|
21
|
-
from ..components.metrics import display_health_indicator, display_kpi_row, display_status_badge
|
|
15
|
+
from ..components.charts import create_status_pie_chart, render_chart
|
|
16
|
+
from ..components.metrics import display_kpi_row, display_status_badge
|
|
22
17
|
from ..components.tables import display_filterable_dataframe, export_dataframe
|
|
23
18
|
except ImportError:
|
|
24
19
|
# Fallback for when imported outside package context
|
|
25
|
-
from components.charts import
|
|
26
|
-
|
|
27
|
-
create_status_pie_chart,
|
|
28
|
-
create_timeline_chart,
|
|
29
|
-
render_chart,
|
|
30
|
-
)
|
|
31
|
-
from components.metrics import display_health_indicator, display_kpi_row, display_status_badge
|
|
20
|
+
from components.charts import create_status_pie_chart, render_chart
|
|
21
|
+
from components.metrics import display_kpi_row, display_status_badge
|
|
32
22
|
from components.tables import display_filterable_dataframe, export_dataframe
|
|
33
23
|
|
|
34
24
|
|
|
35
25
|
def get_workflow_api_url() -> str:
|
|
36
|
-
"""Get Workflow API URL from environment"""
|
|
26
|
+
"""Get Workflow API URL from environment."""
|
|
37
27
|
lsh_url = os.getenv("LSH_API_URL", "http://localhost:3034")
|
|
38
28
|
return f"{lsh_url}/api/workflows"
|
|
39
29
|
|
|
40
30
|
|
|
41
31
|
def fetch_workflows() -> pd.DataFrame:
|
|
42
|
-
"""Fetch workflow definitions from API"""
|
|
32
|
+
"""Fetch workflow definitions from API."""
|
|
43
33
|
try:
|
|
44
34
|
api_url = get_workflow_api_url()
|
|
45
35
|
response = requests.get(api_url, timeout=5)
|
|
@@ -66,7 +56,7 @@ def fetch_workflows() -> pd.DataFrame:
|
|
|
66
56
|
|
|
67
57
|
|
|
68
58
|
def create_mock_workflow_data() -> pd.DataFrame:
|
|
69
|
-
"""Create mock workflow data for demonstration"""
|
|
59
|
+
"""Create mock workflow data for demonstration."""
|
|
70
60
|
workflows = [
|
|
71
61
|
{
|
|
72
62
|
"id": "wf-1",
|
|
@@ -122,7 +112,7 @@ def create_mock_workflow_data() -> pd.DataFrame:
|
|
|
122
112
|
|
|
123
113
|
|
|
124
114
|
def fetch_workflow_executions(workflow_id: Optional[str] = None) -> pd.DataFrame:
|
|
125
|
-
"""Fetch workflow execution history"""
|
|
115
|
+
"""Fetch workflow execution history."""
|
|
126
116
|
try:
|
|
127
117
|
api_url = get_workflow_api_url()
|
|
128
118
|
url = f"{api_url}/{workflow_id}/executions" if workflow_id else f"{api_url}/executions"
|
|
@@ -149,7 +139,7 @@ def fetch_workflow_executions(workflow_id: Optional[str] = None) -> pd.DataFrame
|
|
|
149
139
|
|
|
150
140
|
|
|
151
141
|
def create_mock_execution_data(workflow_id: Optional[str] = None) -> pd.DataFrame:
|
|
152
|
-
"""Create mock execution data"""
|
|
142
|
+
"""Create mock execution data."""
|
|
153
143
|
import random
|
|
154
144
|
|
|
155
145
|
executions = []
|
|
@@ -190,7 +180,7 @@ def create_mock_execution_data(workflow_id: Optional[str] = None) -> pd.DataFram
|
|
|
190
180
|
|
|
191
181
|
|
|
192
182
|
def show_workflows_dashboard():
|
|
193
|
-
"""Main workflow management dashboard"""
|
|
183
|
+
"""Main workflow management dashboard."""
|
|
194
184
|
|
|
195
185
|
st.title("⚙️ Workflow Management")
|
|
196
186
|
st.markdown("Create, schedule, and monitor data pipeline workflows")
|
|
@@ -256,7 +246,7 @@ def show_workflows_dashboard():
|
|
|
256
246
|
|
|
257
247
|
|
|
258
248
|
def show_workflow_list(workflows_df: pd.DataFrame):
|
|
259
|
-
"""Display list of workflows"""
|
|
249
|
+
"""Display list of workflows."""
|
|
260
250
|
|
|
261
251
|
st.markdown("### Active Workflows")
|
|
262
252
|
|
|
@@ -327,7 +317,7 @@ def show_workflow_list(workflows_df: pd.DataFrame):
|
|
|
327
317
|
|
|
328
318
|
|
|
329
319
|
def show_workflow_executions():
|
|
330
|
-
"""Show workflow execution history"""
|
|
320
|
+
"""Show workflow execution history."""
|
|
331
321
|
|
|
332
322
|
st.markdown("### Workflow Execution History")
|
|
333
323
|
|
|
@@ -456,7 +446,7 @@ def show_workflow_executions():
|
|
|
456
446
|
|
|
457
447
|
|
|
458
448
|
def show_workflow_builder():
|
|
459
|
-
"""Workflow builder interface"""
|
|
449
|
+
"""Workflow builder interface."""
|
|
460
450
|
|
|
461
451
|
st.markdown("### ➕ Create New Workflow")
|
|
462
452
|
|
|
@@ -496,15 +486,15 @@ def show_workflow_builder():
|
|
|
496
486
|
for i in range(num_steps):
|
|
497
487
|
with st.expander(f"Step {i+1}"):
|
|
498
488
|
step_name = st.text_input(
|
|
499
|
-
|
|
489
|
+
"Step Name", key=f"step_name_{i}", placeholder=f"Step {i+1}"
|
|
500
490
|
)
|
|
501
491
|
step_type = st.selectbox(
|
|
502
|
-
|
|
492
|
+
"Step Type",
|
|
503
493
|
["API Call", "Python Script", "Database Query", "Data Transform", "Validation"],
|
|
504
494
|
key=f"step_type_{i}",
|
|
505
495
|
)
|
|
506
496
|
step_config = st.text_area(
|
|
507
|
-
|
|
497
|
+
"Configuration (JSON)",
|
|
508
498
|
key=f"step_config_{i}",
|
|
509
499
|
placeholder='{"param": "value"}',
|
|
510
500
|
)
|
|
@@ -532,7 +522,7 @@ def show_workflow_builder():
|
|
|
532
522
|
|
|
533
523
|
|
|
534
524
|
def show_workflow_templates():
|
|
535
|
-
"""Show workflow templates"""
|
|
525
|
+
"""Show workflow templates."""
|
|
536
526
|
|
|
537
527
|
st.markdown("### 📚 Workflow Templates")
|
|
538
528
|
|
|
@@ -569,7 +559,7 @@ def show_workflow_templates():
|
|
|
569
559
|
st.markdown(f"**Steps:** {template['steps']}")
|
|
570
560
|
st.markdown(f"**Category:** {template['category']}")
|
|
571
561
|
|
|
572
|
-
if st.button(
|
|
562
|
+
if st.button("Use Template", key=f"use_{template['name']}"):
|
|
573
563
|
st.info(f"Loading template: {template['name']}")
|
|
574
564
|
# Would populate the workflow builder form
|
|
575
565
|
|
mcli/ml/dashboard/utils.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Shared utility functions for dashboard pages"""
|
|
1
|
+
"""Shared utility functions for dashboard pages."""
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
4
|
import os
|
|
@@ -19,7 +19,7 @@ logger = logging.getLogger(__name__)
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
def get_supabase_client() -> Optional[Client]:
|
|
22
|
-
"""Get Supabase client with Streamlit Cloud secrets support"""
|
|
22
|
+
"""Get Supabase client with Streamlit Cloud secrets support."""
|
|
23
23
|
# Try Streamlit secrets first (for Streamlit Cloud), then fall back to environment variables (for local dev)
|
|
24
24
|
try:
|
|
25
25
|
url = st.secrets.get("SUPABASE_URL", "")
|
|
@@ -37,7 +37,7 @@ def get_supabase_client() -> Optional[Client]:
|
|
|
37
37
|
client = create_client(url, key)
|
|
38
38
|
# Test connection with a simple query
|
|
39
39
|
try:
|
|
40
|
-
|
|
40
|
+
client.table("politicians").select("id").limit(1).execute()
|
|
41
41
|
logger.info(f"✅ Supabase connection successful (URL: {url[:30]}...)")
|
|
42
42
|
return client
|
|
43
43
|
except Exception as conn_error:
|
|
@@ -49,7 +49,7 @@ def get_supabase_client() -> Optional[Client]:
|
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
def get_politician_names() -> List[str]:
|
|
52
|
-
"""Get all politician names from database for searchable dropdown"""
|
|
52
|
+
"""Get all politician names from database for searchable dropdown."""
|
|
53
53
|
try:
|
|
54
54
|
client = get_supabase_client()
|
|
55
55
|
if not client:
|
|
@@ -66,7 +66,7 @@ def get_politician_names() -> List[str]:
|
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
def get_disclosures_data() -> pd.DataFrame:
|
|
69
|
-
"""Get trading disclosures from Supabase with proper schema mapping"""
|
|
69
|
+
"""Get trading disclosures from Supabase with proper schema mapping."""
|
|
70
70
|
client = get_supabase_client()
|
|
71
71
|
if not client:
|
|
72
72
|
st.warning("⚠️ Supabase connection not available. Configure SUPABASE_URL and SUPABASE_KEY.")
|
|
@@ -128,7 +128,7 @@ def get_disclosures_data() -> pd.DataFrame:
|
|
|
128
128
|
|
|
129
129
|
|
|
130
130
|
def _generate_demo_disclosures() -> pd.DataFrame:
|
|
131
|
-
"""Generate demo trading disclosure data for testing"""
|
|
131
|
+
"""Generate demo trading disclosure data for testing."""
|
|
132
132
|
st.info("🔵 Using demo trading data (Supabase unavailable)")
|
|
133
133
|
|
|
134
134
|
import random
|
|
@@ -158,7 +158,7 @@ def _generate_demo_disclosures() -> pd.DataFrame:
|
|
|
158
158
|
|
|
159
159
|
|
|
160
160
|
def get_politician_trading_history(politician_name: str) -> pd.DataFrame:
|
|
161
|
-
"""Get trading history for a specific politician"""
|
|
161
|
+
"""Get trading history for a specific politician."""
|
|
162
162
|
try:
|
|
163
163
|
client = get_supabase_client()
|
|
164
164
|
if not client:
|
|
@@ -169,8 +169,8 @@ def get_politician_trading_history(politician_name: str) -> pd.DataFrame:
|
|
|
169
169
|
if len(name_parts) < 2:
|
|
170
170
|
return pd.DataFrame()
|
|
171
171
|
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
name_parts[0]
|
|
173
|
+
_last_name = " ".join(name_parts[1:]) # noqa: F841
|
|
174
174
|
|
|
175
175
|
# Get trading disclosures for this politician
|
|
176
176
|
response = (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Warning suppression utilities for Streamlit components used outside runtime context"""
|
|
1
|
+
"""Warning suppression utilities for Streamlit components used outside runtime context."""
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
4
|
import warnings
|
|
@@ -7,7 +7,7 @@ from contextlib import contextmanager
|
|
|
7
7
|
|
|
8
8
|
@contextmanager
|
|
9
9
|
def suppress_streamlit_warnings():
|
|
10
|
-
"""Context manager to suppress Streamlit warnings when used outside runtime context"""
|
|
10
|
+
"""Context manager to suppress Streamlit warnings when used outside runtime context."""
|
|
11
11
|
# Suppress specific Streamlit warnings
|
|
12
12
|
with warnings.catch_warnings():
|
|
13
13
|
warnings.filterwarnings("ignore", message=".*missing ScriptRunContext.*")
|
|
@@ -27,7 +27,7 @@ def suppress_streamlit_warnings():
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
def suppress_streamlit_warnings_decorator(func):
|
|
30
|
-
"""Decorator to suppress Streamlit warnings for a function"""
|
|
30
|
+
"""Decorator to suppress Streamlit warnings for a function."""
|
|
31
31
|
|
|
32
32
|
def wrapper(*args, **kwargs):
|
|
33
33
|
with suppress_streamlit_warnings():
|