Timeseries
opengate_data.timeseries
opengate_data.timeseries.find_timeseries
FindTimeseriesBuilder Objects
class FindTimeseriesBuilder(SearchBuilder)Find time series Builder
with_expand
def with_expand(expand: str) -> 'FindTimeseriesBuilder'With expand, select the data field to show information, columns, context or columns.context.
Arguments:
expand (str):
Returns:
FindTimeseriesBuilder- Returns itself to allow for method chaining.
Example:
# expand=columns, expand=context, expand=columns.context
builder.with_expand("columns")with_datastreams
def with_datastreams(datastreams: str) -> 'FindTimeseriesBuilder'With dataStreams, select the dataStreams to filter the Timeseries. To be accept and intepreted by the System the dataStream will be in format URL.
Arguments:
datastreams (str):
Returns:
FindTimeseriesBuilder- Returns itself to allow for method chaining.
Example:
# example: dataStreams=provision.device.identifier,provision.device.communicationModules.subscription.address
builder.with_datastreams("provision.device.identifier")with_organization_name
def with_organization_name(organization_name: str) -> 'FindTimeseriesBuilder'Set organization name
Arguments:
organization_name (str):
Returns:
timeseriesFindTimeseriesBuilder- Returns itself to allow for method chaining.
Example:
builder.with_organization_name("organization_name")with_format
def with_format(format_data: str) -> 'FindTimeseriesBuilder'Formats the flat entities data based on the specified format (‘csv’, ‘dict’, or ‘pandas’). By default, the data is returned as a dictionary.
Arguments:
format_datastr - The format to use for the data.
Example:
builder.with_format(‘dict’) builder.with_format(‘pandas’)
Returns:
SearchBuilderBase- Returns itself to allow for method chaining.
with_identifier
def with_identifier(identifier: str) -> 'FindTimeseriesBuilder'set the timeseries identifier.
Arguments:
identifierstr - The identifier of the timeseries.
Returns:
FindTimeseriesBuilder- Returns itself to allow for method chaining.
Example:
builder.with_identifier("timeseries_id")with_config_file
def with_config_file(config_file: str,
section: str,
config_key: str,
prefer: str = "auto") -> 'FindTimeseriesBuilder'Reads a value from the INI and saves it as a source. ‘prefer’ controls whether the value will be interpreted as identifier, name, or auto (first id, then name).
with_name
def with_name(find_name: str) -> 'FindTimeseriesBuilder'Specify the name to find.
Arguments:
find_namestr - The name of the transformer.
Returns:
AITransformersBuilder- Returns self for chaining.
Example:
builder.with_find_by_name('transformer_name')with_env
def with_env(env_key: str, prefer: str = "auto") -> 'FindTimeseriesBuilder'Use an environment variable as the source. ‘prefer’ can be:
- ‘identifier’ -> treat the value as an identifier
- ’name’ -> treat the value as a name
- ‘auto’ -> try identifier and, if not, name
find_all
def find_all() -> 'FindTimeseriesBuilder'Searches for all available timeseries resources.
Returns:
FindTimeseriesBuilder- Returns the current instance to allow method chaining.
Example:
builder.with_organization_name('my_organization').find_all()find_one
def find_one() -> 'FindTimeseriesBuilder'Searches for a single transformer resource by its identifier.
This method prepares the request to find a specific transformer based on its identifier. The identifier is obtained automatically if not explicitly defined or can be obtained from a configuration file or environment variables.
Returns:
FindTimeseriesBuilder- Returns the current instance to allow method chaining.
Example:
builder.with_organization_name('my_organization').with_organization_name("organization_name").with_format("dict").with_identifier("identifier").find_one().build().execute()build
def build() -> 'FindTimeseriesBuilder'Finalizes the construction of the IoT collection configuration.
This method prepares the builder to execute the collection by ensuring all necessary configurations are set and validates the overall integrity of the build. It should be called before executing the collection to ensure that the configuration is complete and valid.
The build process involves checking that mandatory fields such as the device identifier are set. It also ensures that method calls that are incompatible with each other (like build and build_execute) are not both used.
Returns:
FindTimeseriesBuilder- Returns itself to allow for method chaining, enabling further actions likeexecute.
Raises:
ValueError- If required configurations are missing or if incompatible methods are used together.
Example:
builder.build()build_execute
def build_execute()Executes the timeseries search immediately after building the configuration.
This method is a shortcut that combines building and executing in a single step.
Returns:
dict- A dictionary containing the execution response which includes the status code and potentially other metadata about the execution.
Raises:
ValueError- Ifbuildhas already been called on this builder instance.
Example:
builder.build_execute()execute
def execute() -> ResponseExecute the configured operation and return the response.
This method executes the operation that has been configured using the builder pattern. It ensures that the build method has been called and that it is the last method invoked before execute. Depending on the configured method (e.g., create, find, update, delete), it calls the appropriate internal execution method.
Returns:
requests.Response- The response object from the executed request.
Raises:
Exception- If thebuildmethod has not been called or if it is not the last method invoked beforeexecute.ValueError- If the configured method is unsupported.
Example:
builder.execute()opengate_data.timeseries.timeseries
Provision Timeseries Builder
TimeseriesBuilder Objects
class TimeseriesBuilder(SearchBuilder)Class timeseries builder