Return models
Frontend models for the experience builder.
This module defines the frontend models that are understood and interpreted by the DASF plugin for the experience builder, see also Return Models.
Frontend implemented models:
|
A binary file that the user can download. |
|
A feature base record response. |
|
A link to an external data source. |
|
A geojson response |
|
A combination of multiple return models. |
Classes:
|
A base model for a categorical button. |
|
An enumeration. |
|
|
|
A feature in a GeoJson |
|
|
|
Functions:
|
Infer the EsriFieldType from an existing value. |
- class dasf_exb.return_models.BinaryFile(*, response_type: Literal['categorical_button'] = 'categorical_button', category: str = 'Downloads', text: str | None = None, data: Annotated[bytes, EncodedBytes(encoder=Base64Encoder)], filename: str = 'The name of the file to use for the download', mimetype: str)
Bases:
CategoricalButtonA binary file that the user can download.
See also the frontend implementation CategoricalButton
Attributes:
The title for the button.
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- response_type: Literal['categorical_button']
- class dasf_exb.return_models.CategoricalButton(*, response_type: Literal['categorical_button'] = 'categorical_button', category: str = 'Downloads', text: str | None = None)
Bases:
BaseModelA base model for a categorical button.
Attributes:
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class dasf_exb.return_models.DataSource(*, response_type: Literal['datasource'] = 'datasource', records: List[Dict[str, str | datetime | date | float | int]], name: str)
Bases:
BaseModelA feature base record response.
See also the frontend implementation DataSource
Methods:
Generate a data source config for the frontend
Attributes:
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- generate_datasource_config() RecordSchema
Generate a data source config for the frontend
This method infers the
RecordSchemafor theDataSourceinstance. The record schema can be dumped as JSON and imported to the experience builder frontend to setup the data source. Types of the data source is infered frominfer_esri_field_type()- Returns:
The infered schema
- Return type:
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class dasf_exb.return_models.EsriFieldType(value)
-
An enumeration.
Attributes:
- Blob = 'esriFieldTypeBlob'
- Date = 'esriFieldTypeDate'
- Double = 'esriFieldTypeDouble'
- GUID = 'esriFieldTypeGUID'
- Geometry = 'esriFieldTypeGeometry'
- GlobalID = 'esriFieldTypeGlobalID'
- Integer = 'esriFieldTypeInteger'
- OID = 'esriFieldTypeOID'
- Raster = 'esriFieldTypeRaster'
- Single = 'esriFieldTypeSingle'
- SmallInteger = 'esriFieldTypeSmallInteger'
- String = 'esriFieldTypeString'
- XML = 'esriFieldTypeXML'
- class dasf_exb.return_models.ExternalLink(*, response_type: Literal['categorical_button'] = 'categorical_button', category: str = 'Downloads', text: str | None = None, href: HttpUrl)
Bases:
CategoricalButtonA link to an external data source.
See also the frontend implementation CategoricalButton
Attributes:
The title for the button.
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- href: HttpUrl
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- response_type: Literal['categorical_button']
- class dasf_exb.return_models.GeoJson(*, response_type: Literal['geojson'] = 'geojson', data: GeoJsonData, renderer: Dict | None = None, title: str = 'GeoJSON')
Bases:
BaseModelA geojson response
See also the frontend implementation GeoJson
Attributes:
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- data: GeoJsonData
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class dasf_exb.return_models.GeoJsonData(*, type: str, features: List[GeoJsonFeature], crs: Dict | None = None)
Bases:
BaseModelAttributes:
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- features: List[GeoJsonFeature]
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class dasf_exb.return_models.GeoJsonFeature(*, id: str, type: str, properties: ~typing.Dict = <factory>, geometry: ~typing.Dict)
Bases:
BaseModelA feature in a GeoJson
Attributes:
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class dasf_exb.return_models.MultipleResponses(*, response_type: Literal['multiple'] = 'multiple', data: List[GeoJson | DataSource | BinaryFile | ExternalLink])
Bases:
BaseModelA combination of multiple return models.
See also the frontend implementation MultipleResponses
Attributes:
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- data: List[GeoJson | DataSource | BinaryFile | ExternalLink]
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class dasf_exb.return_models.RecordSchema(*, fields: List[RecordSchemaField], name: str, idField: str | None = None)
Bases:
BaseModelAttributes:
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- fields: List[RecordSchemaField]
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class dasf_exb.return_models.RecordSchemaField(*, name: str, alias: str, type: EsriFieldType)
Bases:
BaseModelAttributes:
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- type: EsriFieldType
- dasf_exb.return_models.infer_esri_field_type(value: Any) EsriFieldType
Infer the EsriFieldType from an existing value.
- Parameters:
value (Any) – The value to infer the type for.
- Returns:
The estimated type for the value. If none can be infered, we use a String.
- Return type: