Skip to content

Commit

Permalink
fixed strings
Browse files Browse the repository at this point in the history
  • Loading branch information
marshHawk4 committed Apr 16, 2024
1 parent 5fe0e76 commit 477c1b6
Show file tree
Hide file tree
Showing 13 changed files with 86 additions and 103 deletions.
12 changes: 5 additions & 7 deletions cdr_schemas/area_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,17 @@ class Area_Extraction(BaseModel):
The type of area extraction.
""",
)
text: Optional[str] = Field(
default=None,
text: str = Field(
default="",
description="""
The text within the extraction area.
""",
)

# Model Provenance
model: Optional[str] = Field(
default=None, description="Name of the model used to generate this data"
)
model_version: Optional[str] = Field(
default=None, description="Version of the model used to generate this data"
model: str = Field(description="Name of the model used to generate this data")
model_version: str = Field(
description="Version of the model used to generate this data"
)
model_config = ConfigDict(protected_namespaces=())
confidence: Optional[Union[float | int]] = Field(
Expand Down
8 changes: 3 additions & 5 deletions cdr_schemas/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ class GeoJsonType(str, Enum):


class ModelProvenance(BaseModel):
model: Optional[str] = Field(
default=None, description="Name of the model used to generate this data"
)
model_version: Optional[str] = Field(
default=None, description="Version of the model used to generate this data"
model: str = Field(description="Name of the model used to generate this data")
model_version: str = Field(
description="Version of the model used to generate this data"
)
model_config = ConfigDict(protected_namespaces=())
confidence: Optional[Union[float | int]] = Field(
Expand Down
8 changes: 2 additions & 6 deletions cdr_schemas/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@ class DocumentProvenance(BaseModel):
external_system_name: str = Field(
..., description="Name of system storing document"
)
external_system_id: Optional[str] = Field(
"", description="The system ID of the document"
)
external_system_url: Optional[str] = Field(
"", description="Name of system storing document"
)
external_system_id: str = Field("", description="The system ID of the document")
external_system_url: str = Field("", description="Name of system storing document")


class UploadDocument(BaseModel):
Expand Down
30 changes: 12 additions & 18 deletions cdr_schemas/features/line_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@ class LineProperty(BaseModel):
"""

# Model Provenance
model: Optional[str] = Field(
default=None, description="Name of the model used to generate this data"
)
model_version: Optional[str] = Field(
default=None, description="Version of the model used to generate this data"
model: str = Field(description="Name of the model used to generate this data")
model_version: str = Field(
description="Version of the model used to generate this data"
)
model_config = ConfigDict(protected_namespaces=())
confidence: Optional[Union[float | int]] = Field(
Expand All @@ -51,9 +49,7 @@ class LineProperty(BaseModel):
dash_pattern: Optional[DashType] = Field(
default=None, description="values = {solid, dash, dotted}"
)
symbol: Optional[str] = Field( # TODO add description
default=None, description="TODO : Add description"
)
symbol: str = Field(default="", description="TODO : Add description")


class LineFeature(BaseModel):
Expand Down Expand Up @@ -96,14 +92,12 @@ class LineLegendAndFeaturesResult(BaseModel):
legend_provenance: Optional[ModelProvenance] = Field(
default=None, description="Where the data originated from."
)
name: Optional[str] = Field(
default=None, description="Label of the map unit in the legend"
)
abbreviation: Optional[str] = Field(
default=None, description="Abbreviation of the map unit label."
name: str = Field(default="", description="Label of the map unit in the legend")
abbreviation: str = Field(
default="", description="Abbreviation of the map unit label."
)
description: Optional[str] = Field(
default=None, description="Description of the map unit in the legend"
description: str = Field(
default="", description="Description of the map unit in the legend"
)
legend_bbox: List[Union[float, int]] = Field(
default_factory=list,
Expand All @@ -119,14 +113,14 @@ class LineLegendAndFeaturesResult(BaseModel):
)

# Segmentation Fields
crs: Optional[str] = Field(
crs: str = Field(
default=CRITICALMAAS_PIXEL,
description="""What projection the geometry of the segmentation are in,
Default is CRITICALMAAS_PIXEL which specifies pixel coordinates.
Possible values are {CRITICALMAAS_PIXEL, EPSG:*}""",
)
cdr_projection_id: Optional[str] = Field(
default=None,
cdr_projection_id: str = Field(
default="",
description="""If non-pixel coordinates are used the cdr projection id of the
georeference that was used to create them is required.""",
)
Expand Down
26 changes: 11 additions & 15 deletions cdr_schemas/features/point_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@ class PointProperties(BaseModel):
"""

# Model Provenance
model: Optional[str] = Field(
default=None, description="Name of the model used to generate this data"
)
model_version: Optional[str] = Field(
default=None, description="Version of the model used to generate this data"
model: str = Field(description="Name of the model used to generate this data")
model_version: str = Field(
description="Version of the model used to generate this data"
)
model_config = ConfigDict(protected_namespaces=())
confidence: Optional[Union[float | int]] = Field(
Expand Down Expand Up @@ -94,14 +92,12 @@ class PointLegendAndFeaturesResult(BaseModel):
legend_provenance: Optional[ModelProvenance] = Field(
default=None, description="Where the data originated from."
)
name: Optional[str] = Field(
default=None, description="Label of the map unit in the legend"
)
abbreviation: Optional[str] = Field(
default=None, description="Abbreviation of the map unit label."
name: str = Field(description="Label of the map unit in the legend")
abbreviation: str = Field(
default="", description="Abbreviation of the map unit label."
)
description: Optional[str] = Field(
default=None, description="Description of the map unit in the legend"
description: str = Field(
default="", description="Description of the map unit in the legend"
)
legend_bbox: List[Union[float, int]] = Field(
default_factory=list,
Expand All @@ -117,14 +113,14 @@ class PointLegendAndFeaturesResult(BaseModel):
)

# Segmentation Fields
crs: Optional[str] = Field(
crs: str = Field(
default=CRITICALMAAS_PIXEL,
description="""What projection the geometry of the segmentation are in,
Default is CRITICALMAAS_PIXEL which specifies pixel coordinates.
Possible values are {CRITICALMAAS_PIXEL, EPSG:*}""",
)
cdr_projection_id: Optional[str] = Field(
default=None,
cdr_projection_id: str = Field(
default="",
description="""If non-pixel coordinates are used the cdr projection id of the
georeference that was used to create them is required.""",
)
Expand Down
44 changes: 18 additions & 26 deletions cdr_schemas/features/polygon_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,8 @@ class PolygonProperty(BaseModel):
Properties of the polygon.
"""

model: Optional[str] = Field(
default=None, description="Name of the model used for extraction"
)
model_version: Optional[str] = Field(
default=None, description="Version of the model used for extraction"
)
model: str = Field(description="Name of the model used for extraction")
model_version: str = Field(description="Version of the model used for extraction")
confidence: Optional[Union[float | int]] = Field(
default=None, description="The prediction confidence of the model"
)
Expand Down Expand Up @@ -75,14 +71,14 @@ class MapUnit(BaseModel):
"""

# TODO Someone needs to add full descriptions to these fields
age_text: Optional[str] = None
age_text: str = ""
b_age: Optional[float] = None
b_interval: Optional[str] = None
lithology: Optional[str] = None
name: Optional[str] = None
b_interval: str = ""
lithology: str = ""
name: str = ""
t_age: Optional[float] = None
t_interval: Optional[str] = None
comments: Optional[str] = None
t_interval: str = ""
comments: str = ""


class PolygonLegendAndFeaturesResult(BaseModel):
Expand All @@ -97,13 +93,11 @@ class PolygonLegendAndFeaturesResult(BaseModel):
legend_provenance: Optional[ModelProvenance] = Field(
default=None, description="Where the data originated from."
)
label: Optional[str] = Field(default=None, description="Label of the map unit")
abbreviation: Optional[str] = Field(
default=None, description="Abbreviation of the map unit label."
)
description: Optional[str] = Field(
default=None, description="Description of the map unit"
label: str = Field(description="Label of the map unit")
abbreviation: str = Field(
default="", description="Abbreviation of the map unit label."
)
description: str = Field(default="", description="Description of the map unit")
legend_bbox: List[Union[float, int]] = Field(
default_factory=list,
description="""The rough 2 point bounding box of the map units label.
Expand All @@ -116,25 +110,23 @@ class PolygonLegendAndFeaturesResult(BaseModel):
label. Format is expected to be [x,y] coordinate pairs
where the top left is the origin (0,0).""",
)
color: Optional[str] = Field(default=None, description="The color of the map unit")
pattern: Optional[str] = Field(
default=None, description="The pattern of the map unit"
)
color: str = Field(default="", description="The color of the map unit")
pattern: str = Field(default="", description="The pattern of the map unit")
### TODO Agreed on Apr 15th call that category can be removed
category: Optional[str] = Field(default=None, description="TODO - what is this?")
category: str = Field(default="", description="TODO - what is this?")
map_unit: Optional[MapUnit] = Field(
default=None, description="Human annotated information on the map unit"
)

# Segmentation Fields
crs: Optional[str] = Field(
crs: str = Field(
default=CRITICALMAAS_PIXEL,
description="""What projection the geometry of the segmentation are in,
Default is CRITICALMAAS_PIXEL which specifies pixel coordinates.
Possible values are {CRITICALMAAS_PIXEL, EPSG:*}""",
)
cdr_projection_id: Optional[str] = Field(
default=None,
cdr_projection_id: str = Field(
default="",
description="""If non-pixel coordinates are used the cdr projection id of the
georeference that was used to create them is required.""",
)
Expand Down
2 changes: 1 addition & 1 deletion cdr_schemas/georeference.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class GroundControlPoint(BaseModel):
The version of the model.
""",
)
crs: Optional[str] = Field(
crs: str = Field(
...,
description="""
Coordinate reference system. i.e. "EPSG:4267"
Expand Down
20 changes: 10 additions & 10 deletions cdr_schemas/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class MapColorSchemeTypes(str, Enum):


class MapMetaData(BaseModel):
title: Optional[str] = Field(
default=None,
title: str = Field(
default="",
description="""
Title of the map/cog.
""",
Expand All @@ -32,8 +32,8 @@ class MapMetaData(BaseModel):
Year the map was made. i.e. 2012
""",
)
crs: Optional[str] = Field(
default=None,
crs: str = Field(
default="",
description="""
CRS of the map. i.e. "EPSG:4267"
""",
Expand All @@ -44,8 +44,8 @@ class MapMetaData(BaseModel):
Authors of the map
""",
)
organization: Optional[str] = Field(
default=None,
organization: str = Field(
default="",
description="""
Organization that created the map
""",
Expand All @@ -56,8 +56,8 @@ class MapMetaData(BaseModel):
Scale of the map. 24000 would be equivalent to 1:24000
""",
)
quadrangle_name: Optional[str] = Field(
default=None,
quadrangle_name: str = Field(
default="",
description="""
If map is based on a quadrangle location we can save the name here.
""",
Expand All @@ -74,8 +74,8 @@ class MapMetaData(BaseModel):
Color scheme of the map.
""",
)
publisher: Optional[str] = None
state: Optional[str] = None
publisher: str = ""
state: str = ""

model: str
model_version: str
Expand Down
26 changes: 15 additions & 11 deletions cdr_schemas/mineral.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ class ResourceReserveCategory(Enum):


class GeologyInfo(BaseModel):
age: Optional[str] = Field(description="Age of the geologic unit or event")
unit_name: Optional[str] = Field(description="Name of the geologic unit")
description: Optional[str]
age: str = Field(default="", description="Age of the geologic unit or event")
unit_name: str = Field(default="", description="Name of the geologic unit")
description: str = ""
lithology: List[str] = Field(default_factory=list, description="Lithology")
process: List[str] = Field(default_factory=list, description="Process")
environment: List[str] = Field(default_factory=list, description="environment")
comments: Optional[str]
comments: str = ""


class Ore(BaseModel):
Expand Down Expand Up @@ -87,7 +87,7 @@ class EvidenceLayer(BaseModel):

class MappableCriteria(BaseModel):
criteria: str
theoretical: Optional[str]
theoretical: str = ""
potential_dataset: list[EvidenceLayer] = Field(
default_factory=list, description="List of evidence layers"
)
Expand Down Expand Up @@ -125,8 +125,9 @@ class Grade(BaseModel):

class MineralInventory(BaseModel):
commodity: Commodity = Field(description="The commodity of an inventory item")
observed_commodity: Optional[str] = Field(
description="The observed commodity in the source data (textual format)"
observed_commodity: str = Field(
default="",
description="The observed commodity in the source data (textual format)",
)
category: Optional[ResourceReserveCategory] = Field(
description="The category of an inventory item"
Expand All @@ -143,8 +144,9 @@ class MineralInventory(BaseModel):
date: Optional[datetime] = Field(
description="When in the point of time mineral inventory valid"
)
zone: Optional[str] = Field(
description="zone of mineral site where inventory item was discovered"
zone: str = Field(
default="",
description="zone of mineral site where inventory item was discovered",
)


Expand All @@ -155,7 +157,9 @@ class LocationInfo(BaseModel):
crs: str = Field(
description="The Coordinate Reference System (CRS) of the location"
)
country: Optional[str] = Field(description="Country that the mine site resides in")
country: str = Field(
default="", description="Country that the mine site resides in"
)
state_or_province: Optional[str] = Field(
description="State or province that the mine site resides in"
)
Expand All @@ -168,7 +172,7 @@ class MineralSite(BaseModel):
record_id: str = Field(
description="Unique ID of the record that the info is retrieved from e.g., 10022920"
)
name: Optional[str] = Field(description="Name of the mine, e.g., Tungsten Jim")
name: str = Field(default="", description="Name of the mine, e.g., Tungsten Jim")
mineral_inventory: list[MineralInventory]
location_info: LocationInfo
geology_info: Optional[GeologyInfo]
Expand Down
Loading

0 comments on commit 477c1b6

Please sign in to comment.