|
14 | 14 |
|
15 | 15 | """This module is used to share common functions between apis endpoints""" |
16 | 16 |
|
| 17 | +import os.path as osp |
17 | 18 | import traceback |
18 | 19 | from collections.abc import Callable, Iterable, Sequence |
19 | 20 | from concurrent.futures import ThreadPoolExecutor |
20 | 21 | from datetime import datetime |
| 22 | +from pathlib import Path |
21 | 23 | from threading import Thread |
22 | 24 | from typing import Any |
23 | 25 |
|
| 26 | +import yaml |
24 | 27 | from dateutil.parser import isoparse |
25 | 28 | from eodag import EOProduct |
26 | 29 | from fastapi import HTTPException, status |
27 | 30 | from rs_server_common.utils.logging import Logging |
28 | 31 |
|
29 | 32 | # pylint: disable=too-few-public-methods |
30 | | - |
31 | 33 | logger = Logging.default(__name__) |
| 34 | +PTYPE_MAPPING_FILE = Path(osp.realpath(osp.dirname(__file__))).parent / "config" / "product_type_mapping.yaml" |
32 | 35 |
|
33 | 36 |
|
34 | 37 | def validate_str_list(parameter: str) -> list | str: |
@@ -242,12 +245,8 @@ def extract_eo_product(eo_product: EOProduct, mapper: dict) -> dict: |
242 | 245 | def _apply_product_facets(feature: dict, _odata: dict) -> None: |
243 | 246 | """Sets product:type, processing:level - temporary hardcoded until RSPY-760 is DONE""" |
244 | 247 |
|
245 | | - product_type_data = { |
246 | | - "product:type": "S01SIWSLC", |
247 | | - "processing:level": "L1", |
248 | | - "instrument_mode": "IW", |
249 | | - "mission": "S1", |
250 | | - } |
| 248 | + with PTYPE_MAPPING_FILE.open("r") as f: |
| 249 | + product_type_data = yaml.safe_load(f)["types"] |
251 | 250 |
|
252 | 251 | props = feature["properties"] |
253 | 252 | if not ( |
|
0 commit comments