Function-backed time series are in the beta phase of development and may not be available on your enrollment. Functionality may change during active development. Contact Palantir Support to request access to Function-backed time series.
Function-backed time series enable you to generate and transform numeric time series using Python logic defined in a function. Foundry treats the function's output as a time series without the need to define a time series sync.
In the example below, a function-backed time series is used in a Workshop module to compute weekly forecasts in real-time. An operator is able to simulate different scenarios for how changing a machine's controls affects the predicted performance forecast.

Function-backed time series require a Python Foundry function that returns a serialized numeric time series. When you query data, Quiver invokes your function with the specified parameters, dynamically generating the time series at query time. This output is then treated as a first-class time series within Foundry, allowing you to apply further operations and visualizations.
This integration makes it easy to incorporate custom models and on-the-fly analytics into your dashboards, enabling flexible and modular time series workflows.
The example below demonstrates how to use Prophet ↗ with function-backed time series for forecasting.
Copied!1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24from functions.api import function from timeseries_sdk.types import TimeSeries from ontology_sdk.ontology.objects import Machine from prophet import Prophet @function def performance_prophet_forecast( machine: Machine, periods: int = 96, # number of future steps freq: str = "15min", # sampling frequency ) -> list[bytes]: """ Forecast a machine's performance_score using Prophet. """ df = machine.performance_score.to_pandas(all_time=True) if df.empty: return TimeSeries.serialize(df) df = df.rename(columns={"timestamp": "ds", "value": "y"}).sort_values("ds") model = Prophet().fit(df) future = model.make_future_dataframe(periods=periods, freq=freq, include_history=True) forecast = model.predict(future) out = forecast[["ds", "yhat"]].rename(columns={"ds": "timestamp", "yhat": "value"}) return TimeSeries.serialize(out)