How ardillachiki/la_ultima_y_nos_vamos works
Project type and purpose
• This is a Python-based, layered application offering both a CLI and a Gradio UI to manage polls, users, votes, and NFTs. It follows a classic MVC-style separation:
• UI layer (CLI & Gradio)
• Controller layer (input routing)
• Service layer (business logic, includes Chatbot and NFT operations)
• Repository layer (data persistence to JSON)
• Model layer (domain objects: Poll, User, Vote, TokenNFT)
• It also incorporates design patterns (Factory, Observer, Strategy) to decouple object creation and algorithm selection.
File structure
• Top-level:
• main.py – application entry point
• data/polls.json – data store
• src/config.py – configuration
• src/controllers – CLI controller
• src/services – PollService, UserService, NFTService, ChatbotService
• src/repositories – JSON-backed repositories
• src/models – domain models
• src/patterns – Factory, Observer, Strategy implementations
• src/strategies – concrete vote-counting strategies
• src/ui – Gradio app
• Tests mirror this layering for each component.
Detail
• Don’t just show “Service” – break out each service you see in src/services
• Model layer: illustrate that PollService produces/consumes Poll objects created by Factory
• Strategy injection into PollService for “vote counting”
• Observer subscriptions, e.g., “VoteSubmitted” event notifying NFTService or ChatbotService