How ukparliament/written-answer-bots works
Main Components
• External Data Sources/API: Since the app imports data (questions, written statements, etc.), add a component for “Data APIs” or “External Data Sources” where the application pulls information from.
• Social Media Integrations: There are specific libraries and tasks under lib/post (directories for Mastodon and Bluesky). Represent these as “Mastodon API” and “Bluesky API” components. Indicate that the application uses these APIs to post content.
• Background or Scheduled Tasks: Numerous Rake tasks (in lib/tasks) related to importing data and posting tweets (e.g., task_import_members.rake, tweet-bluesky.rake, tweet-mastodon.rake, etc.) indicate scheduled jobs that run separately from the main web server. Represent these tasks as a “Task Scheduler / Background Jobs” component.
Relationships and Interactions
• The Application Server (Rails MVC) receives HTTP requests via controllers, interacts with the models to fetch or persist data in the Database, and renders views to users.
• It also triggers background tasks (either via scheduled Rake tasks or cron jobs) that handle importing data from external APIs.
• Once imported, or based on certain conditions, the application posts content to Mastodon and Bluesky via the specific integration modules found in lib/post.
Architectural Patterns
• Using the standard Rails MVC design is a key pattern in this project.
• The separation between the web-facing part of the application (handling user interactions, controllers and views) and background tasks (executing Rake jobs for importing and posting) should be visually emphasized.
• The integration with external APIs (both to import content and to post content) is an important aspect.
Technologies and Design Principles
• Ruby on Rails: Mark the main application as a Ruby on Rails-based server.
• Rake Tasks: Highlight that periodic task execution (for importing and tweeting) is based on Rake tasks.
• API Integrations: Note that the project integrates with Mastodon and Bluesky endpoints.
• Versioning/Deployment: Include elements such as the Procfile that indicates usage on platforms like Heroku, hinting at deployment practices.
Final Advice and Details
• Document any relationships or dependencies, especially focusing on how data travels through the system—from importation, persistence, to content posting on social networks.