diff --git a/README.md b/README.md index 3ac92d6..56eb188 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 AreaType { <> Map_Area: str = 'map_area' @@ -94,15 +101,8 @@ classDiagram confidence: float | int | None = None } - class GeomType { - <> - Point: str = 'Point' - LineString: str = 'LineString' - Polygon: str = 'Polygon' - } - - Area_Extraction ..> AreaType Area_Extraction ..> GeomType + Area_Extraction ..> AreaType ``` @@ -130,6 +130,12 @@ classDiagram confidence: float | int | None = None } + class Geom_Point { + latitude: float | int | None + longitude: float | int | None + type: GeomType = GeomType.Point + } + class GeomType { <> Point: str = 'Point' @@ -137,6 +143,19 @@ classDiagram Polygon: str = 'Polygon' } + class ProjectionResult { + crs: str + gcp_ids: list[str] + file_name: str + validated: bool = False + } + + class GeoreferenceResult { + likely_CRSs: list[str] = list + map_area: Area_Extraction | None = None + projections: list[ProjectionResult] = list + } + class GeoreferenceResults { cog_id: str georeference_results: list[GeoreferenceResult] = list @@ -161,35 +180,16 @@ 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: Area_Extraction | None = None - projections: list[ProjectionResult] = list - } - - class Geom_Point { - latitude: float | int | None - longitude: float | int | None - 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 + GroundControlPoint ..> Geom_Point GeoreferenceResult ..> ProjectionResult - GeoreferenceResults ..> GeoreferenceResult + GeoreferenceResult ..> Area_Extraction GeoreferenceResults ..> GroundControlPoint + GeoreferenceResults ..> GeoreferenceResult ``` @@ -204,12 +204,6 @@ classDiagram ```mermaid classDiagram - class MapShapeTypes { - <> - rectangular: str = 'rectangular' - non_rectangular: str = 'non_rectangular' - } - class MapColorSchemeTypes { <> full_color: str = 'full_color' @@ -217,14 +211,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 - } - class MapMetaData { title: str = '' year: int | None = None @@ -241,8 +227,22 @@ classDiagram model_version: str } - MapMetaData ..> MapShapeTypes + class MapShapeTypes { + <> + 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 + } + MapMetaData ..> MapColorSchemeTypes + MapMetaData ..> MapShapeTypes CogMetaData ..> MapMetaData @@ -258,31 +258,19 @@ classDiagram ```mermaid classDiagram - class PolygonLegendAndFeaturesResult { + class PointLegendAndFeaturesResult { id: str legend_provenance: ModelProvenance | None = None - label: str + 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 reference_id: str = '' validated: bool | None = None crs: str = 'pixel' cdr_projection_id: str = '' - polygon_features: PolygonFeatureCollection | None = None - } - - class CogMetaData { - cog_id: str - system: str - system_version: str - multiple_maps: bool | None = None - map_metadata: list[MapMetaData] = list + point_features: PointFeatureCollection | None = None } class LineLegendAndFeaturesResult { @@ -313,47 +301,59 @@ classDiagram confidence: float | int | None = 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 PointLegendAndFeaturesResult { + class PolygonLegendAndFeaturesResult { id: str legend_provenance: ModelProvenance | None = None - name: str + label: 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 reference_id: str = '' validated: bool | None = None crs: str = 'pixel' cdr_projection_id: str = '' - point_features: PointFeatureCollection | None = None + polygon_features: PolygonFeatureCollection | None = None + } + + class CogMetaData { + cog_id: str + system: str + system_version: str + multiple_maps: bool | None = None + map_metadata: list[MapMetaData] = 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 } - Area_Extraction ..> AreaType Area_Extraction ..> GeomType - LineLegendAndFeaturesResult ..> ModelProvenance + Area_Extraction ..> AreaType LineLegendAndFeaturesResult ..> LineFeatureCollection + LineLegendAndFeaturesResult ..> ModelProvenance PointLegendAndFeaturesResult ..> PointFeatureCollection PointLegendAndFeaturesResult ..> ModelProvenance PolygonLegendAndFeaturesResult ..> PolygonFeatureCollection PolygonLegendAndFeaturesResult ..> ModelProvenance PolygonLegendAndFeaturesResult ..> MapUnit CogMetaData ..> MapMetaData - FeatureResults ..> PolygonLegendAndFeaturesResult - FeatureResults ..> CogMetaData + FeatureResults ..> PointLegendAndFeaturesResult FeatureResults ..> LineLegendAndFeaturesResult FeatureResults ..> Area_Extraction - FeatureResults ..> PointLegendAndFeaturesResult + FeatureResults ..> PolygonLegendAndFeaturesResult + FeatureResults ..> CogMetaData ``` @@ -368,16 +368,15 @@ classDiagram ```mermaid classDiagram - class PointFeatureCollection { - type: GeoJsonType = GeoJsonType.FeatureCollection - features: list[PointFeature] = list - } - - class PointFeature { - type: GeoJsonType = GeoJsonType.Feature - id: str - geometry: Point - properties: PointProperties + class PointProperties { + model: str + model_version: str + confidence: float | int | None = None + bbox: list[float | int] = list + dip: int | None = None + dip_direction: int | None = None + reference_id: str = '' + validated: bool | None = None } class GeomType { @@ -393,26 +392,11 @@ classDiagram confidence: float | int | None = None } - class Point { - coordinates: list[float | int] - type: GeomType = GeomType.Point - } - - class PointProperties { - model: str - model_version: str - confidence: float | int | None = None - bbox: list[float | int] = list - dip: int | None = None - dip_direction: int | None = None - reference_id: str = '' - validated: bool | None = None - } - - class GeoJsonType { - <> - Feature: str = 'Feature' - FeatureCollection: str = 'FeatureCollection' + class PointFeature { + type: GeoJsonType = GeoJsonType.Feature + id: str + geometry: Point + properties: PointProperties } class PointLegendAndFeaturesResult { @@ -430,10 +414,26 @@ classDiagram point_features: PointFeatureCollection | None = None } + class PointFeatureCollection { + type: GeoJsonType = GeoJsonType.FeatureCollection + features: list[PointFeature] = list + } + + class GeoJsonType { + <> + Feature: str = 'Feature' + FeatureCollection: str = 'FeatureCollection' + } + + class Point { + coordinates: list[float | int] + type: GeomType = GeomType.Point + } + Point ..> GeomType - PointFeature ..> GeoJsonType - PointFeature ..> PointProperties PointFeature ..> Point + PointFeature ..> PointProperties + PointFeature ..> GeoJsonType PointFeatureCollection ..> PointFeature PointFeatureCollection ..> GeoJsonType PointLegendAndFeaturesResult ..> PointFeatureCollection @@ -452,6 +452,36 @@ classDiagram ```mermaid classDiagram + class LineLegendAndFeaturesResult { + id: str + legend_provenance: ModelProvenance | None = None + name: str = '' + abbreviation: str = '' + description: str = '' + legend_bbox: list[float | int] = list + legend_contour: list[list[float | int]] = list + reference_id: str = '' + validated: bool | None = None + crs: str = 'pixel' + cdr_projection_id: str = '' + line_features: LineFeatureCollection | None = None + } + + class DashType { + <> + none: str = '' + solid: str = 'solid' + dash: str = 'dash' + dotted: str = 'dotted' + } + + class LineFeature { + type: GeoJsonType = GeoJsonType.Feature + id: str + geometry: Line + properties: LineProperties + } + class GeomType { <> Point: str = 'Point' @@ -465,22 +495,15 @@ classDiagram confidence: float | int | None = None } - class DashType { - <> - none: str = '' - solid: str = 'solid' - dash: str = 'dash' - dotted: str = 'dotted' + class Line { + coordinates: list[list[float | int]] + type: GeomType = GeomType.LineString } - class LineProperties { - model: str - model_version: str - confidence: float | int | None = None - dash_pattern: DashType = DashType.none - symbol: str = '' - reference_id: str = '' - validated: bool | None = None + class GeoJsonType { + <> + Feature: str = 'Feature' + FeatureCollection: str = 'FeatureCollection' } class LineFeatureCollection { @@ -488,37 +511,14 @@ classDiagram features: list[LineFeature] = list } - class LineFeature { - type: GeoJsonType = GeoJsonType.Feature - id: str - geometry: Line - properties: LineProperties - } - - class LineLegendAndFeaturesResult { - id: str - legend_provenance: ModelProvenance | None = None - name: str = '' - abbreviation: str = '' - description: str = '' - legend_bbox: list[float | int] = list - legend_contour: list[list[float | int]] = list + class LineProperties { + model: str + model_version: str + confidence: float | int | None = None + dash_pattern: DashType = DashType.none + symbol: str = '' reference_id: str = '' validated: bool | None = None - crs: str = 'pixel' - cdr_projection_id: str = '' - line_features: LineFeatureCollection | None = None - } - - class Line { - coordinates: list[list[float | int]] - type: GeomType = GeomType.LineString - } - - class GeoJsonType { - <> - Feature: str = 'Feature' - FeatureCollection: str = 'FeatureCollection' } Line ..> GeomType @@ -528,8 +528,8 @@ classDiagram LineFeature ..> Line LineFeatureCollection ..> LineFeature LineFeatureCollection ..> GeoJsonType - LineLegendAndFeaturesResult ..> ModelProvenance LineLegendAndFeaturesResult ..> LineFeatureCollection + LineLegendAndFeaturesResult ..> ModelProvenance ``` @@ -544,6 +544,19 @@ classDiagram ```mermaid classDiagram + class PolygonFeatureCollection { + type: GeoJsonType = GeoJsonType.FeatureCollection + features: list[PolygonFeature] = list + } + + class PolygonProperties { + model: str + model_version: str + reference_id: str = '' + validated: bool | None = None + confidence: float | int | None = None + } + class MapUnit { age_text: str = '' b_age: float | None = None @@ -562,11 +575,6 @@ classDiagram Polygon: str = 'Polygon' } - class PolygonFeatureCollection { - type: GeoJsonType = GeoJsonType.FeatureCollection - features: list[PolygonFeature] = list - } - class ModelProvenance { model: str model_version: str @@ -597,6 +605,12 @@ classDiagram type: GeomType = GeomType.Polygon } + class GeoJsonType { + <> + Feature: str = 'Feature' + FeatureCollection: str = 'FeatureCollection' + } + class PolygonFeature { type: GeoJsonType = GeoJsonType.Feature id: str @@ -604,24 +618,10 @@ classDiagram properties: PolygonProperties } - class PolygonProperties { - model: str - model_version: str - reference_id: str = '' - validated: bool | None = None - confidence: float | int | None = None - } - - class GeoJsonType { - <> - Feature: str = 'Feature' - FeatureCollection: str = 'FeatureCollection' - } - Polygon ..> GeomType + PolygonFeature ..> PolygonProperties PolygonFeature ..> Polygon PolygonFeature ..> GeoJsonType - PolygonFeature ..> PolygonProperties PolygonFeatureCollection ..> PolygonFeature PolygonFeatureCollection ..> GeoJsonType PolygonLegendAndFeaturesResult ..> PolygonFeatureCollection @@ -641,12 +641,6 @@ classDiagram ```mermaid classDiagram - class MapShapeTypes { - <> - rectangular: str = 'rectangular' - non_rectangular: str = 'non_rectangular' - } - class MapColorSchemeTypes { <> full_color: str = 'full_color' @@ -654,14 +648,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 - } - class MapMetaData { title: str = '' year: int | None = None @@ -678,8 +664,22 @@ classDiagram model_version: str } - MapMetaData ..> MapShapeTypes + class MapShapeTypes { + <> + 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 + } + MapMetaData ..> MapColorSchemeTypes + MapMetaData ..> MapShapeTypes CogMetaData ..> MapMetaData @@ -695,19 +695,16 @@ classDiagram ```mermaid classDiagram - 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: DocumentMetaData | None = 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 + issue: str = '' + description: str = '' + publisher: str = '' } class DocumentExtraction { @@ -724,6 +721,15 @@ classDiagram system_version: str } + class UploadDocument { + title: str + is_open: bool = True + provenance: list[DocumentProvenance] = list + metadata: DocumentMetaData | None = None + system: str + system_version: str + } + class Document { id: str title: str @@ -736,16 +742,10 @@ classDiagram 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 - issue: str = '' - description: str = '' - publisher: str = '' + class DocumentProvenance { + external_system_name: str + external_system_id: str = '' + external_system_url: str = '' } UploadDocument ..> DocumentMetaData @@ -766,11 +766,35 @@ classDiagram ```mermaid classDiagram - class MappableCriteria { - criteria: str - theoretical: str = '' - potential_dataset: list[EvidenceLayer] = list - supporting_references: list[DocumentReference] + class DedupSite { + id: str | None = None + sites: list[DedupSiteRecord] = list + commodity: str + contained_metal: float | None = None + contained_metal_units: str = '' + tonnage: float | None = None + tonnage_units: str = '' + grade: float | None = None + grade_units: str = '' + crs: str = '' + centroid: str | None = '' + geom: str | None = '' + deposit_type_candidate: list[DepositTypeCandidate] = list + system: str + system_version: str + data_snapshot: str + data_snapshot_date: str + } + + class MineralInventoryCategory { + category: str + confidence: float | int | None = None + source: str + } + + class Confidence { + confidence: float | int | None = None + source: str } class MineralInventory { @@ -794,30 +818,29 @@ classDiagram zone: str = '' } - class RecordReference { - record_id: str = '' - source: str = '' - uri: str = '' + class GeoLocationInfo { + crs: str + geom: str } - class DedupSite { - id: str | None = None - sites: list[DedupSiteRecord] = list - commodity: str - contained_metal: float | None = None - contained_metal_units: str = '' - tonnage: float | None = None - tonnage_units: str = '' - grade: float | None = None - grade_units: str = '' - crs: str = '' - centroid: str | None = '' - geom: str | None = '' - deposit_type_candidate: list[DepositTypeCandidate] = list - system: str - system_version: str - data_snapshot: str - data_snapshot_date: 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 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 MineralSite { @@ -837,7 +860,9 @@ classDiagram system_version: str } - class Confidence { + class DepositTypeCandidate { + observed_name: str = '' + deposit_type_id: str | None = None confidence: float | int | None = None source: str } @@ -847,36 +872,27 @@ classDiagram relevance_score: float } - 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 = '' - deposit_type_id: str | None = None - confidence: float | int | None = None - source: str + class DedupSiteRecord { + id: str | None = None + mineral_site_id: str + name: str = '' + country: str = '' + province: str = '' + site_rank: str = '' + site_type: str = '' } - class GeoLocationInfo { - crs: str - geom: str + class DepositType { + id: str | None = None + name: str + environment: str + group: 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 DocumentReference { @@ -888,41 +904,25 @@ classDiagram y_max: float | None = None } - class DepositType { - id: str | None = None - name: str - environment: str - group: str - } - - class DedupSiteRecord { - id: str | None = None - mineral_site_id: str - name: str = '' - country: str = '' - province: str = '' - site_rank: str = '' - site_type: str = '' - } - - class MineralInventoryCategory { - category: str - confidence: float | int | None = None - source: str + class MappableCriteria { + criteria: str + theoretical: str = '' + potential_dataset: list[EvidenceLayer] = list + supporting_references: list[DocumentReference] } - MappableCriteria ..> EvidenceLayer MappableCriteria ..> DocumentReference + MappableCriteria ..> EvidenceLayer MineralSystem ..> MappableCriteria + MineralInventory ..> MineralInventoryCategory MineralInventory ..> RecordReference MineralInventory ..> Confidence - MineralInventory ..> MineralInventoryCategory MineralInventory ..> DocumentReference - MineralSite ..> MineralInventory MineralSite ..> GeoLocationInfo + MineralSite ..> MineralInventory MineralSite ..> DepositTypeCandidate - DedupSite ..> DedupSiteRecord DedupSite ..> DepositTypeCandidate + DedupSite ..> DedupSiteRecord ``` @@ -937,6 +937,14 @@ classDiagram ```mermaid classDiagram + class GeoreferenceResults { + cog_id: str + georeference_results: list[GeoreferenceResult] = list + gcps: list[GroundControlPoint] = list + system: str + system_version: str + } + class FeatureResults { system: str system_version: str @@ -954,23 +962,15 @@ classDiagram extraction_results: list[FeatureResults] = list } - class GeoreferenceResults { - cog_id: str - georeference_results: list[GeoreferenceResult] = list - gcps: list[GroundControlPoint] = list - system: str - system_version: str - } - - FeatureResults ..> PolygonLegendAndFeaturesResult - FeatureResults ..> CogMetaData + FeatureResults ..> PointLegendAndFeaturesResult FeatureResults ..> LineLegendAndFeaturesResult FeatureResults ..> Area_Extraction - FeatureResults ..> PointLegendAndFeaturesResult - GeoreferenceResults ..> GeoreferenceResult + FeatureResults ..> PolygonLegendAndFeaturesResult + FeatureResults ..> CogMetaData GeoreferenceResults ..> GroundControlPoint - MapResults ..> FeatureResults + GeoreferenceResults ..> GeoreferenceResult MapResults ..> GeoreferenceResults + MapResults ..> FeatureResults ``` @@ -985,12 +985,6 @@ classDiagram ```mermaid classDiagram - class MapProvenance { - system_name: str - id: str = None - url: str = None - } - class Map { id: str provenance: list[MapProvenance] = list @@ -999,6 +993,12 @@ classDiagram system_version: str } + class MapProvenance { + system_name: str + id: str = None + url: str = None + } + Map ..> MapProvenance @@ -1014,31 +1014,42 @@ classDiagram ```mermaid classDiagram - class ImputeMethod { - <> - MEAN: str = 'mean' - MEDIAN: str = 'median' + class SaveProcessedDataLayer { + model_run_id: str + data_source_id: str + cma_id: str + title: str + system: str + system_version: str + transform_methods: list[TransformMethod | Impute | ScalingType] = '' } - class NeuralNetUserOptions { - smoothing: float | None = 0.5 - dropout: float | None = 0.5 - negative_sampling_fraction: tuple[float, float] | None = (0.0, 0.25) + class ProspectivityOutputLayer { + system: str + system_version: str + model: str = '' + model_version: str = '' + model_run_id: str + output_type: str + cma_id: str + title: str } - class CreateDataSource { - DOI: str = '' - authors: list[str] = list - publication_date: str = '' - category: LayerCategory - subcategory: str = '' - description: str = '' - derivative_ops: str = '' - type: LayerDataType - resolution: list[float | int] = list - format: DataFormat - reference_url: str = '' - evidence_layer_raster_prefix: str = '' + class CreateProspectModelMetaData { + cma_id: str + system: str + system_version: str + author: str = '' + date: str = '' + organization: str = '' + model_type: str + train_config: SOMTrainConfig | NeuralNetUserOptions + evidence_layers: list[DefineProcessDataLayer] + } + + class Impute { + impute_method: ImputeMethod + window_size: list[int] = [3, 3] } class TransformMethod { @@ -1054,17 +1065,36 @@ classDiagram resolution: list[float | int] mineral: str description: str + creation_date: datetime = now } - class ProspectivityOutputLayer { - system: str - system_version: str - model: str = '' - model_version: str = '' - model_run_id: str - output_type: str - cma_id: str - title: str + class CreateDataSource { + DOI: str = '' + authors: list[str] = list + publication_date: str = '' + category: LayerCategory + subcategory: str = '' + description: str = '' + derivative_ops: str = '' + type: LayerDataType + resolution: list[float | int] = list + format: DataFormat + reference_url: str = '' + evidence_layer_raster_prefix: str = '' + } + + 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 + type: LayerDataType + resolution: tuple | None + format: DataFormat + download_url: str | None } class SOMTrainConfig { @@ -1073,19 +1103,32 @@ classDiagram dimensions_y: int | None = 20 num_initializations: int | None = 5 num_epochs: int = 10 - grid_type: SOMGrid | None = 'SOMGrid.RECTANGULAR' - som_type: SOMType | None = 'SOMType.TOROID' - som_initialization: SOMInitialization | None = 'SOMInitialization.RANDOM' + grid_type: SOMGrid | None = 'rectangular' + som_type: SOMType | None = 'toroid' + som_initialization: SOMInitialization | None = 'random' initial_neighborhood_size: float | None = 0.0 final_neighborhood_size: float | None = 1.0 - neighborhood_function: NeighborhoodFunction | None = 'NeighborhoodFunction.GAUSSIAN' + neighborhood_function: NeighborhoodFunction | None = 'gaussian' gaussian_neighborhood_coefficient: float | None = 0.5 - learning_rate_decay: LearningRateDecay | None = 'LearningRateDecay.LINEAR' - neighborhood_decay: NeighborhoodDecay | None = 'NeighborhoodDecay.LINEAR' + learning_rate_decay: LearningRateDecay | None = 'linear' + neighborhood_decay: NeighborhoodDecay | None = 'linear' initial_learning_rate: float | None final_learning_rate: float | None } + class MultiPolygon { + bbox: tuple[float, float, float, float] | tuple[float, float, float, float, float, float] | None = None + type: Literal['MultiPolygon'] + coordinates: list[list[list[Position2D | Position3D]]] + } + + class DefineProcessDataLayer { + cma_id: str + data_source_id: str + title: str + transform_methods: list[TransformMethod | Impute | ScalingType] = list + } + class LayerDataType { <> CONTINUOUS: str = 'continuous' @@ -1093,18 +1136,11 @@ classDiagram CATEGORICAL: str = 'categorical' } - 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 - type: LayerDataType - resolution: tuple | None - format: DataFormat - download_url: str | None + class ScalingType { + <> + MINMAX: str = 'minmax' + MAXABS: str = 'maxabs' + STANDARD: str = 'standard' } class LayerCategory { @@ -1114,16 +1150,16 @@ classDiagram GEOCHEMISTRY: str = 'geochemistry' } - class DefineProcessDataLayer { - cma_id: str - data_source_id: str - title: str - transform_methods: list[TransformMethod | Impute | ScalingType] = list + class ImputeMethod { + <> + MEAN: str = 'mean' + MEDIAN: str = 'median' } - class Impute { - impute_method: ImputeMethod - window_size: list[int] = [3, 3] + class NeuralNetUserOptions { + smoothing: float | None = 0.5 + dropout: float | None = 0.5 + negative_sampling_fraction: tuple[float, float] | None = (0.0, 0.25) } class DataFormat { @@ -1132,67 +1168,33 @@ classDiagram SHP: str = 'shp' } - class MultiPolygon { - bbox: tuple[float, float, float, float] | tuple[float, float, float, float, float, float] | None = None - type: Literal['MultiPolygon'] - coordinates: list[list[list[Position2D | Position3D]]] - } - - class ScalingType { - <> - MINMAX: str = 'minmax' - MAXABS: str = 'maxabs' - STANDARD: str = 'standard' - } - - class SaveProcessedDataLayer { - model_run_id: str - data_source_id: str - cma_id: str - title: str - system: str - system_version: str - transform_methods: list[TransformMethod | Impute | ScalingType] = '' - } - - class CreateProspectModelMetaData { - cma_id: str - system: str - system_version: str - author: str = '' - date: str = '' - organization: str = '' - model_type: str - train_config: SOMTrainConfig | NeuralNetUserOptions - evidence_layers: list[DefineProcessDataLayer] - } - MultiPolygon ..> Position3D MultiPolygon ..> Position2D - SOMTrainConfig ..> SOMGrid - SOMTrainConfig ..> NeighborhoodFunction SOMTrainConfig ..> SOMType - SOMTrainConfig ..> NeighborhoodDecay + SOMTrainConfig ..> NeighborhoodFunction SOMTrainConfig ..> LearningRateDecay + SOMTrainConfig ..> NeighborhoodDecay SOMTrainConfig ..> SOMInitialization + SOMTrainConfig ..> SOMGrid Impute ..> ImputeMethod CreateDataSource ..> DataFormat CreateDataSource ..> LayerDataType CreateDataSource ..> LayerCategory + CreateCriticalMineralAssessment ..> datetime CreateCriticalMineralAssessment ..> MultiPolygon - DefineProcessDataLayer ..> ScalingType - DefineProcessDataLayer ..> Impute DefineProcessDataLayer ..> TransformMethod - SaveProcessedDataLayer ..> ScalingType - SaveProcessedDataLayer ..> Impute + DefineProcessDataLayer ..> Impute + DefineProcessDataLayer ..> ScalingType SaveProcessedDataLayer ..> TransformMethod - CreateProspectModelMetaData ..> NeuralNetUserOptions - CreateProspectModelMetaData ..> DefineProcessDataLayer + SaveProcessedDataLayer ..> Impute + SaveProcessedDataLayer ..> ScalingType CreateProspectModelMetaData ..> SOMTrainConfig + CreateProspectModelMetaData ..> DefineProcessDataLayer + CreateProspectModelMetaData ..> NeuralNetUserOptions + DataSource ..> DataFormat DataSource ..> tuple DataSource ..> LayerDataType DataSource ..> LayerCategory - DataSource ..> DataFormat ``` @@ -1207,10 +1209,23 @@ classDiagram ```mermaid classDiagram - class NeuralNetUserOptions { - smoothing: float | None = 0.5 - dropout: float | None = 0.5 - negative_sampling_fraction: tuple[float, float] | None = (0.0, 0.25) + class SOMTrainConfig { + size: int = 20 + dimensions_x: int | None = 20 + dimensions_y: int | None = 20 + num_initializations: int | None = 5 + num_epochs: int = 10 + grid_type: SOMGrid | None = 'rectangular' + som_type: SOMType | None = 'toroid' + som_initialization: SOMInitialization | None = 'random' + initial_neighborhood_size: float | None = 0.0 + final_neighborhood_size: float | None = 1.0 + neighborhood_function: NeighborhoodFunction | None = 'gaussian' + gaussian_neighborhood_coefficient: float | None = 0.5 + learning_rate_decay: LearningRateDecay | None = 'linear' + neighborhood_decay: NeighborhoodDecay | None = 'linear' + initial_learning_rate: float | None + final_learning_rate: float | None } class NeighborhoodFunction { @@ -1219,24 +1234,12 @@ classDiagram BUBBLE: str = 'bubble' } - class NeighborhoodDecay { - <> - LINEAR: str = 'linear' - EXPONENTIAL: str = 'exponential' - } - class LearningRateDecay { <> LINEAR: str = 'linear' EXPONENTIAL: str = 'exponential' } - class SOMInitialization { - <> - RANDOM: str = 'random' - PCA: str = 'pca' - } - class SOMGrid { <> HEXAGONAL: str = 'hexagonal' @@ -1249,31 +1252,30 @@ classDiagram SHEET: str = 'sheet' } - class SOMTrainConfig { - size: int = 20 - dimensions_x: int | None = 20 - dimensions_y: int | None = 20 - num_initializations: int | None = 5 - num_epochs: int = 10 - grid_type: SOMGrid | None = 'SOMGrid.RECTANGULAR' - som_type: SOMType | None = 'SOMType.TOROID' - som_initialization: SOMInitialization | None = 'SOMInitialization.RANDOM' - initial_neighborhood_size: float | None = 0.0 - final_neighborhood_size: float | None = 1.0 - neighborhood_function: NeighborhoodFunction | None = 'NeighborhoodFunction.GAUSSIAN' - gaussian_neighborhood_coefficient: float | None = 0.5 - learning_rate_decay: LearningRateDecay | None = 'LearningRateDecay.LINEAR' - neighborhood_decay: NeighborhoodDecay | None = 'NeighborhoodDecay.LINEAR' - initial_learning_rate: float | None - final_learning_rate: float | None + class NeuralNetUserOptions { + smoothing: float | None = 0.5 + dropout: float | None = 0.5 + negative_sampling_fraction: tuple[float, float] | None = (0.0, 0.25) + } + + class NeighborhoodDecay { + <> + LINEAR: str = 'linear' + EXPONENTIAL: str = 'exponential' + } + + class SOMInitialization { + <> + RANDOM: str = 'random' + PCA: str = 'pca' } - SOMTrainConfig ..> SOMGrid - SOMTrainConfig ..> NeighborhoodFunction SOMTrainConfig ..> SOMType - SOMTrainConfig ..> NeighborhoodDecay + SOMTrainConfig ..> NeighborhoodFunction SOMTrainConfig ..> LearningRateDecay + SOMTrainConfig ..> NeighborhoodDecay SOMTrainConfig ..> SOMInitialization + SOMTrainConfig ..> SOMGrid ``` diff --git a/cdr_schemas/cdr_responses/prospectivity.py b/cdr_schemas/cdr_responses/prospectivity.py index 138cfd5..0d598e6 100644 --- a/cdr_schemas/cdr_responses/prospectivity.py +++ b/cdr_schemas/cdr_responses/prospectivity.py @@ -1,3 +1,4 @@ +from datetime import datetime from typing import List, Union from pydantic import BaseModel, Field @@ -13,6 +14,7 @@ class CriticalMineralAssessment(CreateCriticalMineralAssessment): cma_id: str = Field(description="ID of the cma") download_url: str = Field(description="url to view template raster") + creation_date: datetime = Field() class DataSource(CreateDataSource): diff --git a/cdr_schemas/prospectivity_input.py b/cdr_schemas/prospectivity_input.py index 17d4cdd..e61dad2 100644 --- a/cdr_schemas/prospectivity_input.py +++ b/cdr_schemas/prospectivity_input.py @@ -1,3 +1,4 @@ +from datetime import datetime from enum import Enum from typing import List, Optional, Union @@ -90,6 +91,7 @@ class CreateCriticalMineralAssessment(BaseModel): resolution: List[Union[float, int]] mineral: str description: str + creation_date: datetime = Field(default_factory=datetime.now) TranformMethods = List[Union[TransformMethod, Impute, ScalingType]]