mcli-framework 7.10.1__py3-none-any.whl → 7.11.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.

Files changed (43) hide show
  1. mcli/app/commands_cmd.py +150 -58
  2. mcli/app/main.py +21 -27
  3. mcli/lib/custom_commands.py +62 -12
  4. mcli/lib/optional_deps.py +240 -0
  5. mcli/lib/paths.py +129 -5
  6. mcli/self/migrate_cmd.py +261 -0
  7. mcli/self/self_cmd.py +8 -0
  8. mcli/workflow/git_commit/ai_service.py +13 -2
  9. mcli/workflow/notebook/__init__.py +16 -0
  10. mcli/workflow/notebook/converter.py +375 -0
  11. mcli/workflow/notebook/notebook_cmd.py +441 -0
  12. mcli/workflow/notebook/schema.py +402 -0
  13. mcli/workflow/notebook/validator.py +313 -0
  14. mcli/workflow/secrets/__init__.py +4 -0
  15. mcli/workflow/secrets/secrets_cmd.py +192 -0
  16. mcli/workflow/workflow.py +35 -5
  17. {mcli_framework-7.10.1.dist-info → mcli_framework-7.11.0.dist-info}/METADATA +86 -55
  18. {mcli_framework-7.10.1.dist-info → mcli_framework-7.11.0.dist-info}/RECORD +22 -34
  19. mcli/ml/features/political_features.py +0 -677
  20. mcli/ml/preprocessing/politician_trading_preprocessor.py +0 -570
  21. mcli/workflow/politician_trading/__init__.py +0 -4
  22. mcli/workflow/politician_trading/config.py +0 -134
  23. mcli/workflow/politician_trading/connectivity.py +0 -492
  24. mcli/workflow/politician_trading/data_sources.py +0 -654
  25. mcli/workflow/politician_trading/database.py +0 -412
  26. mcli/workflow/politician_trading/demo.py +0 -249
  27. mcli/workflow/politician_trading/models.py +0 -327
  28. mcli/workflow/politician_trading/monitoring.py +0 -413
  29. mcli/workflow/politician_trading/scrapers.py +0 -1074
  30. mcli/workflow/politician_trading/scrapers_california.py +0 -434
  31. mcli/workflow/politician_trading/scrapers_corporate_registry.py +0 -797
  32. mcli/workflow/politician_trading/scrapers_eu.py +0 -376
  33. mcli/workflow/politician_trading/scrapers_free_sources.py +0 -509
  34. mcli/workflow/politician_trading/scrapers_third_party.py +0 -373
  35. mcli/workflow/politician_trading/scrapers_uk.py +0 -378
  36. mcli/workflow/politician_trading/scrapers_us_states.py +0 -471
  37. mcli/workflow/politician_trading/seed_database.py +0 -520
  38. mcli/workflow/politician_trading/supabase_functions.py +0 -354
  39. mcli/workflow/politician_trading/workflow.py +0 -879
  40. {mcli_framework-7.10.1.dist-info → mcli_framework-7.11.0.dist-info}/WHEEL +0 -0
  41. {mcli_framework-7.10.1.dist-info → mcli_framework-7.11.0.dist-info}/entry_points.txt +0 -0
  42. {mcli_framework-7.10.1.dist-info → mcli_framework-7.11.0.dist-info}/licenses/LICENSE +0 -0
  43. {mcli_framework-7.10.1.dist-info → mcli_framework-7.11.0.dist-info}/top_level.txt +0 -0
@@ -1,327 +0,0 @@
1
- """
2
- Data models for politician trading information
3
- """
4
-
5
- from dataclasses import dataclass, field
6
- from datetime import datetime
7
- from decimal import Decimal
8
- from enum import Enum
9
- from typing import Any, Dict, List, Optional
10
-
11
-
12
- class PoliticianRole(Enum):
13
- """Political roles"""
14
-
15
- US_HOUSE_REP = "us_house_representative"
16
- US_SENATOR = "us_senator"
17
- UK_MP = "uk_member_of_parliament"
18
- EU_MEP = "eu_parliament_member"
19
- EU_COMMISSIONER = "eu_commissioner"
20
- EU_COUNCIL_MEMBER = "eu_council_member"
21
-
22
- # EU Member State Roles
23
- GERMAN_BUNDESTAG = "german_bundestag_member"
24
- FRENCH_DEPUTY = "french_national_assembly_deputy"
25
- ITALIAN_DEPUTY = "italian_chamber_deputy"
26
- ITALIAN_SENATOR = "italian_senate_member"
27
- SPANISH_DEPUTY = "spanish_congress_deputy"
28
- DUTCH_MP = "dutch_tweede_kamer_member"
29
-
30
- # US State Roles
31
- TEXAS_STATE_OFFICIAL = "texas_state_official"
32
- NEW_YORK_STATE_OFFICIAL = "new_york_state_official"
33
- FLORIDA_STATE_OFFICIAL = "florida_state_official"
34
- ILLINOIS_STATE_OFFICIAL = "illinois_state_official"
35
- PENNSYLVANIA_STATE_OFFICIAL = "pennsylvania_state_official"
36
- MASSACHUSETTS_STATE_OFFICIAL = "massachusetts_state_official"
37
- CALIFORNIA_STATE_OFFICIAL = "california_state_official"
38
-
39
-
40
- class TransactionType(Enum):
41
- """Types of financial transactions"""
42
-
43
- PURCHASE = "purchase"
44
- SALE = "sale"
45
- EXCHANGE = "exchange"
46
- OPTION_PURCHASE = "option_purchase"
47
- OPTION_SALE = "option_sale"
48
-
49
-
50
- class DisclosureStatus(Enum):
51
- """Status of disclosure processing"""
52
-
53
- PENDING = "pending"
54
- PROCESSED = "processed"
55
- FAILED = "failed"
56
- DUPLICATE = "duplicate"
57
-
58
-
59
- @dataclass
60
- class Politician:
61
- """Politician information"""
62
-
63
- id: Optional[str] = None
64
- first_name: str = ""
65
- last_name: str = ""
66
- full_name: str = ""
67
- role: str = "House" # Can be string or PoliticianRole enum
68
- party: str = ""
69
- state_or_country: str = ""
70
- district: Optional[str] = None
71
- term_start: Optional[datetime] = None
72
- term_end: Optional[datetime] = None
73
-
74
- # External identifiers
75
- bioguide_id: Optional[str] = None # US Congress bioguide ID
76
- eu_id: Optional[str] = None # EU Parliament ID
77
-
78
- created_at: datetime = field(default_factory=datetime.utcnow)
79
- updated_at: datetime = field(default_factory=datetime.utcnow)
80
-
81
-
82
- @dataclass
83
- class TradingDisclosure:
84
- """Individual trading disclosure"""
85
-
86
- id: Optional[str] = None
87
- politician_id: str = ""
88
- politician_bioguide_id: Optional[str] = None # For lookups before politician_id is assigned
89
-
90
- # Transaction details
91
- transaction_date: datetime = field(default_factory=datetime.utcnow)
92
- disclosure_date: datetime = field(default_factory=datetime.utcnow)
93
- transaction_type: TransactionType = TransactionType.PURCHASE
94
-
95
- # Asset information
96
- asset_name: str = ""
97
- asset_ticker: Optional[str] = None
98
- asset_type: str = "" # stock, bond, option, etc.
99
-
100
- # Financial details
101
- amount_range_min: Optional[Decimal] = None
102
- amount_range_max: Optional[Decimal] = None
103
- amount_exact: Optional[Decimal] = None
104
-
105
- # Source information
106
- source_url: str = ""
107
- source_document_id: Optional[str] = None
108
- raw_data: Dict[str, Any] = field(default_factory=dict)
109
-
110
- # Processing status
111
- status: DisclosureStatus = DisclosureStatus.PENDING
112
- processing_notes: str = ""
113
-
114
- created_at: datetime = field(default_factory=datetime.utcnow)
115
- updated_at: datetime = field(default_factory=datetime.utcnow)
116
-
117
-
118
- @dataclass
119
- class DataPullJob:
120
- """Information about data pull jobs"""
121
-
122
- id: Optional[str] = None
123
- job_type: str = "" # "us_congress", "eu_parliament", etc.
124
- status: str = "pending" # pending, running, completed, failed
125
-
126
- started_at: Optional[datetime] = None
127
- completed_at: Optional[datetime] = None
128
-
129
- # Results
130
- records_found: int = 0
131
- records_processed: int = 0
132
- records_new: int = 0
133
- records_updated: int = 0
134
- records_failed: int = 0
135
-
136
- # Error information
137
- error_message: Optional[str] = None
138
- error_details: Dict[str, Any] = field(default_factory=dict)
139
-
140
- # Configuration used
141
- config_snapshot: Dict[str, Any] = field(default_factory=dict)
142
-
143
- created_at: datetime = field(default_factory=datetime.utcnow)
144
-
145
-
146
- @dataclass
147
- class DataSource:
148
- """Information about data sources"""
149
-
150
- id: Optional[str] = None
151
- name: str = ""
152
- url: str = ""
153
- source_type: str = "" # "official", "aggregator", "api"
154
- region: str = "" # "us", "eu"
155
-
156
- # Status tracking
157
- is_active: bool = True
158
- last_successful_pull: Optional[datetime] = None
159
- last_attempt: Optional[datetime] = None
160
- consecutive_failures: int = 0
161
-
162
- # Configuration
163
- request_config: Dict[str, Any] = field(default_factory=dict)
164
-
165
- created_at: datetime = field(default_factory=datetime.utcnow)
166
- updated_at: datetime = field(default_factory=datetime.utcnow)
167
-
168
-
169
- # =============================================================================
170
- # Corporate Registry Models
171
- # =============================================================================
172
-
173
-
174
- @dataclass
175
- class Company:
176
- """Corporate registry company information"""
177
-
178
- id: Optional[str] = None
179
- company_number: str = "" # Registration number in jurisdiction
180
- company_name: str = ""
181
- jurisdiction: str = "" # Country/region code (e.g., "GB", "US", "FR")
182
-
183
- # Company details
184
- company_type: Optional[str] = None
185
- status: str = "active" # active, dissolved, liquidation, etc.
186
- incorporation_date: Optional[datetime] = None
187
- registered_address: Optional[str] = None
188
-
189
- # Business information
190
- sic_codes: List[str] = field(default_factory=list) # Standard Industrial Classification
191
- nature_of_business: Optional[str] = None
192
-
193
- # Source information
194
- source: str = "" # "uk_companies_house", "opencorporates", etc.
195
- source_url: Optional[str] = None
196
- raw_data: Dict[str, Any] = field(default_factory=dict)
197
-
198
- created_at: datetime = field(default_factory=datetime.utcnow)
199
- updated_at: datetime = field(default_factory=datetime.utcnow)
200
-
201
-
202
- @dataclass
203
- class CompanyOfficer:
204
- """Company officer/director information"""
205
-
206
- id: Optional[str] = None
207
- company_id: str = "" # Foreign key to Company
208
-
209
- # Officer details
210
- name: str = ""
211
- officer_role: str = "" # director, secretary, etc.
212
- appointed_on: Optional[datetime] = None
213
- resigned_on: Optional[datetime] = None
214
-
215
- # Personal details (may be limited by privacy laws)
216
- nationality: Optional[str] = None
217
- occupation: Optional[str] = None
218
- country_of_residence: Optional[str] = None
219
- date_of_birth: Optional[datetime] = None # Often only month/year available
220
-
221
- # Address (often redacted for privacy)
222
- address: Optional[str] = None
223
-
224
- # Source information
225
- source: str = ""
226
- raw_data: Dict[str, Any] = field(default_factory=dict)
227
-
228
- created_at: datetime = field(default_factory=datetime.utcnow)
229
- updated_at: datetime = field(default_factory=datetime.utcnow)
230
-
231
-
232
- @dataclass
233
- class PersonWithSignificantControl:
234
- """Person with significant control (PSC) - UK Companies House"""
235
-
236
- id: Optional[str] = None
237
- company_id: str = "" # Foreign key to Company
238
-
239
- # PSC details
240
- name: str = ""
241
- kind: str = (
242
- "" # individual-person-with-significant-control, corporate-entity-person-with-significant-control, etc.
243
- )
244
-
245
- # Control nature
246
- natures_of_control: List[str] = field(
247
- default_factory=list
248
- ) # ownership-of-shares-75-to-100-percent, etc.
249
- notified_on: Optional[datetime] = None
250
-
251
- # Personal details (may be redacted)
252
- nationality: Optional[str] = None
253
- country_of_residence: Optional[str] = None
254
- date_of_birth: Optional[datetime] = None # Usually only month/year
255
-
256
- # Address
257
- address: Optional[str] = None
258
-
259
- # Source information
260
- source: str = ""
261
- raw_data: Dict[str, Any] = field(default_factory=dict)
262
-
263
- created_at: datetime = field(default_factory=datetime.utcnow)
264
- updated_at: datetime = field(default_factory=datetime.utcnow)
265
-
266
-
267
- @dataclass
268
- class FinancialPublication:
269
- """Financial publication/disclosure (e.g., France Info-Financière)"""
270
-
271
- id: Optional[str] = None
272
- publication_id: str = "" # Source publication ID
273
-
274
- # Publication details
275
- title: str = ""
276
- publication_type: str = "" # prospectus, annual-report, regulatory-filing, etc.
277
- publication_date: datetime = field(default_factory=datetime.utcnow)
278
-
279
- # Issuer/company
280
- issuer_name: Optional[str] = None
281
- issuer_id: Optional[str] = None # LEI, ISIN, or other identifier
282
- company_id: Optional[str] = None # Foreign key to Company (if linked)
283
-
284
- # Document information
285
- document_url: Optional[str] = None
286
- document_format: Optional[str] = None # pdf, html, xml
287
- language: Optional[str] = None
288
-
289
- # Source information
290
- source: str = "" # "info_financiere", "xbrl_filings", etc.
291
- jurisdiction: str = ""
292
- raw_data: Dict[str, Any] = field(default_factory=dict)
293
-
294
- created_at: datetime = field(default_factory=datetime.utcnow)
295
- updated_at: datetime = field(default_factory=datetime.utcnow)
296
-
297
-
298
- @dataclass
299
- class XBRLFiling:
300
- """XBRL financial statement filing"""
301
-
302
- id: Optional[str] = None
303
- filing_id: str = "" # Source filing ID
304
-
305
- # Filing details
306
- entity_name: str = ""
307
- entity_id: Optional[str] = None # LEI or other identifier
308
- company_id: Optional[str] = None # Foreign key to Company (if linked)
309
-
310
- # Filing information
311
- filing_date: datetime = field(default_factory=datetime.utcnow)
312
- period_start: Optional[datetime] = None
313
- period_end: Optional[datetime] = None
314
- fiscal_year: Optional[int] = None
315
- fiscal_period: Optional[str] = None # Q1, Q2, FY, etc.
316
-
317
- # Document
318
- document_url: Optional[str] = None
319
- taxonomy: Optional[str] = None # ESEF, UKSEF, US-GAAP, etc.
320
-
321
- # Source information
322
- source: str = "" # "xbrl_filings", "xbrl_us", etc.
323
- jurisdiction: str = ""
324
- raw_data: Dict[str, Any] = field(default_factory=dict)
325
-
326
- created_at: datetime = field(default_factory=datetime.utcnow)
327
- updated_at: datetime = field(default_factory=datetime.utcnow)