To develop a module for a web shop that fetches product data from various sources (e.g., CSV, XML, database) and normalizes it into a unified format. The normalized data should be displayed on a single result page.
- Fetch product data from multiple sources (CSV, XML, database, etc.).
- Normalize data into a consistent format with the following fields:
title,description,image_link,price - Display all normalized products on a single result page.
- Handling multiple data sources with different structures.
- Normalizing data with potential inconsistencies in field names and formats.
- Ensuring scalability for additional data sources in the future.
- Abstract different data sources to decouple them from higher-level modules.
- Enable easy integration of new sources (e.g., APIs or customer-specific formats).
- Design a flexible normalization system to unify product data.
- Ensure the system is adaptable for future enhancements, including AI-based techniques.
- Make connectors and normalization layers modular and extensible to accommodate future needs.
- Handle malformed or incomplete data gracefully, ensuring it doesn't disrupt processing.
- Future revisions should incorporate automated data correction during normalization.
- The controller that handles web requests.
- Depends on the
ProductPipelineto process and retrieve normalized product data.
- Acts as the orchestrator of the system.
- Retrieves data from the
ProductConnectorCollector, normalizes it using theProductNormalizer, and prepares it for display. - Manages templates for normalizing data from different connectors.
- Dynamically collects and manages multiple connectors that implement the
ProductConnectorinterface. - Provides an iterable collection of connectors to the
ProductPipeline.
Defines the contract using interface class ProductConnector and implements the connectors.
- Implementations:
ProductConnectorSimulatedDb: Fetches product data from a simulated database (CSV).ProductConnectorCsv: Handles CSV-based product data sources.ProductConnectorXml: Processes product data from XML files.ProductConnectorJson: Manages product data from JSON files or APIs.
- Defines the contract using interface class
Normalizerand implements it. - Uses a configurable template to normalize raw product data into a consistent format.
- Ensures data quality through validation and transformation.
DefaultControllerdepends onProductPipelinefor data processing.ProductPipelineinteracts withProductConnectorCollectorfor fetching raw data andProductNormalizerfor normalizing it.ProductConnectorCollectormanually aggregates multiple connectors implementing theProductConnectorinterface.
Analyzed the task description and researched tire specifications for better understanding.
- Identified challanges and decided on initial priorities.
- Designed a draft class diagram and interfaces for connector and normalization layers.
- Decided to implement normalization as a separate service for flexibility.
- Created a Symfony skeleton project.
- Configured a
DefaultControllerand a Twig templade to render the output as a web page.
- Implemented initial connectors to test data flow.
- Created the
ProductConnectorCollectorto collect and manage connectors.
- Developed
ProductNormalizerwith a configurable template system. - Added error handling for flexibility and malformed data.
Built the pipeline to fetch, normalize, and combine data for display.
- Validated functionality with the provided CSV file.
- Tested edge cases, such as malformed rows.
Re-sketched the class diagram using PhpStorm and refined it for clarity
Documented the process in detail using Joplin and exported to PDF.
Includes requirement analysis, system setup, implementation, testing, and documentation.
ProductConnectorandNormalizerare Interface classes.ProductConnectorCollectorstatically manages connectors and could be enhanced with yaml or tag-based autowiring for flexibility.ProductNormalizeris designed to support advanced features like AI-based information extraction.

