How jordimunozflorensa/hackupc_2024 works
Main Components
• Entry/Control Module: At the center, you have main.py, which acts as the application’s entry point. It likely coordinates invoking the various submodules and handling input (including redirection of error messages to errores.log).
• Data Layer: Represent the CSV files (both in the root and inside the “data” folder, such as products.csv, medicaments.csv, lista_productos*.csv, etc.) as the primary data sources. They function as simple flat-file “databases” storing product information and order lists.
• Algorithm Layer: Include algorithm.py, tsp.py, and sa.py. These files handle the core optimization routines (e.g., solving the TSP problem) – with “sa.py” likely implementing a simulated annealing method as an optimization technique.
• Service Layer: The “services” directory holds modules like name_matcher.py, order_item_manager.py, and order_list_manager.py. These components encapsulate business logic (for instance, matching product names using fuzzy matching, managing items and lists) and provide separation of concerns.
• Utility/Generation Layer: Files like generar_listas.py and lambda_function.py likely assist in generating lists and integrating with cloud services (for speech recognition using google-cloud-speech) or even AWS Lambda if the name is literal.
Demonstrate Relationships and Interactions
• That main.py orchestrates the overall flow by reading CSV data, calling the service layer (for matching and ordering items), and then invoking the algorithm components for optimization (TSP implementation).
• The Data Layer supplies raw input to main.py and other modules.
• The Service Layer (name_matcher, order_item_manager, etc.) processes and refines the data (e.g., matching product names with fuzzy logic).
• The Algorithm Layer uses the processed data to execute TSP routines and possibly simulated annealing as implemented in sa.py.
• The results (optimized order lists) are either logged, stored back into CSV files, or passed to further modules (e.g., generar_listas.py) for final output.
• Integration points with external libraries (for speech recognition and fuzzy matching) and external services (if lambda_function.py is deployed as a cloud function).
Architectural Patterns and Design Principles
• Modular Design: Highlight that the project is organized into distinct modules (data, business logic/services, and algorithms) – each handling a specific concern.
• Separation of Concerns: Demonstrate that data handling, business logic, and optimization computations are kept in separate files/folders (for instance, by separating algorithm functions from service functions).
• Dependency Management: Note that external libraries (SpeechRecognition, fuzzywuzzy, etc.) are dependencies that integrate into the modules handling speech and text processing.