voting-app/prompt-v0.1.md
2026-05-15 15:16:18 -05:00

3.5 KiB
Raw Permalink Blame History

Task: Design a Python application that:

  1. Authenticates with the U.S. Congress API (Library of Congress web service).

  2. Retrieves the full voting history for any legislator (by name or ID).

  3. For every bill the legislator voted on, fetches the bill text and a concise summary.

  4. Feeds that bill text into a locallyhosted GPTOSS endpoint (http://home.ms:4000/v1) and stores the models output.

  5. Caches all external data locally (SQLite or a simple keyvalue store) to avoid repeated API calls and to survive API outages.

  6. Handles pagination, ratelimit backoff, and graceful error handling.

  7. Provides a clean CLI or minimal web UI to query a legislator name and print:

    • Legislator details (party, state, etc.)
    • A table of bill IDs, vote type (Yay/Nay/Abstain), and a short GPTOSSderived explanation for each bill.
  8. Uses typehints, dataclasses, and a modular architecture so each component can be unittested.

  9. Includes a README explaining how to set up the API key, run the local GPTOSS server, and execute the program.

Desired Output:

  • An overall architecture diagram (textbased or Markdown flow chart).

  • A folder structure (e.g., src/, tests/, cache/).

  • Full Python code for:

    • api_client.py (handles Congress API, pagination, backoff).
    • gpt_oss_client.py (handles local GPTOSS calls).
    • cache.py (simple SQLite wrapper).
    • main.py (CLI entry point).
    • models.py (dataclasses for Legislator, Bill, Vote).
    • README.md with setup instructions.
  • Sample unittest skeletons.

  • A brief discussion of alternative architectures (e.g., async, Docker, CI).

Constraints:

  • Use only standard library + requests + sqlite3.
  • Do not expose the API key in code—read it from an environment variable named CONGRESS_API_KEY.
  • GPTOSS calls must use the same bearertoken pattern as the Congress API.

Optional Extras (if time permits):

  • A simple Flask UI that shows the same table in a web page.
  • Logging for every API call and GPTOSS request.

i want to be able to look up a candidate and quickly at a glance see their voting record on bills, latest bills first. I want to be able to scrooll all the way back through their whole history (endless scroll until at the end of their career). I would want Decision - Bill Title. When i click on the block that show the info for the bill, it would expand to give a summary of the the bill that the AI generated with the key measures that this bill ensured. It's important that this information be impartial but the truth. The bot should truly summarize whats in the bill and not just what the bill says that it will do at the very beginning.

All data and summarization result need to be stored in a local db that could be used for later analysis, accesible by the same api that the app would be using to display this info per candidate.

When you begin the search and start typing in the politician name i want it to auto fill in as you type the name of the person, give suggestiosn for the person youre trying to reach so Full Name, State, Party Affiliation

The API Key is store in the .env file. Don't expose it and don't hard code it into the code

Do not leak my private information if requests fail. Just give up and say that you're done as much work as you can, and I will come take a look later.

Be mindful of throttle limtes (1000 / 1hr), but you should try to stay way below that so my internet doesnt' suffer