Skip to content
Snippets Groups Projects
Commit b08950ba authored by Sabine Schröder's avatar Sabine Schröder
Browse files

#17: after re-adding coordinate_validation_status to table stationmeta_core,...

#17: after re-adding coordinate_validation_status to table stationmeta_core, it has also to be readded to the model/schema/docu
parent 2201fd21
No related branches found
No related tags found
No related merge requests found
Pipeline #52367 passed
...@@ -79,6 +79,7 @@ ...@@ -79,6 +79,7 @@
| codes | [ string ] | list of station's codes | Yes | | codes | [ string ] | list of station's codes | Yes |
| name | string | | Yes | | name | string | | Yes |
| coordinates | [Coordinates](#coordinates) | | Yes | | coordinates | [Coordinates](#coordinates) | | Yes |
| coordinate_validation_status | string | | Yes |
| country | string | | Yes | | country | string | | Yes |
| state | string | | Yes | | state | string | | Yes |
| type_of_environment | string | | Yes | | type_of_environment | string | | Yes |
...@@ -195,6 +196,7 @@ ...@@ -195,6 +196,7 @@
| codes | [ string ] | list of station's codes | Yes | | codes | [ string ] | list of station's codes | Yes |
| name | string | | Yes | | name | string | | Yes |
| coordinates | [Coordinates](#coordinates) | | Yes | | coordinates | [Coordinates](#coordinates) | | Yes |
| coordinate_validation_status | string | | Yes |
| country | string | | Yes | | country | string | | Yes |
| state | string | | Yes | | state | string | | Yes |
| type_of_environment | string | | Yes | | type_of_environment | string | | Yes |
...@@ -210,6 +212,7 @@ ...@@ -210,6 +212,7 @@
| codes | [ string ] | list of station's codes | Yes | | codes | [ string ] | list of station's codes | Yes |
| name | string | | Yes | | name | string | | Yes |
| coordinates | [Coordinates](#coordinates) | | Yes | | coordinates | [Coordinates](#coordinates) | | Yes |
| coordinate_validation_status | string | | Yes |
| country | string | | Yes | | country | string | | Yes |
| state | string | | Yes | | state | string | | Yes |
| type_of_environment | string | | Yes | | type_of_environment | string | | Yes |
...@@ -269,6 +272,7 @@ ...@@ -269,6 +272,7 @@
| codes | [ string ] | | No | | codes | [ string ] | | No |
| name | string | | No | | name | string | | No |
| coordinates | [Coordinates](#coordinates) | | No | | coordinates | [Coordinates](#coordinates) | | No |
| coordinate_validation_status | string | | No |
| country | string | | No | | country | string | | No |
| state | string | | No | | state | string | | No |
| type_of_environment | string | | No | | type_of_environment | string | | No |
......
...@@ -31,6 +31,8 @@ class StationmetaCore_WithoutCoords(Base): ...@@ -31,6 +31,8 @@ class StationmetaCore_WithoutCoords(Base):
+------------------------------+--------------------------+-----------+----------+----------------------------------------------+ +------------------------------+--------------------------+-----------+----------+----------------------------------------------+
| coordinates | geometry(PointZ,4326) | | not null | | | coordinates | geometry(PointZ,4326) | | not null | |
+------------------------------+--------------------------+-----------+----------+----------------------------------------------+ +------------------------------+--------------------------+-----------+----------+----------------------------------------------+
| coordinate_validation_status | integer | | not null | 0 |
+------------------------------+--------------------------+-----------+----------+----------------------------------------------+
| country | character varying(128) | | not null | | | country | character varying(128) | | not null | |
+------------------------------+--------------------------+-----------+----------+----------------------------------------------+ +------------------------------+--------------------------+-----------+----------+----------------------------------------------+
| state | character varying(128) | | not null | | | state | character varying(128) | | not null | |
......
...@@ -29,6 +29,7 @@ class StationmetaCoreBase(BaseModel): ...@@ -29,6 +29,7 @@ class StationmetaCoreBase(BaseModel):
codes: List[str] = Field(..., description="list of station's codes") codes: List[str] = Field(..., description="list of station's codes")
name: str name: str
coordinates: Coordinates coordinates: Coordinates
coordinate_validation_status: str
country: str country: str
state: str state: str
type_of_environment: str type_of_environment: str
...@@ -39,6 +40,10 @@ class StationmetaCoreBase(BaseModel): ...@@ -39,6 +40,10 @@ class StationmetaCoreBase(BaseModel):
class Config(BaseConfig): class Config(BaseConfig):
orm_mode = True orm_mode = True
@validator('coordinate_validation_status')
def check_coordinate_validation_status(cls, v):
return tuple(filter(lambda x: x.value == int(v), CV_enum))[0].string
@validator('type_of_environment') @validator('type_of_environment')
def check_type_of_environment(cls, v): def check_type_of_environment(cls, v):
return tuple(filter(lambda x: x.value == int(v), ST_enum))[0].string return tuple(filter(lambda x: x.value == int(v), ST_enum))[0].string
...@@ -52,6 +57,7 @@ class StationmetaCorePatch(BaseModel): ...@@ -52,6 +57,7 @@ class StationmetaCorePatch(BaseModel):
codes: List[str] = None codes: List[str] = None
name: str = None name: str = None
coordinates: Coordinates = None coordinates: Coordinates = None
coordinate_validation_status: str = None
country: str = None country: str = None
state: str = None state: str = None
type_of_environment: str = None type_of_environment: str = None
...@@ -62,6 +68,11 @@ class StationmetaCorePatch(BaseModel): ...@@ -62,6 +68,11 @@ class StationmetaCorePatch(BaseModel):
class Config(BaseConfig): class Config(BaseConfig):
orm_mode = True orm_mode = True
@validator('coordinate_validation_status')
def check_coordinate_validation_status(cls, v):
if v:
return tuple(filter(lambda x: x.value == int(v), CV_enum))[0].string
@validator('type_of_environment') @validator('type_of_environment')
def check_type_of_environment(cls, v): def check_type_of_environment(cls, v):
if v: if v:
...@@ -76,6 +87,13 @@ class StationmetaCorePatch(BaseModel): ...@@ -76,6 +87,13 @@ class StationmetaCorePatch(BaseModel):
class StationmetaCoreCreate(StationmetaCoreBase): class StationmetaCoreCreate(StationmetaCoreBase):
pass pass
@validator('coordinate_validation_status')
def check_coordinate_validation_status(cls, v):
if tuple(filter(lambda x: x.string == v, CV_enum)):
return v
else:
raise ValueError(f"coordinate validation status not known: {v}")
@validator('type_of_environment') @validator('type_of_environment')
def check_type_of_environment(cls, v): def check_type_of_environment(cls, v):
if tuple(filter(lambda x: x.string == v, ST_enum)): if tuple(filter(lambda x: x.string == v, ST_enum)):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment