Models
Data models used throughout the biosample-enricher package.
Core Models
These models are shared across multiple services and represent fundamental concepts.
biosample_enricher.models
Pydantic models for biosample data normalization and validation.
Provides explicit schema definitions for standardized biosample location data extracted from NMDC and GOLD databases, and elevation service output models.
- class biosample_enricher.models.BiosampleLocation(**data)[source]
Bases:
BaseModelStandardized biosample location data for API enrichment.
- Parameters:
data (
Any)
- calculate_completeness()[source]
Calculate location completeness score based on available fields.
- Return type:
- class Config[source]
Bases:
objectPydantic configuration.
- extra = 'forbid'
- validate_assignment = True
- str_strip_whitespace = True
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'str_strip_whitespace': True, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.models.Variable(value)[source]
-
Enumeration of variables that can be observed/measured.
- ELEVATION = 'elevation'
- class biosample_enricher.models.ValueStatus(value)[source]
-
Status of the observation value.
- OK = 'ok'
- ERROR = 'error'
- PARTIAL = 'partial'
- UNKNOWN = 'unknown'
- class biosample_enricher.models.GeoPoint(**data)[source]
Bases:
BaseModelGeographic point with precision information.
- Parameters:
data (
Any)
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.models.ProviderRef(**data)[source]
Bases:
BaseModelReference to a data provider.
- Parameters:
data (
Any)
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.models.Observation(**data)[source]
Bases:
BaseModelA single observation/measurement result.
- Parameters:
data (
Any)
-
value_status:
ValueStatus
-
provider:
ProviderRef
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.models.EnrichmentRun(**data)[source]
Bases:
BaseModelMetadata about a specific enrichment run.
- Parameters:
data (
Any)
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.models.OutputEnvelope(**data)[source]
Bases:
BaseModelTop-level container for enrichment results.
- Parameters:
data (
Any)
-
run:
EnrichmentRun
-
observations:
list[Observation]
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.models.CoordinateClassification(**data)[source]
Bases:
BaseModelClassification of geographic coordinates.
- Parameters:
data (
Any)
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.models.ElevationRequest(**data)[source]
Bases:
BaseModelRequest for elevation data at specific coordinates.
- Parameters:
data (
Any)
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.models.ElevationResult(**data)[source]
Bases:
BaseModelSingle elevation result for compatibility/convenience.
- Parameters:
data (
Any)
-
classification:
CoordinateClassification
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Service-Specific Models
Each service has its own specialized models for requests and responses.
Weather Models
Weather enrichment data models with standardized schema for biosample metadata.
- class biosample_enricher.weather.models.TemporalQuality(value)[source]
-
Temporal precision quality levels for weather data.
- DAY_SPECIFIC_COMPLETE = 'day_specific_complete'
- DAY_SPECIFIC_PARTIAL = 'day_specific_partial'
- WEEKLY_COMPOSITE = 'weekly_composite'
- MONTHLY_CLIMATOLOGY = 'monthly_climatology'
- NO_DATA = 'no_data'
- class biosample_enricher.weather.models.WeatherProvider(value)[source]
-
Supported weather data providers.
- OPEN_METEO = 'open_meteo'
- METEOSTAT = 'meteostat'
- NOAA = 'noaa'
- ECMWF = 'ecmwf'
- class biosample_enricher.weather.models.TemporalPrecision(method, target_date, data_quality, coverage_info=None, caveat=None, provider=None)[source]
Bases:
objectTemporal precision metadata for weather observations.
- Parameters:
-
data_quality:
TemporalQuality
- class biosample_enricher.weather.models.WeatherObservation(**data)[source]
Bases:
BaseModelSingle weather parameter observation with units and temporal context.
- Parameters:
data (
Any)
-
temporal_precision:
TemporalPrecision
- classmethod validate_value(v)[source]
Validate that value is either a number or dict with numeric values.
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.weather.models.WeatherResult(**data)[source]
Bases:
BaseModelStandardized weather enrichment result aligned with NMDC/GOLD schemas.
Maps weather API responses to biosample schema fields with temporal precision.
- Parameters:
data (
Any)
-
temperature:
WeatherObservation|None
-
wind_speed:
WeatherObservation|None
-
wind_direction:
WeatherObservation|None
-
humidity:
WeatherObservation|None
-
solar_radiation:
WeatherObservation|None
-
precipitation:
WeatherObservation|None
-
pressure:
WeatherObservation|None
-
overall_quality:
TemporalQuality|None
- get_schema_mapping(target_schema='nmdc')[source]
Map weather observations to target biosample schema fields.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.weather.models.MultiProviderClimateNormals(**data)[source]
Bases:
BaseModelClimate normals from multiple providers for comparison and validation.
Returns results from all requested providers, allowing users to: - Compare values across different data sources - Detect provider outages/failures - Validate data quality by cross-checking - Choose which provider to trust for their use case
This is the default return type when multiple providers are queried.
- Parameters:
data (
Any)
- get_provider_result(provider_name)[source]
Get result from a specific provider.
- Parameters:
provider_name (
str)- Return type:
- get_consensus_precipitation()[source]
Calculate consensus annual precipitation across all successful providers.
Returns the mean precipitation if multiple providers available, otherwise returns the single provider’s value.
- get_consensus_temperature()[source]
Calculate consensus annual temperature across all successful providers.
Returns the mean temperature if multiple providers available, otherwise returns the single provider’s value.
- get_value_ranges()[source]
Get min/max range of values across providers.
Useful for detecting large discrepancies and data quality issues.
- Returns:
annual_precpt_range: (min, max) in mm/year or None
annual_temp_range: (min, max) in °C or None
- Return type:
Dict with keys
- to_submission_schema(provider=None, strategy='mean')[source]
Extract values in submission-schema compatible format.
- Parameters:
provider (
str|None) – Specific provider to use (e.g., “meteostat”). If None, uses strategy.strategy (
str) – How to combine multiple providers: - “mean”: Average across all successful providers (default) - “median”: Middle value when sorted (robust to outliers) - “first”: Use first successful provider - “best_quality”: Use provider with lowest station_distance_km
- Returns:
dict[str,Any] – Dict with submission-schema values plus metadata about provider selection
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.weather.models.ClimateNormalsResult(**data)[source]
Bases:
BaseModel30-year climate averages (normals) from a single provider.
Climate normals provide baseline environmental conditions over a standard 30-year period (typically 1991-2020), representing typical climate rather than day-to-day weather variability.
Use this for: - Annual precipitation totals (sum of 12 monthly means) - Annual temperature averages - Long-term climate characterization - Biosample metadata fields like annual_precpt, annual_temp
For day-specific weather conditions, use WeatherResult instead. For multi-provider comparisons, see MultiProviderClimateNormals.
- Parameters:
data (
Any)
- get_annual_precipitation()[source]
Calculate annual precipitation by summing 12 monthly normals.
Returns total in millimeters, suitable for submission-schema annual_precpt slot.
- Returns:
- Annual precipitation in millimeters (mm/year), or None if
data incomplete (requires at least 10 months of valid data).
- Return type:
Example
>>> result.get_annual_precipitation() 547.2 # mm/year
- get_annual_temperature()[source]
Calculate annual average temperature from 12 monthly normals.
Returns average in degrees Celsius, suitable for submission-schema annual_temp slot.
Example
>>> result.get_annual_temperature() 12.5 # °C
- to_submission_schema()[source]
Extract values in submission-schema compatible format.
Provides simple scalar values suitable for NMDC submission-schema slots, following general-purpose design pattern (Issue #193).
- Returns:
annual_precpt: float | None - Annual precipitation in millimeters (mm/year). Sum of 12 monthly normals. None if <10 months available.
annual_temp: float | None - Annual average temperature in degrees Celsius (°C). Average of 12 monthly normals. None if <10 months.
climate_normals_period: str - Period as “YYYY-YYYY” (e.g. “1991-2020”)
station_distance_km: float - Distance to weather station in kilometers
data_source: str - Provider name (e.g. “meteostat”)
- Return type:
Dict with keys
Example
>>> normals = service.get_climate_normals(37.7749, -122.4194) >>> values = normals.to_submission_schema() >>> print(f"Annual rainfall: {values['annual_precpt']} mm") Annual rainfall: 547.2 mm
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Marine Models
Marine enrichment data models with standardized schema for oceanographic metadata.
- class biosample_enricher.marine.models.MarineQuality(value)[source]
-
Data quality levels for marine observations.
- SATELLITE_L3 = 'satellite_l3'
- SATELLITE_L4 = 'satellite_l4'
- MODEL_REANALYSIS = 'model_reanalysis'
- CLIMATOLOGY = 'climatology'
- STATIC_DATASET = 'static_dataset'
- NO_DATA = 'no_data'
- class biosample_enricher.marine.models.MarineProvider(value)[source]
-
Supported marine data providers.
- NOAA_OISST = 'noaa_oisst'
- GEBCO = 'gebco'
- ESA_CCI = 'esa_cci'
- CMEMS = 'cmems'
- OSCAR = 'oscar'
- class biosample_enricher.marine.models.MarinePrecision(method, target_date, data_quality, spatial_resolution=None, temporal_resolution=None, provider=None)[source]
Bases:
objectPrecision metadata for marine observations.
- Parameters:
-
data_quality:
MarineQuality
- class biosample_enricher.marine.models.MarineObservation(**data)[source]
Bases:
BaseModelSingle marine parameter observation with units and precision context.
- Parameters:
data (
Any)
-
precision:
MarinePrecision
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.marine.models.MarineResult(**data)[source]
Bases:
BaseModelComplete marine data result for a location and date.
- Parameters:
data (
Any)
-
sea_surface_temperature:
MarineObservation|None
-
bathymetry:
MarineObservation|None
-
chlorophyll_a:
MarineObservation|None
-
salinity:
MarineObservation|None
-
dissolved_oxygen:
MarineObservation|None
-
ph:
MarineObservation|None
-
ocean_current_u:
MarineObservation|None
-
ocean_current_v:
MarineObservation|None
-
significant_wave_height:
MarineObservation|None
-
overall_quality:
MarineQuality
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Soil Models
Pydantic models for soil enrichment data.
- class biosample_enricher.soil.models.SoilObservation(**data)[source]
Bases:
BaseModelIndividual soil measurement or prediction at a location.
- Parameters:
data (
Any)
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.soil.models.SoilResult(**data)[source]
Bases:
BaseModelResults from soil enrichment for a specific location.
- Parameters:
data (
Any)
-
observations:
list[SoilObservation]
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- biosample_enricher.soil.models.classify_texture(sand_pct, silt_pct, clay_pct)[source]
Classify soil texture using USDA texture triangle.
- Parameters:
- Returns:
str– USDA texture class name- Raises:
ValueError – If percentages don’t sum to ~100% or are invalid
Land Cover Models
Data models for land cover and vegetation enrichment.
- class biosample_enricher.land.models.LandCoverObservation(**data)[source]
Bases:
BaseModelLand cover classification from a specific provider.
- Parameters:
data (
Any)
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.land.models.VegetationObservation(**data)[source]
Bases:
BaseModelVegetation indices from a specific provider.
- Parameters:
data (
Any)
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.land.models.LandResult(**data)[source]
Bases:
BaseModelComplete land cover and vegetation enrichment result.
- Parameters:
data (
Any)
-
land_cover:
list[LandCoverObservation]
-
vegetation:
list[VegetationObservation]
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Geocoding Models
Forward Geocoding:
Data models for forward geocoding results (place names to coordinates).
- class biosample_enricher.forward_geocoding.models.LocationType(value)[source]
-
Types of locations that can be geocoded.
- COUNTRY = 'country'
- STATE = 'state'
- CITY = 'city'
- TOWN = 'town'
- VILLAGE = 'village'
- POSTAL_CODE = 'postal_code'
- ADDRESS = 'address'
- LANDMARK = 'landmark'
- NATURAL_FEATURE = 'natural_feature'
- ADMINISTRATIVE_AREA = 'administrative_area'
- UNKNOWN = 'unknown'
- class biosample_enricher.forward_geocoding.models.GeometryType(value)[source]
-
Types of geometry returned by geocoding services.
- POINT = 'POINT'
- BOUNDS = 'BOUNDS'
- APPROXIMATE = 'APPROXIMATE'
- INTERPOLATED = 'INTERPOLATED'
- ROOFTOP = 'ROOFTOP'
- class biosample_enricher.forward_geocoding.models.BoundingBox(**data)[source]
Bases:
BaseModelGeographic bounding box for a location.
- Parameters:
data (
Any)
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.forward_geocoding.models.ForwardGeocodeLocation(**data)[source]
Bases:
BaseModelA geocoded location result (place name to coordinates).
- Parameters:
data (
Any)
-
location_type:
LocationType
-
geometry_type:
GeometryType|None
-
bounding_box:
BoundingBox|None
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.forward_geocoding.models.ForwardGeocodeProvider(**data)[source]
Bases:
BaseModelInformation about the geocoding provider.
- Parameters:
data (
Any)
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.forward_geocoding.models.ForwardGeocodeResult(**data)[source]
Bases:
BaseModelComplete forward geocoding result with metadata.
- Parameters:
data (
Any)
-
locations:
list[ForwardGeocodeLocation]
-
provider:
ForwardGeocodeProvider
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.forward_geocoding.models.ForwardGeocodeFetchResult(**data)[source]
Bases:
BaseModelInternal result from provider fetch operation.
- Parameters:
data (
Any)
-
result:
ForwardGeocodeResult|None
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Reverse Geocoding:
Pydantic models for reverse geocoding data normalization and validation.
Provides explicit schema definitions for standardized reverse geocoding results from OSM and Google providers.
- class biosample_enricher.reverse_geocoding_models.AddressComponentType(value)[source]
-
Types of address components from various providers.
- COUNTRY = 'country'
- ADMINISTRATIVE_AREA_LEVEL_1 = 'administrative_area_level_1'
- ADMINISTRATIVE_AREA_LEVEL_2 = 'administrative_area_level_2'
- ADMINISTRATIVE_AREA_LEVEL_3 = 'administrative_area_level_3'
- ADMINISTRATIVE_AREA_LEVEL_4 = 'administrative_area_level_4'
- ADMINISTRATIVE_AREA_LEVEL_5 = 'administrative_area_level_5'
- LOCALITY = 'locality'
- SUBLOCALITY = 'sublocality'
- SUBLOCALITY_LEVEL_1 = 'sublocality_level_1'
- SUBLOCALITY_LEVEL_2 = 'sublocality_level_2'
- SUBLOCALITY_LEVEL_3 = 'sublocality_level_3'
- SUBLOCALITY_LEVEL_4 = 'sublocality_level_4'
- SUBLOCALITY_LEVEL_5 = 'sublocality_level_5'
- ROUTE = 'route'
- STREET_NUMBER = 'street_number'
- STREET_ADDRESS = 'street_address'
- PREMISE = 'premise'
- SUBPREMISE = 'subpremise'
- POSTAL_CODE = 'postal_code'
- POSTAL_CODE_PREFIX = 'postal_code_prefix'
- POSTAL_CODE_SUFFIX = 'postal_code_suffix'
- NATURAL_FEATURE = 'natural_feature'
- PARK = 'park'
- POINT_OF_INTEREST = 'point_of_interest'
- ESTABLISHMENT = 'establishment'
- NEIGHBORHOOD = 'neighborhood'
- COLLOQUIAL_AREA = 'colloquial_area'
- PLUS_CODE = 'plus_code'
- POLITICAL = 'political'
- INTERSECTION = 'intersection'
- CONTINENT = 'continent'
- REGION = 'region'
- ISLAND = 'island'
- ARCHIPELAGO = 'archipelago'
- class biosample_enricher.reverse_geocoding_models.AddressComponent(**data)[source]
Bases:
BaseModelStructured address component with type and value.
- Parameters:
data (
Any)
-
type:
AddressComponentType
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.reverse_geocoding_models.BoundingBox(**data)[source]
Bases:
BaseModelGeographic bounding box.
- Parameters:
data (
Any)
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.reverse_geocoding_models.PlaceType(value)[source]
-
Types of places that can be returned.
- BUILDING = 'building'
- HOUSE = 'house'
- AMENITY = 'amenity'
- SHOP = 'shop'
- TOURISM = 'tourism'
- HISTORIC = 'historic'
- LEISURE = 'leisure'
- NATURAL = 'natural'
- LANDUSE = 'landuse'
- WATERWAY = 'waterway'
- HIGHWAY = 'highway'
- RAILWAY = 'railway'
- AEROWAY = 'aeroway'
- BOUNDARY = 'boundary'
- PLACE = 'place'
- OFFICE = 'office'
- EMERGENCY = 'emergency'
- MILITARY = 'military'
- CRAFT = 'craft'
- MAN_MADE = 'man_made'
- ESTABLISHMENT = 'establishment'
- POINT_OF_INTEREST = 'point_of_interest'
- PARK = 'park'
- OTHER = 'other'
- class biosample_enricher.reverse_geocoding_models.ReverseGeocodeLocation(**data)[source]
Bases:
BaseModelSingle reverse geocoding result location.
- Parameters:
data (
Any)
-
components:
list[AddressComponent]
-
bounding_box:
BoundingBox|None
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.reverse_geocoding_models.ReverseGeocodeProvider(**data)[source]
Bases:
BaseModelInformation about the reverse geocoding provider.
- Parameters:
data (
Any)
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.reverse_geocoding_models.ReverseGeocodeResult(**data)[source]
Bases:
BaseModelComplete reverse geocoding result with metadata.
- Parameters:
data (
Any)
-
locations:
list[ReverseGeocodeLocation]
-
provider:
ReverseGeocodeProvider
- filter_by_type(place_type)[source]
Filter locations by place type.
- Parameters:
place_type (
PlaceType)- Return type:
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.reverse_geocoding_models.ReverseGeocodeFetchResult(**data)[source]
Bases:
BaseModelInternal result from provider fetch operation.
- Parameters:
data (
Any)
-
result:
ReverseGeocodeResult|None
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
OSM Features Models
Data models for OpenStreetMap geographic features.
- class biosample_enricher.osm_features.models.OSMElementType(value)[source]
-
Types of OSM elements.
- NODE = 'node'
- WAY = 'way'
- RELATION = 'relation'
- class biosample_enricher.osm_features.models.GeometryType(value)[source]
-
Types of geometric representations.
- POINT = 'point'
- LINESTRING = 'linestring'
- POLYGON = 'polygon'
- MULTIPOLYGON = 'multipolygon'
- class biosample_enricher.osm_features.models.FeatureCategory(value)[source]
-
Main categories of OSM features.
- NATURAL = 'natural'
- WATERWAY = 'waterway'
- HIGHWAY = 'highway'
- RAILWAY = 'railway'
- AEROWAY = 'aeroway'
- AMENITY = 'amenity'
- LEISURE = 'leisure'
- LANDUSE = 'landuse'
- BUILDING = 'building'
- BOUNDARY = 'boundary'
- PLACE = 'place'
- TOURISM = 'tourism'
- SHOP = 'shop'
- CRAFT = 'craft'
- OFFICE = 'office'
- OTHER = 'other'
- class biosample_enricher.osm_features.models.Coordinates(**data)[source]
Bases:
BaseModelGeographic coordinates.
- Parameters:
data (
Any)
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.osm_features.models.OSMNamedFeature(**data)[source]
Bases:
BaseModelA named geographic feature from OpenStreetMap.
- Parameters:
data (
Any)
-
osm_type:
OSMElementType
-
centroid:
Coordinates|None
-
geometry_type:
GeometryType|None
-
category:
FeatureCategory
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.osm_features.models.OSMUnnamedCounts(**data)[source]
Bases:
BaseModelCounts of unnamed features by category and subcategory.
- Parameters:
data (
Any)
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.osm_features.models.OSMQuery(**data)[source]
Bases:
BaseModelParameters for an OSM Overpass query.
- Parameters:
data (
Any)
-
center:
Coordinates
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.osm_features.models.OSMFeaturesResult(**data)[source]
Bases:
BaseModelComplete result from OSM features enrichment.
- Parameters:
data (
Any)
-
named_features:
list[OSMNamedFeature]
-
unnamed_counts:
list[OSMUnnamedCounts]
- get_features_by_category(category)[source]
Get all named features of a specific category.
- Parameters:
category (
FeatureCategory)- Return type:
- get_nearest_feature(category)[source]
Get the nearest named feature of a specific category.
- Parameters:
category (
FeatureCategory)- Return type:
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.osm_features.models.OSMFetchResult(**data)[source]
Bases:
BaseModelInternal result from OSM Overpass API fetch operation.
- Parameters:
data (
Any)
-
result:
OSMFeaturesResult|None
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.osm_features.models.GooglePlacesFeature(**data)[source]
Bases:
BaseModelA feature from Google Places API.
- Parameters:
data (
Any)
-
centroid:
Coordinates|None
-
category:
FeatureCategory
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.osm_features.models.GooglePlacesResult(**data)[source]
Bases:
BaseModelResult from Google Places API query.
- Parameters:
data (
Any)
-
query:
Coordinates
-
named_features:
list[GooglePlacesFeature]
- get_nearest_feature(category)[source]
Get nearest feature of specified category.
- Parameters:
category (
FeatureCategory)- Return type:
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.osm_features.models.GooglePlacesFetchResult(**data)[source]
Bases:
BaseModelResult of fetching from Google Places API.
- Parameters:
data (
Any)
-
result:
GooglePlacesResult|None
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class biosample_enricher.osm_features.models.CombinedFeaturesResult(**data)[source]
Bases:
BaseModelCombined results from multiple geographic feature providers.
- Parameters:
data (
Any)
-
query:
Coordinates
-
osm_result:
OSMFeaturesResult|None
-
google_result:
GooglePlacesResult|None
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Common Patterns
All models follow these conventions:
Type Safety
Full type hints using Python 3.11+ syntax
Pydantic validation for all external data
mypy strict mode compliance
Coordinate Handling
Latitude: -90 to 90 decimal degrees
Longitude: -180 to 180 decimal degrees
Automatic canonicalization to 4 decimal places (~11m precision)
Observation Pattern
Many services return Observation objects with:
value_numeric: Numeric measurement (if applicable)value_string: String value (if applicable)provider: Data source informationmetadata: Additional context
See Also
Services - Service implementations using these models
Providers - Provider-specific response handling
Architecture - Overall system design