deseasion.backend.models.geo_data module

class deseasion.backend.models.geo_data.AttributeType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

nominal = 2
ordinal = 3
quantitative = 1
class deseasion.backend.models.geo_data.BaseData(name, features=[], description=None, **kwargs)

Bases: HasPermissions, TimestampMixin, Model

Permission

alias of BaseDataPermission

attributes
created_at
description
features
id
is_public
load_properties(force=False)

Load the model properties and save them to the database

Args:

force (bool): to force the loading of the properties

modified_at
name
original_name
permissions

Create new a permissions table linking a user with an object

The table created will be called ‘<name>_permission’, with <name> being the name of the table where this mixin is used

query: t.ClassVar[Query]

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.

shares
type
class deseasion.backend.models.geo_data.BaseGeoData(name, features=[], description=None, **kwargs)

Bases: BaseData

as_geojson()
attributes
created_at
description
extent
extent_filter
features
id
is_public
load_extent()
modified_at
name
original_name
permissions

Create new a permissions table linking a user with an object

The table created will be called ‘<name>_permission’, with <name> being the name of the table where this mixin is used

query: t.ClassVar[Query]

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.

shares
type
class deseasion.backend.models.geo_data.DataAttribute(**kwargs)

Bases: ModelMixin, Model

data
data_id
get_value_class()
id
load_statistics()

Load statistics about the attribute values.

The stats are calculated using pandas’ describe function.

mrsort_criteria
name
new_copy()
query: t.ClassVar[Query]

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.

same_as(other) bool

Check attribute is same as other.

Parameters:

other – other data attribute or None

Returns:

True if they are the same, False otherwise

Warning

This does not check values or statistics

statistics
type
values
class deseasion.backend.models.geo_data.DataAttributeNominal(**kwargs)

Bases: DataAttribute

data
data_id
get_value_class()
id
mrsort_criteria
name
query: t.ClassVar[Query]

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.

statistics
type
values
class deseasion.backend.models.geo_data.DataAttributeOrdinal(**kwargs)

Bases: DataAttribute

data
data_id
get_value_class()
id
mrsort_criteria
name
new_copy()
order
query: t.ClassVar[Query]

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.

same_as(other) bool

Check attribute is same as other.

Parameters:

other – other data attribute or None

Returns:

True if they are the same, False otherwise

Warning

This does not check values or statistics

statistics
type
values
class deseasion.backend.models.geo_data.DataAttributeQuantitative(**kwargs)

Bases: DataAttribute

data
data_id
get_value_class()
id
mrsort_criteria
name
query: t.ClassVar[Query]

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.

statistics
type
values
class deseasion.backend.models.geo_data.DataValue(**kwargs)

Bases: ModelMixin, Model

attribute
attribute_id
feature
feature_id
id
query: t.ClassVar[Query]

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.

type
value
class deseasion.backend.models.geo_data.DataValueNominal(**kwargs)

Bases: DataValue

attribute
attribute_id
feature
feature_id
id
query: t.ClassVar[Query]

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.

type
value
class deseasion.backend.models.geo_data.DataValueOrdinal(**kwargs)

Bases: DataValue

attribute
attribute_id
feature
feature_id
id
query: t.ClassVar[Query]

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.

type
value
class deseasion.backend.models.geo_data.DataValueQuantitative(**kwargs)

Bases: DataValue

attribute
attribute_id
feature
feature_id
id
query: t.ClassVar[Query]

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.

type
value
class deseasion.backend.models.geo_data.Feature(*args, properties=[], execution_artifact=None, input_features=[], **kwargs)

Bases: ModelMixin, Model

Table for the data features.

Attributes:

properties (dict): The properties or attributes of the feature. data_id (int): Reference to the data.

data
data_id
execution_artifact
explain()

Return explanation for feature values.

This is empty except for generated geo data features.

Returns:

get_input_data()

Returns the list of input data.

get_input_features(data_id)

Returns the input features belonging to provided data.

get_output_data()

Returns the list of output data.

get_output_features(data_id)

Returns the output features belonging to provided data.

get_property(prop)

Returns the value of the property

id
input_features
output_features
properties
query: t.ClassVar[Query]

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.

type
class deseasion.backend.models.geo_data.FeatureType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

feature = 1
geo_feature = 2
class deseasion.backend.models.geo_data.GeneratedGeoData(name, features=[], description=None, **kwargs)

Bases: BaseGeoData

Table for the geographical data generated by the processing model in the projects.

attributes
created_at
description
extent
extent_filter
features
id
is_public
modified_at
name
original_name
permissions

Create new a permissions table linking a user with an object

The table created will be called ‘<name>_permission’, with <name> being the name of the table where this mixin is used

project_data
query: t.ClassVar[Query]

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.

shares
type
class deseasion.backend.models.geo_data.GeoData(*args, original_name=None, source_driver=None, is_public=False, **kwargs)

Bases: UploadableData, BaseGeoData

Table for the geographical data loaded from files.

Attributes:

original_name (str): The name of the file. source_driver (str): Which format the original data used. upload_user_id (int): Reference to the user who uploaded the data. description (str): A description text.

attributes
created_at
description
extent
extent_filter
features
id
is_public
modified_at
name
original_name
permissions

Create new a permissions table linking a user with an object

The table created will be called ‘<name>_permission’, with <name> being the name of the table where this mixin is used

query: t.ClassVar[Query]

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.

shares
source_driver
type
upload_user_id
class deseasion.backend.models.geo_data.GeoDataType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

generated_geo_data = 2
geo_data = 1
global_data = 3
wfs = 4
wms = 5
class deseasion.backend.models.geo_data.GeoFeature(geom, *args, **kwargs)

Bases: Feature

Table for the geo-data features.

Attributes:

geom: The geometry of the feature. properties (dict): The properties or attributes of the feature. data_id (int): Reference to the geo-data.

as_geojson()

Return the feature as a GeoJSON data.

data
data_id
execution_artifact
geom
id
input_features
output_features
properties
query: t.ClassVar[Query]

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.

type
class deseasion.backend.models.geo_data.GlobalData(feature, **kwargs)

Bases: UploadableData, BaseData

attributes
created_at
description
feature
feature_id
features
get_property(prop)

Returns the value of the property

id
is_public
modified_at
name
original_name
permissions

Create new a permissions table linking a user with an object

The table created will be called ‘<name>_permission’, with <name> being the name of the table where this mixin is used

properties
query: t.ClassVar[Query]

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.

set_property(prop, value)

Set property value.

Try to reuse existing attribute if type matches.

Parameters:
  • prop – property name (attribute name)

  • value – new property value

shares
type
upload_user_id
class deseasion.backend.models.geo_data.StreamGeoData

Bases: object

keywords = Column(None, ARRAY(String(), dimensions=1), table=None)
title = Column(None, String(), table=None)
url = Column(None, String(), table=None, nullable=False)
version = Column(None, String(), table=None)
class deseasion.backend.models.geo_data.UploadableData

Bases: object

upload_user
upload_user_id = Column(None, Integer(), ForeignKey('user.id'), table=None)
class deseasion.backend.models.geo_data.WFSGeoData(url, feature_type, name=None, original_name=None, is_public=False, title=None, description=None, keywords=None, **kwargs)

Bases: UploadableData, StreamGeoData, BaseGeoData

attributes
created_at
description
extent
extent_filter
feature_type
features
id
is_public
keywords
modified_at
name
original_name
permissions

Create new a permissions table linking a user with an object

The table created will be called ‘<name>_permission’, with <name> being the name of the table where this mixin is used

query: t.ClassVar[Query]

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.

shares
title
type
upload_user_id
url
version
class deseasion.backend.models.geo_data.WMSGeoData(url, layer, name=None, original_name=None, is_public=False, title=None, description=None, keywords=None, classes=None, start=None, step=None, stop=None, **kwargs)

Bases: UploadableData, StreamGeoData, BaseGeoData

attributes
classes
created_at
description
extent
extent_filter
features
id
is_public
keywords
layer
modified_at
name
original_name
permissions

Create new a permissions table linking a user with an object

The table created will be called ‘<name>_permission’, with <name> being the name of the table where this mixin is used

query: t.ClassVar[Query]

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.

resolution
shares
start
step
stop
title
type
upload_user_id
url
version