Bringing Live Data into a Twin

Intermediate

Connect a twin to a live data source and fetch actual figures into a scenario, by hand or automatically whenever a dashboard is opened.

A twin doesn't have to be filled by hand. With a live data source, Metapad fetches actual figures (revenue, orders, headcount) from another system and writes them into a scenario's time series. Formulas and dashboards then work with real data.

Before you start

  • The twin needs a calendar: a Time unit and a First step date, and the scenario needs a Step (see Putting a Twin on a Calendar). That is how Metapad tells the provider which periods it wants.
  • Someone has to provide the data: a provider is a small web service that answers Metapad in an agreed format. Which providers your models can reach is set up by the people who run your Metapad (on app.metapad.ai, that's transentis — contact us). Sign-in details are part of that setup, so no passwords are stored in your model.

Connect the twin

  1. Select the twin in the Model Navigator. In the Properties panel, find Live data source.
  2. Enter the Provider URL (it must start with https://).
  3. Under Match by, choose how the provider identifies your agents:
    • Name: by agent name and property name, e.g. Berlin Store / revenue. The easy start; agent names must be unique in the scenario.
    • ID: by Metapad's IDs. Survives renaming, but the provider has to know the IDs.

Fetch the data

  1. Choose the Scenario to fill and press Fetch now.
  2. Metapad reports what happened, e.g. Fetched 240 values into Actuals — 3 skipped. Last fetch under the button shows when, by whom and how many values were written.

Everyone who has the model open sees the values arrive, and one undo takes the whole fetch back.

Fetched values and your own values

In the time series grid, hover over a cell to see where its value came from: Fetched from the live data source or Entered manually.

  • A fetch never overwrites a value you typed in. To replace manual values with the provider's figures, use Fetch and replace manual values. Manual values the provider has no data for stay as they are.
  • A fetch never deletes values. If the provider stops sending a period, the last fetched value stays.
  • Fetching again is safe: unchanged figures stay the same, corrected ones are updated.
  • Properties that have a formula are never filled; they keep computing. To combine actuals with a forecast, fetch into a plain property and read it from a formula (see Mixing Live Data and Forecasts with the Time Slider).

Why values are skipped

The fetch message lists skipped values by reason. The most common ones:

  • unknown agent / unknown property: the name or ID doesn't exist in this scenario. Check spelling, or switch Match by.
  • ambiguous agent: two agents share that name. Rename one.
  • manual value kept: see above.
  • wrong value type: e.g. text sent for a number property.

Keep a scenario up to date automatically

In a scenario's properties, tick Live data scenario. From then on, whenever someone opens one of its dashboards or changes the time range, Metapad fetches the periods that are still missing, and always the current one. This also works for readers of a published site, so a published dashboard shows this month's figures without anyone pressing a button.

Next steps

  • Putting a Twin on a Calendar — the calendar live data needs
  • Mixing Live Data and Forecasts with the Time Slider — show actuals up to today, the simulation from there on
  • Entering Time Series Data — the grid where fetched values appear
  • Building a Live Data Provider — for developers: the contract for the system that sends the data

This content was written collaboratively with AI.