mcli-framework 7.1.3__py3-none-any.whl → 7.3.1__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 (114) hide show
  1. mcli/__init__.py +160 -0
  2. mcli/__main__.py +14 -0
  3. mcli/app/__init__.py +23 -0
  4. mcli/app/main.py +10 -0
  5. mcli/app/model/__init__.py +0 -0
  6. mcli/app/video/__init__.py +5 -0
  7. mcli/chat/__init__.py +34 -0
  8. mcli/lib/__init__.py +0 -0
  9. mcli/lib/api/__init__.py +0 -0
  10. mcli/lib/auth/__init__.py +1 -0
  11. mcli/lib/config/__init__.py +1 -0
  12. mcli/lib/custom_commands.py +424 -0
  13. mcli/lib/erd/__init__.py +25 -0
  14. mcli/lib/files/__init__.py +0 -0
  15. mcli/lib/fs/__init__.py +1 -0
  16. mcli/lib/logger/__init__.py +3 -0
  17. mcli/lib/paths.py +12 -0
  18. mcli/lib/performance/__init__.py +17 -0
  19. mcli/lib/pickles/__init__.py +1 -0
  20. mcli/lib/shell/__init__.py +0 -0
  21. mcli/lib/toml/__init__.py +1 -0
  22. mcli/lib/watcher/__init__.py +0 -0
  23. mcli/ml/__init__.py +16 -0
  24. mcli/ml/api/__init__.py +30 -0
  25. mcli/ml/api/routers/__init__.py +27 -0
  26. mcli/ml/api/schemas.py +2 -2
  27. mcli/ml/auth/__init__.py +45 -0
  28. mcli/ml/auth/models.py +2 -2
  29. mcli/ml/backtesting/__init__.py +39 -0
  30. mcli/ml/cli/__init__.py +5 -0
  31. mcli/ml/cli/main.py +1 -1
  32. mcli/ml/config/__init__.py +33 -0
  33. mcli/ml/configs/__init__.py +16 -0
  34. mcli/ml/dashboard/__init__.py +12 -0
  35. mcli/ml/dashboard/app.py +13 -13
  36. mcli/ml/dashboard/app_integrated.py +1309 -148
  37. mcli/ml/dashboard/app_supabase.py +46 -21
  38. mcli/ml/dashboard/app_training.py +14 -14
  39. mcli/ml/dashboard/components/__init__.py +7 -0
  40. mcli/ml/dashboard/components/charts.py +258 -0
  41. mcli/ml/dashboard/components/metrics.py +125 -0
  42. mcli/ml/dashboard/components/tables.py +228 -0
  43. mcli/ml/dashboard/pages/__init__.py +6 -0
  44. mcli/ml/dashboard/pages/cicd.py +382 -0
  45. mcli/ml/dashboard/pages/predictions_enhanced.py +834 -0
  46. mcli/ml/dashboard/pages/scrapers_and_logs.py +1060 -0
  47. mcli/ml/dashboard/pages/test_portfolio.py +373 -0
  48. mcli/ml/dashboard/pages/trading.py +714 -0
  49. mcli/ml/dashboard/pages/workflows.py +533 -0
  50. mcli/ml/dashboard/utils.py +154 -0
  51. mcli/ml/data_ingestion/__init__.py +39 -0
  52. mcli/ml/database/__init__.py +47 -0
  53. mcli/ml/experimentation/__init__.py +29 -0
  54. mcli/ml/features/__init__.py +39 -0
  55. mcli/ml/mlops/__init__.py +33 -0
  56. mcli/ml/models/__init__.py +94 -0
  57. mcli/ml/monitoring/__init__.py +25 -0
  58. mcli/ml/optimization/__init__.py +27 -0
  59. mcli/ml/predictions/__init__.py +5 -0
  60. mcli/ml/preprocessing/__init__.py +28 -0
  61. mcli/ml/scripts/__init__.py +1 -0
  62. mcli/ml/trading/__init__.py +60 -0
  63. mcli/ml/trading/alpaca_client.py +353 -0
  64. mcli/ml/trading/migrations.py +164 -0
  65. mcli/ml/trading/models.py +418 -0
  66. mcli/ml/trading/paper_trading.py +326 -0
  67. mcli/ml/trading/risk_management.py +370 -0
  68. mcli/ml/trading/trading_service.py +480 -0
  69. mcli/ml/training/__init__.py +10 -0
  70. mcli/ml/training/train_model.py +569 -0
  71. mcli/mygroup/__init__.py +3 -0
  72. mcli/public/__init__.py +1 -0
  73. mcli/public/commands/__init__.py +2 -0
  74. mcli/self/__init__.py +3 -0
  75. mcli/self/self_cmd.py +579 -91
  76. mcli/workflow/__init__.py +0 -0
  77. mcli/workflow/daemon/__init__.py +15 -0
  78. mcli/workflow/daemon/daemon.py +21 -3
  79. mcli/workflow/dashboard/__init__.py +5 -0
  80. mcli/workflow/docker/__init__.py +0 -0
  81. mcli/workflow/file/__init__.py +0 -0
  82. mcli/workflow/gcloud/__init__.py +1 -0
  83. mcli/workflow/git_commit/__init__.py +0 -0
  84. mcli/workflow/interview/__init__.py +0 -0
  85. mcli/workflow/politician_trading/__init__.py +4 -0
  86. mcli/workflow/politician_trading/data_sources.py +259 -1
  87. mcli/workflow/politician_trading/models.py +159 -1
  88. mcli/workflow/politician_trading/scrapers_corporate_registry.py +846 -0
  89. mcli/workflow/politician_trading/scrapers_free_sources.py +516 -0
  90. mcli/workflow/politician_trading/scrapers_third_party.py +391 -0
  91. mcli/workflow/politician_trading/seed_database.py +539 -0
  92. mcli/workflow/registry/__init__.py +0 -0
  93. mcli/workflow/repo/__init__.py +0 -0
  94. mcli/workflow/scheduler/__init__.py +25 -0
  95. mcli/workflow/search/__init__.py +0 -0
  96. mcli/workflow/sync/__init__.py +5 -0
  97. mcli/workflow/videos/__init__.py +1 -0
  98. mcli/workflow/wakatime/__init__.py +80 -0
  99. mcli/workflow/workflow.py +8 -27
  100. {mcli_framework-7.1.3.dist-info → mcli_framework-7.3.1.dist-info}/METADATA +3 -1
  101. {mcli_framework-7.1.3.dist-info → mcli_framework-7.3.1.dist-info}/RECORD +105 -29
  102. mcli/workflow/daemon/api_daemon.py +0 -800
  103. mcli/workflow/daemon/commands.py +0 -1196
  104. mcli/workflow/dashboard/dashboard_cmd.py +0 -120
  105. mcli/workflow/file/file.py +0 -100
  106. mcli/workflow/git_commit/commands.py +0 -430
  107. mcli/workflow/politician_trading/commands.py +0 -1939
  108. mcli/workflow/scheduler/commands.py +0 -493
  109. mcli/workflow/sync/sync_cmd.py +0 -437
  110. mcli/workflow/videos/videos.py +0 -242
  111. {mcli_framework-7.1.3.dist-info → mcli_framework-7.3.1.dist-info}/WHEEL +0 -0
  112. {mcli_framework-7.1.3.dist-info → mcli_framework-7.3.1.dist-info}/entry_points.txt +0 -0
  113. {mcli_framework-7.1.3.dist-info → mcli_framework-7.3.1.dist-info}/licenses/LICENSE +0 -0
  114. {mcli_framework-7.1.3.dist-info → mcli_framework-7.3.1.dist-info}/top_level.txt +0 -0
File without changes
@@ -0,0 +1,15 @@
1
+ """
2
+ Daemon service for command management and execution.
3
+
4
+ This module provides a background daemon service that can store, manage, and execute
5
+ commands written in various programming languages (Python, Node.js, Lua, Shell).
6
+ Commands are stored in a SQLite database with embeddings for similarity search and
7
+ hierarchical grouping.
8
+
9
+ The daemon CLI commands are now loaded from portable JSON files in ~/.mcli/commands/
10
+ """
11
+
12
+ from .daemon import Command, CommandExecutor, DaemonService
13
+
14
+ # Export main components
15
+ __all__ = ["Command", "CommandExecutor", "DaemonService"]
@@ -16,17 +16,35 @@ import click
16
16
  import psutil
17
17
  from sklearn.feature_extraction.text import TfidfVectorizer
18
18
  from sklearn.metrics.pairwise import cosine_similarity
19
- from watchdog.events import FileSystemEventHandler
20
- from watchdog.observers import Observer
19
+
20
+ try:
21
+ from watchdog.events import FileSystemEventHandler
22
+ from watchdog.observers import Observer
23
+ HAS_WATCHDOG = True
24
+ except ImportError:
25
+ # Watchdog not available, file watching will be disabled
26
+ HAS_WATCHDOG = False
27
+ FileSystemEventHandler = object # Stub for inheritance
28
+ Observer = None
21
29
 
22
30
  # Import existing utilities
23
31
  from mcli.lib.logger.logger import get_logger
24
32
  from mcli.lib.toml.toml import read_from_toml
25
- from mcli.workflow.daemon.commands import CommandDatabase
26
33
 
27
34
  logger = get_logger(__name__)
28
35
 
29
36
 
37
+ # Stub CommandDatabase for backward compatibility
38
+ # Commands are now managed via JSON files in ~/.mcli/commands/
39
+ class CommandDatabase:
40
+ """Stub database for backward compatibility.
41
+ Commands are now stored as JSON files and loaded via the custom commands system.
42
+ """
43
+ def __init__(self, db_path: Optional[str] = None):
44
+ logger.debug("CommandDatabase stub initialized - commands now managed via JSON files")
45
+ pass
46
+
47
+
30
48
  @dataclass
31
49
  class Command:
32
50
  """Represents a stored command"""
@@ -0,0 +1,5 @@
1
+ """Dashboard workflow module."""
2
+
3
+ from .dashboard_cmd import dashboard
4
+
5
+ __all__ = ["dashboard"]
File without changes
File without changes
@@ -0,0 +1 @@
1
+ from .gcloud import gcloud
File without changes
File without changes
@@ -0,0 +1,4 @@
1
+ """
2
+ Politician Trading Data Workflow
3
+ Tracks publicly available trading information for US and EU politicians
4
+ """
@@ -297,6 +297,20 @@ EU_NATIONAL_SOURCES = [
297
297
  # =============================================================================
298
298
 
299
299
  THIRD_PARTY_SOURCES = [
300
+ DataSource(
301
+ name="Senate Stock Watcher (GitHub)",
302
+ jurisdiction="US-Federal",
303
+ institution="Third-party aggregator",
304
+ url="https://github.com/timothycarambat/senate-stock-watcher-data",
305
+ disclosure_types=[DisclosureType.STOCK_TRANSACTIONS],
306
+ access_method=AccessMethod.API,
307
+ update_frequency="Continuously updated from Senate filings",
308
+ data_format="json",
309
+ api_key_required=False,
310
+ rate_limits="GitHub rate limits",
311
+ notes="FREE! Automated aggregation of Senate PTR filings. JSON dataset updated continuously. All historical data available in all_transactions.json. No API key required!",
312
+ status="active",
313
+ ),
300
314
  DataSource(
301
315
  name="OpenSecrets Personal Finances",
302
316
  jurisdiction="US-Federal",
@@ -327,6 +341,20 @@ THIRD_PARTY_SOURCES = [
327
341
  name="QuiverQuant Congressional Trading",
328
342
  jurisdiction="US-Federal",
329
343
  institution="Third-party aggregator",
344
+ url="https://www.quiverquant.com/congresstrading/",
345
+ disclosure_types=[DisclosureType.STOCK_TRANSACTIONS],
346
+ access_method=AccessMethod.WEB_SCRAPING,
347
+ update_frequency="Real-time",
348
+ data_format="html",
349
+ api_key_required=False,
350
+ rate_limits="Web scraping rate limits apply",
351
+ notes="Financial data company focusing on congressional stock trades. Web interface with trade details, filing dates, and performance metrics. Premium API available.",
352
+ status="active",
353
+ ),
354
+ DataSource(
355
+ name="QuiverQuant API",
356
+ jurisdiction="US-Federal",
357
+ institution="Third-party aggregator",
330
358
  url="https://api.quiverquant.com/beta/live/congresstrading",
331
359
  disclosure_types=[DisclosureType.STOCK_TRANSACTIONS],
332
360
  access_method=AccessMethod.API,
@@ -334,7 +362,236 @@ THIRD_PARTY_SOURCES = [
334
362
  data_format="json",
335
363
  api_key_required=True,
336
364
  rate_limits="Varies by subscription",
337
- notes="Financial data company focusing on congressional stock trades.",
365
+ notes="Premium API for QuiverQuant congressional trading data. Requires subscription.",
366
+ status="active",
367
+ ),
368
+ DataSource(
369
+ name="StockNear Politicians",
370
+ jurisdiction="US-Federal",
371
+ institution="Third-party aggregator",
372
+ url="https://stocknear.com/politicians",
373
+ disclosure_types=[DisclosureType.STOCK_TRANSACTIONS],
374
+ access_method=AccessMethod.WEB_SCRAPING,
375
+ update_frequency="Real-time",
376
+ data_format="html",
377
+ api_key_required=False,
378
+ notes="Tracks 299 politicians with trade counts, districts, last trade dates, and party affiliation. Pro subscription for unlimited access.",
379
+ status="active",
380
+ ),
381
+ DataSource(
382
+ name="Barchart Politician Insider Trading",
383
+ jurisdiction="US-Federal",
384
+ institution="Third-party aggregator",
385
+ url="https://www.barchart.com/investing-ideas/politician-insider-trading",
386
+ disclosure_types=[DisclosureType.STOCK_TRANSACTIONS],
387
+ access_method=AccessMethod.WEB_SCRAPING,
388
+ update_frequency="Updated within 45 days of transaction",
389
+ data_format="html",
390
+ threshold_amount=None,
391
+ notes="Tracks House and Senate trades from last 60 days. Includes buy/sell counts and transaction totals. CSV export available.",
392
+ status="active",
393
+ ),
394
+ DataSource(
395
+ name="ProPublica Congress API",
396
+ jurisdiction="US-Federal",
397
+ institution="Third-party aggregator",
398
+ url="https://api.propublica.org/congress/v1",
399
+ disclosure_types=[DisclosureType.STOCK_TRANSACTIONS, DisclosureType.FINANCIAL_INTERESTS],
400
+ access_method=AccessMethod.API,
401
+ update_frequency="Daily",
402
+ data_format="json",
403
+ api_key_required=True,
404
+ rate_limits="5000 requests/day (free tier)",
405
+ notes="DEPRECATED: ProPublica Congress API is no longer available as of 2025. Use Senate Stock Watcher or Finnhub instead.",
406
+ status="inactive",
407
+ ),
408
+ DataSource(
409
+ name="Finnhub Congressional Trading",
410
+ jurisdiction="US-Federal",
411
+ institution="Third-party aggregator",
412
+ url="https://finnhub.io/docs/api/congressional-trading",
413
+ disclosure_types=[DisclosureType.STOCK_TRANSACTIONS],
414
+ access_method=AccessMethod.API,
415
+ update_frequency="Real-time",
416
+ data_format="json",
417
+ api_key_required=True,
418
+ rate_limits="30 requests/second (free tier)",
419
+ notes="FREE API key available at finnhub.io. Provides congressional trading data by stock symbol. Response includes representative name, transaction date/type, and amount ranges.",
420
+ status="active",
421
+ ),
422
+ DataSource(
423
+ name="SEC Edgar Insider Trading",
424
+ jurisdiction="US-Federal",
425
+ institution="Official government source",
426
+ url="https://data.sec.gov",
427
+ disclosure_types=[DisclosureType.STOCK_TRANSACTIONS],
428
+ access_method=AccessMethod.API,
429
+ update_frequency="Real-time",
430
+ data_format="json",
431
+ api_key_required=False,
432
+ rate_limits="10 requests/second",
433
+ notes="FREE! Official SEC data. Access company submissions and Form 4 insider trading filings via data.sec.gov/submissions/CIK##########.json. Requires User-Agent header.",
434
+ status="active",
435
+ ),
436
+ ]
437
+
438
+ # =============================================================================
439
+ # CORPORATE REGISTRY & FINANCIAL DISCLOSURE SOURCES
440
+ # =============================================================================
441
+
442
+ CORPORATE_REGISTRY_SOURCES = [
443
+ DataSource(
444
+ name="UK Companies House REST API",
445
+ jurisdiction="UK",
446
+ institution="Companies House (UK company registry)",
447
+ url="https://api.companieshouse.gov.uk/",
448
+ disclosure_types=[DisclosureType.FINANCIAL_INTERESTS, DisclosureType.ASSET_DECLARATIONS],
449
+ access_method=AccessMethod.API,
450
+ update_frequency="Real-time",
451
+ data_format="json",
452
+ api_key_required=True,
453
+ rate_limits="600 requests per 5 minutes per key",
454
+ notes="HTTP Basic Auth using API key as username. Endpoints: /company/{company_number}, /company/{company_number}/filing-history, /officers, /persons-with-significant-control, /search/companies. Some filings/accounts documents are metadata only, not full financial statement parsing. Docs: https://developer.company-information.service.gov.uk/",
455
+ status="active",
456
+ ),
457
+ DataSource(
458
+ name="UK Companies House Streaming API",
459
+ jurisdiction="UK",
460
+ institution="Companies House (UK company registry)",
461
+ url="https://stream.companieshouse.gov.uk/",
462
+ disclosure_types=[DisclosureType.FINANCIAL_INTERESTS, DisclosureType.ASSET_DECLARATIONS],
463
+ access_method=AccessMethod.API,
464
+ update_frequency="Real-time (streaming)",
465
+ data_format="json",
466
+ api_key_required=True,
467
+ rate_limits="Streaming connection",
468
+ notes="Streaming API for real-time company changes. Requires stream key obtained via registration. Streams: company information, filing history, insolvency, charges. Delivers JSON events as changes occur. Useful for real-time updates vs polling REST API. Docs: https://www.api.gov.uk/ch/companies-house-streaming/",
469
+ status="active",
470
+ ),
471
+ DataSource(
472
+ name="GetEDGE API (ASIC Australia)",
473
+ jurisdiction="Australia",
474
+ institution="ASIC (Australian Securities and Investments Commission)",
475
+ url="https://getedge.com.au/docs/api",
476
+ disclosure_types=[DisclosureType.FINANCIAL_INTERESTS, DisclosureType.ASSET_DECLARATIONS],
477
+ access_method=AccessMethod.API,
478
+ update_frequency="Real-time",
479
+ data_format="json",
480
+ api_key_required=True,
481
+ rate_limits="Varies by subscription",
482
+ notes="Token (API key) authentication. 60-character API key via account portal. Endpoints: Company Registration, Name Change, Business Name Registration, Registry Agent Services, Document production. Oriented to registry/incorporation/document services rather than full financial disclosure data. Requires 'software provider' / digital agent status for some endpoints. Docs: https://getedge.com.au/docs/api",
483
+ status="active",
484
+ ),
485
+ DataSource(
486
+ name="Info-Financière API (France)",
487
+ jurisdiction="France",
488
+ institution="AMF (Autorité des marchés financiers)",
489
+ url="https://info-financiere.gouv.fr/api/v1/console",
490
+ disclosure_types=[DisclosureType.FINANCIAL_INTERESTS, DisclosureType.STOCK_TRANSACTIONS],
491
+ access_method=AccessMethod.API,
492
+ update_frequency="Real-time",
493
+ data_format="json",
494
+ api_key_required=False,
495
+ rate_limits="10,000 API calls per IP per day",
496
+ notes="FREE! Open access (accès libre) via OpenData service for publicly listed/regulated disclosures. Returns metadata + original documents (PDF, HTML, XML) plus links. Documents are in issuer's original language and format - not always fully parsed. Some regulatory constraints on personal data/redaction may apply. Docs: https://www.data.gouv.fr/dataservices/api-info-financiere/",
497
+ status="active",
498
+ ),
499
+ DataSource(
500
+ name="Hong Kong Companies Registry e-Monitor API",
501
+ jurisdiction="Hong Kong",
502
+ institution="Companies Registry (Hong Kong)",
503
+ url="https://www.cr.gov.hk/en/electronic/e-servicesportal/",
504
+ disclosure_types=[DisclosureType.FINANCIAL_INTERESTS, DisclosureType.ASSET_DECLARATIONS],
505
+ access_method=AccessMethod.API,
506
+ update_frequency="Real-time (notifications)",
507
+ data_format="json",
508
+ api_key_required=True,
509
+ rate_limits="N/A (notification-based)",
510
+ notes="Notification/subscription API - not full search/document retrieval. Users must register and subscribe to 'Other Companies' service (HK$17/year per company) to receive notifications via API. Notifications are JSON via HTTPS POST to subscriber's endpoint. Payload includes change data and encrypted API key header for verification. API endpoint must support HTTPS and validate certificate. Docs: https://www.cr.gov.hk/en/electronic/e-servicesportal/faq/e-monitor.htm",
511
+ status="active",
512
+ ),
513
+ DataSource(
514
+ name="Hong Kong Companies Registry (General)",
515
+ jurisdiction="Hong Kong",
516
+ institution="Companies Registry (Hong Kong)",
517
+ url="https://www.cr.gov.hk/en/electronic/e-servicesportal/",
518
+ disclosure_types=[DisclosureType.FINANCIAL_INTERESTS, DisclosureType.ASSET_DECLARATIONS],
519
+ access_method=AccessMethod.WEB_SCRAPING,
520
+ update_frequency="Real-time",
521
+ data_format="html",
522
+ api_key_required=True,
523
+ rate_limits="Portal-based",
524
+ notes="Requires login/account. Public search services via portal. Not a fully open API. Outputs may be HTML, images, document scans; limited structured data. Corporate registry made more restrictive: directors' residential address/identity data partly redacted; only limited shareholder details publicly accessible. No full open API - requires portal access or purchase.",
525
+ status="planned",
526
+ ),
527
+ DataSource(
528
+ name="OpenCorporates API",
529
+ jurisdiction="Global",
530
+ institution="Third-party aggregator (multi-jurisdiction)",
531
+ url="https://api.opencorporates.com/v0.4/",
532
+ disclosure_types=[DisclosureType.FINANCIAL_INTERESTS, DisclosureType.ASSET_DECLARATIONS],
533
+ access_method=AccessMethod.API,
534
+ update_frequency="Daily",
535
+ data_format="json",
536
+ api_key_required=True,
537
+ rate_limits="Varies by tier (free + paid)",
538
+ notes="Global multi-jurisdiction aggregator. Endpoints: /companies/{jurisdiction}/{company_id}, /companies/search, /officers, /filings, /events. Supports pagination. Query parameters: q, jurisdiction_code, company_number, per_page, page, order. Depth of filings/events data depends on jurisdiction and data source - many 'filings' may just be metadata or pointers to documents rather than full statements. Rate limits apply per key. Docs: https://api.opencorporates.com/documentation/API-Reference",
539
+ status="active",
540
+ ),
541
+ DataSource(
542
+ name="Transparent Data - Company Registers API",
543
+ jurisdiction="EU/Europe",
544
+ institution="Third-party aggregator (EU registry metadata)",
545
+ url="https://apidoc.transparentdata.pl/company_registers_api.html",
546
+ disclosure_types=[DisclosureType.FINANCIAL_INTERESTS, DisclosureType.ASSET_DECLARATIONS],
547
+ access_method=AccessMethod.API,
548
+ update_frequency="Daily",
549
+ data_format="json",
550
+ api_key_required=True,
551
+ rate_limits="Varies by subscription",
552
+ notes="EU/Europe registry aggregator. Covers registry/legal metadata rather than full financial statements or regulatory filings. Likely JSON REST style with parameters for jurisdiction, company registration number, etc. Docs: https://apidoc.transparentdata.pl/company_registers_api.html",
553
+ status="active",
554
+ ),
555
+ DataSource(
556
+ name="XBRL/ESEF/UKSEF via filings.xbrl.org",
557
+ jurisdiction="EU/UK/Ukraine",
558
+ institution="XBRL International (standardized financial reporting)",
559
+ url="https://filings.xbrl.org/",
560
+ disclosure_types=[DisclosureType.FINANCIAL_INTERESTS, DisclosureType.ASSET_DECLARATIONS],
561
+ access_method=AccessMethod.API,
562
+ update_frequency="Daily",
563
+ data_format="json",
564
+ api_key_required=False,
565
+ rate_limits="None specified",
566
+ notes="FREE! JSON:API compliant responses. Filtering via query parameters (filter[...]), pagination, sorting. Covers EU/UK/Ukraine filings. Some jurisdictions' filings missing (e.g., Germany, Ireland) as of current state. Endpoints: /filings, /entities, /validation_messages. Docs: https://filings.xbrl.org/docs/api",
567
+ status="active",
568
+ ),
569
+ DataSource(
570
+ name="XBRL US API",
571
+ jurisdiction="USA",
572
+ institution="XBRL US (financial data standardization)",
573
+ url="https://github.com/xbrlus/xbrl-api",
574
+ disclosure_types=[DisclosureType.FINANCIAL_INTERESTS, DisclosureType.STOCK_TRANSACTIONS],
575
+ access_method=AccessMethod.API,
576
+ update_frequency="Real-time (~15 min latency from SEC)",
577
+ data_format="json",
578
+ api_key_required=True,
579
+ rate_limits="Varies by tier",
580
+ notes="FREE API key available. JSON/REST endpoints for company, filing, facts. Fact-level retrieval mapping XBRL tags to numeric values. Latency ~15 minutes behind SEC updates. Best for programmatic fact extraction from SEC filings. Docs: https://github.com/xbrlus/xbrl-api",
581
+ status="active",
582
+ ),
583
+ DataSource(
584
+ name="XBRLAnalyst API",
585
+ jurisdiction="USA",
586
+ institution="Third-party aggregator (SEC filings)",
587
+ url="https://www.finddynamics.com/",
588
+ disclosure_types=[DisclosureType.FINANCIAL_INTERESTS, DisclosureType.STOCK_TRANSACTIONS],
589
+ access_method=AccessMethod.API,
590
+ update_frequency="Real-time",
591
+ data_format="json",
592
+ api_key_required=True,
593
+ rate_limits="Varies by subscription",
594
+ notes="Endpoints for firms, filings, statements, metrics. JSON (default) or XML (via format parameter). Free (limited) access for non-registered users for core metrics; full access for subscribers. Focused on US public companies (SEC filings).",
338
595
  status="active",
339
596
  ),
340
597
  ]
@@ -349,6 +606,7 @@ ALL_DATA_SOURCES = {
349
606
  "eu_parliament": EU_PARLIAMENT_SOURCES,
350
607
  "eu_national": EU_NATIONAL_SOURCES,
351
608
  "third_party": THIRD_PARTY_SOURCES,
609
+ "corporate_registry": CORPORATE_REGISTRY_SOURCES,
352
610
  }
353
611
 
354
612
  # Summary statistics
@@ -64,7 +64,7 @@ class Politician:
64
64
  first_name: str = ""
65
65
  last_name: str = ""
66
66
  full_name: str = ""
67
- role: PoliticianRole = PoliticianRole.US_HOUSE_REP
67
+ role: str = "House" # Can be string or PoliticianRole enum
68
68
  party: str = ""
69
69
  state_or_country: str = ""
70
70
  district: Optional[str] = None
@@ -85,6 +85,7 @@ class TradingDisclosure:
85
85
 
86
86
  id: Optional[str] = None
87
87
  politician_id: str = ""
88
+ politician_bioguide_id: Optional[str] = None # For lookups before politician_id is assigned
88
89
 
89
90
  # Transaction details
90
91
  transaction_date: datetime = field(default_factory=datetime.utcnow)
@@ -163,3 +164,160 @@ class DataSource:
163
164
 
164
165
  created_at: datetime = field(default_factory=datetime.utcnow)
165
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 = "" # individual-person-with-significant-control, corporate-entity-person-with-significant-control, etc.
242
+
243
+ # Control nature
244
+ natures_of_control: List[str] = field(default_factory=list) # ownership-of-shares-75-to-100-percent, etc.
245
+ notified_on: Optional[datetime] = None
246
+
247
+ # Personal details (may be redacted)
248
+ nationality: Optional[str] = None
249
+ country_of_residence: Optional[str] = None
250
+ date_of_birth: Optional[datetime] = None # Usually only month/year
251
+
252
+ # Address
253
+ address: Optional[str] = None
254
+
255
+ # Source information
256
+ source: str = ""
257
+ raw_data: Dict[str, Any] = field(default_factory=dict)
258
+
259
+ created_at: datetime = field(default_factory=datetime.utcnow)
260
+ updated_at: datetime = field(default_factory=datetime.utcnow)
261
+
262
+
263
+ @dataclass
264
+ class FinancialPublication:
265
+ """Financial publication/disclosure (e.g., France Info-Financière)"""
266
+
267
+ id: Optional[str] = None
268
+ publication_id: str = "" # Source publication ID
269
+
270
+ # Publication details
271
+ title: str = ""
272
+ publication_type: str = "" # prospectus, annual-report, regulatory-filing, etc.
273
+ publication_date: datetime = field(default_factory=datetime.utcnow)
274
+
275
+ # Issuer/company
276
+ issuer_name: Optional[str] = None
277
+ issuer_id: Optional[str] = None # LEI, ISIN, or other identifier
278
+ company_id: Optional[str] = None # Foreign key to Company (if linked)
279
+
280
+ # Document information
281
+ document_url: Optional[str] = None
282
+ document_format: Optional[str] = None # pdf, html, xml
283
+ language: Optional[str] = None
284
+
285
+ # Source information
286
+ source: str = "" # "info_financiere", "xbrl_filings", etc.
287
+ jurisdiction: str = ""
288
+ raw_data: Dict[str, Any] = field(default_factory=dict)
289
+
290
+ created_at: datetime = field(default_factory=datetime.utcnow)
291
+ updated_at: datetime = field(default_factory=datetime.utcnow)
292
+
293
+
294
+ @dataclass
295
+ class XBRLFiling:
296
+ """XBRL financial statement filing"""
297
+
298
+ id: Optional[str] = None
299
+ filing_id: str = "" # Source filing ID
300
+
301
+ # Filing details
302
+ entity_name: str = ""
303
+ entity_id: Optional[str] = None # LEI or other identifier
304
+ company_id: Optional[str] = None # Foreign key to Company (if linked)
305
+
306
+ # Filing information
307
+ filing_date: datetime = field(default_factory=datetime.utcnow)
308
+ period_start: Optional[datetime] = None
309
+ period_end: Optional[datetime] = None
310
+ fiscal_year: Optional[int] = None
311
+ fiscal_period: Optional[str] = None # Q1, Q2, FY, etc.
312
+
313
+ # Document
314
+ document_url: Optional[str] = None
315
+ taxonomy: Optional[str] = None # ESEF, UKSEF, US-GAAP, etc.
316
+
317
+ # Source information
318
+ source: str = "" # "xbrl_filings", "xbrl_us", etc.
319
+ jurisdiction: str = ""
320
+ raw_data: Dict[str, Any] = field(default_factory=dict)
321
+
322
+ created_at: datetime = field(default_factory=datetime.utcnow)
323
+ updated_at: datetime = field(default_factory=datetime.utcnow)