Skip to content

indexes

ecoscope.platform.indexes

Attributes

CompositeFilter module-attribute

CompositeFilter = tuple[Filter, ...]

Filter module-attribute

Filter = tuple[IndexName, Literal['='], IndexValue]

IndexName module-attribute

IndexName: TypeAlias = str

IndexValue module-attribute

IndexValue: TypeAlias = str

TemporalIndexType module-attribute

TemporalIndexType = Union[Year, Month, YearMonth, DayOfTheYear, DayOfTheMonth, DayOfTheWeek, Hour, Date]

UserDefinedGroupers module-attribute

UserDefinedGroupers: TypeAlias = list[ValueGrouper | TemporalGrouper | SpatialGrouper]

strftime_directives module-attribute

strftime_directives: List[TemporalIndexType] = [Year(), Month(), YearMonth(), DayOfTheYear(), DayOfTheMonth(), DayOfTheWeek(), Hour(), Date()]

Classes

AllGrouper

Bases: BaseModel

Attributes
display_name property
display_name
help_text property
help_text
index_name class-attribute instance-attribute
index_name: Annotated[str, AdvancedField(default=All)] = 'All'
model_config class-attribute instance-attribute
model_config = ConfigDict(frozen=True)
sort_key property
sort_key: None

Date dataclass

Date(directive: Literal['%Y-%m-%d'] = '%Y-%m-%d', selector_title: str = 'Date (example: 2025-01-31)', display_name: str = 'Date', sort_key: None = None)
Attributes
directive class-attribute instance-attribute
directive: Literal['%Y-%m-%d'] = '%Y-%m-%d'
display_name class-attribute instance-attribute
display_name: str = 'Date'
selector_title class-attribute instance-attribute
selector_title: str = 'Date (example: 2025-01-31)'
sort_key class-attribute instance-attribute
sort_key: None = None

DayOfTheMonth dataclass

DayOfTheMonth(directive: Literal['%d'] = '%d', selector_title: str = 'Day of the month as a number (example: 31)', display_name: str = 'Day of the month', sort_key: None = None)
Attributes
directive class-attribute instance-attribute
directive: Literal['%d'] = '%d'
display_name class-attribute instance-attribute
display_name: str = 'Day of the month'
selector_title class-attribute instance-attribute
selector_title: str = 'Day of the month as a number (example: 31)'
sort_key class-attribute instance-attribute
sort_key: None = None

DayOfTheWeek dataclass

DayOfTheWeek(directive: Literal['%A'] = '%A', selector_title: str = 'Day of the week (example: Sunday)', display_name: str = 'Day of the week', sort_key: Callable = index)
Attributes
directive class-attribute instance-attribute
directive: Literal['%A'] = '%A'
display_name class-attribute instance-attribute
display_name: str = 'Day of the week'
selector_title class-attribute instance-attribute
selector_title: str = 'Day of the week (example: Sunday)'
sort_key class-attribute instance-attribute
sort_key: Callable = index

DayOfTheYear dataclass

DayOfTheYear(directive: Literal['%j'] = '%j', selector_title: str = 'Day of the year as a number (example: 365)', display_name: str = 'Day of the year', sort_key: None = None)
Attributes
directive class-attribute instance-attribute
directive: Literal['%j'] = '%j'
display_name class-attribute instance-attribute
display_name: str = 'Day of the year'
selector_title class-attribute instance-attribute
selector_title: str = 'Day of the year as a number (example: 365)'
sort_key class-attribute instance-attribute
sort_key: None = None

Hour dataclass

Hour(directive: Literal['%H'] = '%H', selector_title: str = 'Hour (24-hour clock) as number (example: 22)', display_name: str = 'Hour', sort_key: None = None)
Attributes
directive class-attribute instance-attribute
directive: Literal['%H'] = '%H'
display_name class-attribute instance-attribute
display_name: str = 'Hour'
selector_title class-attribute instance-attribute
selector_title: str = 'Hour (24-hour clock) as number (example: 22)'
sort_key class-attribute instance-attribute
sort_key: None = None

Month dataclass

Month(directive: Literal['%B'] = '%B', selector_title: str = 'Month (example: September)', display_name: str = 'Month', sort_key: Callable = index)
Attributes
directive class-attribute instance-attribute
directive: Literal['%B'] = '%B'
display_name class-attribute instance-attribute
display_name: str = 'Month'
selector_title class-attribute instance-attribute
selector_title: str = 'Month (example: September)'
sort_key class-attribute instance-attribute
sort_key: Callable = index

SpatialGrouper

Bases: BaseModel

Attributes
display_name property
display_name: str
help_text class-attribute instance-attribute
help_text: Annotated[str | SkipJsonSchema[None], AdvancedField(default=None, exclude=True)] = None
index_name property
index_name: str
is_resolved property
is_resolved: bool
model_config class-attribute instance-attribute
model_config = ConfigDict(title='Spatial')
sort_key property
sort_key: None
spatial_index_name instance-attribute
spatial_index_name: IndexName
spatial_regions property
spatial_regions: AnyGeoDataFrame | None
Methods:
resolve
resolve(spatial_regions: AnyGeoDataFrame) -> None
Source code in ecoscope/platform/indexes.py
def resolve(self, spatial_regions: AnyGeoDataFrame) -> None:
    self._resolved_spatial_regions = spatial_regions

TemporalGrouper

Bases: BaseModel

Attributes
display_name property
display_name
help_text class-attribute instance-attribute
help_text: Annotated[str | SkipJsonSchema[None], AdvancedField(default=None, exclude=True)] = None
index_name property
index_name
is_temporal class-attribute instance-attribute
is_temporal: Annotated[Literal[True], Field(exclude=True)] = True
model_config class-attribute instance-attribute
model_config = ConfigDict(frozen=True, title='Time')
sort_key property
sort_key: Callable | None
temporal_index instance-attribute
temporal_index: Annotated[TemporalIndexType, BeforeValidator(_coerce_temporal_index)]

ValueGrouper

Bases: BaseModel

Attributes
display_name property
display_name
help_text class-attribute instance-attribute
help_text: Annotated[str | SkipJsonSchema[None], AdvancedField(default=None, exclude=True)] = None
index_name instance-attribute
index_name: IndexName
model_config class-attribute instance-attribute
model_config = ConfigDict(frozen=True, title='Category')
sort_key property
sort_key: None

Year dataclass

Year(directive: Literal['%Y'] = '%Y', selector_title: str = 'Year (example: 2024)', display_name: str = 'Year', sort_key: None = None)
Attributes
directive class-attribute instance-attribute
directive: Literal['%Y'] = '%Y'
display_name class-attribute instance-attribute
display_name: str = 'Year'
selector_title class-attribute instance-attribute
selector_title: str = 'Year (example: 2024)'
sort_key class-attribute instance-attribute
sort_key: None = None

YearMonth dataclass

YearMonth(directive: Literal['%Y-%m'] = '%Y-%m', selector_title: str = 'Year and Month (example: 2023-01)', display_name: str = 'Year-Month', sort_key: None = None)
Attributes
directive class-attribute instance-attribute
directive: Literal['%Y-%m'] = '%Y-%m'
display_name class-attribute instance-attribute
display_name: str = 'Year-Month'
selector_title class-attribute instance-attribute
selector_title: str = 'Year and Month (example: 2023-01)'
sort_key class-attribute instance-attribute
sort_key: None = None