21 lines
634 B
Python
21 lines
634 B
Python
|
|
# services/external/app/ingestion/adapters/__init__.py
|
||
|
|
"""
|
||
|
|
Adapter registry - Maps city IDs to adapter implementations
|
||
|
|
"""
|
||
|
|
|
||
|
|
from typing import Dict, Type
|
||
|
|
from ..base_adapter import CityDataAdapter
|
||
|
|
from .madrid_adapter import MadridAdapter
|
||
|
|
|
||
|
|
ADAPTER_REGISTRY: Dict[str, Type[CityDataAdapter]] = {
|
||
|
|
"madrid": MadridAdapter,
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
def get_adapter(city_id: str, config: Dict) -> CityDataAdapter:
|
||
|
|
"""Factory to instantiate appropriate adapter"""
|
||
|
|
adapter_class = ADAPTER_REGISTRY.get(city_id)
|
||
|
|
if not adapter_class:
|
||
|
|
raise ValueError(f"No adapter registered for city: {city_id}")
|
||
|
|
return adapter_class(city_id, config)
|