Skip to main content
Glama

FedMCP - Federal Parliamentary Information

test_legisinfo_json_ingestion.py3.24 kB
"""Test LEGISinfo JSON bulk ingestion for bills.""" import sys from pathlib import Path # Add packages to path PIPELINE_PATH = Path(__file__).parent / "packages" / "data-pipeline" sys.path.insert(0, str(PIPELINE_PATH)) from fedmcp_pipeline.utils.neo4j_client import Neo4jClient from fedmcp_pipeline.utils.config import Config from fedmcp_pipeline.ingest.parliament import ingest_bills_from_legisinfo_json # Load config config = Config(env_file=Path("packages/data-pipeline/.env")) print("=" * 60) print("Testing LEGISinfo JSON Bill Ingestion") print("=" * 60) with Neo4jClient(config.neo4j_uri, config.neo4j_user, config.neo4j_password) as client: # Ingest bills from LEGISinfo JSON print("\n1. Ingesting bills from LEGISinfo JSON bulk export...") bill_count = ingest_bills_from_legisinfo_json(client) print(f"✅ Ingested {bill_count} bills") # Check sponsor coverage print("\n2. Checking sponsor data coverage...") result = client.run_query(""" MATCH (b:Bill) RETURN count(b) AS total_bills, count(b.sponsor_name) AS bills_with_sponsors, toFloat(count(b.sponsor_name)) / count(b) * 100 AS sponsor_coverage """) stats = result[0] print(f"Total bills: {stats['total_bills']}") print(f"Bills with sponsors: {stats['bills_with_sponsors']}") print(f"Coverage: {stats['sponsor_coverage']:.1f}%") # Check SPONSORED relationships print("\n3. Checking SPONSORED relationships...") result = client.run_query(""" MATCH (m:MP)-[:SPONSORED]->(b:Bill) RETURN count(*) AS relationship_count """) rel_count = result[0].get("relationship_count", 0) print(f"SPONSORED relationships: {rel_count}") # Sample some sponsored bills print("\n4. Sample sponsored bills:") samples = client.run_query(""" MATCH (m:MP)-[:SPONSORED]->(b:Bill) WHERE b.session = '45-1' RETURN m.name AS mp_name, b.number AS bill_number, b.title AS title ORDER BY b.number LIMIT 10 """) if samples: for s in samples: print(f" {s.get('mp_name')} → {s.get('bill_number')}") title = s.get('title', '') if len(title) > 60: title = title[:60] + "..." print(f" {title}") else: print(" ⚠️ No SPONSORED relationships found for current session") # Check bill status distribution print("\n5. Bill status distribution:") status_result = client.run_query(""" MATCH (b:Bill) WHERE b.session = '45-1' RETURN b.status AS status, count(*) AS count ORDER BY count DESC LIMIT 10 """) for row in status_result: print(f" {row.get('status')}: {row.get('count')} bills") # Performance comparison print("\n" + "=" * 60) print("PERFORMANCE COMPARISON") print("=" * 60) print(""" LEGISinfo JSON (current): - 1 HTTP request (204KB) - ~1-2 seconds total time - 100% sponsor coverage - All bill statuses included OpenParliament API (old): - 5,653+ individual API calls - ~50 minutes at 10 req/sec - 88% sponsor coverage (list endpoint) - Requires rate limiting """) print("\n✅ Test complete!")

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/northernvariables/FedMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server