fietsboek.transformers package¶
Fietsboek GPX transformers.
A “transformer” is something like a filter - it takes in a GPX file and applies some small corrections, such as smoothing out the elevation. In order to avoid confusion with the naming (and the “filters” you have when searching for tracks), we call those “GPX filters” transformers.
This module defines the abstract interface for transformers, as well as function to load and apply transformers.
- class fietsboek.transformers.Parameters(**data)¶
Bases:
BaseModel
Parameters for a transformer.
This is basically a wrapper around pydantic models that allows the parameters to be serialized from and to POST request parameters.
- html_ui()¶
Renders a HTML UI for this parameter set.
- Return type:
list
[ParameterDefinition
]- Returns:
The rendered UI, ready for inclusion.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class fietsboek.transformers.Transformer¶
Bases:
ABC
A
Transformer
is the main interface for track manipulation.- abstract classmethod description()¶
A short description of what this transformer does.
- Return type:
TranslationString
- Returns:
The transformer’s description.
- abstract execute(gpx)¶
Run the transformation on the input gpx.
This is expected to modify the GPX object to represent the new state.
- Parameters:
gpx (
GPX
) – The GPX object to transform. Note that this object will be mutated!
- abstract classmethod identifier()¶
Returns a string identifier for this transformer.
This identifier is used when serializing/deserializing the filters.
- Return type:
- Returns:
A machine-readable identifier for this transformer.
- abstract classmethod name()¶
The human-readable name of this transformer, as a translateable string.
- Return type:
TranslationString
- Returns:
The transformer’s name.
- abstract classmethod parameter_model()¶
Returns the parameter model that this transformer expects.
- Return type:
- Returns:
The parameter model class.
- abstract property parameters: Parameters¶
Returns the parameters of this transformer.
Note that the caller may modify the parameters, which should be reflected in future applications of the transformer.
- Returns:
The parameters.
- fietsboek.transformers.list_transformers()¶
Returns a list of all available transformers.
- Return type:
- Returns:
A list of transformers.