liveBook · Manning

Provenance

As explained in Digital Twins in Action

Lineage tracking records the origins, transformations, dependencies, and destinations of data or derived artifacts.

Provenance is the traceable history of data used by a digital twin: where a value came from, how it changed, and how it reached a derived dataset or decision. A list of sources is a starting point, not a complete lineage record. Trustworthy outputs require transformations to be clear and reproducible. section 2.6 section 4.4.4

For data that feeds a decision, retain enough context to answer:

From meter readings to a dashboard

A meter exports minute-by-minute power readings as CSV. An Apache Spark job groups readings by local week, sums watt-hours into kilowatt-hours, and sums costs for a dashboard. The resulting weekly value is easier to trust when its raw input and transformation can be traced. The aggregation code shows the transformation; it does not, by itself, demonstrate that lineage metadata is recorded. section 4.4.4

Listing 4.9 An example of using Apache Spark to extract minute-by-minute power
from pyspark.sql import SparkSession
from pyspark.sql.functions import date_trunc, sum as spark_sum, avg, col
from pyspark.sql.types import *

spark = SparkSession.builder.appName("WeeklyUsage").getOrCreate()

schema = StructType([  #1
    StructField("datetime_utc", TimestampType(), True),
    StructField("datetime_local", TimestampType(), True),
    StructField("watt_hours", DoubleType(), True),
    StructField("cost_dollars", DoubleType(), True),
    StructField("is_peak", BooleanType(), True)
])

df = spark.read.option("header", "true").schema(schema).csv(
  "powerpal_data.csv")

weekly_usage = df.groupBy(  #2
    date_trunc("week", col("datetime_local")).alias("week_start")
).agg(
    (spark_sum("watt_hours") / 1000).alias("total_kwh"),
    spark_sum("cost_dollars").alias("total_cost_dollars")
).orderBy("week_start")

print("Weekly Usage (kWh) and Cost:")
weekly_usage.show()

spark.stop()

Inspect the input schema, weekly grouping, and summed fields to identify the steps a lineage record would need to describe. section 4.4.4

At home, provenance may be informal. In an industrial twin, a faulty reading may need to be traced during an incident investigation, or a maintenance decision justified to a regulator. Multiple owners, validation workflows, and high data volumes make complete, auditable lineage an operational requirement rather than a convenience. section 2.6 section 4.5.4

How Digital Twins in Action covers it

How deep it goes
Defines the information industrial lineage must preserve and illustrates an ETL transformation, but does not implement lineage capture.
Examples
Uses source documents and a Spark job that aggregates minute-by-minute meter CSV readings into weekly consumption and cost.
What you can do after
Diagnose/debug with it by tracing a faulty reading through its source, pipeline, and validation history.
How it connects
Connects provenance to ETL, data quality, validation workflows, and feature stores.

Also explained in

Compare how 12 books explain provenance →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Digital Twins in Action. The section links point to the parts of the book it draws on.