mcli-framework 7.2.0__py3-none-any.whl → 7.4.0__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/__init__.py +160 -0
- mcli/__main__.py +14 -0
- mcli/app/__init__.py +23 -0
- mcli/app/commands_cmd.py +741 -0
- mcli/app/model/__init__.py +0 -0
- mcli/app/video/__init__.py +5 -0
- mcli/chat/__init__.py +34 -0
- mcli/lib/__init__.py +0 -0
- mcli/lib/api/__init__.py +0 -0
- mcli/lib/auth/__init__.py +1 -0
- mcli/lib/config/__init__.py +1 -0
- mcli/lib/erd/__init__.py +25 -0
- mcli/lib/files/__init__.py +0 -0
- mcli/lib/fs/__init__.py +1 -0
- mcli/lib/logger/__init__.py +3 -0
- mcli/lib/performance/__init__.py +17 -0
- mcli/lib/pickles/__init__.py +1 -0
- mcli/lib/shell/__init__.py +0 -0
- mcli/lib/toml/__init__.py +1 -0
- mcli/lib/watcher/__init__.py +0 -0
- mcli/ml/__init__.py +16 -0
- mcli/ml/api/__init__.py +30 -0
- mcli/ml/api/routers/__init__.py +27 -0
- mcli/ml/api/schemas.py +2 -2
- mcli/ml/auth/__init__.py +45 -0
- mcli/ml/auth/models.py +2 -2
- mcli/ml/backtesting/__init__.py +39 -0
- mcli/ml/cli/__init__.py +5 -0
- mcli/ml/cli/main.py +1 -1
- mcli/ml/config/__init__.py +33 -0
- mcli/ml/configs/__init__.py +16 -0
- mcli/ml/dashboard/__init__.py +12 -0
- mcli/ml/dashboard/app_integrated.py +296 -30
- mcli/ml/dashboard/app_training.py +1 -1
- mcli/ml/dashboard/components/__init__.py +7 -0
- mcli/ml/dashboard/pages/__init__.py +6 -0
- mcli/ml/dashboard/pages/cicd.py +1 -1
- mcli/ml/dashboard/pages/debug_dependencies.py +364 -0
- mcli/ml/dashboard/pages/gravity_viz.py +565 -0
- mcli/ml/dashboard/pages/monte_carlo_predictions.py +555 -0
- mcli/ml/dashboard/pages/overview.py +378 -0
- mcli/ml/dashboard/pages/predictions_enhanced.py +20 -6
- mcli/ml/dashboard/pages/scrapers_and_logs.py +22 -6
- mcli/ml/dashboard/pages/test_portfolio.py +423 -0
- mcli/ml/dashboard/pages/trading.py +768 -0
- mcli/ml/dashboard/streamlit_extras_utils.py +297 -0
- mcli/ml/dashboard/utils.py +161 -0
- mcli/ml/dashboard/warning_suppression.py +34 -0
- mcli/ml/data_ingestion/__init__.py +39 -0
- mcli/ml/database/__init__.py +47 -0
- mcli/ml/database/session.py +169 -16
- mcli/ml/experimentation/__init__.py +29 -0
- mcli/ml/features/__init__.py +39 -0
- mcli/ml/mlops/__init__.py +33 -0
- mcli/ml/models/__init__.py +94 -0
- mcli/ml/monitoring/__init__.py +25 -0
- mcli/ml/optimization/__init__.py +27 -0
- mcli/ml/predictions/__init__.py +5 -0
- mcli/ml/predictions/monte_carlo.py +428 -0
- mcli/ml/preprocessing/__init__.py +28 -0
- mcli/ml/scripts/__init__.py +1 -0
- mcli/ml/trading/__init__.py +66 -0
- mcli/ml/trading/alpaca_client.py +417 -0
- mcli/ml/trading/migrations.py +164 -0
- mcli/ml/trading/models.py +418 -0
- mcli/ml/trading/paper_trading.py +326 -0
- mcli/ml/trading/risk_management.py +370 -0
- mcli/ml/trading/trading_service.py +480 -0
- mcli/ml/training/__init__.py +10 -0
- mcli/mygroup/__init__.py +3 -0
- mcli/public/__init__.py +1 -0
- mcli/public/commands/__init__.py +2 -0
- mcli/self/__init__.py +3 -0
- mcli/self/self_cmd.py +514 -15
- mcli/workflow/__init__.py +0 -0
- mcli/workflow/daemon/__init__.py +15 -0
- mcli/workflow/daemon/daemon.py +21 -3
- mcli/workflow/dashboard/__init__.py +5 -0
- mcli/workflow/docker/__init__.py +0 -0
- mcli/workflow/file/__init__.py +0 -0
- mcli/workflow/gcloud/__init__.py +1 -0
- mcli/workflow/git_commit/__init__.py +0 -0
- mcli/workflow/interview/__init__.py +0 -0
- mcli/workflow/politician_trading/__init__.py +4 -0
- mcli/workflow/registry/__init__.py +0 -0
- mcli/workflow/repo/__init__.py +0 -0
- mcli/workflow/scheduler/__init__.py +25 -0
- mcli/workflow/search/__init__.py +0 -0
- mcli/workflow/sync/__init__.py +5 -0
- mcli/workflow/videos/__init__.py +1 -0
- mcli/workflow/wakatime/__init__.py +80 -0
- {mcli_framework-7.2.0.dist-info → mcli_framework-7.4.0.dist-info}/METADATA +4 -1
- {mcli_framework-7.2.0.dist-info → mcli_framework-7.4.0.dist-info}/RECORD +97 -18
- {mcli_framework-7.2.0.dist-info → mcli_framework-7.4.0.dist-info}/WHEEL +0 -0
- {mcli_framework-7.2.0.dist-info → mcli_framework-7.4.0.dist-info}/entry_points.txt +0 -0
- {mcli_framework-7.2.0.dist-info → mcli_framework-7.4.0.dist-info}/licenses/LICENSE +0 -0
- {mcli_framework-7.2.0.dist-info → mcli_framework-7.4.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
"""Overview page - Introduction to the Politician Trading Tracker"""
|
|
2
|
+
|
|
3
|
+
import streamlit as st
|
|
4
|
+
|
|
5
|
+
# Try to import streamlit-extras for enhanced UI
|
|
6
|
+
try:
|
|
7
|
+
from mcli.ml.dashboard.streamlit_extras_utils import (
|
|
8
|
+
section_header,
|
|
9
|
+
info_card,
|
|
10
|
+
vertical_space,
|
|
11
|
+
)
|
|
12
|
+
HAS_EXTRAS = True
|
|
13
|
+
except ImportError:
|
|
14
|
+
HAS_EXTRAS = False
|
|
15
|
+
section_header = lambda label, desc="", **kwargs: st.header(label)
|
|
16
|
+
info_card = None
|
|
17
|
+
vertical_space = lambda x: st.write("")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def show_overview():
|
|
21
|
+
"""Main overview page"""
|
|
22
|
+
|
|
23
|
+
# Hero section
|
|
24
|
+
st.markdown(
|
|
25
|
+
"""
|
|
26
|
+
<div style='text-align: center; padding: 2rem 0;'>
|
|
27
|
+
<h1 style='color: #1f77b4; font-size: 3rem; margin-bottom: 0.5rem;'>
|
|
28
|
+
📊 Politician Trading Tracker
|
|
29
|
+
</h1>
|
|
30
|
+
<h3 style='color: #666; font-weight: normal;'>
|
|
31
|
+
Track, Analyze & Replicate Congressional Trading Patterns
|
|
32
|
+
</h3>
|
|
33
|
+
</div>
|
|
34
|
+
""",
|
|
35
|
+
unsafe_allow_html=True
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
st.markdown("---")
|
|
39
|
+
|
|
40
|
+
# What is this?
|
|
41
|
+
section_header(
|
|
42
|
+
"🎯 What is Politician Trading Tracker?",
|
|
43
|
+
"Your comprehensive tool for analyzing Congressional stock trades",
|
|
44
|
+
divider="blue"
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
st.markdown("""
|
|
48
|
+
This dashboard provides **real-time access** to Congressional stock trading disclosures,
|
|
49
|
+
allowing you to track when U.S. politicians buy and sell stocks, analyze their patterns,
|
|
50
|
+
and make informed investment decisions.
|
|
51
|
+
|
|
52
|
+
### Why Track Politician Trading?
|
|
53
|
+
|
|
54
|
+
📈 **Historical Outperformance**: Studies show Congressional portfolios often outperform the market
|
|
55
|
+
🔍 **Early Insights**: Politicians may have access to non-public information through briefings
|
|
56
|
+
💡 **Smart Money**: Following experienced investors can inform your strategy
|
|
57
|
+
📊 **Transparency**: Make use of public disclosure data for better decisions
|
|
58
|
+
""")
|
|
59
|
+
|
|
60
|
+
vertical_space(2)
|
|
61
|
+
|
|
62
|
+
# Key Features
|
|
63
|
+
section_header(
|
|
64
|
+
"✨ Key Features",
|
|
65
|
+
"Powerful tools for trading analysis",
|
|
66
|
+
divider="green"
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
col1, col2, col3 = st.columns(3)
|
|
70
|
+
|
|
71
|
+
with col1:
|
|
72
|
+
st.markdown("""
|
|
73
|
+
### 📊 Data Tracking
|
|
74
|
+
- **Real-time updates** from official sources
|
|
75
|
+
- **Historical data** going back years
|
|
76
|
+
- **Multiple sources**: Senate, House, Senate Stock Watcher
|
|
77
|
+
- **Automated scraping** for latest disclosures
|
|
78
|
+
""")
|
|
79
|
+
|
|
80
|
+
with col2:
|
|
81
|
+
st.markdown("""
|
|
82
|
+
### 🤖 ML Predictions
|
|
83
|
+
- **Machine learning models** for stock prediction
|
|
84
|
+
- **Monte Carlo simulations** for risk analysis
|
|
85
|
+
- **Pattern recognition** in trading behavior
|
|
86
|
+
- **Price forecasting** based on historical data
|
|
87
|
+
""")
|
|
88
|
+
|
|
89
|
+
with col3:
|
|
90
|
+
st.markdown("""
|
|
91
|
+
### 💼 Trading Tools
|
|
92
|
+
- **Paper trading** integration (Alpaca)
|
|
93
|
+
- **Portfolio tracking** and management
|
|
94
|
+
- **Risk assessment** tools
|
|
95
|
+
- **Performance analytics**
|
|
96
|
+
""")
|
|
97
|
+
|
|
98
|
+
vertical_space(2)
|
|
99
|
+
|
|
100
|
+
# Quick Start Guide
|
|
101
|
+
section_header(
|
|
102
|
+
"🚀 Quick Start Guide",
|
|
103
|
+
"Get started in 3 easy steps",
|
|
104
|
+
divider="violet"
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
st.markdown("""
|
|
108
|
+
### Step 1: Explore Trading Data
|
|
109
|
+
|
|
110
|
+
👉 Navigate to **"Scrapers & Logs"** to:
|
|
111
|
+
- View recent politician stock disclosures
|
|
112
|
+
- Search for specific politicians or stocks
|
|
113
|
+
- See transaction details (buy/sell amounts, dates)
|
|
114
|
+
- Export data for further analysis
|
|
115
|
+
|
|
116
|
+
### Step 2: Analyze with ML
|
|
117
|
+
|
|
118
|
+
👉 Go to **"Predictions"** or **"Monte Carlo Predictions"** to:
|
|
119
|
+
- See ML-generated stock predictions based on politician trades
|
|
120
|
+
- Run Monte Carlo simulations for risk analysis
|
|
121
|
+
- View expected returns and probability of profit
|
|
122
|
+
- Understand confidence intervals
|
|
123
|
+
|
|
124
|
+
### Step 3: Track Your Portfolio
|
|
125
|
+
|
|
126
|
+
👉 Use **"Trading Dashboard"** or **"Test Portfolio"** to:
|
|
127
|
+
- Create paper trading portfolios
|
|
128
|
+
- Replicate politician trades
|
|
129
|
+
- Track your performance
|
|
130
|
+
- Compare to market benchmarks
|
|
131
|
+
""")
|
|
132
|
+
|
|
133
|
+
vertical_space(2)
|
|
134
|
+
|
|
135
|
+
# Page Navigation Guide
|
|
136
|
+
section_header(
|
|
137
|
+
"🗺️ Page Navigation Guide",
|
|
138
|
+
"Explore all available features",
|
|
139
|
+
divider="orange"
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
# Create expandable sections for each page category
|
|
143
|
+
with st.expander("📊 **Data & Monitoring Pages**", expanded=True):
|
|
144
|
+
st.markdown("""
|
|
145
|
+
- **Pipeline Overview**: System status and data processing metrics
|
|
146
|
+
- **Scrapers & Logs**: Manual and automated data collection from government sources
|
|
147
|
+
- **System Health**: Monitor data pipeline health and API connections
|
|
148
|
+
- **LSH Jobs**: Background job status and processing queues
|
|
149
|
+
""")
|
|
150
|
+
|
|
151
|
+
with st.expander("🤖 **ML & Predictions Pages**"):
|
|
152
|
+
st.markdown("""
|
|
153
|
+
- **Predictions**: Enhanced ML predictions based on politician trading patterns
|
|
154
|
+
- **Monte Carlo Predictions**: Probabilistic simulation of price paths and returns
|
|
155
|
+
- **Model Performance**: Evaluation metrics for ML models
|
|
156
|
+
- **Model Training & Evaluation**: Train new models and compare performance
|
|
157
|
+
""")
|
|
158
|
+
|
|
159
|
+
with st.expander("💼 **Trading & Portfolio Pages**"):
|
|
160
|
+
st.markdown("""
|
|
161
|
+
- **Trading Dashboard**: Full-featured paper trading interface
|
|
162
|
+
- **Test Portfolio**: Simplified portfolio testing and tracking
|
|
163
|
+
- **Paper trading** via Alpaca API integration
|
|
164
|
+
- Track performance against politician portfolios
|
|
165
|
+
""")
|
|
166
|
+
|
|
167
|
+
with st.expander("⚙️ **Technical & DevOps Pages**"):
|
|
168
|
+
st.markdown("""
|
|
169
|
+
- **CI/CD Pipelines**: Monitor build and deployment pipelines
|
|
170
|
+
- **Workflows**: Track automated workflow executions
|
|
171
|
+
- **ML Processing**: Data preprocessing and feature engineering
|
|
172
|
+
- **Debug Dependencies**: Troubleshoot installation and import issues (useful for alpaca-py debugging)
|
|
173
|
+
""")
|
|
174
|
+
|
|
175
|
+
vertical_space(2)
|
|
176
|
+
|
|
177
|
+
# FAQ Section
|
|
178
|
+
section_header(
|
|
179
|
+
"❓ Frequently Asked Questions",
|
|
180
|
+
"Common questions answered",
|
|
181
|
+
divider="gray"
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
with st.expander("**Q: Is this legal? Can I really track politician trades?**"):
|
|
185
|
+
st.markdown("""
|
|
186
|
+
**A:** Yes, absolutely! The STOCK Act (Stop Trading on Congressional Knowledge Act)
|
|
187
|
+
requires members of Congress to publicly disclose their stock trades within 45 days.
|
|
188
|
+
This app aggregates and analyzes publicly available data.
|
|
189
|
+
|
|
190
|
+
All data comes from official sources:
|
|
191
|
+
- Senate eFiling system
|
|
192
|
+
- House Financial Disclosure reports
|
|
193
|
+
- Senate Stock Watcher (GitHub dataset)
|
|
194
|
+
""")
|
|
195
|
+
|
|
196
|
+
with st.expander("**Q: How recent is the data?**"):
|
|
197
|
+
st.markdown("""
|
|
198
|
+
**A:** Data freshness depends on the source:
|
|
199
|
+
|
|
200
|
+
- **Senate Stock Watcher**: Updated daily from official sources
|
|
201
|
+
- **Manual scrapers**: Run on-demand for latest disclosures
|
|
202
|
+
- **Automated jobs**: Process new filings regularly
|
|
203
|
+
|
|
204
|
+
Note: Due to the 45-day disclosure requirement, trades are not real-time.
|
|
205
|
+
You're seeing what politicians bought/sold 1-6 weeks ago.
|
|
206
|
+
""")
|
|
207
|
+
|
|
208
|
+
with st.expander("**Q: Can I actually trade based on this data?**"):
|
|
209
|
+
st.markdown("""
|
|
210
|
+
**A:** Yes! The dashboard includes:
|
|
211
|
+
|
|
212
|
+
- **Paper Trading**: Practice with virtual money via Alpaca paper trading API
|
|
213
|
+
- **Real Trading Integration**: Configure real Alpaca account (at your own risk)
|
|
214
|
+
- **Portfolio Tracking**: Monitor your replicated politician portfolios
|
|
215
|
+
|
|
216
|
+
⚠️ **Important Disclaimers:**
|
|
217
|
+
- Past performance doesn't guarantee future results
|
|
218
|
+
- Politician trades are disclosed 45 days late
|
|
219
|
+
- This is for educational/informational purposes
|
|
220
|
+
- Always do your own research before investing
|
|
221
|
+
""")
|
|
222
|
+
|
|
223
|
+
with st.expander("**Q: Which politicians can I track?**"):
|
|
224
|
+
st.markdown("""
|
|
225
|
+
**A:** The dashboard tracks:
|
|
226
|
+
|
|
227
|
+
- All U.S. Senators
|
|
228
|
+
- All U.S. Representatives
|
|
229
|
+
- High-profile traders (Pelosi, McConnell, etc.)
|
|
230
|
+
- Committee members with oversight of industries
|
|
231
|
+
|
|
232
|
+
Search by name in the **Predictions** or **Scrapers & Logs** pages.
|
|
233
|
+
""")
|
|
234
|
+
|
|
235
|
+
with st.expander("**Q: How do the ML predictions work?**"):
|
|
236
|
+
st.markdown("""
|
|
237
|
+
**A:** The system uses multiple techniques:
|
|
238
|
+
|
|
239
|
+
1. **Historical Pattern Analysis**: Identifies successful trading patterns
|
|
240
|
+
2. **Feature Engineering**: Incorporates politician profile, committee assignments, transaction size
|
|
241
|
+
3. **Machine Learning Models**: Trains on historical data to predict outcomes
|
|
242
|
+
4. **Monte Carlo Simulation**: Models thousands of possible price paths
|
|
243
|
+
5. **Risk Metrics**: Calculates probability of profit, Value at Risk, confidence intervals
|
|
244
|
+
|
|
245
|
+
See the **Model Training & Evaluation** page for technical details.
|
|
246
|
+
""")
|
|
247
|
+
|
|
248
|
+
with st.expander("**Q: What data sources does this use?**"):
|
|
249
|
+
st.markdown("""
|
|
250
|
+
**A:** Multiple official and curated sources:
|
|
251
|
+
|
|
252
|
+
**Primary Sources:**
|
|
253
|
+
- Senate eFiling system (senate.gov)
|
|
254
|
+
- House Financial Disclosure (clerk.house.gov)
|
|
255
|
+
- Senate Stock Watcher GitHub (curated dataset)
|
|
256
|
+
|
|
257
|
+
**Supporting Data:**
|
|
258
|
+
- UK Companies House API (for UK company data)
|
|
259
|
+
- Yahoo Finance (for stock prices and fundamentals)
|
|
260
|
+
- Alpaca API (for trading and market data)
|
|
261
|
+
""")
|
|
262
|
+
|
|
263
|
+
with st.expander("**Q: Is my trading data private?**"):
|
|
264
|
+
st.markdown("""
|
|
265
|
+
**A:** Yes! This is a personal dashboard:
|
|
266
|
+
|
|
267
|
+
- Paper trading portfolios are stored locally or in your Supabase instance
|
|
268
|
+
- No trading data is shared publicly
|
|
269
|
+
- API keys are stored securely in Streamlit secrets
|
|
270
|
+
- You control your own data
|
|
271
|
+
""")
|
|
272
|
+
|
|
273
|
+
with st.expander("**Q: What if I find a bug or have a feature request?**"):
|
|
274
|
+
st.markdown("""
|
|
275
|
+
**A:** Contributions welcome!
|
|
276
|
+
|
|
277
|
+
- **Report bugs**: Open an issue on GitHub
|
|
278
|
+
- **Request features**: Submit feature requests
|
|
279
|
+
- **Contribute**: Pull requests accepted
|
|
280
|
+
- **Documentation**: Help improve the docs
|
|
281
|
+
|
|
282
|
+
This is an open-source project built for the community.
|
|
283
|
+
""")
|
|
284
|
+
|
|
285
|
+
with st.expander("**Q: Why are some pages showing errors or not loading?**"):
|
|
286
|
+
st.markdown("""
|
|
287
|
+
**A:** Some pages require optional dependencies that may not be installed:
|
|
288
|
+
|
|
289
|
+
**Common Issues:**
|
|
290
|
+
- **Trading Dashboard/Test Portfolio**: Requires `alpaca-py` package
|
|
291
|
+
- **Advanced ML pages**: May require `torch` or `pytorch-lightning` (not available on Streamlit Cloud)
|
|
292
|
+
|
|
293
|
+
**Troubleshooting:**
|
|
294
|
+
1. Check the error message displayed at the top of the dashboard
|
|
295
|
+
2. Visit the **Debug Dependencies** page for detailed diagnostics
|
|
296
|
+
3. The Debug page shows:
|
|
297
|
+
- Which packages are installed
|
|
298
|
+
- Detailed import error messages
|
|
299
|
+
- Python environment information
|
|
300
|
+
- Troubleshooting suggestions
|
|
301
|
+
|
|
302
|
+
**Note:** Most pages have graceful fallbacks and will work with demo data if dependencies are missing.
|
|
303
|
+
""")
|
|
304
|
+
|
|
305
|
+
vertical_space(2)
|
|
306
|
+
|
|
307
|
+
# Getting Started Actions
|
|
308
|
+
section_header(
|
|
309
|
+
"🎬 Ready to Get Started?",
|
|
310
|
+
"Choose your path",
|
|
311
|
+
divider="rainbow"
|
|
312
|
+
)
|
|
313
|
+
|
|
314
|
+
col1, col2, col3 = st.columns(3)
|
|
315
|
+
|
|
316
|
+
with col1:
|
|
317
|
+
st.markdown("""
|
|
318
|
+
### 🔍 **Explore Data**
|
|
319
|
+
Start by browsing recent politician trades
|
|
320
|
+
|
|
321
|
+
👉 Go to **Scrapers & Logs**
|
|
322
|
+
""")
|
|
323
|
+
if st.button("View Trading Data", key="btn_scrapers", use_container_width=True):
|
|
324
|
+
st.info("Navigate to 'Scrapers & Logs' in the sidebar →")
|
|
325
|
+
|
|
326
|
+
with col2:
|
|
327
|
+
st.markdown("""
|
|
328
|
+
### 📊 **Run Analysis**
|
|
329
|
+
See ML predictions and simulations
|
|
330
|
+
|
|
331
|
+
👉 Go to **Monte Carlo Predictions**
|
|
332
|
+
""")
|
|
333
|
+
if st.button("Analyze Stocks", key="btn_monte_carlo", use_container_width=True):
|
|
334
|
+
st.info("Navigate to 'Monte Carlo Predictions' in the sidebar →")
|
|
335
|
+
|
|
336
|
+
with col3:
|
|
337
|
+
st.markdown("""
|
|
338
|
+
### 💼 **Start Trading**
|
|
339
|
+
Create a paper trading portfolio
|
|
340
|
+
|
|
341
|
+
👉 Go to **Trading Dashboard**
|
|
342
|
+
""")
|
|
343
|
+
if st.button("Paper Trade", key="btn_trading", use_container_width=True):
|
|
344
|
+
st.info("Navigate to 'Trading Dashboard' in the sidebar →")
|
|
345
|
+
|
|
346
|
+
vertical_space(2)
|
|
347
|
+
|
|
348
|
+
# Disclaimers
|
|
349
|
+
st.markdown("---")
|
|
350
|
+
st.markdown("""
|
|
351
|
+
### ⚠️ Important Disclaimers
|
|
352
|
+
|
|
353
|
+
- **Not Financial Advice**: This tool is for educational and informational purposes only
|
|
354
|
+
- **Do Your Research**: Always conduct your own due diligence before investing
|
|
355
|
+
- **Risk Warning**: All investments carry risk. Past performance doesn't guarantee future results
|
|
356
|
+
- **Delayed Data**: Politician trades are disclosed 45 days after execution
|
|
357
|
+
- **No Guarantees**: ML predictions are probabilistic, not certainties
|
|
358
|
+
- **Paper Trading**: Practice with virtual money before risking real capital
|
|
359
|
+
|
|
360
|
+
**Legal Note**: All data comes from public sources. This dashboard aggregates
|
|
361
|
+
publicly disclosed information under the STOCK Act and is compliant with all regulations.
|
|
362
|
+
""")
|
|
363
|
+
|
|
364
|
+
vertical_space(1)
|
|
365
|
+
|
|
366
|
+
# Footer
|
|
367
|
+
st.markdown("""
|
|
368
|
+
<div style='text-align: center; color: #666; padding: 2rem 0;'>
|
|
369
|
+
<p>Built with ❤️ for transparent government and informed investing</p>
|
|
370
|
+
<p style='font-size: 0.9rem;'>
|
|
371
|
+
Data sources: Senate.gov • House.gov • Senate Stock Watcher • Yahoo Finance
|
|
372
|
+
</p>
|
|
373
|
+
</div>
|
|
374
|
+
""", unsafe_allow_html=True)
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
if __name__ == "__main__":
|
|
378
|
+
show_overview()
|
|
@@ -21,23 +21,37 @@ except ImportError:
|
|
|
21
21
|
from components.charts import create_timeline_chart, render_chart
|
|
22
22
|
from components.tables import display_filterable_dataframe, export_dataframe
|
|
23
23
|
|
|
24
|
-
# Import real data functions from
|
|
24
|
+
# Import real data functions from utils
|
|
25
25
|
try:
|
|
26
|
-
|
|
27
|
-
from ..app_integrated import (
|
|
26
|
+
from ..utils import (
|
|
28
27
|
get_supabase_client,
|
|
29
28
|
get_disclosures_data,
|
|
30
|
-
run_ml_pipeline,
|
|
31
29
|
get_politician_names,
|
|
32
30
|
get_politician_trading_history,
|
|
33
|
-
engineer_features,
|
|
34
|
-
generate_production_prediction
|
|
35
31
|
)
|
|
36
32
|
HAS_REAL_DATA = True
|
|
37
33
|
except ImportError:
|
|
38
34
|
HAS_REAL_DATA = False
|
|
39
35
|
st.warning("⚠️ Real data functions not available. Using fallback mode.")
|
|
40
36
|
|
|
37
|
+
# Fallback functions for missing imports
|
|
38
|
+
def run_ml_pipeline(df_disclosures):
|
|
39
|
+
"""Fallback ML pipeline function"""
|
|
40
|
+
return df_disclosures
|
|
41
|
+
|
|
42
|
+
def engineer_features(df):
|
|
43
|
+
"""Fallback feature engineering function"""
|
|
44
|
+
return df
|
|
45
|
+
|
|
46
|
+
def generate_production_prediction(df, features, trading_history):
|
|
47
|
+
"""Fallback prediction function"""
|
|
48
|
+
import random
|
|
49
|
+
return {
|
|
50
|
+
'predicted_return': random.uniform(-0.1, 0.1),
|
|
51
|
+
'confidence': random.uniform(0.5, 0.9),
|
|
52
|
+
'recommendation': random.choice(['BUY', 'SELL', 'HOLD'])
|
|
53
|
+
}
|
|
54
|
+
|
|
41
55
|
|
|
42
56
|
def generate_mock_predictions(num_predictions: int = 50) -> pd.DataFrame:
|
|
43
57
|
"""Generate mock prediction data for demonstration"""
|
|
@@ -32,6 +32,9 @@ logger = logging.getLogger(__name__)
|
|
|
32
32
|
def show_scrapers_and_logs():
|
|
33
33
|
"""Main function for scrapers and logs page"""
|
|
34
34
|
st.header("🔍 Data Scrapers & System Logs")
|
|
35
|
+
|
|
36
|
+
# Add a simple test to ensure the page is rendering
|
|
37
|
+
st.info("📋 Page loaded successfully - Scrapers & Logs functionality is available")
|
|
35
38
|
|
|
36
39
|
st.markdown("""
|
|
37
40
|
**Features:**
|
|
@@ -912,10 +915,18 @@ def show_system_logs():
|
|
|
912
915
|
except Exception as e:
|
|
913
916
|
st.error(f"Error reading log file: {e}")
|
|
914
917
|
else:
|
|
915
|
-
st.info(
|
|
918
|
+
st.info("📋 **No logs available yet**")
|
|
919
|
+
st.markdown("""
|
|
920
|
+
System logs will appear here automatically after scraping jobs run.
|
|
921
|
+
|
|
922
|
+
**To generate logs:**
|
|
923
|
+
- Use the "Manual Scrapers" section above to run a data pull
|
|
924
|
+
- Wait for automated jobs to execute
|
|
925
|
+
- Logs will be stored in: `/tmp/seed_database.log`
|
|
926
|
+
""")
|
|
916
927
|
|
|
917
928
|
# Create example logs display
|
|
918
|
-
st.markdown("### Example Log Output")
|
|
929
|
+
st.markdown("### 📝 Example Log Output")
|
|
919
930
|
st.code("""
|
|
920
931
|
2025-10-07 12:00:00 - INFO - Starting data pull job: senate_watcher_seed
|
|
921
932
|
2025-10-07 12:00:05 - INFO - Fetched 8350 Senate transactions
|
|
@@ -975,7 +986,7 @@ def show_job_history():
|
|
|
975
986
|
names=job_type_counts.index,
|
|
976
987
|
title="Jobs by Type"
|
|
977
988
|
)
|
|
978
|
-
st.plotly_chart(fig, use_container_width=True)
|
|
989
|
+
st.plotly_chart(fig, config={"displayModeBar": True}, use_container_width=True)
|
|
979
990
|
|
|
980
991
|
# Status breakdown
|
|
981
992
|
st.markdown("### Status Breakdown")
|
|
@@ -988,7 +999,7 @@ def show_job_history():
|
|
|
988
999
|
labels={'x': 'Status', 'y': 'Count'},
|
|
989
1000
|
title="Jobs by Status"
|
|
990
1001
|
)
|
|
991
|
-
st.plotly_chart(fig, use_container_width=True)
|
|
1002
|
+
st.plotly_chart(fig, config={"displayModeBar": True}, use_container_width=True)
|
|
992
1003
|
|
|
993
1004
|
# Timeline
|
|
994
1005
|
st.markdown("### Job Timeline")
|
|
@@ -1004,7 +1015,7 @@ def show_job_history():
|
|
|
1004
1015
|
color='status',
|
|
1005
1016
|
title="Jobs Over Time"
|
|
1006
1017
|
)
|
|
1007
|
-
st.plotly_chart(fig, use_container_width=True)
|
|
1018
|
+
st.plotly_chart(fig, config={"displayModeBar": True}, use_container_width=True)
|
|
1008
1019
|
|
|
1009
1020
|
# Records processed
|
|
1010
1021
|
st.markdown("### Records Processed")
|
|
@@ -1042,7 +1053,7 @@ def show_job_history():
|
|
|
1042
1053
|
hovermode='x unified'
|
|
1043
1054
|
)
|
|
1044
1055
|
|
|
1045
|
-
st.plotly_chart(fig, use_container_width=True)
|
|
1056
|
+
st.plotly_chart(fig, config={"displayModeBar": True}, use_container_width=True)
|
|
1046
1057
|
|
|
1047
1058
|
else:
|
|
1048
1059
|
st.info("No job history available yet. Run some scraping jobs to see statistics here.")
|
|
@@ -1058,3 +1069,8 @@ def show_job_history():
|
|
|
1058
1069
|
|
|
1059
1070
|
# Export for use in main dashboard
|
|
1060
1071
|
__all__ = ["show_scrapers_and_logs"]
|
|
1072
|
+
|
|
1073
|
+
|
|
1074
|
+
# Module-level execution only when run directly (not when imported)
|
|
1075
|
+
if __name__ == "__main__":
|
|
1076
|
+
show_scrapers_and_logs()
|