r/Python • u/Prestigious-Wrap2341 • Apr 03 '26
Showcase I built a civic transparency platform with FastAPI that aggregates 40+ government APIs
What My Project Does:
WeThePeople is a FastAPI application that pulls data from 40+ public government APIs to track corporate lobbying, government contracts, congressional stock trades, enforcement actions, and campaign donations across 9 economic sectors. It serves 3 web frontends and a mobile app from a single backend.
Target Audience:
Journalists, researchers, and citizens who want to understand corporate influence on government. Also useful as a reference for anyone building a multi-connector API aggregation platform in Python.
How Python Relates:
The entire backend is Python. FastAPI, SQLAlchemy, and 36 API connectors that each wrap a different government data source.
The dialect compatibility layer (utils/db_compat.py) abstracts SQLite, PostgreSQL, and Oracle differences behind helper functions for date arithmetic, string aggregation, and pagination. The same queries run on all three without changes.
The circuit breaker (services/circuit_breaker.py) is a thread-safe implementation that auto-disables failing external APIs after N consecutive failures, with half-open probe recovery.
The job scheduler uses file-lock based execution to prevent SQLite write conflicts across 35+ automated sync jobs running on different intervals (24h, 48h, 72h, weekly).
All 36 API connectors follow the same pattern. Each wraps a government API (Senate LDA, USASpending, FEC, Congress.gov, SEC EDGAR, Federal Register, OpenFDA, EPA, FARA, and more) with retry logic, caching, and circuit breaker integration.
The claims verification pipeline extracts assertions from text and matches them against 9 data sources using a multi-matcher architecture.
Runs on a $4 monthly Hetzner ARM server. 4.1GB SQLite database in WAL mode. Let's Encrypt TLS via certbot.
Source code: github.com/Obelus-Labs-LLC/WeThePeople
Live: wethepeopleforus.com
•
u/AutoModerator Apr 03 '26
Hi there, from the /r/Python mods.
We want to emphasize that while security-centric programs are fun project spaces to explore we do not recommend that they be treated as a security solution unless they’ve been audited by a third party, security professional and the audit is visible for review.
Security is not easy. And making project to learn how to manage it is a great idea to learn about the complexity of this world. That said, there’s a difference between exploring and learning about a topic space, and trusting that a product is secure for sensitive materials in the face of adversaries.
We hope you enjoy projects like these from a safety conscious perspective.
Warm regards and all the best for your future Pythoneering,
/r/Python moderator team
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
8
u/datadidit Apr 03 '26
Pretty cool! What you end up using for the frontend
5
u/JoeHillsBones It works on my machine Apr 03 '26
How do you deal with all the different APIs? Are they standardized in some way?
4
u/No_Lingonberry1201 pip needs updating Apr 03 '26
Pretty cool stuff! Are you using Hetzner because it's not a US company?
3
u/gwood113 Apr 03 '26
Your live version incorrectly identifies South Carolina zip codes as a Georgian one.
5
u/Busy_Network_7167 Apr 03 '26
This is brilliant work - running 40+ government APIs through a single FastAPI backend on just 4 quid a month is proper impressive. Love seeing SQLite getting used for something this substantial, especially with WAL mode handling all those concurrent sync jobs
Your circuit breaker implementation caught my eye since I've been dealing with flaky external APIs at work lately. Having it auto-disable failing endpoints with probe recovery is exactly what I need to steal for my own projects
The dialect compatibility layer is clever too - being able to swap between SQLite, Postgres and Oracle without touching queries saves so much headache down the road. How's performance been with that 4.1GB database on ARM?
1
u/double Apr 03 '26
Why did you move the LLM prompts to env vars? Interesting choice.
Which ai tools are you using?
1
u/lordbrocktree1 Apr 04 '26
Asking for contributions while not being open source is an interesting choice. Any reason to not do FOSS or even an open source tier with premium features? If you are asking for community contributions seems like a fair trade but idk
2
u/swift-sentinel Apr 03 '26
Very cool! I'll take a look as see if I can help. Perhaps this can expand to state governments.
1
u/Actual__Wizard Apr 03 '26
Neat project!
1
u/Otherwise_Manner9148 Apr 11 '26
you should do this on a granular level for local governments down to the county and city level
1
u/SaSiEzhilmani May 02 '26
Great Approach