How dreamblader/master_duel_pack_scorer works
Main Components
• Entry Point: The __main__.py file acts as the main orchestrator, invoking the various modules.
• Data Layers:
• Input Data: The data folder (containing CSV files for Master Duel progression data) and the cards.db file (which might be used to persist or cross-reference card information).
• Data Acquisition and Processing:
• Scrapper (scrapper.py): Likely responsible for web scraping to obtain additional card pack or pricing information.
• Fetcher (fetcher.py): Potentially works in tandem with the scrapper to retrieve fresh data from external sources.
• Parser (parser.py): Processes raw data (from fetching, scraping, or CSV inputs) and converts this into a structured format.
• Domain Modeling:
• Models directory: Contains modules like card_data.py, enums.py, secret_banner_data.py, and secret_pack_data.py. These represent the core data structures and business logic (e.g., definitions, constants, and domain-specific entities).
• Output and Reporting:
• Writer (writer.py): Likely compiles the processed data and outputs results or scores.
• Utility Functions:
• Utils (utils.py) and web_elements.py: Provide support functions that simplify operations across various modules.
Relationships and Data Flow
• The process would typically start in __main__.py, which orchestrates the entire pipeline.
• Data from CSV files and the database (cards.db) form the base input layer.
• The scrapper and fetcher modules gather additional data from external sources, if needed.
• The parser module takes raw inputs (from both CSV/external sources) and uses the domain models to transform them into structured data.
• Once structured, the writer module produces the final report or scoring output based on this data.
• Utility functions are called as needed by each component to handle common tasks.
Architectural Patterns and Design Principles
• Modular Design: Each component (acquisition, parsing, modeling, writing) is separated into its own module or file.
• Procedural Pipeline: The code likely flows in a sequential “pipeline”: fetch/scrape → parse → model → write.
• Data-centric Approach: There’s an emphasis on input from files and databases, then transforming that data through standard processes.
• Loose Coupling: While functions across modules call each other, the separation into distinct responsibilities suggests a design focused on maintainability.