Skip to content

Commit

Permalink
added metadata schema (#13)
Browse files Browse the repository at this point in the history
* added metadata schema

* added metadata schema

* added extra area
  • Loading branch information
marshHawk4 authored Mar 26, 2024
1 parent 3ce0789 commit ba7d11b
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 2 deletions.
4 changes: 4 additions & 0 deletions cdr_schemas/area_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ class AreaType(str, Enum):
OCR = "ocr"
Polygon_Legend_Area = "polygon_legend_area"
Line_Point_Legend_Area = "line_point_legend_area"
Line_Legend_Area = "line_legend_area"
Point_Legend_Area = "point_legend_area"
Correlation_Diagram = "correlation_diagram"


class Area_Extraction(BaseModel):
Expand Down Expand Up @@ -44,4 +47,5 @@ class Area_Extraction(BaseModel):
model_version: Optional[str] = Field(
description="model version used for extraction"
)

model_config = ConfigDict(protected_namespaces=())
4 changes: 2 additions & 2 deletions cdr_schemas/georeference.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ class GroundControlPoint(BaseModel):
map_geom: Geom_Point = Field(
...,
description="""
Point geometry, in world coordinates. [longitude, latitude].
Point geometry, in world coordinates.
""",
)
px_geom: Pixel_Point = Field(
...,
description="""
Point geometry, in pixel coordinates. [columns from left, row from bottom].
Point geometry, in pixel coordinates.
""",
)
confidence: Optional[float] = Field(
Expand Down
85 changes: 85 additions & 0 deletions cdr_schemas/metadata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
from typing import List, Union, Optional
from enum import Enum
from pydantic import BaseModel, Field, ConfigDict


class MapShapeTypes(str, Enum):
"""Enum for the possible values of map_shape field of MapMetadata."""

rectangular = "rectangular"
non_rectangular = "non_rectangular"


class MapColorSchemeTypes(str, Enum):
"""Enum for the possible values of map_color_scheme field of MapMetadata"""

full_color = "full_color"
monochrome = "monochrome"
grayscale = "grayscale"


class MapMetaData(BaseModel):
title: Optional[str] = Field(
...,
description="""
Title of the map/cog.
""",
)
year: Optional[int] = Field(
...,
description="""
Year the map was made. i.e. 2012
""",
)
crs: Optional[str] = Field(
...,
description="""
CRS of the map. i.e. "EPSG:4267"
""",
)
authors: Optional[List[str]] = Field(
...,
description="""
Authors of the map
""",
)
organization: Optional[str] = Field(
...,
description="""
Organization that created the map
""",
)
scale: Optional[int] = Field(
...,
description="""
Scale of the map. 24000 would be equivalent to 1:24000
""",
)
quadrangle_name: Optional[str] = Field(
...,
description="""
If map is based on a quadrangle location we can save the name here.
""",
)
map_shape: Optional[MapShapeTypes] = Field(
...,
description="""
If the map area(s) has a rectangle shape.
""",
)
map_color_scheme: Optional[MapColorSchemeTypes]
publisher: Optional[str]
state: Optional[str]

model: str
model_version: str

model_config = ConfigDict(protected_namespaces=())


class CogMetaData(BaseModel):
cog_id: str
system: str
system_version: str
multiple_maps: Optional[bool]
map_metadata: Optional[List[MapMetaData]]

0 comments on commit ba7d11b

Please sign in to comment.