From cbb406c1be892f46a8c9adbb173d2a847be9b820 Mon Sep 17 00:00:00 2001 From: Anders Rantala Hunderi Date: Mon, 9 Dec 2024 10:26:51 +0100 Subject: [PATCH] Refactor - Removed unused duplicated strat unit schema (#824) --- .../primary/routers/surface/schemas.py | 6 +++++ .../primary/routers/well/converters.py | 21 +-------------- .../primary/primary/routers/well/schemas.py | 26 ------------------- frontend/src/api/models/StratigraphicUnit.ts | 5 ++++ 4 files changed, 12 insertions(+), 46 deletions(-) diff --git a/backend_py/primary/primary/routers/surface/schemas.py b/backend_py/primary/primary/routers/surface/schemas.py index 3e6224991..719478b86 100644 --- a/backend_py/primary/primary/routers/surface/schemas.py +++ b/backend_py/primary/primary/routers/surface/schemas.py @@ -167,6 +167,12 @@ class PointSetXY(BaseModel): class StratigraphicUnit(BaseModel): + """ + Stratigraphic unit from SMDA + + Camel case attributes needed for esvIntersection component in front-end + """ + identifier: str top: str base: str diff --git a/backend_py/primary/primary/routers/well/converters.py b/backend_py/primary/primary/routers/well/converters.py index ab40d5a80..3aa679195 100644 --- a/backend_py/primary/primary/routers/well/converters.py +++ b/backend_py/primary/primary/routers/well/converters.py @@ -1,4 +1,4 @@ -from primary.services.smda_access.types import WellboreHeader, WellboreTrajectory, WellborePick, StratigraphicUnit +from primary.services.smda_access.types import WellboreHeader, WellboreTrajectory, WellborePick from primary.services.ssdl_access.types import ( WellboreCasing, WellboreCompletion, @@ -27,25 +27,6 @@ def convert_wellbore_pick_to_schema(wellbore_pick: WellborePick) -> schemas.Well ) -def convert_stratigraphic_unit_to_schema( - stratigraphic_unit: StratigraphicUnit, -) -> schemas.StratigraphicUnit: - return schemas.StratigraphicUnit( - identifier=stratigraphic_unit.identifier, - top=stratigraphic_unit.top, - base=stratigraphic_unit.base, - stratUnitLevel=stratigraphic_unit.strat_unit_level, - stratUnitType=stratigraphic_unit.strat_unit_type, - topAge=stratigraphic_unit.top_age, - baseAge=stratigraphic_unit.base_age, - stratUnitParent=stratigraphic_unit.strat_unit_parent, - colorR=stratigraphic_unit.color_r, - colorG=stratigraphic_unit.color_g, - colorB=stratigraphic_unit.color_b, - lithologyType=stratigraphic_unit.lithology_type, - ) - - def convert_wellbore_header_to_schema( drilled_wellbore_header: WellboreHeader, ) -> schemas.WellboreHeader: diff --git a/backend_py/primary/primary/routers/well/schemas.py b/backend_py/primary/primary/routers/well/schemas.py index cbb606e1c..fb31a9e8a 100644 --- a/backend_py/primary/primary/routers/well/schemas.py +++ b/backend_py/primary/primary/routers/well/schemas.py @@ -2,27 +2,6 @@ from pydantic import BaseModel -class StratigraphicUnit(BaseModel): - """ - Stratigraphic unit from SMDA - - Camel case attributes needed for esvIntersection component in front-end - """ - - identifier: str - top: str - base: str - stratUnitLevel: int - stratUnitType: str - topAge: int | float - baseAge: int | float - stratUnitParent: Optional[str] = None - colorR: int - colorG: int - colorB: int - lithologyType: int | float | str = "unknown" - - class WellboreHeader(BaseModel): wellboreUuid: str uniqueWellboreIdentifier: str @@ -66,11 +45,6 @@ class WellborePick(BaseModel): mdUnit: str -class WellborePicksAndStratigraphicUnits(BaseModel): - wellbore_picks: List[WellborePick] = [] - stratigraphic_units: List[StratigraphicUnit] = [] - - class WellboreCompletion(BaseModel): mdTop: float mdBottom: float diff --git a/frontend/src/api/models/StratigraphicUnit.ts b/frontend/src/api/models/StratigraphicUnit.ts index bb879bac0..614eb722c 100644 --- a/frontend/src/api/models/StratigraphicUnit.ts +++ b/frontend/src/api/models/StratigraphicUnit.ts @@ -2,6 +2,11 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ +/** + * Stratigraphic unit from SMDA + * + * Camel case attributes needed for esvIntersection component in front-end + */ export type StratigraphicUnit = { identifier: string; top: string;