From 3710d7819175ae4dd2e653cbe64710684107a6fb Mon Sep 17 00:00:00 2001 From: Scott Haleen Date: Tue, 25 Jun 2024 15:18:52 -0400 Subject: [PATCH 1/5] mineral updates --- README.md | 933 ++++++++++++++++++++--------------------- cdr_schemas/mineral.py | 222 +++++----- 2 files changed, 558 insertions(+), 597 deletions(-) diff --git a/README.md b/README.md index d45a1f6..e632d3a 100644 --- a/README.md +++ b/README.md @@ -68,24 +68,24 @@ poetry run docs ```mermaid classDiagram - class GeomType { - <> - Point: str = 'Point' - LineString: str = 'LineString' - Polygon: str = 'Polygon' - } - class Area_Extraction { type: GeomType = GeomType.Polygon - coordinates: list[list[list[float | int]]] - bbox: list[float | int] = list + coordinates: list[list[list[Union[float, int]]]] + bbox: list[Union[float, int]] = list category: AreaType text: str = '' reference_id: str = '' validated: bool = False model: str model_version: str - confidence: float | int | None = None + confidence: Union[float, int, NoneType] = None + } + + class GeomType { + <> + Point: str = 'Point' + LineString: str = 'LineString' + Polygon: str = 'Polygon' } class AreaType { @@ -117,30 +117,11 @@ classDiagram ```mermaid classDiagram - class GeoreferenceResults { - cog_id: str - georeference_results: list[GeoreferenceResult] = list - gcps: list[GroundControlPoint] = list - system: str - system_version: str - } - - class Geom_Point { - latitude: float | int | None - longitude: float | int | None - type: GeomType = GeomType.Point - } - - class GeoreferenceResult { - likely_CRSs: list[str] = list - map_area: Area_Extraction | None = None - projections: list[ProjectionResult] = list - } - - class Pixel_Point { - rows_from_top: float | int - columns_from_left: float | int - type: GeomType = GeomType.Point + class ProjectionResult { + crs: str + gcp_ids: list[str] + file_name: str + validated: bool = False } class GeomType { @@ -150,42 +131,61 @@ classDiagram Polygon: str = 'Polygon' } + class GroundControlPoint { + gcp_id: str + map_geom: Geom_Point + px_geom: Pixel_Point + confidence: Union[float, int, NoneType] = None + model: str + model_version: str + crs: str + } + + class Geom_Point { + latitude: Union[float, int, NoneType] + longitude: Union[float, int, NoneType] + type: GeomType = GeomType.Point + } + class Area_Extraction { type: GeomType = GeomType.Polygon - coordinates: list[list[list[float | int]]] - bbox: list[float | int] = list + coordinates: list[list[list[Union[float, int]]]] + bbox: list[Union[float, int]] = list category: AreaType text: str = '' reference_id: str = '' validated: bool = False model: str model_version: str - confidence: float | int | None = None + confidence: Union[float, int, NoneType] = None } - class ProjectionResult { - crs: str - gcp_ids: list[str] - file_name: str - validated: bool = False + class Pixel_Point { + rows_from_top: Union[float, int] + columns_from_left: Union[float, int] + type: GeomType = GeomType.Point } - class GroundControlPoint { - gcp_id: str - map_geom: Geom_Point - px_geom: Pixel_Point - confidence: float | int | None = None - model: str - model_version: str - crs: str + class GeoreferenceResult { + likely_CRSs: list[str] = list + map_area: Optional[Area_Extraction] = None + projections: list[ProjectionResult] = list + } + + class GeoreferenceResults { + cog_id: str + georeference_results: list[GeoreferenceResult] = list + gcps: list[GroundControlPoint] = list + system: str + system_version: str } Area_Extraction ..> GeomType Area_Extraction ..> AreaType Geom_Point ..> GeomType Pixel_Point ..> GeomType - GroundControlPoint ..> Pixel_Point GroundControlPoint ..> Geom_Point + GroundControlPoint ..> Pixel_Point GeoreferenceResult ..> Area_Extraction GeoreferenceResult ..> ProjectionResult GeoreferenceResults ..> GeoreferenceResult @@ -204,28 +204,36 @@ classDiagram ```mermaid classDiagram - class MapShapeTypes { - <> - rectangular: str = 'rectangular' - non_rectangular: str = 'non_rectangular' + class CogMetaData { + cog_id: str + system: str + system_version: str + multiple_maps: Optional[bool] = None + map_metadata: list[MapMetaData] = list } class MapMetaData { title: str = '' - year: int | None = None + year: Optional[int] = None crs: str = '' authors: list[str] = list organization: str = '' - scale: int | None = None + scale: Optional[int] = None quadrangle_name: str = '' - map_shape: MapShapeTypes | None = None - map_color_scheme: MapColorSchemeTypes | None = None + map_shape: Optional[MapShapeTypes] = None + map_color_scheme: Optional[MapColorSchemeTypes] = None publisher: str = '' state: str = '' model: str model_version: str } + class MapShapeTypes { + <> + rectangular: str = 'rectangular' + non_rectangular: str = 'non_rectangular' + } + class MapColorSchemeTypes { <> full_color: str = 'full_color' @@ -233,14 +241,6 @@ classDiagram grayscale: str = 'grayscale' } - class CogMetaData { - cog_id: str - system: str - system_version: str - multiple_maps: bool | None = None - map_metadata: list[MapMetaData] = list - } - MapMetaData ..> MapShapeTypes MapMetaData ..> MapColorSchemeTypes CogMetaData ..> MapMetaData @@ -258,102 +258,102 @@ classDiagram ```mermaid classDiagram - class PolygonLegendAndFeaturesResult { + class LineLegendAndFeaturesResult { id: str - legend_provenance: ModelProvenance | None = None - label: str + legend_provenance: Optional[ModelProvenance] = None + name: str = '' abbreviation: str = '' description: str = '' - legend_bbox: list[float | int] = list - legend_contour: list[list[float | int]] = list - color: str = '' - pattern: str = '' - category: str = '' - map_unit: MapUnit | None = None + legend_bbox: list[Union[float, int]] = list + legend_contour: list[list[Union[float, int]]] = list reference_id: str = '' validated: bool = False crs: str = 'pixel' cdr_projection_id: str = '' - polygon_features: PolygonFeatureCollection | None = None + line_features: Optional[LineFeatureCollection] = None } - class Area_Extraction { - type: GeomType = GeomType.Polygon - coordinates: list[list[list[float | int]]] - bbox: list[float | int] = list - category: AreaType - text: str = '' - reference_id: str = '' - validated: bool = False - model: str - model_version: str - confidence: float | int | None = None - } - - class CogMetaData { - cog_id: str + class FeatureResults { system: str system_version: str - multiple_maps: bool | None = None - map_metadata: list[MapMetaData] = list + cog_id: str + line_feature_results: list[LineLegendAndFeaturesResult] = list + point_feature_results: list[PointLegendAndFeaturesResult] = list + polygon_feature_results: list[PolygonLegendAndFeaturesResult] = list + cog_area_extractions: list[Area_Extraction] = list + cog_metadata_extractions: list[CogMetaData] = list } - class LineLegendAndFeaturesResult { + class PointLegendAndFeaturesResult { id: str - legend_provenance: ModelProvenance | None = None - name: str = '' + legend_provenance: Optional[ModelProvenance] = None + name: str abbreviation: str = '' description: str = '' - legend_bbox: list[float | int] = list - legend_contour: list[list[float | int]] = list + legend_bbox: list[Union[float, int]] = list + legend_contour: list[list[Union[float, int]]] = list reference_id: str = '' validated: bool = False crs: str = 'pixel' cdr_projection_id: str = '' - line_features: LineFeatureCollection | None = None + point_features: Optional[PointFeatureCollection] = None } - class FeatureResults { + class CogMetaData { + cog_id: str system: str system_version: str - cog_id: str - line_feature_results: list[LineLegendAndFeaturesResult] = list - point_feature_results: list[PointLegendAndFeaturesResult] = list - polygon_feature_results: list[PolygonLegendAndFeaturesResult] = list - cog_area_extractions: list[Area_Extraction] = list - cog_metadata_extractions: list[CogMetaData] = list + multiple_maps: Optional[bool] = None + map_metadata: list[MapMetaData] = list } - class PointLegendAndFeaturesResult { + class PolygonLegendAndFeaturesResult { id: str - legend_provenance: ModelProvenance | None = None - name: str + legend_provenance: Optional[ModelProvenance] = None + label: str abbreviation: str = '' description: str = '' - legend_bbox: list[float | int] = list - legend_contour: list[list[float | int]] = list + legend_bbox: list[Union[float, int]] = list + legend_contour: list[list[Union[float, int]]] = list + color: str = '' + pattern: str = '' + category: str = '' + map_unit: Optional[MapUnit] = None reference_id: str = '' validated: bool = False crs: str = 'pixel' cdr_projection_id: str = '' - point_features: PointFeatureCollection | None = None + polygon_features: Optional[PolygonFeatureCollection] = None + } + + class Area_Extraction { + type: GeomType = GeomType.Polygon + coordinates: list[list[list[Union[float, int]]]] + bbox: list[Union[float, int]] = list + category: AreaType + text: str = '' + reference_id: str = '' + validated: bool = False + model: str + model_version: str + confidence: Union[float, int, NoneType] = None } Area_Extraction ..> GeomType Area_Extraction ..> AreaType - LineLegendAndFeaturesResult ..> LineFeatureCollection LineLegendAndFeaturesResult ..> ModelProvenance + LineLegendAndFeaturesResult ..> LineFeatureCollection PointLegendAndFeaturesResult ..> PointFeatureCollection PointLegendAndFeaturesResult ..> ModelProvenance - PolygonLegendAndFeaturesResult ..> ModelProvenance - PolygonLegendAndFeaturesResult ..> MapUnit PolygonLegendAndFeaturesResult ..> PolygonFeatureCollection + PolygonLegendAndFeaturesResult ..> MapUnit + PolygonLegendAndFeaturesResult ..> ModelProvenance CogMetaData ..> MapMetaData - FeatureResults ..> Area_Extraction - FeatureResults ..> CogMetaData - FeatureResults ..> PolygonLegendAndFeaturesResult FeatureResults ..> LineLegendAndFeaturesResult FeatureResults ..> PointLegendAndFeaturesResult + FeatureResults ..> CogMetaData + FeatureResults ..> PolygonLegendAndFeaturesResult + FeatureResults ..> Area_Extraction ``` @@ -368,29 +368,6 @@ classDiagram ```mermaid classDiagram - class PointProperties { - model: str - model_version: str - confidence: float | int | None = None - bbox: list[float | int] | None = None - dip: int | None = None - dip_direction: int | None = None - reference_id: str = '' - validated: bool = False - } - - class PointFeatureCollection { - type: GeoJsonType = GeoJsonType.FeatureCollection - features: list[PointFeature] = list - } - - class PointFeature { - type: GeoJsonType = GeoJsonType.Feature - id: str - geometry: Point - properties: PointProperties - } - class GeomType { <> Point: str = 'Point' @@ -398,44 +375,67 @@ classDiagram Polygon: str = 'Polygon' } + class ModelProvenance { + model: str + model_version: str + confidence: Union[float, int, NoneType] = None + } + class Point { - coordinates: list[float | int] + coordinates: list[Union[float, int]] type: GeomType = GeomType.Point } - class GeoJsonType { - <> - Feature: str = 'Feature' - FeatureCollection: str = 'FeatureCollection' + class PointFeatureCollection { + type: GeoJsonType = GeoJsonType.FeatureCollection + features: list[PointFeature] = list } - class ModelProvenance { + class PointProperties { model: str model_version: str - confidence: float | int | None = None + confidence: Union[float, int, NoneType] = None + bbox: Optional[list[Union[float, int]]] = None + dip: Optional[int] = None + dip_direction: Optional[int] = None + reference_id: str = '' + validated: bool = False } class PointLegendAndFeaturesResult { id: str - legend_provenance: ModelProvenance | None = None + legend_provenance: Optional[ModelProvenance] = None name: str abbreviation: str = '' description: str = '' - legend_bbox: list[float | int] = list - legend_contour: list[list[float | int]] = list + legend_bbox: list[Union[float, int]] = list + legend_contour: list[list[Union[float, int]]] = list reference_id: str = '' validated: bool = False crs: str = 'pixel' cdr_projection_id: str = '' - point_features: PointFeatureCollection | None = None + point_features: Optional[PointFeatureCollection] = None + } + + class GeoJsonType { + <> + Feature: str = 'Feature' + FeatureCollection: str = 'FeatureCollection' + } + + class PointFeature { + type: GeoJsonType = GeoJsonType.Feature + id: str + geometry: Point + properties: PointProperties } Point ..> GeomType PointFeature ..> PointProperties - PointFeature ..> Point PointFeature ..> GeoJsonType - PointFeatureCollection ..> PointFeature + PointFeature ..> Point PointFeatureCollection ..> GeoJsonType + PointFeatureCollection ..> PointFeature PointLegendAndFeaturesResult ..> PointFeatureCollection PointLegendAndFeaturesResult ..> ModelProvenance @@ -452,15 +452,8 @@ classDiagram ```mermaid classDiagram - class LineFeature { - type: GeoJsonType = GeoJsonType.Feature - id: str - geometry: Line - properties: LineProperty - } - class Line { - coordinates: list[list[float | int]] + coordinates: list[list[Union[float, int]]] type: GeomType = GeomType.LineString } @@ -471,17 +464,20 @@ classDiagram Polygon: str = 'Polygon' } - class DashType { - <> - solid: str = 'solid' - dash: str = 'dash' - dotted: str = 'dotted' + class ModelProvenance { + model: str + model_version: str + confidence: Union[float, int, NoneType] = None } - class GeoJsonType { - <> - Feature: str = 'Feature' - FeatureCollection: str = 'FeatureCollection' + class LineProperty { + model: str + model_version: str + confidence: Union[float, int, NoneType] = None + dash_pattern: Optional[DashType] = None + symbol: str = '' + reference_id: str = '' + validated: bool = False } class LineFeatureCollection { @@ -489,46 +485,50 @@ classDiagram features: list[LineFeature] = list } + class LineFeature { + type: GeoJsonType = GeoJsonType.Feature + id: str + geometry: Line + properties: LineProperty + } + class LineLegendAndFeaturesResult { id: str - legend_provenance: ModelProvenance | None = None + legend_provenance: Optional[ModelProvenance] = None name: str = '' abbreviation: str = '' description: str = '' - legend_bbox: list[float | int] = list - legend_contour: list[list[float | int]] = list + legend_bbox: list[Union[float, int]] = list + legend_contour: list[list[Union[float, int]]] = list reference_id: str = '' validated: bool = False crs: str = 'pixel' cdr_projection_id: str = '' - line_features: LineFeatureCollection | None = None + line_features: Optional[LineFeatureCollection] = None } - class ModelProvenance { - model: str - model_version: str - confidence: float | int | None = None + class DashType { + <> + solid: str = 'solid' + dash: str = 'dash' + dotted: str = 'dotted' } - class LineProperty { - model: str - model_version: str - confidence: float | int | None = None - dash_pattern: DashType | None = None - symbol: str = '' - reference_id: str = '' - validated: bool = False + class GeoJsonType { + <> + Feature: str = 'Feature' + FeatureCollection: str = 'FeatureCollection' } Line ..> GeomType LineProperty ..> DashType - LineFeature ..> Line LineFeature ..> LineProperty LineFeature ..> GeoJsonType - LineFeatureCollection ..> LineFeature + LineFeature ..> Line LineFeatureCollection ..> GeoJsonType - LineLegendAndFeaturesResult ..> LineFeatureCollection + LineFeatureCollection ..> LineFeature LineLegendAndFeaturesResult ..> ModelProvenance + LineLegendAndFeaturesResult ..> LineFeatureCollection ``` @@ -543,89 +543,89 @@ classDiagram ```mermaid classDiagram - class PolygonFeature { - type: GeoJsonType = GeoJsonType.Feature - id: str - geometry: Polygon - properties: PolygonProperty - } - - class Polygon { - coordinates: list[list[list[float | int]]] - type: GeomType = GeomType.Polygon - } - - class GeomType { - <> - Point: str = 'Point' - LineString: str = 'LineString' - Polygon: str = 'Polygon' - } - class PolygonProperty { model: str model_version: str reference_id: str = '' validated: bool = False - confidence: float | int | None = None + confidence: Union[float, int, NoneType] = None } - class GeoJsonType { - <> - Feature: str = 'Feature' - FeatureCollection: str = 'FeatureCollection' + class PolygonFeatureCollection { + type: GeoJsonType = GeoJsonType.FeatureCollection + features: list[PolygonFeature] = list } class PolygonLegendAndFeaturesResult { id: str - legend_provenance: ModelProvenance | None = None + legend_provenance: Optional[ModelProvenance] = None label: str abbreviation: str = '' description: str = '' - legend_bbox: list[float | int] = list - legend_contour: list[list[float | int]] = list + legend_bbox: list[Union[float, int]] = list + legend_contour: list[list[Union[float, int]]] = list color: str = '' pattern: str = '' category: str = '' - map_unit: MapUnit | None = None + map_unit: Optional[MapUnit] = None reference_id: str = '' validated: bool = False crs: str = 'pixel' cdr_projection_id: str = '' - polygon_features: PolygonFeatureCollection | None = None + polygon_features: Optional[PolygonFeatureCollection] = None + } + + class GeomType { + <> + Point: str = 'Point' + LineString: str = 'LineString' + Polygon: str = 'Polygon' } class ModelProvenance { model: str model_version: str - confidence: float | int | None = None + confidence: Union[float, int, NoneType] = None + } + + class Polygon { + coordinates: list[list[list[Union[float, int]]]] + type: GeomType = GeomType.Polygon } class MapUnit { age_text: str = '' - b_age: float | None = None + b_age: Optional[float] = None b_interval: str = '' lithology: str = '' name: str = '' - t_age: float | None = None + t_age: Optional[float] = None t_interval: str = '' comments: str = '' } - class PolygonFeatureCollection { - type: GeoJsonType = GeoJsonType.FeatureCollection - features: list[PolygonFeature] = list + class PolygonFeature { + type: GeoJsonType = GeoJsonType.Feature + id: str + geometry: Polygon + properties: PolygonProperty + } + + class GeoJsonType { + <> + Feature: str = 'Feature' + FeatureCollection: str = 'FeatureCollection' } Polygon ..> GeomType - PolygonFeature ..> Polygon PolygonFeature ..> PolygonProperty PolygonFeature ..> GeoJsonType + PolygonFeature ..> Polygon PolygonFeatureCollection ..> PolygonFeature PolygonFeatureCollection ..> GeoJsonType - PolygonLegendAndFeaturesResult ..> ModelProvenance - PolygonLegendAndFeaturesResult ..> MapUnit PolygonLegendAndFeaturesResult ..> PolygonFeatureCollection + PolygonLegendAndFeaturesResult ..> MapUnit + PolygonLegendAndFeaturesResult ..> ModelProvenance ``` @@ -640,41 +640,41 @@ classDiagram ```mermaid classDiagram - class MapShapeTypes { - <> - rectangular: str = 'rectangular' - non_rectangular: str = 'non_rectangular' + class CogMetaData { + cog_id: str + system: str + system_version: str + multiple_maps: Optional[bool] = None + map_metadata: list[MapMetaData] = list } class MapMetaData { title: str = '' - year: int | None = None + year: Optional[int] = None crs: str = '' authors: list[str] = list organization: str = '' - scale: int | None = None + scale: Optional[int] = None quadrangle_name: str = '' - map_shape: MapShapeTypes | None = None - map_color_scheme: MapColorSchemeTypes | None = None + map_shape: Optional[MapShapeTypes] = None + map_color_scheme: Optional[MapColorSchemeTypes] = None publisher: str = '' state: str = '' model: str model_version: str } - class MapColorSchemeTypes { + class MapShapeTypes { <> - full_color: str = 'full_color' - monochrome: str = 'monochrome' - grayscale: str = 'grayscale' + rectangular: str = 'rectangular' + non_rectangular: str = 'non_rectangular' } - - class CogMetaData { - cog_id: str - system: str - system_version: str - multiple_maps: bool | None = None - map_metadata: list[MapMetaData] = list + + class MapColorSchemeTypes { + <> + full_color: str = 'full_color' + monochrome: str = 'monochrome' + grayscale: str = 'grayscale' } MapMetaData ..> MapShapeTypes @@ -694,13 +694,25 @@ classDiagram ```mermaid classDiagram + class Document { + id: str + title: str + is_open: bool + pages: int + size: int + provenance: list[DocumentProvenance] = list + metadata: Optional[DocumentMetaData] = None + system: str + system_version: str + } + class DocumentMetaData { doi: str = '' authors: list[str] = list journal: str = '' - year: int | None = None - month: int | None = None - volume: int | None = None + year: Optional[int] = None + month: Optional[int] = None + volume: Optional[int] = None issue: str = '' description: str = '' publisher: str = '' @@ -716,41 +728,29 @@ classDiagram title: str is_open: bool = True provenance: list[DocumentProvenance] = list - metadata: DocumentMetaData | None = None + metadata: Optional[DocumentMetaData] = None system: str system_version: str } class DocumentExtraction { - id: str | None = None + id: UnionType[str, NoneType] = None document_id: str = None extraction_type: str extraction_label: str - score: float | None = None - bbox: tuple[float, float, float, float] | None = None - page_num: int | None = None - external_link: str | None = None - data: dict[] | None = None - system: str - system_version: str - } - - class Document { - id: str - title: str - is_open: bool - pages: int - size: int - provenance: list[DocumentProvenance] = list - metadata: DocumentMetaData | None = None + score: UnionType[float, NoneType] = None + bbox: UnionType[tuple[float, float, float, float], NoneType] = None + page_num: UnionType[int, NoneType] = None + external_link: UnionType[str, NoneType] = None + data: Optional[dict[]] = None system: str system_version: str } - UploadDocument ..> DocumentMetaData UploadDocument ..> DocumentProvenance - Document ..> DocumentMetaData + UploadDocument ..> DocumentMetaData Document ..> DocumentProvenance + Document ..> DocumentMetaData ``` @@ -765,91 +765,28 @@ classDiagram ```mermaid classDiagram - class PageInfo { - page: int - bounding_box: BoundingBox | None - } - - class Document { - id: str - title: str - is_open: bool - pages: int - size: int - provenance: list[DocumentProvenance] = list - metadata: DocumentMetaData | None = None - system: str - system_version: str - } - - class LocationInfo { - location: Geometry - crs: str - country: str = '' - state_or_province: str | None - } - - class EvidenceLayer { - name: str - relevance_score: float - } - - class Commodity { - name: str - } - - class Geometry { - <> - Point: str = 'Point' - Polygon: str = 'Polygon' - } - - class Grade { - grade_unit: str - grade_value: float + class MineralInventoryCategory { + category: str + confidence: Union[float, int, NoneType] + source: str } class DepositTypeCandidate { observed_name: str - normalized_uri: DepositType - confidence: float | int | None + name: str + confidence: Union[float, int, NoneType] source: str } - class Ore { - ore_unit: str - ore_value: float - } - - class BoundingBox { - x_min: float - x_max: float - y_min: float - y_max: float - } - - class MineralInventory { - commodity: Commodity - observed_commodity: str = '' - category: ResourceReserveCategory | None - ore: Ore | None - grade: Grade | None - cutoff_grade: Grade | None - contained_metal: float | None - reference: Reference - date: datetime | None - zone: str = '' - } - class MappableCriteria { criteria: str theoretical: str = '' potential_dataset: list[EvidenceLayer] = list - supporting_references: list[Reference] + supporting_references: list[DocumentReference] } class MineralSystem { - deposit_type: list[DepositType] + deposit_type: list[str] = list source: list[MappableCriteria] pathway: list[MappableCriteria] trap: list[MappableCriteria] = list @@ -858,67 +795,85 @@ classDiagram outflow: list[MappableCriteria] = list } - class GeologyInfo { - age: str = '' - unit_name: str = '' - description: str = '' - lithology: list[str] = list - process: list[str] = list - environment: list[str] = list - comments: str = '' - } - - class DepositType { - name: str - environment: str - group: str + class DocumentReference { + cdr_id: str + page: Optional[int] + x_min: Optional[float] + x_max: Optional[float] + y_min: Optional[float] + y_max: Optional[float] } class MineralSite { + id: str source_id: str record_id: str name: str = '' - mineral_inventory: list[MineralInventory] - location_info: LocationInfo - geology_info: GeologyInfo | None - deposit_type_candidate: list[DepositTypeCandidate] + site_rank: str = '' + site_type: str = '' + country: list[str] = list + province: list[str] = list + location: Optional[GeoLocationInfo] + mineral_inventory: list[MineralInventory] = list + deposit_type_candidate: list[DepositTypeCandidate] = list } - class Reference { - document: Document - page_info: list[PageInfo] = list + class MineralInventory { + contained_metal: Optional[float] + commodity: str = '' + commodity_observed_name: str = '' + ore_unit: str = '' + ore_value: Optional[float] + grade_unit: str = '' + grade_value: Optional[float] + cutoff_grade_unit: str = '' + cutoff_grade_value: Optional[float] + material_form: Optional[float] + material_form_unit: str = '' + material_form_conversion: Optional[float] + categories: list[MineralInventoryCategory] = list + documents: list[DocumentReference] = list + records: list[RecordReference] = list + date: Optional[datetime] + zone: str = '' } - class ResourceReserveCategory { - <> - INFERRED: str = 'Inferred Mineral Resource' - INDICATED: str = 'Indicated Mineral Resource' - MEASURED: str = 'Measured Mineral Resource' - PROBABLE: str = 'Probable Mineral Reserve' - PROVEN: str = 'Proven Mineral Reserve' + class EvidenceLayer { + name: str = '' + relevance_score: float + } + + class GeoLocationInfo { + crs: str + geom: str + } + + class GeologyInfo { + age: str = '' + unit_name: str = '' + description: str = '' + lithology: list[str] = list + process: list[str] = list + environment: list[str] = list + comments: str = '' + } + + class RecordReference { + record_id: str = '' + source: str = '' + uri: str = '' } - Document ..> DocumentMetaData - Document ..> DocumentProvenance - DepositTypeCandidate ..> DepositType - PageInfo ..> BoundingBox - Reference ..> PageInfo - Reference ..> Document MappableCriteria ..> EvidenceLayer - MappableCriteria ..> Reference - MineralSystem ..> DepositType + MappableCriteria ..> DocumentReference MineralSystem ..> MappableCriteria - MineralInventory ..> Reference - MineralInventory ..> Ore - MineralInventory ..> Grade - MineralInventory ..> Commodity - MineralInventory ..> ResourceReserveCategory + MineralInventory ..> MineralInventoryCategory + MineralInventory ..> DocumentReference + MineralInventory ..> RecordReference MineralInventory ..> datetime - LocationInfo ..> Geometry - MineralSite ..> GeologyInfo - MineralSite ..> DepositTypeCandidate MineralSite ..> MineralInventory - MineralSite ..> LocationInfo + MineralSite ..> GeoLocationInfo + MineralSite ..> DepositTypeCandidate ``` @@ -933,6 +888,17 @@ classDiagram ```mermaid classDiagram + class FeatureResults { + system: str + system_version: str + cog_id: str + line_feature_results: list[LineLegendAndFeaturesResult] = list + point_feature_results: list[PointLegendAndFeaturesResult] = list + polygon_feature_results: list[PolygonLegendAndFeaturesResult] = list + cog_area_extractions: list[Area_Extraction] = list + cog_metadata_extractions: list[CogMetaData] = list + } + class GeoreferenceResults { cog_id: str georeference_results: list[GeoreferenceResult] = list @@ -947,26 +913,15 @@ classDiagram extraction_results: list[FeatureResults] = list } - class FeatureResults { - system: str - system_version: str - cog_id: str - line_feature_results: list[LineLegendAndFeaturesResult] = list - point_feature_results: list[PointLegendAndFeaturesResult] = list - polygon_feature_results: list[PolygonLegendAndFeaturesResult] = list - cog_area_extractions: list[Area_Extraction] = list - cog_metadata_extractions: list[CogMetaData] = list - } - - FeatureResults ..> Area_Extraction - FeatureResults ..> CogMetaData - FeatureResults ..> PolygonLegendAndFeaturesResult FeatureResults ..> LineLegendAndFeaturesResult FeatureResults ..> PointLegendAndFeaturesResult + FeatureResults ..> CogMetaData + FeatureResults ..> PolygonLegendAndFeaturesResult + FeatureResults ..> Area_Extraction GeoreferenceResults ..> GeoreferenceResult GeoreferenceResults ..> GroundControlPoint - MapResults ..> GeoreferenceResults MapResults ..> FeatureResults + MapResults ..> GeoreferenceResults ``` @@ -1010,12 +965,6 @@ classDiagram ```mermaid classDiagram - class DataFormat { - <> - TIF: str = 'tif' - SHP: str = 'shp' - } - class InterpolationType { <> LINEAR: str = 'linear' @@ -1024,20 +973,11 @@ classDiagram NONE: str = 'none' } - class StackMetaData { - title: str | None - year: int | None - crs: str | None - authors: list[str] | None - organization: str | None - scale: int | None - evidence_layers: list[ProcessedDataLayer] - } - - class LayerDataType { + class LayerCategory { <> - CONTINUOUS: str = 'continuous' - BINARY: str = 'binary' + GEOPHYSICS: str = 'geophysics' + GEOLOGY: str = 'geology' + GEOCHEMISTRY: str = 'geochemistry' } class ScalingType { @@ -1047,40 +987,55 @@ classDiagram STANDARD: str = 'standard' } + class LayerDataType { + <> + CONTINUOUS: str = 'continuous' + BINARY: str = 'binary' + } + class ProcessedDataLayer { - title: str | None + title: Optional[str] resampling_method: InterpolationType scaling_method: ScalingType normalization_method: str } - class LayerCategory { - <> - GEOPHYSICS: str = 'geophysics' - GEOLOGY: str = 'geology' - GEOCHEMISTRY: str = 'geochemistry' + class StackMetaData { + title: Optional[str] + year: Optional[int] + crs: Optional[str] + authors: Optional[list[str]] + organization: Optional[str] + scale: Optional[int] + evidence_layers: list[ProcessedDataLayer] } class DataSource { - DOI: str | None - authors: list[str] | None - publication_date: str | None - category: LayerCategory | str | None - subcategory: str | None - description: str | None - derivative_ops: str | None + DOI: Optional[str] + authors: Optional[list[str]] + publication_date: Optional[str] + category: Union[LayerCategory, str, NoneType] + subcategory: Optional[str] + description: Optional[str] + derivative_ops: Optional[str] type: LayerDataType - resolution: tuple | None + resolution: Optional[tuple] format: DataFormat - download_url: str | None + download_url: Optional[str] } + class DataFormat { + <> + TIF: str = 'tif' + SHP: str = 'shp' + } + + DataSource ..> LayerCategory DataSource ..> LayerDataType DataSource ..> DataFormat DataSource ..> tuple - DataSource ..> LayerCategory - ProcessedDataLayer ..> ScalingType ProcessedDataLayer ..> InterpolationType + ProcessedDataLayer ..> ScalingType StackMetaData ..> ProcessedDataLayer @@ -1096,39 +1051,46 @@ classDiagram ```mermaid classDiagram - class CMAModel { - title: str | None - date: int | None - authors: list[str] | None - organization: str | None - cma_model_type: NeuralNetModel | SOMModel - training_data: StackMetaData - } - class SOMGrid { <> HEXAGONAL: str = 'hexagonal' RECTANGULAR: str = 'rectangular' } - class NeuralNetModel { - train_config: NeuralNetTrainConfig + class SOMType { + <> + TOROID: str = 'toroid' + SHEET: str = 'sheet' } - class Accelerator { + class CMAModel { + title: Optional[str] + date: Optional[int] + authors: Optional[list[str]] + organization: Optional[str] + cma_model_type: Union[NeuralNetModel, SOMModel] + training_data: StackMetaData + } + + class NeighborhoodFunction { <> - CPU: str = 'cpu' - GPU: str = 'gpu' + GAUSSIAN: str = 'gaussian' + BUBBLE: str = 'bubble' } - class StackMetaData { - title: str | None - year: int | None - crs: str | None - authors: list[str] | None - organization: str | None - scale: int | None - evidence_layers: list[ProcessedDataLayer] + class NeuralNetTrainConfig { + min_epochs: int + max_epochs: int + accelerator: Accelerator + precision: int + val_check_interval: float + deterministic: bool + } + + class SOMInitialization { + <> + RANDOM: str = 'random' + PCA: str = 'pca' } class SOMModel { @@ -1141,10 +1103,20 @@ classDiagram EXPONENTIAL: str = 'exponential' } - class LearningRateDecay { + class Accelerator { <> - LINEAR: str = 'linear' - EXPONENTIAL: str = 'exponential' + CPU: str = 'cpu' + GPU: str = 'gpu' + } + + class StackMetaData { + title: Optional[str] + year: Optional[int] + crs: Optional[str] + authors: Optional[list[str]] + organization: Optional[str] + scale: Optional[int] + evidence_layers: list[ProcessedDataLayer] } class SOMTrainConfig { @@ -1162,46 +1134,29 @@ classDiagram som_grid: SOMGrid } - class SOMInitialization { - <> - RANDOM: str = 'random' - PCA: str = 'pca' - } - - class SOMType { - <> - TOROID: str = 'toroid' - SHEET: str = 'sheet' + class NeuralNetModel { + train_config: NeuralNetTrainConfig } - class NeighborhoodFunction { + class LearningRateDecay { <> - GAUSSIAN: str = 'gaussian' - BUBBLE: str = 'bubble' - } - - class NeuralNetTrainConfig { - min_epochs: int - max_epochs: int - accelerator: Accelerator - precision: int - val_check_interval: float - deterministic: bool + LINEAR: str = 'linear' + EXPONENTIAL: str = 'exponential' } StackMetaData ..> ProcessedDataLayer NeuralNetTrainConfig ..> Accelerator - SOMTrainConfig ..> SOMInitialization SOMTrainConfig ..> SOMGrid SOMTrainConfig ..> SOMType SOMTrainConfig ..> NeighborhoodFunction - SOMTrainConfig ..> NeighborhoodDecay + SOMTrainConfig ..> SOMInitialization SOMTrainConfig ..> LearningRateDecay + SOMTrainConfig ..> NeighborhoodDecay NeuralNetModel ..> NeuralNetTrainConfig SOMModel ..> SOMTrainConfig + CMAModel ..> SOMModel CMAModel ..> StackMetaData CMAModel ..> NeuralNetModel - CMAModel ..> SOMModel ``` diff --git a/cdr_schemas/mineral.py b/cdr_schemas/mineral.py index dbccc5d..b04ada6 100644 --- a/cdr_schemas/mineral.py +++ b/cdr_schemas/mineral.py @@ -1,23 +1,48 @@ from datetime import datetime -from enum import Enum from typing import List, Optional, Union from pydantic import BaseModel, Field -from cdr_schemas.document import Document +class DocumentReference(BaseModel): + cdr_id: str + page: Optional[int] + x_min: Optional[float] + x_max: Optional[float] + y_min: Optional[float] + y_max: Optional[float] -class Geometry(Enum): - Point = "Point" - Polygon = "Polygon" +class EvidenceLayer(BaseModel): + name: str = Field(default="") + relevance_score: float -class ResourceReserveCategory(Enum): - INFERRED = "Inferred Mineral Resource" - INDICATED = "Indicated Mineral Resource" - MEASURED = "Measured Mineral Resource" - PROBABLE = "Probable Mineral Reserve" - PROVEN = "Proven Mineral Reserve" + +class MappableCriteria(BaseModel): + criteria: str + theoretical: str = Field(default="") + potential_dataset: list[EvidenceLayer] = Field( + default_factory=list, description="List of evidence layers" + ) + supporting_references: list[DocumentReference] + + +class MineralSystem(BaseModel): + deposit_type: list[str] = Field(default_factory=list) + source: list[MappableCriteria] + pathway: list[MappableCriteria] + trap: list[MappableCriteria] = Field( + default_factory=list, description="Mappable Criteria: trap" + ) + preservation: list[MappableCriteria] = Field( + default_factory=list, description="Mappable Criteria: Preservation" + ) + energy: list[MappableCriteria] = Field( + default_factory=list, description="Mappable Criteria: Energy" + ) + outflow: list[MappableCriteria] = Field( + default_factory=list, description="Mappable Criteria: outflow" + ) class GeologyInfo(BaseModel): @@ -30,26 +55,13 @@ class GeologyInfo(BaseModel): comments: str = "" -class Ore(BaseModel): - ore_unit: str = Field( - description="The unit in which ore quantity is measured, eg, metric tonnes" - ) - ore_value: float = Field(description="The value of ore quantity") - - -class DepositType(BaseModel): - name: str = Field(description="Deposit type name") - environment: str = Field(description="Deposit type environment") - group: str = Field(description="Deposit type group") - - class DepositTypeCandidate(BaseModel): observed_name: str = Field( description="Source dataset that the site info is retrieved from. e.g., MRDS" ) - normalized_uri: DepositType = Field( - description="The deposit type of an inventory item" - ) + + name: str = Field(description="Deposit type name") + confidence: Optional[Union[float, int]] = Field( description="Score deposit type of an inventory item" ) @@ -58,89 +70,81 @@ class DepositTypeCandidate(BaseModel): ) -class BoundingBox(BaseModel): - x_min: float - x_max: float - y_min: float - y_max: float +class RecordReference(BaseModel): + record_id: str = Field(default="", description="id in source") + source: str = Field(default="", description="Source information") + uri: str = Field(default="", description="uri of source") -class PageInfo(BaseModel): - page: int - bounding_box: Optional[BoundingBox] = Field( - description="Coordinates of the document where reference is found" +class MineralInventoryCategory(BaseModel): + category: str = Field(description="category name") + confidence: Optional[Union[float, int]] + source: str = Field( + description="Source of the classification (automated model version / SME / etc...)" ) -class Reference(BaseModel): - document: Document - page_info: List[PageInfo] = Field( - default_factory=list, - description="List of pages and their respective bounding boxes where the reference is found", +class GeoLocationInfo(BaseModel): + crs: str = Field( + description="The Coordinate Reference System (CRS) of the location" ) - -class EvidenceLayer(BaseModel): - name: str - relevance_score: float - - -class MappableCriteria(BaseModel): - criteria: str - theoretical: str = "" - potential_dataset: list[EvidenceLayer] = Field( - default_factory=list, description="List of evidence layers" + geom: str = Field( + description="Type: Polygon or Point, value indicates the geolocation of the site" ) - supporting_references: list[Reference] -class MineralSystem(BaseModel): - deposit_type: list[DepositType] - source: list[MappableCriteria] - pathway: list[MappableCriteria] - trap: list[MappableCriteria] = Field( - default_factory=list, description="Mappable Criteria: trap" - ) - preservation: list[MappableCriteria] = Field( - default_factory=list, description="Mappable Criteria: Preservation" - ) - energy: list[MappableCriteria] = Field( - default_factory=list, description="Mappable Criteria: Energy" +class MineralInventory(BaseModel): + contained_metal: Optional[float] = Field( + description="The quantity of a contained metal in an inventory item" ) - outflow: list[MappableCriteria] = Field( - default_factory=list, description="Mappable Criteria: outflow" + commodity: str = Field(default="", description="The commodity of an inventory item") + commodity_observed_name: str = Field( + default="", + description="The observed commodity in the source data (textual format)", ) + ore_unit: str = Field( + default="", + description="The unit in which ore quantity is measured, eg, metric tonnes", + ) + ore_value: Optional[float] = Field(description="The value of ore quantity") -class Commodity(BaseModel): - name: str - - -class Grade(BaseModel): grade_unit: str = Field( - description="The unit in which grade is measured, eg, percent" + default="", description="The unit in which grade is measured, eg, percent" ) - grade_value: float = Field(description="The value of grade") - + grade_value: Optional[float] = Field(description="The value of grade") -class MineralInventory(BaseModel): - commodity: Commodity = Field(description="The commodity of an inventory item") - observed_commodity: str = Field( - default="", - description="The observed commodity in the source data (textual format)", + cutoff_grade_unit: str = Field( + default="", description="The unit in which grade is measured, eg, percent" ) - category: Optional[ResourceReserveCategory] = Field( - description="The category of an inventory item" + cutoff_grade_value: Optional[float] = Field(description="The value of grade") + + material_form: Optional[float] + material_form_unit: str = Field(default="") + material_form_conversion: Optional[float] + + categories: List[MineralInventoryCategory] = Field( + default_factory=list, + description=""" + A list of categories + """, ) - ore: Optional[Ore] = Field(description="The ore of an inventory item") - grade: Optional[Grade] = Field(description="The grade of an inventory item") - cutoff_grade: Optional[Grade] = Field( - description="The cutoff grade of the observed inventory item" + + documents: List[DocumentReference] = Field( + default_factory=list, + description=""" + A list of document references + """, ) - contained_metal: Optional[float] = Field( - description="The quantity of a contained metal in an inventory item" + + records: List[RecordReference] = Field( + default_factory=list, + description=""" + A list of records references from databases or other sources + """, ) - reference: Reference = Field(description="The reference of an inventory item") + date: Optional[datetime] = Field( description="When in the point of time mineral inventory valid" ) @@ -150,22 +154,8 @@ class MineralInventory(BaseModel): ) -class LocationInfo(BaseModel): - location: Geometry = Field( - description="Type: Polygon or Point, value indicates the geolocation of the site" - ) - crs: str = Field( - description="The Coordinate Reference System (CRS) of the location" - ) - 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" - ) - - class MineralSite(BaseModel): + id: str = Field(description="Mineral Site Id") source_id: str = Field( description="Source dataset that the site info is retrieved from. e.g., MRDS" ) @@ -173,7 +163,23 @@ class MineralSite(BaseModel): description="Unique ID of the record that the info is retrieved from e.g., 10022920" ) name: str = Field(default="", description="Name of the mine, e.g., Tungsten Jim") - mineral_inventory: list[MineralInventory] - location_info: LocationInfo - geology_info: Optional[GeologyInfo] - deposit_type_candidate: list[DepositTypeCandidate] + + site_rank: str = Field(default="") + site_type: str = Field(default="") + country: List[str] = Field(default_factory=list) + province: List[str] = Field(default_factory=list) + location: Optional[GeoLocationInfo] + + mineral_inventory: List[MineralInventory] = Field( + default_factory=list, + description=""" + A list of mineral inventories + """, + ) + + deposit_type_candidate: List[DepositTypeCandidate] = Field( + default_factory=list, + description=""" + A list of deposit types candidates + """, + ) From f6131409356c96cb1f83ce875686965fcf5f1067 Mon Sep 17 00:00:00 2001 From: Scott Haleen Date: Tue, 25 Jun 2024 15:30:43 -0400 Subject: [PATCH 2/5] confidence score --- README.md | 653 +++++++++++++++++++++-------------------- cdr_schemas/mineral.py | 9 + 2 files changed, 339 insertions(+), 323 deletions(-) diff --git a/README.md b/README.md index e632d3a..46dafea 100644 --- a/README.md +++ b/README.md @@ -68,26 +68,6 @@ poetry run docs ```mermaid classDiagram - class Area_Extraction { - type: GeomType = GeomType.Polygon - coordinates: list[list[list[Union[float, int]]]] - bbox: list[Union[float, int]] = list - category: AreaType - text: str = '' - reference_id: str = '' - validated: bool = False - model: str - model_version: str - confidence: Union[float, int, NoneType] = None - } - - class GeomType { - <> - Point: str = 'Point' - LineString: str = 'LineString' - Polygon: str = 'Polygon' - } - class AreaType { <> Map_Area: str = 'map_area' @@ -101,8 +81,28 @@ classDiagram Correlation_Diagram: str = 'correlation_diagram' } - Area_Extraction ..> GeomType + class GeomType { + <> + Point: str = 'Point' + LineString: str = 'LineString' + Polygon: str = 'Polygon' + } + + class Area_Extraction { + type: GeomType = GeomType.Polygon + coordinates: list[list[list[Union[float, int]]]] + bbox: list[Union[float, int]] = list + category: AreaType + text: str = '' + reference_id: str = '' + validated: bool = False + model: str + model_version: str + confidence: Union[float, int, NoneType] = None + } + Area_Extraction ..> AreaType + Area_Extraction ..> GeomType ``` @@ -117,11 +117,18 @@ classDiagram ```mermaid classDiagram - class ProjectionResult { - crs: str - gcp_ids: list[str] - file_name: str - validated: bool = False + class Pixel_Point { + rows_from_top: Union[float, int] + columns_from_left: Union[float, int] + type: GeomType = GeomType.Point + } + + class GeoreferenceResults { + cog_id: str + georeference_results: list[GeoreferenceResult] = list + gcps: list[GroundControlPoint] = list + system: str + system_version: str } class GeomType { @@ -131,6 +138,18 @@ classDiagram Polygon: str = 'Polygon' } + class GeoreferenceResult { + likely_CRSs: list[str] = list + map_area: Optional[Area_Extraction] = None + projections: list[ProjectionResult] = list + } + + class Geom_Point { + latitude: Union[float, int, NoneType] + longitude: Union[float, int, NoneType] + type: GeomType = GeomType.Point + } + class GroundControlPoint { gcp_id: str map_geom: Geom_Point @@ -141,10 +160,11 @@ classDiagram crs: str } - class Geom_Point { - latitude: Union[float, int, NoneType] - longitude: Union[float, int, NoneType] - type: GeomType = GeomType.Point + class ProjectionResult { + crs: str + gcp_ids: list[str] + file_name: str + validated: bool = False } class Area_Extraction { @@ -160,36 +180,16 @@ classDiagram confidence: Union[float, int, NoneType] = None } - class Pixel_Point { - rows_from_top: Union[float, int] - columns_from_left: Union[float, int] - type: GeomType = GeomType.Point - } - - class GeoreferenceResult { - likely_CRSs: list[str] = list - map_area: Optional[Area_Extraction] = None - projections: list[ProjectionResult] = list - } - - class GeoreferenceResults { - cog_id: str - georeference_results: list[GeoreferenceResult] = list - gcps: list[GroundControlPoint] = list - system: str - system_version: str - } - - Area_Extraction ..> GeomType Area_Extraction ..> AreaType + Area_Extraction ..> GeomType Geom_Point ..> GeomType Pixel_Point ..> GeomType - GroundControlPoint ..> Geom_Point GroundControlPoint ..> Pixel_Point + GroundControlPoint ..> Geom_Point GeoreferenceResult ..> Area_Extraction GeoreferenceResult ..> ProjectionResult - GeoreferenceResults ..> GeoreferenceResult GeoreferenceResults ..> GroundControlPoint + GeoreferenceResults ..> GeoreferenceResult ``` @@ -204,14 +204,6 @@ classDiagram ```mermaid classDiagram - class CogMetaData { - cog_id: str - system: str - system_version: str - multiple_maps: Optional[bool] = None - map_metadata: list[MapMetaData] = list - } - class MapMetaData { title: str = '' year: Optional[int] = None @@ -241,6 +233,14 @@ classDiagram grayscale: str = 'grayscale' } + class CogMetaData { + cog_id: str + system: str + system_version: str + multiple_maps: Optional[bool] = None + map_metadata: list[MapMetaData] = list + } + MapMetaData ..> MapShapeTypes MapMetaData ..> MapColorSchemeTypes CogMetaData ..> MapMetaData @@ -258,30 +258,23 @@ classDiagram ```mermaid classDiagram - class LineLegendAndFeaturesResult { + class PolygonLegendAndFeaturesResult { id: str legend_provenance: Optional[ModelProvenance] = None - name: str = '' + label: str abbreviation: str = '' description: str = '' legend_bbox: list[Union[float, int]] = list legend_contour: list[list[Union[float, int]]] = list + color: str = '' + pattern: str = '' + category: str = '' + map_unit: Optional[MapUnit] = None reference_id: str = '' validated: bool = False crs: str = 'pixel' cdr_projection_id: str = '' - line_features: Optional[LineFeatureCollection] = None - } - - class FeatureResults { - system: str - system_version: str - cog_id: str - line_feature_results: list[LineLegendAndFeaturesResult] = list - point_feature_results: list[PointLegendAndFeaturesResult] = list - polygon_feature_results: list[PolygonLegendAndFeaturesResult] = list - cog_area_extractions: list[Area_Extraction] = list - cog_metadata_extractions: list[CogMetaData] = list + polygon_features: Optional[PolygonFeatureCollection] = None } class PointLegendAndFeaturesResult { @@ -299,31 +292,38 @@ classDiagram point_features: Optional[PointFeatureCollection] = None } - class CogMetaData { - cog_id: str - system: str - system_version: str - multiple_maps: Optional[bool] = None - map_metadata: list[MapMetaData] = list - } - - class PolygonLegendAndFeaturesResult { + class LineLegendAndFeaturesResult { id: str legend_provenance: Optional[ModelProvenance] = None - label: str + name: str = '' abbreviation: str = '' description: str = '' legend_bbox: list[Union[float, int]] = list legend_contour: list[list[Union[float, int]]] = list - color: str = '' - pattern: str = '' - category: str = '' - map_unit: Optional[MapUnit] = None reference_id: str = '' validated: bool = False crs: str = 'pixel' cdr_projection_id: str = '' - polygon_features: Optional[PolygonFeatureCollection] = None + line_features: Optional[LineFeatureCollection] = None + } + + class FeatureResults { + system: str + system_version: str + cog_id: str + line_feature_results: list[LineLegendAndFeaturesResult] = list + point_feature_results: list[PointLegendAndFeaturesResult] = list + polygon_feature_results: list[PolygonLegendAndFeaturesResult] = list + cog_area_extractions: list[Area_Extraction] = list + cog_metadata_extractions: list[CogMetaData] = list + } + + class CogMetaData { + cog_id: str + system: str + system_version: str + multiple_maps: Optional[bool] = None + map_metadata: list[MapMetaData] = list } class Area_Extraction { @@ -339,20 +339,20 @@ classDiagram confidence: Union[float, int, NoneType] = None } - Area_Extraction ..> GeomType Area_Extraction ..> AreaType + Area_Extraction ..> GeomType LineLegendAndFeaturesResult ..> ModelProvenance LineLegendAndFeaturesResult ..> LineFeatureCollection - PointLegendAndFeaturesResult ..> PointFeatureCollection PointLegendAndFeaturesResult ..> ModelProvenance + PointLegendAndFeaturesResult ..> PointFeatureCollection PolygonLegendAndFeaturesResult ..> PolygonFeatureCollection - PolygonLegendAndFeaturesResult ..> MapUnit PolygonLegendAndFeaturesResult ..> ModelProvenance + PolygonLegendAndFeaturesResult ..> MapUnit CogMetaData ..> MapMetaData - FeatureResults ..> LineLegendAndFeaturesResult + FeatureResults ..> PolygonLegendAndFeaturesResult FeatureResults ..> PointLegendAndFeaturesResult + FeatureResults ..> LineLegendAndFeaturesResult FeatureResults ..> CogMetaData - FeatureResults ..> PolygonLegendAndFeaturesResult FeatureResults ..> Area_Extraction @@ -368,22 +368,30 @@ classDiagram ```mermaid classDiagram - class GeomType { - <> - Point: str = 'Point' - LineString: str = 'LineString' - Polygon: str = 'Polygon' + class PointLegendAndFeaturesResult { + id: str + legend_provenance: Optional[ModelProvenance] = None + name: str + abbreviation: str = '' + description: str = '' + legend_bbox: list[Union[float, int]] = list + legend_contour: list[list[Union[float, int]]] = list + reference_id: str = '' + validated: bool = False + crs: str = 'pixel' + cdr_projection_id: str = '' + point_features: Optional[PointFeatureCollection] = None } - class ModelProvenance { + class PointProperties { model: str model_version: str confidence: Union[float, int, NoneType] = None - } - - class Point { - coordinates: list[Union[float, int]] - type: GeomType = GeomType.Point + bbox: Optional[list[Union[float, int]]] = None + dip: Optional[int] = None + dip_direction: Optional[int] = None + reference_id: str = '' + validated: bool = False } class PointFeatureCollection { @@ -391,30 +399,22 @@ classDiagram features: list[PointFeature] = list } - class PointProperties { + class GeomType { + <> + Point: str = 'Point' + LineString: str = 'LineString' + Polygon: str = 'Polygon' + } + + class ModelProvenance { model: str model_version: str confidence: Union[float, int, NoneType] = None - bbox: Optional[list[Union[float, int]]] = None - dip: Optional[int] = None - dip_direction: Optional[int] = None - reference_id: str = '' - validated: bool = False } - class PointLegendAndFeaturesResult { - id: str - legend_provenance: Optional[ModelProvenance] = None - name: str - abbreviation: str = '' - description: str = '' - legend_bbox: list[Union[float, int]] = list - legend_contour: list[list[Union[float, int]]] = list - reference_id: str = '' - validated: bool = False - crs: str = 'pixel' - cdr_projection_id: str = '' - point_features: Optional[PointFeatureCollection] = None + class Point { + coordinates: list[Union[float, int]] + type: GeomType = GeomType.Point } class GeoJsonType { @@ -431,13 +431,13 @@ classDiagram } Point ..> GeomType + PointFeature ..> Point PointFeature ..> PointProperties PointFeature ..> GeoJsonType - PointFeature ..> Point PointFeatureCollection ..> GeoJsonType PointFeatureCollection ..> PointFeature - PointLegendAndFeaturesResult ..> PointFeatureCollection PointLegendAndFeaturesResult ..> ModelProvenance + PointLegendAndFeaturesResult ..> PointFeatureCollection ``` @@ -452,24 +452,6 @@ classDiagram ```mermaid classDiagram - class Line { - coordinates: list[list[Union[float, int]]] - type: GeomType = GeomType.LineString - } - - class GeomType { - <> - Point: str = 'Point' - LineString: str = 'LineString' - Polygon: str = 'Polygon' - } - - class ModelProvenance { - model: str - model_version: str - confidence: Union[float, int, NoneType] = None - } - class LineProperty { model: str model_version: str @@ -480,18 +462,6 @@ classDiagram validated: bool = False } - class LineFeatureCollection { - type: GeoJsonType = GeoJsonType.FeatureCollection - features: list[LineFeature] = list - } - - class LineFeature { - type: GeoJsonType = GeoJsonType.Feature - id: str - geometry: Line - properties: LineProperty - } - class LineLegendAndFeaturesResult { id: str legend_provenance: Optional[ModelProvenance] = None @@ -507,6 +477,31 @@ classDiagram line_features: Optional[LineFeatureCollection] = None } + class Line { + coordinates: list[list[Union[float, int]]] + type: GeomType = GeomType.LineString + } + + class GeomType { + <> + Point: str = 'Point' + LineString: str = 'LineString' + Polygon: str = 'Polygon' + } + + class ModelProvenance { + model: str + model_version: str + confidence: Union[float, int, NoneType] = None + } + + class LineFeature { + type: GeoJsonType = GeoJsonType.Feature + id: str + geometry: Line + properties: LineProperty + } + class DashType { <> solid: str = 'solid' @@ -520,6 +515,11 @@ classDiagram FeatureCollection: str = 'FeatureCollection' } + class LineFeatureCollection { + type: GeoJsonType = GeoJsonType.FeatureCollection + features: list[LineFeature] = list + } + Line ..> GeomType LineProperty ..> DashType LineFeature ..> LineProperty @@ -556,6 +556,19 @@ classDiagram features: list[PolygonFeature] = list } + class GeomType { + <> + Point: str = 'Point' + LineString: str = 'LineString' + Polygon: str = 'Polygon' + } + + class ModelProvenance { + model: str + model_version: str + confidence: Union[float, int, NoneType] = None + } + class PolygonLegendAndFeaturesResult { id: str legend_provenance: Optional[ModelProvenance] = None @@ -575,17 +588,11 @@ classDiagram polygon_features: Optional[PolygonFeatureCollection] = None } - class GeomType { - <> - Point: str = 'Point' - LineString: str = 'LineString' - Polygon: str = 'Polygon' - } - - class ModelProvenance { - model: str - model_version: str - confidence: Union[float, int, NoneType] = None + class PolygonFeature { + type: GeoJsonType = GeoJsonType.Feature + id: str + geometry: Polygon + properties: PolygonProperty } class Polygon { @@ -604,13 +611,6 @@ classDiagram comments: str = '' } - class PolygonFeature { - type: GeoJsonType = GeoJsonType.Feature - id: str - geometry: Polygon - properties: PolygonProperty - } - class GeoJsonType { <> Feature: str = 'Feature' @@ -618,14 +618,14 @@ classDiagram } Polygon ..> GeomType - PolygonFeature ..> PolygonProperty PolygonFeature ..> GeoJsonType PolygonFeature ..> Polygon + PolygonFeature ..> PolygonProperty PolygonFeatureCollection ..> PolygonFeature PolygonFeatureCollection ..> GeoJsonType PolygonLegendAndFeaturesResult ..> PolygonFeatureCollection - PolygonLegendAndFeaturesResult ..> MapUnit PolygonLegendAndFeaturesResult ..> ModelProvenance + PolygonLegendAndFeaturesResult ..> MapUnit ``` @@ -640,14 +640,6 @@ classDiagram ```mermaid classDiagram - class CogMetaData { - cog_id: str - system: str - system_version: str - multiple_maps: Optional[bool] = None - map_metadata: list[MapMetaData] = list - } - class MapMetaData { title: str = '' year: Optional[int] = None @@ -677,6 +669,14 @@ classDiagram grayscale: str = 'grayscale' } + class CogMetaData { + cog_id: str + system: str + system_version: str + multiple_maps: Optional[bool] = None + map_metadata: list[MapMetaData] = list + } + MapMetaData ..> MapShapeTypes MapMetaData ..> MapColorSchemeTypes CogMetaData ..> MapMetaData @@ -694,16 +694,10 @@ classDiagram ```mermaid classDiagram - class Document { - id: str - title: str - is_open: bool - pages: int - size: int - provenance: list[DocumentProvenance] = list - metadata: Optional[DocumentMetaData] = None - system: str - system_version: str + class DocumentProvenance { + external_system_name: str + external_system_id: str = '' + external_system_url: str = '' } class DocumentMetaData { @@ -718,10 +712,16 @@ classDiagram publisher: str = '' } - class DocumentProvenance { - external_system_name: str - external_system_id: str = '' - external_system_url: str = '' + class Document { + id: str + title: str + is_open: bool + pages: int + size: int + provenance: list[DocumentProvenance] = list + metadata: Optional[DocumentMetaData] = None + system: str + system_version: str } class UploadDocument { @@ -765,12 +765,6 @@ classDiagram ```mermaid classDiagram - class MineralInventoryCategory { - category: str - confidence: Union[float, int, NoneType] - source: str - } - class DepositTypeCandidate { observed_name: str name: str @@ -778,23 +772,6 @@ classDiagram source: str } - class MappableCriteria { - criteria: str - theoretical: str = '' - potential_dataset: list[EvidenceLayer] = list - supporting_references: list[DocumentReference] - } - - class MineralSystem { - deposit_type: list[str] = list - source: list[MappableCriteria] - pathway: list[MappableCriteria] - trap: list[MappableCriteria] = list - preservation: list[MappableCriteria] = list - energy: list[MappableCriteria] = list - outflow: list[MappableCriteria] = list - } - class DocumentReference { cdr_id: str page: Optional[int] @@ -818,6 +795,55 @@ classDiagram deposit_type_candidate: list[DepositTypeCandidate] = list } + class MineralSystem { + deposit_type: list[str] = list + source: list[MappableCriteria] + pathway: list[MappableCriteria] + trap: list[MappableCriteria] = list + preservation: list[MappableCriteria] = list + energy: list[MappableCriteria] = list + outflow: list[MappableCriteria] = list + } + + class MappableCriteria { + criteria: str + theoretical: str = '' + potential_dataset: list[EvidenceLayer] = list + supporting_references: list[DocumentReference] + } + + class EvidenceLayer { + name: str = '' + relevance_score: float + } + + class RecordReference { + record_id: str = '' + source: str = '' + uri: str = '' + } + + class MineralInventoryCategory { + category: str + confidence: Union[float, int, NoneType] + source: str + } + + class GeologyInfo { + age: str = '' + unit_name: str = '' + description: str = '' + lithology: list[str] = list + process: list[str] = list + environment: list[str] = list + comments: str = '' + } + + class Confidence { + confidence: Union[float, int, NoneType] + source: str + } + class MineralInventory { contained_metal: Optional[float] commodity: str = '' @@ -831,6 +857,7 @@ classDiagram material_form: Optional[float] material_form_unit: str = '' material_form_conversion: Optional[float] + confidence: Confidence categories: list[MineralInventoryCategory] = list documents: list[DocumentReference] = list records: list[RecordReference] = list @@ -838,42 +865,22 @@ classDiagram zone: str = '' } - class EvidenceLayer { - name: str = '' - relevance_score: float - } - class GeoLocationInfo { crs: str geom: str } - class GeologyInfo { - age: str = '' - unit_name: str = '' - description: str = '' - lithology: list[str] = list - process: list[str] = list - environment: list[str] = list - comments: str = '' - } - - class RecordReference { - record_id: str = '' - source: str = '' - uri: str = '' - } - - MappableCriteria ..> EvidenceLayer MappableCriteria ..> DocumentReference + MappableCriteria ..> EvidenceLayer MineralSystem ..> MappableCriteria - MineralInventory ..> MineralInventoryCategory MineralInventory ..> DocumentReference - MineralInventory ..> RecordReference MineralInventory ..> datetime + MineralInventory ..> Confidence + MineralInventory ..> RecordReference + MineralInventory ..> MineralInventoryCategory + MineralSite ..> DepositTypeCandidate MineralSite ..> MineralInventory MineralSite ..> GeoLocationInfo - MineralSite ..> DepositTypeCandidate ``` @@ -899,6 +906,12 @@ classDiagram cog_metadata_extractions: list[CogMetaData] = list } + class MapResults { + cog_id: str + georef_results: list[GeoreferenceResults] = list + extraction_results: list[FeatureResults] = list + } + class GeoreferenceResults { cog_id: str georeference_results: list[GeoreferenceResult] = list @@ -907,19 +920,13 @@ classDiagram system_version: str } - class MapResults { - cog_id: str - georef_results: list[GeoreferenceResults] = list - extraction_results: list[FeatureResults] = list - } - - FeatureResults ..> LineLegendAndFeaturesResult + FeatureResults ..> PolygonLegendAndFeaturesResult FeatureResults ..> PointLegendAndFeaturesResult + FeatureResults ..> LineLegendAndFeaturesResult FeatureResults ..> CogMetaData - FeatureResults ..> PolygonLegendAndFeaturesResult FeatureResults ..> Area_Extraction - GeoreferenceResults ..> GeoreferenceResult GeoreferenceResults ..> GroundControlPoint + GeoreferenceResults ..> GeoreferenceResult MapResults ..> FeatureResults MapResults ..> GeoreferenceResults @@ -965,6 +972,27 @@ classDiagram ```mermaid classDiagram + class ScalingType { + <> + MINMAX: str = 'minmax' + MAXABS: str = 'maxabs' + STANDARD: str = 'standard' + } + + class DataSource { + DOI: Optional[str] + authors: Optional[list[str]] + publication_date: Optional[str] + category: Union[LayerCategory, str, NoneType] + subcategory: Optional[str] + description: Optional[str] + derivative_ops: Optional[str] + type: LayerDataType + resolution: Optional[tuple] + format: DataFormat + download_url: Optional[str] + } + class InterpolationType { <> LINEAR: str = 'linear' @@ -973,18 +1001,10 @@ classDiagram NONE: str = 'none' } - class LayerCategory { - <> - GEOPHYSICS: str = 'geophysics' - GEOLOGY: str = 'geology' - GEOCHEMISTRY: str = 'geochemistry' - } - - class ScalingType { + class DataFormat { <> - MINMAX: str = 'minmax' - MAXABS: str = 'maxabs' - STANDARD: str = 'standard' + TIF: str = 'tif' + SHP: str = 'shp' } class LayerDataType { @@ -993,13 +1013,6 @@ classDiagram BINARY: str = 'binary' } - class ProcessedDataLayer { - title: Optional[str] - resampling_method: InterpolationType - scaling_method: ScalingType - normalization_method: str - } - class StackMetaData { title: Optional[str] year: Optional[int] @@ -1010,32 +1023,26 @@ classDiagram evidence_layers: list[ProcessedDataLayer] } - class DataSource { - DOI: Optional[str] - authors: Optional[list[str]] - publication_date: Optional[str] - category: Union[LayerCategory, str, NoneType] - subcategory: Optional[str] - description: Optional[str] - derivative_ops: Optional[str] - type: LayerDataType - resolution: Optional[tuple] - format: DataFormat - download_url: Optional[str] + class ProcessedDataLayer { + title: Optional[str] + resampling_method: InterpolationType + scaling_method: ScalingType + normalization_method: str } - class DataFormat { + class LayerCategory { <> - TIF: str = 'tif' - SHP: str = 'shp' + GEOPHYSICS: str = 'geophysics' + GEOLOGY: str = 'geology' + GEOCHEMISTRY: str = 'geochemistry' } - DataSource ..> LayerCategory DataSource ..> LayerDataType DataSource ..> DataFormat + DataSource ..> LayerCategory DataSource ..> tuple - ProcessedDataLayer ..> InterpolationType ProcessedDataLayer ..> ScalingType + ProcessedDataLayer ..> InterpolationType StackMetaData ..> ProcessedDataLayer @@ -1057,19 +1064,16 @@ classDiagram RECTANGULAR: str = 'rectangular' } - class SOMType { + class Accelerator { <> - TOROID: str = 'toroid' - SHEET: str = 'sheet' + CPU: str = 'cpu' + GPU: str = 'gpu' } - class CMAModel { - title: Optional[str] - date: Optional[int] - authors: Optional[list[str]] - organization: Optional[str] - cma_model_type: Union[NeuralNetModel, SOMModel] - training_data: StackMetaData + class NeighborhoodDecay { + <> + LINEAR: str = 'linear' + EXPONENTIAL: str = 'exponential' } class NeighborhoodFunction { @@ -1078,6 +1082,12 @@ classDiagram BUBBLE: str = 'bubble' } + class SOMInitialization { + <> + RANDOM: str = 'random' + PCA: str = 'pca' + } + class NeuralNetTrainConfig { min_epochs: int max_epochs: int @@ -1087,28 +1097,10 @@ classDiagram deterministic: bool } - class SOMInitialization { - <> - RANDOM: str = 'random' - PCA: str = 'pca' - } - class SOMModel { train_config: SOMTrainConfig } - class NeighborhoodDecay { - <> - LINEAR: str = 'linear' - EXPONENTIAL: str = 'exponential' - } - - class Accelerator { - <> - CPU: str = 'cpu' - GPU: str = 'gpu' - } - class StackMetaData { title: Optional[str] year: Optional[int] @@ -1119,6 +1111,16 @@ classDiagram evidence_layers: list[ProcessedDataLayer] } + class NeuralNetModel { + train_config: NeuralNetTrainConfig + } + + class SOMType { + <> + TOROID: str = 'toroid' + SHEET: str = 'sheet' + } + class SOMTrainConfig { dimensions_x: int dimensions_y: int @@ -1134,8 +1136,13 @@ classDiagram som_grid: SOMGrid } - class NeuralNetModel { - train_config: NeuralNetTrainConfig + class CMAModel { + title: Optional[str] + date: Optional[int] + authors: Optional[list[str]] + organization: Optional[str] + cma_model_type: Union[NeuralNetModel, SOMModel] + training_data: StackMetaData } class LearningRateDecay { @@ -1148,15 +1155,15 @@ classDiagram NeuralNetTrainConfig ..> Accelerator SOMTrainConfig ..> SOMGrid SOMTrainConfig ..> SOMType + SOMTrainConfig ..> NeighborhoodDecay SOMTrainConfig ..> NeighborhoodFunction SOMTrainConfig ..> SOMInitialization SOMTrainConfig ..> LearningRateDecay - SOMTrainConfig ..> NeighborhoodDecay NeuralNetModel ..> NeuralNetTrainConfig SOMModel ..> SOMTrainConfig CMAModel ..> SOMModel - CMAModel ..> StackMetaData CMAModel ..> NeuralNetModel + CMAModel ..> StackMetaData ``` diff --git a/cdr_schemas/mineral.py b/cdr_schemas/mineral.py index b04ada6..793d855 100644 --- a/cdr_schemas/mineral.py +++ b/cdr_schemas/mineral.py @@ -94,6 +94,13 @@ class GeoLocationInfo(BaseModel): ) +class Confidence(BaseModel): + confidence: Optional[Union[float, int]] + source: str = Field( + description="Source of the classification (automated model version / SME / etc...)" + ) + + class MineralInventory(BaseModel): contained_metal: Optional[float] = Field( description="The quantity of a contained metal in an inventory item" @@ -124,6 +131,8 @@ class MineralInventory(BaseModel): material_form_unit: str = Field(default="") material_form_conversion: Optional[float] + confidence: Confidence + categories: List[MineralInventoryCategory] = Field( default_factory=list, description=""" From 1ba1307fef4395e026d2cb555622d31fe38d01b9 Mon Sep 17 00:00:00 2001 From: Scott Haleen Date: Wed, 26 Jun 2024 13:57:31 -0400 Subject: [PATCH 3/5] mineral updates --- README.md | 790 ++++++++++++++++++++--------------------- cdr_schemas/mineral.py | 57 +-- 2 files changed, 427 insertions(+), 420 deletions(-) diff --git a/README.md b/README.md index 46dafea..916ed21 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,19 @@ poetry run docs ```mermaid classDiagram + class Area_Extraction { + type: GeomType = GeomType.Polygon + coordinates: list[list[list[Union[float, int]]]] + bbox: list[Union[float, int]] = list + category: AreaType + text: str = '' + reference_id: str = '' + validated: bool = False + model: str + model_version: str + confidence: Union[float, int, NoneType] = None + } + class AreaType { <> Map_Area: str = 'map_area' @@ -88,19 +101,6 @@ classDiagram Polygon: str = 'Polygon' } - class Area_Extraction { - type: GeomType = GeomType.Polygon - coordinates: list[list[list[Union[float, int]]]] - bbox: list[Union[float, int]] = list - category: AreaType - text: str = '' - reference_id: str = '' - validated: bool = False - model: str - model_version: str - confidence: Union[float, int, NoneType] = None - } - Area_Extraction ..> AreaType Area_Extraction ..> GeomType @@ -123,12 +123,17 @@ classDiagram type: GeomType = GeomType.Point } - class GeoreferenceResults { - cog_id: str - georeference_results: list[GeoreferenceResult] = list - gcps: list[GroundControlPoint] = list - system: str - system_version: str + class Area_Extraction { + type: GeomType = GeomType.Polygon + coordinates: list[list[list[Union[float, int]]]] + bbox: list[Union[float, int]] = list + category: AreaType + text: str = '' + reference_id: str = '' + validated: bool = False + model: str + model_version: str + confidence: Union[float, int, NoneType] = None } class GeomType { @@ -138,18 +143,6 @@ classDiagram Polygon: str = 'Polygon' } - class GeoreferenceResult { - likely_CRSs: list[str] = list - map_area: Optional[Area_Extraction] = None - projections: list[ProjectionResult] = list - } - - class Geom_Point { - latitude: Union[float, int, NoneType] - longitude: Union[float, int, NoneType] - type: GeomType = GeomType.Point - } - class GroundControlPoint { gcp_id: str map_geom: Geom_Point @@ -167,25 +160,32 @@ classDiagram validated: bool = False } - class Area_Extraction { - type: GeomType = GeomType.Polygon - coordinates: list[list[list[Union[float, int]]]] - bbox: list[Union[float, int]] = list - category: AreaType - text: str = '' - reference_id: str = '' - validated: bool = False - model: str - model_version: str - confidence: Union[float, int, NoneType] = None + class GeoreferenceResult { + likely_CRSs: list[str] = list + map_area: Optional[Area_Extraction] = None + projections: list[ProjectionResult] = list + } + + class GeoreferenceResults { + cog_id: str + georeference_results: list[GeoreferenceResult] = list + gcps: list[GroundControlPoint] = list + system: str + system_version: str + } + + class Geom_Point { + latitude: Union[float, int, NoneType] + longitude: Union[float, int, NoneType] + type: GeomType = GeomType.Point } Area_Extraction ..> AreaType Area_Extraction ..> GeomType Geom_Point ..> GeomType Pixel_Point ..> GeomType - GroundControlPoint ..> Pixel_Point GroundControlPoint ..> Geom_Point + GroundControlPoint ..> Pixel_Point GeoreferenceResult ..> Area_Extraction GeoreferenceResult ..> ProjectionResult GeoreferenceResults ..> GroundControlPoint @@ -204,20 +204,11 @@ classDiagram ```mermaid classDiagram - class MapMetaData { - title: str = '' - year: Optional[int] = None - crs: str = '' - authors: list[str] = list - organization: str = '' - scale: Optional[int] = None - quadrangle_name: str = '' - map_shape: Optional[MapShapeTypes] = None - map_color_scheme: Optional[MapColorSchemeTypes] = None - publisher: str = '' - state: str = '' - model: str - model_version: str + class MapColorSchemeTypes { + <> + full_color: str = 'full_color' + monochrome: str = 'monochrome' + grayscale: str = 'grayscale' } class MapShapeTypes { @@ -226,13 +217,6 @@ classDiagram non_rectangular: str = 'non_rectangular' } - class MapColorSchemeTypes { - <> - full_color: str = 'full_color' - monochrome: str = 'monochrome' - grayscale: str = 'grayscale' - } - class CogMetaData { cog_id: str system: str @@ -241,8 +225,24 @@ classDiagram map_metadata: list[MapMetaData] = list } - MapMetaData ..> MapShapeTypes + class MapMetaData { + title: str = '' + year: Optional[int] = None + crs: str = '' + authors: list[str] = list + organization: str = '' + scale: Optional[int] = None + quadrangle_name: str = '' + map_shape: Optional[MapShapeTypes] = None + map_color_scheme: Optional[MapColorSchemeTypes] = None + publisher: str = '' + state: str = '' + model: str + model_version: str + } + MapMetaData ..> MapColorSchemeTypes + MapMetaData ..> MapShapeTypes CogMetaData ..> MapMetaData @@ -292,6 +292,27 @@ classDiagram point_features: Optional[PointFeatureCollection] = None } + class CogMetaData { + cog_id: str + system: str + system_version: str + multiple_maps: Optional[bool] = None + map_metadata: list[MapMetaData] = list + } + + class Area_Extraction { + type: GeomType = GeomType.Polygon + coordinates: list[list[list[Union[float, int]]]] + bbox: list[Union[float, int]] = list + category: AreaType + text: str = '' + reference_id: str = '' + validated: bool = False + model: str + model_version: str + confidence: Union[float, int, NoneType] = None + } + class LineLegendAndFeaturesResult { id: str legend_provenance: Optional[ModelProvenance] = None @@ -318,42 +339,21 @@ classDiagram cog_metadata_extractions: list[CogMetaData] = list } - class CogMetaData { - cog_id: str - system: str - system_version: str - multiple_maps: Optional[bool] = None - map_metadata: list[MapMetaData] = list - } - - class Area_Extraction { - type: GeomType = GeomType.Polygon - coordinates: list[list[list[Union[float, int]]]] - bbox: list[Union[float, int]] = list - category: AreaType - text: str = '' - reference_id: str = '' - validated: bool = False - model: str - model_version: str - confidence: Union[float, int, NoneType] = None - } - Area_Extraction ..> AreaType Area_Extraction ..> GeomType - LineLegendAndFeaturesResult ..> ModelProvenance LineLegendAndFeaturesResult ..> LineFeatureCollection - PointLegendAndFeaturesResult ..> ModelProvenance + LineLegendAndFeaturesResult ..> ModelProvenance PointLegendAndFeaturesResult ..> PointFeatureCollection + PointLegendAndFeaturesResult ..> ModelProvenance PolygonLegendAndFeaturesResult ..> PolygonFeatureCollection PolygonLegendAndFeaturesResult ..> ModelProvenance PolygonLegendAndFeaturesResult ..> MapUnit CogMetaData ..> MapMetaData FeatureResults ..> PolygonLegendAndFeaturesResult FeatureResults ..> PointLegendAndFeaturesResult - FeatureResults ..> LineLegendAndFeaturesResult FeatureResults ..> CogMetaData FeatureResults ..> Area_Extraction + FeatureResults ..> LineLegendAndFeaturesResult ``` @@ -368,19 +368,11 @@ classDiagram ```mermaid classDiagram - class PointLegendAndFeaturesResult { + class PointFeature { + type: GeoJsonType = GeoJsonType.Feature id: str - legend_provenance: Optional[ModelProvenance] = None - name: str - abbreviation: str = '' - description: str = '' - legend_bbox: list[Union[float, int]] = list - legend_contour: list[list[Union[float, int]]] = list - reference_id: str = '' - validated: bool = False - crs: str = 'pixel' - cdr_projection_id: str = '' - point_features: Optional[PointFeatureCollection] = None + geometry: Point + properties: PointProperties } class PointProperties { @@ -394,9 +386,15 @@ classDiagram validated: bool = False } - class PointFeatureCollection { - type: GeoJsonType = GeoJsonType.FeatureCollection - features: list[PointFeature] = list + class Point { + coordinates: list[Union[float, int]] + type: GeomType = GeomType.Point + } + + class ModelProvenance { + model: str + model_version: str + confidence: Union[float, int, NoneType] = None } class GeomType { @@ -406,15 +404,9 @@ classDiagram Polygon: str = 'Polygon' } - class ModelProvenance { - model: str - model_version: str - confidence: Union[float, int, NoneType] = None - } - - class Point { - coordinates: list[Union[float, int]] - type: GeomType = GeomType.Point + class PointFeatureCollection { + type: GeoJsonType = GeoJsonType.FeatureCollection + features: list[PointFeature] = list } class GeoJsonType { @@ -423,21 +415,29 @@ classDiagram FeatureCollection: str = 'FeatureCollection' } - class PointFeature { - type: GeoJsonType = GeoJsonType.Feature + class PointLegendAndFeaturesResult { id: str - geometry: Point - properties: PointProperties + legend_provenance: Optional[ModelProvenance] = None + name: str + abbreviation: str = '' + description: str = '' + legend_bbox: list[Union[float, int]] = list + legend_contour: list[list[Union[float, int]]] = list + reference_id: str = '' + validated: bool = False + crs: str = 'pixel' + cdr_projection_id: str = '' + point_features: Optional[PointFeatureCollection] = None } Point ..> GeomType - PointFeature ..> Point PointFeature ..> PointProperties + PointFeature ..> Point PointFeature ..> GeoJsonType - PointFeatureCollection ..> GeoJsonType PointFeatureCollection ..> PointFeature - PointLegendAndFeaturesResult ..> ModelProvenance + PointFeatureCollection ..> GeoJsonType PointLegendAndFeaturesResult ..> PointFeatureCollection + PointLegendAndFeaturesResult ..> ModelProvenance ``` @@ -452,34 +452,22 @@ classDiagram ```mermaid classDiagram - class LineProperty { + class Line { + coordinates: list[list[Union[float, int]]] + type: GeomType = GeomType.LineString + } + + class DashType { + <> + solid: str = 'solid' + dash: str = 'dash' + dotted: str = 'dotted' + } + + class ModelProvenance { model: str model_version: str confidence: Union[float, int, NoneType] = None - dash_pattern: Optional[DashType] = None - symbol: str = '' - reference_id: str = '' - validated: bool = False - } - - class LineLegendAndFeaturesResult { - id: str - legend_provenance: Optional[ModelProvenance] = None - name: str = '' - abbreviation: str = '' - description: str = '' - legend_bbox: list[Union[float, int]] = list - legend_contour: list[list[Union[float, int]]] = list - reference_id: str = '' - validated: bool = False - crs: str = 'pixel' - cdr_projection_id: str = '' - line_features: Optional[LineFeatureCollection] = None - } - - class Line { - coordinates: list[list[Union[float, int]]] - type: GeomType = GeomType.LineString } class GeomType { @@ -489,10 +477,14 @@ classDiagram Polygon: str = 'Polygon' } - class ModelProvenance { + class LineProperty { model: str model_version: str confidence: Union[float, int, NoneType] = None + dash_pattern: Optional[DashType] = None + symbol: str = '' + reference_id: str = '' + validated: bool = False } class LineFeature { @@ -502,11 +494,9 @@ classDiagram properties: LineProperty } - class DashType { - <> - solid: str = 'solid' - dash: str = 'dash' - dotted: str = 'dotted' + class LineFeatureCollection { + type: GeoJsonType = GeoJsonType.FeatureCollection + features: list[LineFeature] = list } class GeoJsonType { @@ -515,20 +505,30 @@ classDiagram FeatureCollection: str = 'FeatureCollection' } - class LineFeatureCollection { - type: GeoJsonType = GeoJsonType.FeatureCollection - features: list[LineFeature] = list + class LineLegendAndFeaturesResult { + id: str + legend_provenance: Optional[ModelProvenance] = None + name: str = '' + abbreviation: str = '' + description: str = '' + legend_bbox: list[Union[float, int]] = list + legend_contour: list[list[Union[float, int]]] = list + reference_id: str = '' + validated: bool = False + crs: str = 'pixel' + cdr_projection_id: str = '' + line_features: Optional[LineFeatureCollection] = None } Line ..> GeomType LineProperty ..> DashType + LineFeature ..> Line LineFeature ..> LineProperty LineFeature ..> GeoJsonType - LineFeature ..> Line - LineFeatureCollection ..> GeoJsonType LineFeatureCollection ..> LineFeature - LineLegendAndFeaturesResult ..> ModelProvenance + LineFeatureCollection ..> GeoJsonType LineLegendAndFeaturesResult ..> LineFeatureCollection + LineLegendAndFeaturesResult ..> ModelProvenance ``` @@ -543,32 +543,6 @@ classDiagram ```mermaid classDiagram - class PolygonProperty { - model: str - model_version: str - reference_id: str = '' - validated: bool = False - confidence: Union[float, int, NoneType] = None - } - - class PolygonFeatureCollection { - type: GeoJsonType = GeoJsonType.FeatureCollection - features: list[PolygonFeature] = list - } - - class GeomType { - <> - Point: str = 'Point' - LineString: str = 'LineString' - Polygon: str = 'Polygon' - } - - class ModelProvenance { - model: str - model_version: str - confidence: Union[float, int, NoneType] = None - } - class PolygonLegendAndFeaturesResult { id: str legend_provenance: Optional[ModelProvenance] = None @@ -588,6 +562,11 @@ classDiagram polygon_features: Optional[PolygonFeatureCollection] = None } + class PolygonFeatureCollection { + type: GeoJsonType = GeoJsonType.FeatureCollection + features: list[PolygonFeature] = list + } + class PolygonFeature { type: GeoJsonType = GeoJsonType.Feature id: str @@ -600,6 +579,25 @@ classDiagram type: GeomType = GeomType.Polygon } + class ModelProvenance { + model: str + model_version: str + confidence: Union[float, int, NoneType] = None + } + + class GeomType { + <> + Point: str = 'Point' + LineString: str = 'LineString' + Polygon: str = 'Polygon' + } + + class GeoJsonType { + <> + Feature: str = 'Feature' + FeatureCollection: str = 'FeatureCollection' + } + class MapUnit { age_text: str = '' b_age: Optional[float] = None @@ -611,16 +609,18 @@ classDiagram comments: str = '' } - class GeoJsonType { - <> - Feature: str = 'Feature' - FeatureCollection: str = 'FeatureCollection' + class PolygonProperty { + model: str + model_version: str + reference_id: str = '' + validated: bool = False + confidence: Union[float, int, NoneType] = None } Polygon ..> GeomType - PolygonFeature ..> GeoJsonType - PolygonFeature ..> Polygon PolygonFeature ..> PolygonProperty + PolygonFeature ..> Polygon + PolygonFeature ..> GeoJsonType PolygonFeatureCollection ..> PolygonFeature PolygonFeatureCollection ..> GeoJsonType PolygonLegendAndFeaturesResult ..> PolygonFeatureCollection @@ -640,20 +640,11 @@ classDiagram ```mermaid classDiagram - class MapMetaData { - title: str = '' - year: Optional[int] = None - crs: str = '' - authors: list[str] = list - organization: str = '' - scale: Optional[int] = None - quadrangle_name: str = '' - map_shape: Optional[MapShapeTypes] = None - map_color_scheme: Optional[MapColorSchemeTypes] = None - publisher: str = '' - state: str = '' - model: str - model_version: str + class MapColorSchemeTypes { + <> + full_color: str = 'full_color' + monochrome: str = 'monochrome' + grayscale: str = 'grayscale' } class MapShapeTypes { @@ -662,13 +653,6 @@ classDiagram non_rectangular: str = 'non_rectangular' } - class MapColorSchemeTypes { - <> - full_color: str = 'full_color' - monochrome: str = 'monochrome' - grayscale: str = 'grayscale' - } - class CogMetaData { cog_id: str system: str @@ -677,8 +661,24 @@ classDiagram map_metadata: list[MapMetaData] = list } - MapMetaData ..> MapShapeTypes + class MapMetaData { + title: str = '' + year: Optional[int] = None + crs: str = '' + authors: list[str] = list + organization: str = '' + scale: Optional[int] = None + quadrangle_name: str = '' + map_shape: Optional[MapShapeTypes] = None + map_color_scheme: Optional[MapColorSchemeTypes] = None + publisher: str = '' + state: str = '' + model: str + model_version: str + } + MapMetaData ..> MapColorSchemeTypes + MapMetaData ..> MapShapeTypes CogMetaData ..> MapMetaData @@ -694,24 +694,6 @@ classDiagram ```mermaid classDiagram - class DocumentProvenance { - external_system_name: str - external_system_id: str = '' - external_system_url: str = '' - } - - class DocumentMetaData { - doi: str = '' - authors: list[str] = list - journal: str = '' - year: Optional[int] = None - month: Optional[int] = None - volume: Optional[int] = None - issue: str = '' - description: str = '' - publisher: str = '' - } - class Document { id: str title: str @@ -724,6 +706,12 @@ classDiagram system_version: str } + class DocumentProvenance { + external_system_name: str + external_system_id: str = '' + external_system_url: str = '' + } + class UploadDocument { title: str is_open: bool = True @@ -733,6 +721,18 @@ classDiagram system_version: str } + class DocumentMetaData { + doi: str = '' + authors: list[str] = list + journal: str = '' + year: Optional[int] = None + month: Optional[int] = None + volume: Optional[int] = None + issue: str = '' + description: str = '' + publisher: str = '' + } + class DocumentExtraction { id: UnionType[str, NoneType] = None document_id: str = None @@ -747,10 +747,10 @@ classDiagram system_version: str } - UploadDocument ..> DocumentProvenance UploadDocument ..> DocumentMetaData - Document ..> DocumentProvenance + UploadDocument ..> DocumentProvenance Document ..> DocumentMetaData + Document ..> DocumentProvenance ``` @@ -765,46 +765,6 @@ classDiagram ```mermaid classDiagram - class DepositTypeCandidate { - observed_name: str - name: str - confidence: Union[float, int, NoneType] - source: str - } - - class DocumentReference { - cdr_id: str - page: Optional[int] - x_min: Optional[float] - x_max: Optional[float] - y_min: Optional[float] - y_max: Optional[float] - } - - class MineralSite { - id: str - source_id: str - record_id: str - name: str = '' - site_rank: str = '' - site_type: str = '' - country: list[str] = list - province: list[str] = list - location: Optional[GeoLocationInfo] - mineral_inventory: list[MineralInventory] = list - deposit_type_candidate: list[DepositTypeCandidate] = list - } - - class MineralSystem { - deposit_type: list[str] = list - source: list[MappableCriteria] - pathway: list[MappableCriteria] - trap: list[MappableCriteria] = list - preservation: list[MappableCriteria] = list - energy: list[MappableCriteria] = list - outflow: list[MappableCriteria] = list - } - class MappableCriteria { criteria: str theoretical: str = '' @@ -817,70 +777,110 @@ classDiagram relevance_score: float } - class RecordReference { - record_id: str = '' - source: str = '' - uri: str = '' - } - class MineralInventoryCategory { category: str - confidence: Union[float, int, NoneType] - source: str - } - - class GeologyInfo { - age: str = '' - unit_name: str = '' - description: str = '' - lithology: list[str] = list - process: list[str] = list - environment: list[str] = list - comments: str = '' - } - - class Confidence { - confidence: Union[float, int, NoneType] + confidence: Union[float, int, NoneType] = None source: str } class MineralInventory { - contained_metal: Optional[float] + contained_metal: Optional[float] = None commodity: str = '' commodity_observed_name: str = '' ore_unit: str = '' - ore_value: Optional[float] + ore_value: Optional[float] = None grade_unit: str = '' - grade_value: Optional[float] + grade_value: Optional[float] = None cutoff_grade_unit: str = '' - cutoff_grade_value: Optional[float] - material_form: Optional[float] + cutoff_grade_value: Optional[float] = None + material_form: Optional[float] = None material_form_unit: str = '' - material_form_conversion: Optional[float] - confidence: Confidence + material_form_conversion: Optional[float] = None + confidence: Optional[Confidence] = None categories: list[MineralInventoryCategory] = list documents: list[DocumentReference] = list records: list[RecordReference] = list - date: Optional[datetime] + date: Optional[datetime] = None zone: str = '' } + class MineralSystem { + deposit_type: list[str] = list + source: list[MappableCriteria] = list + pathway: list[MappableCriteria] = list + trap: list[MappableCriteria] = list + preservation: list[MappableCriteria] = list + energy: list[MappableCriteria] = list + outflow: list[MappableCriteria] = list + } + + class GeologyInfo { + age: str = '' + unit_name: str = '' + description: str = '' + lithology: list[str] = list + process: list[str] = list + environment: list[str] = list + comments: str = '' + } + + class MineralSite { + id: str + source_id: str = '' + record_id: str = '' + name: str = '' + site_rank: str = '' + site_type: str = '' + country: list[str] = list + province: list[str] = list + location: Optional[GeoLocationInfo] = None + mineral_inventory: list[MineralInventory] = list + deposit_type_candidate: list[DepositTypeCandidate] = list + } + class GeoLocationInfo { crs: str geom: str } - MappableCriteria ..> DocumentReference + class DepositTypeCandidate { + observed_name: str = '' + name: str + confidence: Union[float, int, NoneType] = None + source: str + } + + class RecordReference { + record_id: str = '' + source: str = '' + uri: str = '' + } + + class Confidence { + confidence: Union[float, int, NoneType] = None + source: str + } + + class DocumentReference { + cdr_id: str + page: Optional[int] = None + x_min: Optional[float] = None + x_max: Optional[float] = None + y_min: Optional[float] = None + y_max: Optional[float] = None + } + MappableCriteria ..> EvidenceLayer + MappableCriteria ..> DocumentReference MineralSystem ..> MappableCriteria - MineralInventory ..> DocumentReference - MineralInventory ..> datetime - MineralInventory ..> Confidence MineralInventory ..> RecordReference MineralInventory ..> MineralInventoryCategory + MineralInventory ..> Confidence + MineralInventory ..> DocumentReference + MineralInventory ..> datetime + MineralSite ..> GeoLocationInfo MineralSite ..> DepositTypeCandidate MineralSite ..> MineralInventory - MineralSite ..> GeoLocationInfo ``` @@ -922,9 +922,9 @@ classDiagram FeatureResults ..> PolygonLegendAndFeaturesResult FeatureResults ..> PointLegendAndFeaturesResult - FeatureResults ..> LineLegendAndFeaturesResult FeatureResults ..> CogMetaData FeatureResults ..> Area_Extraction + FeatureResults ..> LineLegendAndFeaturesResult GeoreferenceResults ..> GroundControlPoint GeoreferenceResults ..> GeoreferenceResult MapResults ..> FeatureResults @@ -972,6 +972,12 @@ classDiagram ```mermaid classDiagram + class DataFormat { + <> + TIF: str = 'tif' + SHP: str = 'shp' + } + class ScalingType { <> MINMAX: str = 'minmax' @@ -979,18 +985,11 @@ classDiagram STANDARD: str = 'standard' } - class DataSource { - DOI: Optional[str] - authors: Optional[list[str]] - publication_date: Optional[str] - category: Union[LayerCategory, str, NoneType] - subcategory: Optional[str] - description: Optional[str] - derivative_ops: Optional[str] - type: LayerDataType - resolution: Optional[tuple] - format: DataFormat - download_url: Optional[str] + class LayerCategory { + <> + GEOPHYSICS: str = 'geophysics' + GEOLOGY: str = 'geology' + GEOCHEMISTRY: str = 'geochemistry' } class InterpolationType { @@ -1001,16 +1000,11 @@ classDiagram NONE: str = 'none' } - class DataFormat { - <> - TIF: str = 'tif' - SHP: str = 'shp' - } - - class LayerDataType { - <> - CONTINUOUS: str = 'continuous' - BINARY: str = 'binary' + class ProcessedDataLayer { + title: Optional[str] + resampling_method: InterpolationType + scaling_method: ScalingType + normalization_method: str } class StackMetaData { @@ -1023,26 +1017,32 @@ classDiagram evidence_layers: list[ProcessedDataLayer] } - class ProcessedDataLayer { - title: Optional[str] - resampling_method: InterpolationType - scaling_method: ScalingType - normalization_method: str + class LayerDataType { + <> + CONTINUOUS: str = 'continuous' + BINARY: str = 'binary' } - class LayerCategory { - <> - GEOPHYSICS: str = 'geophysics' - GEOLOGY: str = 'geology' - GEOCHEMISTRY: str = 'geochemistry' + class DataSource { + DOI: Optional[str] + authors: Optional[list[str]] + publication_date: Optional[str] + category: Union[LayerCategory, str, NoneType] + subcategory: Optional[str] + description: Optional[str] + derivative_ops: Optional[str] + type: LayerDataType + resolution: Optional[tuple] + format: DataFormat + download_url: Optional[str] } - DataSource ..> LayerDataType DataSource ..> DataFormat DataSource ..> LayerCategory DataSource ..> tuple - ProcessedDataLayer ..> ScalingType + DataSource ..> LayerDataType ProcessedDataLayer ..> InterpolationType + ProcessedDataLayer ..> ScalingType StackMetaData ..> ProcessedDataLayer @@ -1058,16 +1058,17 @@ classDiagram ```mermaid classDiagram - class SOMGrid { - <> - HEXAGONAL: str = 'hexagonal' - RECTANGULAR: str = 'rectangular' + class SOMModel { + train_config: SOMTrainConfig } - class Accelerator { - <> - CPU: str = 'cpu' - GPU: str = 'gpu' + class CMAModel { + title: Optional[str] + date: Optional[int] + authors: Optional[list[str]] + organization: Optional[str] + cma_model_type: Union[NeuralNetModel, SOMModel] + training_data: StackMetaData } class NeighborhoodDecay { @@ -1076,16 +1077,37 @@ classDiagram EXPONENTIAL: str = 'exponential' } - class NeighborhoodFunction { + class SOMType { <> - GAUSSIAN: str = 'gaussian' - BUBBLE: str = 'bubble' + TOROID: str = 'toroid' + SHEET: str = 'sheet' } - class SOMInitialization { + class SOMTrainConfig { + dimensions_x: int + dimensions_y: int + num_epochs: int + num_initializations: int + neighborhood_function: NeighborhoodFunction + som_type: SOMType + neighborhood_decay: NeighborhoodDecay + learning_rate_decay: LearningRateDecay + initial_learning_rate: float + final_learning_rate: float + som_initialization: SOMInitialization + som_grid: SOMGrid + } + + class SOMGrid { <> - RANDOM: str = 'random' - PCA: str = 'pca' + HEXAGONAL: str = 'hexagonal' + RECTANGULAR: str = 'rectangular' + } + + class Accelerator { + <> + CPU: str = 'cpu' + GPU: str = 'gpu' } class NeuralNetTrainConfig { @@ -1097,8 +1119,16 @@ classDiagram deterministic: bool } - class SOMModel { - train_config: SOMTrainConfig + class LearningRateDecay { + <> + LINEAR: str = 'linear' + EXPONENTIAL: str = 'exponential' + } + + class SOMInitialization { + <> + RANDOM: str = 'random' + PCA: str = 'pca' } class StackMetaData { @@ -1115,54 +1145,24 @@ classDiagram train_config: NeuralNetTrainConfig } - class SOMType { - <> - TOROID: str = 'toroid' - SHEET: str = 'sheet' - } - - class SOMTrainConfig { - dimensions_x: int - dimensions_y: int - num_epochs: int - num_initializations: int - neighborhood_function: NeighborhoodFunction - som_type: SOMType - neighborhood_decay: NeighborhoodDecay - learning_rate_decay: LearningRateDecay - initial_learning_rate: float - final_learning_rate: float - som_initialization: SOMInitialization - som_grid: SOMGrid - } - - class CMAModel { - title: Optional[str] - date: Optional[int] - authors: Optional[list[str]] - organization: Optional[str] - cma_model_type: Union[NeuralNetModel, SOMModel] - training_data: StackMetaData - } - - class LearningRateDecay { + class NeighborhoodFunction { <> - LINEAR: str = 'linear' - EXPONENTIAL: str = 'exponential' + GAUSSIAN: str = 'gaussian' + BUBBLE: str = 'bubble' } StackMetaData ..> ProcessedDataLayer NeuralNetTrainConfig ..> Accelerator - SOMTrainConfig ..> SOMGrid - SOMTrainConfig ..> SOMType - SOMTrainConfig ..> NeighborhoodDecay - SOMTrainConfig ..> NeighborhoodFunction SOMTrainConfig ..> SOMInitialization SOMTrainConfig ..> LearningRateDecay + SOMTrainConfig ..> NeighborhoodFunction + SOMTrainConfig ..> SOMType + SOMTrainConfig ..> NeighborhoodDecay + SOMTrainConfig ..> SOMGrid NeuralNetModel ..> NeuralNetTrainConfig SOMModel ..> SOMTrainConfig - CMAModel ..> SOMModel CMAModel ..> NeuralNetModel + CMAModel ..> SOMModel CMAModel ..> StackMetaData diff --git a/cdr_schemas/mineral.py b/cdr_schemas/mineral.py index 793d855..c6a3d9f 100644 --- a/cdr_schemas/mineral.py +++ b/cdr_schemas/mineral.py @@ -6,11 +6,11 @@ class DocumentReference(BaseModel): cdr_id: str - page: Optional[int] - x_min: Optional[float] - x_max: Optional[float] - y_min: Optional[float] - y_max: Optional[float] + page: Optional[int] = Field(default=None) + x_min: Optional[float] = Field(default=None) + x_max: Optional[float] = Field(default=None) + y_min: Optional[float] = Field(default=None) + y_max: Optional[float] = Field(default=None) class EvidenceLayer(BaseModel): @@ -29,8 +29,8 @@ class MappableCriteria(BaseModel): class MineralSystem(BaseModel): deposit_type: list[str] = Field(default_factory=list) - source: list[MappableCriteria] - pathway: list[MappableCriteria] + source: list[MappableCriteria] = Field(default_factory=list) + pathway: list[MappableCriteria] = Field(default_factory=list) trap: list[MappableCriteria] = Field( default_factory=list, description="Mappable Criteria: trap" ) @@ -48,22 +48,23 @@ class MineralSystem(BaseModel): class GeologyInfo(BaseModel): 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 = "" + description: str = Field(default="") 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: str = "" + comments: str = Field(default="") class DepositTypeCandidate(BaseModel): observed_name: str = Field( - description="Source dataset that the site info is retrieved from. e.g., MRDS" + default="", + description="Source dataset that the site info is retrieved from. e.g., MRDS", ) name: str = Field(description="Deposit type name") confidence: Optional[Union[float, int]] = Field( - description="Score deposit type of an inventory item" + default=None, description="Score deposit type of an inventory item" ) source: str = Field( description="Source of the classification (automated model version / SME / etc...)" @@ -78,7 +79,9 @@ class RecordReference(BaseModel): class MineralInventoryCategory(BaseModel): category: str = Field(description="category name") - confidence: Optional[Union[float, int]] + confidence: Optional[Union[float, int]] = Field( + default=None, + ) source: str = Field( description="Source of the classification (automated model version / SME / etc...)" ) @@ -95,7 +98,7 @@ class GeoLocationInfo(BaseModel): class Confidence(BaseModel): - confidence: Optional[Union[float, int]] + confidence: Optional[Union[float, int]] = Field(default=None) source: str = Field( description="Source of the classification (automated model version / SME / etc...)" ) @@ -103,7 +106,8 @@ class Confidence(BaseModel): class MineralInventory(BaseModel): contained_metal: Optional[float] = Field( - description="The quantity of a contained metal in an inventory item" + default=None, + description="The quantity of a contained metal in an inventory item", ) commodity: str = Field(default="", description="The commodity of an inventory item") commodity_observed_name: str = Field( @@ -115,23 +119,25 @@ class MineralInventory(BaseModel): default="", description="The unit in which ore quantity is measured, eg, metric tonnes", ) - ore_value: Optional[float] = Field(description="The value of ore quantity") + ore_value: Optional[float] = Field( + default=None, description="The value of ore quantity" + ) grade_unit: str = Field( default="", description="The unit in which grade is measured, eg, percent" ) - grade_value: Optional[float] = Field(description="The value of grade") + grade_value: Optional[float] = Field(default=None, description="The value of grade") cutoff_grade_unit: str = Field( default="", description="The unit in which grade is measured, eg, percent" ) - cutoff_grade_value: Optional[float] = Field(description="The value of grade") + cutoff_grade_value: Optional[float] = Field(default=None) - material_form: Optional[float] + material_form: Optional[float] = Field(default=None) material_form_unit: str = Field(default="") - material_form_conversion: Optional[float] + material_form_conversion: Optional[float] = Field(default=None) - confidence: Confidence + confidence: Optional[Confidence] = Field(default=None) categories: List[MineralInventoryCategory] = Field( default_factory=list, @@ -155,7 +161,7 @@ class MineralInventory(BaseModel): ) date: Optional[datetime] = Field( - description="When in the point of time mineral inventory valid" + default=None, description="When in the point of time mineral inventory valid" ) zone: str = Field( default="", @@ -166,10 +172,12 @@ class MineralInventory(BaseModel): class MineralSite(BaseModel): id: str = Field(description="Mineral Site Id") source_id: str = Field( - description="Source dataset that the site info is retrieved from. e.g., MRDS" + default="", + description="Source dataset that the site info is retrieved from. e.g., MRDS", ) record_id: str = Field( - description="Unique ID of the record that the info is retrieved from e.g., 10022920" + default="", + description="Unique ID of the record that the info is retrieved from e.g., 10022920", ) name: str = Field(default="", description="Name of the mine, e.g., Tungsten Jim") @@ -177,8 +185,7 @@ class MineralSite(BaseModel): site_type: str = Field(default="") country: List[str] = Field(default_factory=list) province: List[str] = Field(default_factory=list) - location: Optional[GeoLocationInfo] - + location: Optional[GeoLocationInfo] = Field(default=None) mineral_inventory: List[MineralInventory] = Field( default_factory=list, description=""" From a647240fda120f34b880cf47d9dc7de9a72c3a51 Mon Sep 17 00:00:00 2001 From: Scott Haleen Date: Wed, 26 Jun 2024 15:24:14 -0400 Subject: [PATCH 4/5] dt --- README.md | 744 +++++++++++++++++++++-------------------- cdr_schemas/mineral.py | 6 + 2 files changed, 381 insertions(+), 369 deletions(-) diff --git a/README.md b/README.md index 916ed21..d35bc8b 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,13 @@ poetry run docs ```mermaid classDiagram + class GeomType { + <> + Point: str = 'Point' + LineString: str = 'LineString' + Polygon: str = 'Polygon' + } + class Area_Extraction { type: GeomType = GeomType.Polygon coordinates: list[list[list[Union[float, int]]]] @@ -94,15 +101,8 @@ classDiagram Correlation_Diagram: str = 'correlation_diagram' } - class GeomType { - <> - Point: str = 'Point' - LineString: str = 'LineString' - Polygon: str = 'Polygon' - } - - Area_Extraction ..> AreaType Area_Extraction ..> GeomType + Area_Extraction ..> AreaType ``` @@ -117,12 +117,6 @@ classDiagram ```mermaid classDiagram - class Pixel_Point { - rows_from_top: Union[float, int] - columns_from_left: Union[float, int] - type: GeomType = GeomType.Point - } - class Area_Extraction { type: GeomType = GeomType.Polygon coordinates: list[list[list[Union[float, int]]]] @@ -136,11 +130,29 @@ classDiagram confidence: Union[float, int, NoneType] = None } - class GeomType { - <> - Point: str = 'Point' - LineString: str = 'LineString' - Polygon: str = 'Polygon' + class GeoreferenceResult { + likely_CRSs: list[str] = list + map_area: Optional[Area_Extraction] = None + projections: list[ProjectionResult] = list + } + + class ProjectionResult { + crs: str + gcp_ids: list[str] + file_name: str + validated: bool = False + } + + class Geom_Point { + latitude: Union[float, int, NoneType] + longitude: Union[float, int, NoneType] + type: GeomType = GeomType.Point + } + + class Pixel_Point { + rows_from_top: Union[float, int] + columns_from_left: Union[float, int] + type: GeomType = GeomType.Point } class GroundControlPoint { @@ -153,17 +165,11 @@ classDiagram crs: str } - class ProjectionResult { - crs: str - gcp_ids: list[str] - file_name: str - validated: bool = False - } - - class GeoreferenceResult { - likely_CRSs: list[str] = list - map_area: Optional[Area_Extraction] = None - projections: list[ProjectionResult] = list + class GeomType { + <> + Point: str = 'Point' + LineString: str = 'LineString' + Polygon: str = 'Polygon' } class GeoreferenceResults { @@ -174,22 +180,16 @@ classDiagram system_version: str } - class Geom_Point { - latitude: Union[float, int, NoneType] - longitude: Union[float, int, NoneType] - type: GeomType = GeomType.Point - } - - Area_Extraction ..> AreaType Area_Extraction ..> GeomType + Area_Extraction ..> AreaType Geom_Point ..> GeomType Pixel_Point ..> GeomType GroundControlPoint ..> Geom_Point GroundControlPoint ..> Pixel_Point GeoreferenceResult ..> Area_Extraction GeoreferenceResult ..> ProjectionResult - GeoreferenceResults ..> GroundControlPoint GeoreferenceResults ..> GeoreferenceResult + GeoreferenceResults ..> GroundControlPoint ``` @@ -211,20 +211,6 @@ classDiagram grayscale: str = 'grayscale' } - class MapShapeTypes { - <> - rectangular: str = 'rectangular' - non_rectangular: str = 'non_rectangular' - } - - class CogMetaData { - cog_id: str - system: str - system_version: str - multiple_maps: Optional[bool] = None - map_metadata: list[MapMetaData] = list - } - class MapMetaData { title: str = '' year: Optional[int] = None @@ -241,6 +227,20 @@ classDiagram model_version: str } + class MapShapeTypes { + <> + rectangular: str = 'rectangular' + non_rectangular: str = 'non_rectangular' + } + + class CogMetaData { + cog_id: str + system: str + system_version: str + multiple_maps: Optional[bool] = None + map_metadata: list[MapMetaData] = list + } + MapMetaData ..> MapColorSchemeTypes MapMetaData ..> MapShapeTypes CogMetaData ..> MapMetaData @@ -258,6 +258,30 @@ classDiagram ```mermaid classDiagram + class FeatureResults { + system: str + system_version: str + cog_id: str + line_feature_results: list[LineLegendAndFeaturesResult] = list + point_feature_results: list[PointLegendAndFeaturesResult] = list + polygon_feature_results: list[PolygonLegendAndFeaturesResult] = list + cog_area_extractions: list[Area_Extraction] = list + cog_metadata_extractions: list[CogMetaData] = list + } + + class Area_Extraction { + type: GeomType = GeomType.Polygon + coordinates: list[list[list[Union[float, int]]]] + bbox: list[Union[float, int]] = list + category: AreaType + text: str = '' + reference_id: str = '' + validated: bool = False + model: str + model_version: str + confidence: Union[float, int, NoneType] = None + } + class PolygonLegendAndFeaturesResult { id: str legend_provenance: Optional[ModelProvenance] = None @@ -277,6 +301,14 @@ classDiagram polygon_features: Optional[PolygonFeatureCollection] = None } + class CogMetaData { + cog_id: str + system: str + system_version: str + multiple_maps: Optional[bool] = None + map_metadata: list[MapMetaData] = list + } + class PointLegendAndFeaturesResult { id: str legend_provenance: Optional[ModelProvenance] = None @@ -292,27 +324,6 @@ classDiagram point_features: Optional[PointFeatureCollection] = None } - class CogMetaData { - cog_id: str - system: str - system_version: str - multiple_maps: Optional[bool] = None - map_metadata: list[MapMetaData] = list - } - - class Area_Extraction { - type: GeomType = GeomType.Polygon - coordinates: list[list[list[Union[float, int]]]] - bbox: list[Union[float, int]] = list - category: AreaType - text: str = '' - reference_id: str = '' - validated: bool = False - model: str - model_version: str - confidence: Union[float, int, NoneType] = None - } - class LineLegendAndFeaturesResult { id: str legend_provenance: Optional[ModelProvenance] = None @@ -328,32 +339,21 @@ classDiagram line_features: Optional[LineFeatureCollection] = None } - class FeatureResults { - system: str - system_version: str - cog_id: str - line_feature_results: list[LineLegendAndFeaturesResult] = list - point_feature_results: list[PointLegendAndFeaturesResult] = list - polygon_feature_results: list[PolygonLegendAndFeaturesResult] = list - cog_area_extractions: list[Area_Extraction] = list - cog_metadata_extractions: list[CogMetaData] = list - } - - Area_Extraction ..> AreaType Area_Extraction ..> GeomType + Area_Extraction ..> AreaType LineLegendAndFeaturesResult ..> LineFeatureCollection LineLegendAndFeaturesResult ..> ModelProvenance - PointLegendAndFeaturesResult ..> PointFeatureCollection PointLegendAndFeaturesResult ..> ModelProvenance - PolygonLegendAndFeaturesResult ..> PolygonFeatureCollection + PointLegendAndFeaturesResult ..> PointFeatureCollection PolygonLegendAndFeaturesResult ..> ModelProvenance PolygonLegendAndFeaturesResult ..> MapUnit + PolygonLegendAndFeaturesResult ..> PolygonFeatureCollection CogMetaData ..> MapMetaData - FeatureResults ..> PolygonLegendAndFeaturesResult - FeatureResults ..> PointLegendAndFeaturesResult - FeatureResults ..> CogMetaData FeatureResults ..> Area_Extraction + FeatureResults ..> PolygonLegendAndFeaturesResult FeatureResults ..> LineLegendAndFeaturesResult + FeatureResults ..> CogMetaData + FeatureResults ..> PointLegendAndFeaturesResult ``` @@ -368,22 +368,15 @@ classDiagram ```mermaid classDiagram - class PointFeature { - type: GeoJsonType = GeoJsonType.Feature - id: str - geometry: Point - properties: PointProperties + class PointFeatureCollection { + type: GeoJsonType = GeoJsonType.FeatureCollection + features: list[PointFeature] = list } - class PointProperties { - model: str - model_version: str - confidence: Union[float, int, NoneType] = None - bbox: Optional[list[Union[float, int]]] = None - dip: Optional[int] = None - dip_direction: Optional[int] = None - reference_id: str = '' - validated: bool = False + class GeoJsonType { + <> + Feature: str = 'Feature' + FeatureCollection: str = 'FeatureCollection' } class Point { @@ -391,12 +384,6 @@ classDiagram type: GeomType = GeomType.Point } - class ModelProvenance { - model: str - model_version: str - confidence: Union[float, int, NoneType] = None - } - class GeomType { <> Point: str = 'Point' @@ -404,15 +391,17 @@ classDiagram Polygon: str = 'Polygon' } - class PointFeatureCollection { - type: GeoJsonType = GeoJsonType.FeatureCollection - features: list[PointFeature] = list + class ModelProvenance { + model: str + model_version: str + confidence: Union[float, int, NoneType] = None } - class GeoJsonType { - <> - Feature: str = 'Feature' - FeatureCollection: str = 'FeatureCollection' + class PointFeature { + type: GeoJsonType = GeoJsonType.Feature + id: str + geometry: Point + properties: PointProperties } class PointLegendAndFeaturesResult { @@ -430,14 +419,25 @@ classDiagram point_features: Optional[PointFeatureCollection] = None } + class PointProperties { + model: str + model_version: str + confidence: Union[float, int, NoneType] = None + bbox: list[Union[float, int]] = None + dip: Optional[int] = None + dip_direction: Optional[int] = None + reference_id: str = '' + validated: bool = False + } + Point ..> GeomType - PointFeature ..> PointProperties PointFeature ..> Point PointFeature ..> GeoJsonType + PointFeature ..> PointProperties PointFeatureCollection ..> PointFeature PointFeatureCollection ..> GeoJsonType - PointLegendAndFeaturesResult ..> PointFeatureCollection PointLegendAndFeaturesResult ..> ModelProvenance + PointLegendAndFeaturesResult ..> PointFeatureCollection ``` @@ -452,23 +452,38 @@ classDiagram ```mermaid classDiagram - class Line { - coordinates: list[list[Union[float, int]]] - type: GeomType = GeomType.LineString + class LineFeature { + type: GeoJsonType = GeoJsonType.Feature + id: str + geometry: Line + properties: LineProperty } - class DashType { + class GeoJsonType { <> - solid: str = 'solid' - dash: str = 'dash' - dotted: str = 'dotted' + Feature: str = 'Feature' + FeatureCollection: str = 'FeatureCollection' } - class ModelProvenance { - model: str - model_version: str - confidence: Union[float, int, NoneType] = None - } + class LineLegendAndFeaturesResult { + id: str + legend_provenance: Optional[ModelProvenance] = None + name: str = '' + abbreviation: str = '' + description: str = '' + legend_bbox: list[Union[float, int]] = list + legend_contour: list[list[Union[float, int]]] = list + reference_id: str = '' + validated: bool = False + crs: str = 'pixel' + cdr_projection_id: str = '' + line_features: Optional[LineFeatureCollection] = None + } + + class LineFeatureCollection { + type: GeoJsonType = GeoJsonType.FeatureCollection + features: list[LineFeature] = list + } class GeomType { <> @@ -477,47 +492,32 @@ classDiagram Polygon: str = 'Polygon' } - class LineProperty { + class ModelProvenance { model: str model_version: str confidence: Union[float, int, NoneType] = None - dash_pattern: Optional[DashType] = None - symbol: str = '' - reference_id: str = '' - validated: bool = False } - class LineFeature { - type: GeoJsonType = GeoJsonType.Feature - id: str - geometry: Line - properties: LineProperty - } - - class LineFeatureCollection { - type: GeoJsonType = GeoJsonType.FeatureCollection - features: list[LineFeature] = list + class DashType { + <> + solid: str = 'solid' + dash: str = 'dash' + dotted: str = 'dotted' } - class GeoJsonType { - <> - Feature: str = 'Feature' - FeatureCollection: str = 'FeatureCollection' + class Line { + coordinates: list[list[Union[float, int]]] + type: GeomType = GeomType.LineString } - class LineLegendAndFeaturesResult { - id: str - legend_provenance: Optional[ModelProvenance] = None - name: str = '' - abbreviation: str = '' - description: str = '' - legend_bbox: list[Union[float, int]] = list - legend_contour: list[list[Union[float, int]]] = list + class LineProperty { + model: str + model_version: str + confidence: Union[float, int, NoneType] = None + dash_pattern: Optional[DashType] = None + symbol: str = '' reference_id: str = '' validated: bool = False - crs: str = 'pixel' - cdr_projection_id: str = '' - line_features: Optional[LineFeatureCollection] = None } Line ..> GeomType @@ -543,6 +543,17 @@ classDiagram ```mermaid classDiagram + class MapUnit { + age_text: str = '' + b_age: Optional[float] = None + b_interval: str = '' + lithology: str = '' + name: str = '' + t_age: Optional[float] = None + t_interval: str = '' + comments: str = '' + } + class PolygonLegendAndFeaturesResult { id: str legend_provenance: Optional[ModelProvenance] = None @@ -562,9 +573,10 @@ classDiagram polygon_features: Optional[PolygonFeatureCollection] = None } - class PolygonFeatureCollection { - type: GeoJsonType = GeoJsonType.FeatureCollection - features: list[PolygonFeature] = list + class GeoJsonType { + <> + Feature: str = 'Feature' + FeatureCollection: str = 'FeatureCollection' } class PolygonFeature { @@ -574,9 +586,11 @@ classDiagram properties: PolygonProperty } - class Polygon { - coordinates: list[list[list[Union[float, int]]]] - type: GeomType = GeomType.Polygon + class GeomType { + <> + Point: str = 'Point' + LineString: str = 'LineString' + Polygon: str = 'Polygon' } class ModelProvenance { @@ -585,28 +599,14 @@ classDiagram confidence: Union[float, int, NoneType] = None } - class GeomType { - <> - Point: str = 'Point' - LineString: str = 'LineString' - Polygon: str = 'Polygon' - } - - class GeoJsonType { - <> - Feature: str = 'Feature' - FeatureCollection: str = 'FeatureCollection' + class Polygon { + coordinates: list[list[list[Union[float, int]]]] + type: GeomType = GeomType.Polygon } - class MapUnit { - age_text: str = '' - b_age: Optional[float] = None - b_interval: str = '' - lithology: str = '' - name: str = '' - t_age: Optional[float] = None - t_interval: str = '' - comments: str = '' + class PolygonFeatureCollection { + type: GeoJsonType = GeoJsonType.FeatureCollection + features: list[PolygonFeature] = list } class PolygonProperty { @@ -618,14 +618,14 @@ classDiagram } Polygon ..> GeomType - PolygonFeature ..> PolygonProperty PolygonFeature ..> Polygon + PolygonFeature ..> PolygonProperty PolygonFeature ..> GeoJsonType - PolygonFeatureCollection ..> PolygonFeature PolygonFeatureCollection ..> GeoJsonType - PolygonLegendAndFeaturesResult ..> PolygonFeatureCollection + PolygonFeatureCollection ..> PolygonFeature PolygonLegendAndFeaturesResult ..> ModelProvenance PolygonLegendAndFeaturesResult ..> MapUnit + PolygonLegendAndFeaturesResult ..> PolygonFeatureCollection ``` @@ -647,20 +647,6 @@ classDiagram grayscale: str = 'grayscale' } - class MapShapeTypes { - <> - rectangular: str = 'rectangular' - non_rectangular: str = 'non_rectangular' - } - - class CogMetaData { - cog_id: str - system: str - system_version: str - multiple_maps: Optional[bool] = None - map_metadata: list[MapMetaData] = list - } - class MapMetaData { title: str = '' year: Optional[int] = None @@ -677,6 +663,20 @@ classDiagram model_version: str } + class MapShapeTypes { + <> + rectangular: str = 'rectangular' + non_rectangular: str = 'non_rectangular' + } + + class CogMetaData { + cog_id: str + system: str + system_version: str + multiple_maps: Optional[bool] = None + map_metadata: list[MapMetaData] = list + } + MapMetaData ..> MapColorSchemeTypes MapMetaData ..> MapShapeTypes CogMetaData ..> MapMetaData @@ -694,33 +694,6 @@ classDiagram ```mermaid classDiagram - class Document { - id: str - title: str - is_open: bool - pages: int - size: int - provenance: list[DocumentProvenance] = list - metadata: Optional[DocumentMetaData] = None - system: str - system_version: str - } - - class DocumentProvenance { - external_system_name: str - external_system_id: str = '' - external_system_url: str = '' - } - - class UploadDocument { - title: str - is_open: bool = True - provenance: list[DocumentProvenance] = list - metadata: Optional[DocumentMetaData] = None - system: str - system_version: str - } - class DocumentMetaData { doi: str = '' authors: list[str] = list @@ -733,6 +706,15 @@ classDiagram publisher: str = '' } + class UploadDocument { + title: str + is_open: bool = True + provenance: list[DocumentProvenance] = list + metadata: Optional[DocumentMetaData] = None + system: str + system_version: str + } + class DocumentExtraction { id: UnionType[str, NoneType] = None document_id: str = None @@ -747,6 +729,24 @@ classDiagram system_version: str } + class DocumentProvenance { + external_system_name: str + external_system_id: str = '' + external_system_url: str = '' + } + + class Document { + id: str + title: str + is_open: bool + pages: int + size: int + provenance: list[DocumentProvenance] = list + metadata: Optional[DocumentMetaData] = None + system: str + system_version: str + } + UploadDocument ..> DocumentMetaData UploadDocument ..> DocumentProvenance Document ..> DocumentMetaData @@ -765,24 +765,6 @@ classDiagram ```mermaid classDiagram - class MappableCriteria { - criteria: str - theoretical: str = '' - potential_dataset: list[EvidenceLayer] = list - supporting_references: list[DocumentReference] - } - - class EvidenceLayer { - name: str = '' - relevance_score: float - } - - class MineralInventoryCategory { - category: str - confidence: Union[float, int, NoneType] = None - source: str - } - class MineralInventory { contained_metal: Optional[float] = None commodity: str = '' @@ -804,24 +786,50 @@ classDiagram zone: str = '' } - class MineralSystem { - deposit_type: list[str] = list - source: list[MappableCriteria] = list - pathway: list[MappableCriteria] = list - trap: list[MappableCriteria] = list - preservation: list[MappableCriteria] = list - energy: list[MappableCriteria] = list - outflow: list[MappableCriteria] = list + class DepositTypeCandidate { + observed_name: str = '' + name: str + confidence: Union[float, int, NoneType] = None + source: str } - class GeologyInfo { - age: str = '' - unit_name: str = '' - description: str = '' - lithology: list[str] = list - process: list[str] = list - environment: list[str] = list - comments: str = '' + class RecordReference { + record_id: str = '' + source: str = '' + uri: str = '' + } + + class EvidenceLayer { + name: str = '' + relevance_score: float + } + + class MappableCriteria { + criteria: str + theoretical: str = '' + potential_dataset: list[EvidenceLayer] = list + supporting_references: list[DocumentReference] + } + + class DocumentReference { + cdr_id: str + page: Optional[int] = None + x_min: Optional[float] = None + x_max: Optional[float] = None + y_min: Optional[float] = None + y_max: Optional[float] = None + } + + class DepositType { + name: str + environment: str + group: str + } + + class MineralInventoryCategory { + category: str + confidence: Union[float, int, NoneType] = None + source: str } class MineralSite { @@ -838,49 +846,47 @@ classDiagram deposit_type_candidate: list[DepositTypeCandidate] = list } - class GeoLocationInfo { - crs: str - geom: str + class MineralSystem { + deposit_type: list[str] = list + source: list[MappableCriteria] = list + pathway: list[MappableCriteria] = list + trap: list[MappableCriteria] = list + preservation: list[MappableCriteria] = list + energy: list[MappableCriteria] = list + outflow: list[MappableCriteria] = list } - class DepositTypeCandidate { - observed_name: str = '' - name: str + class Confidence { confidence: Union[float, int, NoneType] = None source: str } - class RecordReference { - record_id: str = '' - source: str = '' - uri: str = '' - } - - class Confidence { - confidence: Union[float, int, NoneType] = None - source: str + class GeoLocationInfo { + crs: str + geom: str } - class DocumentReference { - cdr_id: str - page: Optional[int] = None - x_min: Optional[float] = None - x_max: Optional[float] = None - y_min: Optional[float] = None - y_max: Optional[float] = None + class GeologyInfo { + age: str = '' + unit_name: str = '' + description: str = '' + lithology: list[str] = list + process: list[str] = list + environment: list[str] = list + comments: str = '' } - MappableCriteria ..> EvidenceLayer MappableCriteria ..> DocumentReference + MappableCriteria ..> EvidenceLayer MineralSystem ..> MappableCriteria - MineralInventory ..> RecordReference MineralInventory ..> MineralInventoryCategory MineralInventory ..> Confidence - MineralInventory ..> DocumentReference MineralInventory ..> datetime + MineralInventory ..> DocumentReference + MineralInventory ..> RecordReference + MineralSite ..> MineralInventory MineralSite ..> GeoLocationInfo MineralSite ..> DepositTypeCandidate - MineralSite ..> MineralInventory ``` @@ -920,13 +926,13 @@ classDiagram system_version: str } - FeatureResults ..> PolygonLegendAndFeaturesResult - FeatureResults ..> PointLegendAndFeaturesResult - FeatureResults ..> CogMetaData FeatureResults ..> Area_Extraction + FeatureResults ..> PolygonLegendAndFeaturesResult FeatureResults ..> LineLegendAndFeaturesResult - GeoreferenceResults ..> GroundControlPoint + FeatureResults ..> CogMetaData + FeatureResults ..> PointLegendAndFeaturesResult GeoreferenceResults ..> GeoreferenceResult + GeoreferenceResults ..> GroundControlPoint MapResults ..> FeatureResults MapResults ..> GeoreferenceResults @@ -985,6 +991,13 @@ classDiagram STANDARD: str = 'standard' } + class ProcessedDataLayer { + title: Optional[str] + resampling_method: InterpolationType + scaling_method: ScalingType + normalization_method: str + } + class LayerCategory { <> GEOPHYSICS: str = 'geophysics' @@ -992,6 +1005,26 @@ classDiagram GEOCHEMISTRY: str = 'geochemistry' } + class DataSource { + DOI: Optional[str] + authors: Optional[list[str]] + publication_date: Optional[str] + category: Union[LayerCategory, str, NoneType] + subcategory: Optional[str] + description: Optional[str] + derivative_ops: Optional[str] + type: LayerDataType + resolution: Optional[tuple] + format: DataFormat + download_url: Optional[str] + } + + class LayerDataType { + <> + CONTINUOUS: str = 'continuous' + BINARY: str = 'binary' + } + class InterpolationType { <> LINEAR: str = 'linear' @@ -1000,13 +1033,6 @@ classDiagram NONE: str = 'none' } - class ProcessedDataLayer { - title: Optional[str] - resampling_method: InterpolationType - scaling_method: ScalingType - normalization_method: str - } - class StackMetaData { title: Optional[str] year: Optional[int] @@ -1017,29 +1043,9 @@ classDiagram evidence_layers: list[ProcessedDataLayer] } - class LayerDataType { - <> - CONTINUOUS: str = 'continuous' - BINARY: str = 'binary' - } - - class DataSource { - DOI: Optional[str] - authors: Optional[list[str]] - publication_date: Optional[str] - category: Union[LayerCategory, str, NoneType] - subcategory: Optional[str] - description: Optional[str] - derivative_ops: Optional[str] - type: LayerDataType - resolution: Optional[tuple] - format: DataFormat - download_url: Optional[str] - } - + DataSource ..> tuple DataSource ..> DataFormat DataSource ..> LayerCategory - DataSource ..> tuple DataSource ..> LayerDataType ProcessedDataLayer ..> InterpolationType ProcessedDataLayer ..> ScalingType @@ -1058,31 +1064,6 @@ classDiagram ```mermaid classDiagram - class SOMModel { - train_config: SOMTrainConfig - } - - class CMAModel { - title: Optional[str] - date: Optional[int] - authors: Optional[list[str]] - organization: Optional[str] - cma_model_type: Union[NeuralNetModel, SOMModel] - training_data: StackMetaData - } - - class NeighborhoodDecay { - <> - LINEAR: str = 'linear' - EXPONENTIAL: str = 'exponential' - } - - class SOMType { - <> - TOROID: str = 'toroid' - SHEET: str = 'sheet' - } - class SOMTrainConfig { dimensions_x: int dimensions_y: int @@ -1098,37 +1079,53 @@ classDiagram som_grid: SOMGrid } - class SOMGrid { + class LearningRateDecay { <> - HEXAGONAL: str = 'hexagonal' - RECTANGULAR: str = 'rectangular' + LINEAR: str = 'linear' + EXPONENTIAL: str = 'exponential' } - class Accelerator { + class SOMType { <> - CPU: str = 'cpu' - GPU: str = 'gpu' + TOROID: str = 'toroid' + SHEET: str = 'sheet' } - class NeuralNetTrainConfig { - min_epochs: int - max_epochs: int - accelerator: Accelerator - precision: int - val_check_interval: float - deterministic: bool + class SOMInitialization { + <> + RANDOM: str = 'random' + PCA: str = 'pca' } - class LearningRateDecay { + class CMAModel { + title: Optional[str] + date: Optional[int] + authors: Optional[list[str]] + organization: Optional[str] + cma_model_type: Union[NeuralNetModel, SOMModel] + training_data: StackMetaData + } + + class NeighborhoodDecay { <> LINEAR: str = 'linear' EXPONENTIAL: str = 'exponential' } - class SOMInitialization { + class SOMModel { + train_config: SOMTrainConfig + } + + class Accelerator { <> - RANDOM: str = 'random' - PCA: str = 'pca' + CPU: str = 'cpu' + GPU: str = 'gpu' + } + + class SOMGrid { + <> + HEXAGONAL: str = 'hexagonal' + RECTANGULAR: str = 'rectangular' } class StackMetaData { @@ -1151,18 +1148,27 @@ classDiagram BUBBLE: str = 'bubble' } + class NeuralNetTrainConfig { + min_epochs: int + max_epochs: int + accelerator: Accelerator + precision: int + val_check_interval: float + deterministic: bool + } + StackMetaData ..> ProcessedDataLayer NeuralNetTrainConfig ..> Accelerator - SOMTrainConfig ..> SOMInitialization + SOMTrainConfig ..> SOMGrid SOMTrainConfig ..> LearningRateDecay - SOMTrainConfig ..> NeighborhoodFunction SOMTrainConfig ..> SOMType + SOMTrainConfig ..> SOMInitialization + SOMTrainConfig ..> NeighborhoodFunction SOMTrainConfig ..> NeighborhoodDecay - SOMTrainConfig ..> SOMGrid NeuralNetModel ..> NeuralNetTrainConfig SOMModel ..> SOMTrainConfig - CMAModel ..> NeuralNetModel CMAModel ..> SOMModel + CMAModel ..> NeuralNetModel CMAModel ..> StackMetaData diff --git a/cdr_schemas/mineral.py b/cdr_schemas/mineral.py index c6a3d9f..4bdbd2d 100644 --- a/cdr_schemas/mineral.py +++ b/cdr_schemas/mineral.py @@ -55,6 +55,12 @@ class GeologyInfo(BaseModel): comments: str = Field(default="") +class DepositType(BaseModel): + name: str = Field(description="Deposit type name") + environment: str = Field(description="Deposit type environment") + group: str = Field(description="Deposit type group") + + class DepositTypeCandidate(BaseModel): observed_name: str = Field( default="", From caa2994f6ef03139ecaa5de4b1c5d205231b39ad Mon Sep 17 00:00:00 2001 From: Scott Haleen Date: Wed, 26 Jun 2024 18:43:43 -0400 Subject: [PATCH 5/5] minerals updates --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3518b0d..4cbc15a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "cdr_schemas" -version = "0.3.2" +version = "0.3.3" description = "CDR Schemas" authors = [] readme = "README.md"