Skip to content

Commit 108dcf2

Browse files
committed
ptype mapping
1 parent 5665bcd commit 108dcf2

File tree

1 file changed

+6
-7
lines changed
  • services/common/rs_server_common/utils

1 file changed

+6
-7
lines changed

services/common/rs_server_common/utils/utils.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,24 @@
1414

1515
"""This module is used to share common functions between apis endpoints"""
1616

17+
import os.path as osp
1718
import traceback
1819
from collections.abc import Callable, Iterable, Sequence
1920
from concurrent.futures import ThreadPoolExecutor
2021
from datetime import datetime
22+
from pathlib import Path
2123
from threading import Thread
2224
from typing import Any
2325

26+
import yaml
2427
from dateutil.parser import isoparse
2528
from eodag import EOProduct
2629
from fastapi import HTTPException, status
2730
from rs_server_common.utils.logging import Logging
2831

2932
# pylint: disable=too-few-public-methods
30-
3133
logger = Logging.default(__name__)
34+
PTYPE_MAPPING_FILE = Path(osp.realpath(osp.dirname(__file__))).parent / "config" / "product_type_mapping.yaml"
3235

3336

3437
def validate_str_list(parameter: str) -> list | str:
@@ -242,12 +245,8 @@ def extract_eo_product(eo_product: EOProduct, mapper: dict) -> dict:
242245
def _apply_product_facets(feature: dict, _odata: dict) -> None:
243246
"""Sets product:type, processing:level - temporary hardcoded until RSPY-760 is DONE"""
244247

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"]
251250

252251
props = feature["properties"]
253252
if not (

0 commit comments

Comments
 (0)