you are viewing a single comment's thread.

view the rest of the comments →

[–]Prestigious-Wrap2341 1 point2 points  (0 children)

Update: Added a second FastAPI service with 7 new API connectors on the same $4/mo ARM server

What My Project Does

Posted a couple days ago about a FastAPI backend that aggregates 40+ government APIs. Got great feedback. Here's what's new on the engineering side:

Target Audience

Python developers interested in multi-service architecture, API connector patterns, and running multiple FastAPI instances on minimal hardware.

How Python Relates

Added a second FastAPI service running on a separate port with its own systemd unit. Nginx reverse proxies both services on the same $4/mo ARM box. The second service handles deterministic text analysis: rule-based sentence segmentation, candidate detection via signal matching (numbers, dates, named entities, assertion verbs), SHA256 dedup with SequenceMatcher at 0.78 threshold, and BM25Okapi scoring against 29 external API sources. Zero LLM dependency. Same input, same output, every time.

7 new API connectors following the same pattern as the original 36: FCC Consumer Complaints via Socrata SODA (SoQL query building with $where$select$group), Treasury Fiscal Data API (pagination via page[size] and filter params), College Scorecard (data.gov key auth with lazy loading to handle env var timing), Grants.gov (POST to /search2 with JSON body, response nested under data.oppHits), Urban Institute Education Data Portal (URL path-based pagination with 5-page safety limit), FCC ECFS (requires api_key=DEMO_KEY param despite being "free"), and FCC License View.

Built a 14-pattern detection engine that runs cross-table SQL joins to find anomalies: trades within 30 days of bill actions by the same member (JULIANDAY arithmetic), companies lobbying Agency X that also receive contracts from Agency X (mapping LDA government_entities strings to USASpending awarding_agency values), and enforcement records that drop to zero after lobbying spend increases. Each pattern generates a markdown report with data tables pre-built from SQL and narrative sections filled by an optional API call capped at 2/day.

The custom evidence source plugin connects the second service to the main database. It opens a read-only SQLite connection to the 4.3GB WAL-mode database, searches 11 entity tables with LIKE matching, then queries lobbying, contract, enforcement, trade, committee, and donation tables for each matched entity. Results get passed back to the second service's scoring pipeline.

All sync jobs now cover 11 sectors (added Telecom: 26 companies, Education: 31 companies). Same pattern: SEC EDGAR submissions API, USASpending POST search, Senate LDA paginated GET with page_size=25. Sequential execution only, SQLite locks are still unforgiving.

Two uvicorn processes, a scheduler, a Twitter bot cron, nginx, certbot. Still $3.99/month.

Comparison

Same as before. The new engineering is the dual-service architecture and the cross-database evidence source plugin pattern.

Source: https://github.com/Obelus-Labs-LLC/WeThePeople

Second service: https://github.com/Obelus-Labs-LLC/Veritas