- Supplier Layer
BaseSupplier
- Abstract base class for all suppliers- Implementations:
AcmeSupplier
,PatagoniaSupplier
,PaperfliesSupplier
- Managed by
SupplierManager
for unified data fetching.
- Data Processing Layer
- Normalization:
DataNormalizer
for data cleaning and standardization - Merging:
DataMerger
for combining data from multiple sources - Validation: Uses Pydantic models in
models/hotel.py
- Storage Layer
- Abstract
BaseDB
interface - Implementations:
HotelDB
andRawHotelDB
- API Layer
- FastAPI-style routing with
HotelAPI
- Endpoint handlers in api/routers
- Data fetching from suppliers
- Normalization and cleaning
- Updating fully normalized data in database
- Merging with bias handling for multiple suppliers
- Storage in databases
- API access to merged data
- Single Responsibility: Each class has one purpose (e.g.,
Normalizer
) - Open/Closed: Abstract base classes allow extension (e.g.,
BaseSupplier
) - Liskov Substitution: All database implementations follow
BaseDB
contract - Interface Segregation: Targeted interfaces like
AttributeNormalizer
- Dependency Injection: Services accept dependencies in constructors
- Clear separation between data, domain logic, and presentation
- Domain models independent of external concerns
- Use of interfaces for flexibility
- Strategy: Different merger strategies in
services/merger.py
- Factory: Supplier creation in
SupplierManager
- Singleton: Logger implementation in
utils/logger.py
- Decorator: API routing decorators
- Data Quality
- Robust normalization via
HotelCleaner
- Configurable bias handling for data merging
- Validation using Pydantic models
- Extensibility
- Easy to add new suppliers
- Pluggable normalizers and mergers
- Configurable via configs/config.py
- Maintainability
- Comprehensive logging system
- Clear error handling with custom exceptions
- Well-defined interfaces
python main.py hotel_id1,hotel_id2 destination_id1