liveBook · Manning

Historical data

As explained in Digital Twins in Action

Historical data consists of recorded observations from earlier periods that provide evidence about past states, behavior, or trends.

Historical data is a record of earlier states or behavior. In a digital twin, it establishes a baseline and supplies patterns for predicting what may happen next. It does not replace current observations: a predictive twin combines past behavior with the system’s present state. section 1.3.3 section 2.2.1

Start with the decisions and metrics the data must support. For a home energy twin, historical electricity, gas, and water records can establish a consumption baseline before higher-resolution sensors are added. Older records may be scattered across portals and stored as CSV files, API data, or PDFs; they may also arrive too infrequently to support timely behavior changes. section 2.2.1 section 2.3.1

A practical path from archived bills to usable history is:

  • Extract dated meter readings from scanned bills with optical character recognition (OCR). section 2.3.1
  • Tune the extraction to the bill format, then run it across the archive to assemble a machine-readable timeline. section 2.3.1
  • Inspect the resulting baseline for seasonal patterns and changes associated with equipment upgrades before using it as model input. section 2.3.1
Listing 2.1 Extracting the meter reading by using OCR to digitize data
from PIL import Image
import pytesseract, re

def extract_meter_reading(text):
  pattern = r"Current Meter Reading:\s*(\d+)"  #1
  match = re.search(pattern, text)
  return int(match.group(1)) if match else None

def extract_date(text):
  pattern = r"(\d{1,2}/\d{1,2}/\d{4})"  #2
  matches = re.findall(pattern, text)
  return matches[-1] if matches else None

def read_bill():
  image = Image.open(r"./images/gasBill.png")
  text = pytesseract.image_to_string(image)

  meter_reading = extract_meter_reading(text)
  date = extract_date(text)

  return {
    "meter_reading": meter_reading,
    "date": date
  }

The Python listing runs Tesseract on a bill image, then uses regular expressions to return a meter reading and date. Its patterns must be tuned to the bill format; OCR is imperfect. section 2.3.1

From baseline to prediction

Ten years of digitized household bills reveal seasonal consumption and changes after solar equipment was installed. In predictive use, a simpler historical pattern might indicate when a motor bearing’s rising temperature will cross a safe limit; a model trained on years of operations might instead detect degradation well before failure. Both rely on an important condition: future behavior must remain sufficiently consistent with the past. section 2.3.1 section 1.3.3

How Digital Twins in Action covers it

How deep it goes
Works through digitizing archived bills and interpreting a ten-year baseline, but does not detail training a predictive model.
Examples
Uses scanned utility bills and a ten-year household consumption timeline, alongside motor-temperature and travel-time predictions.
What it assumes
Assumes defined objectives and metrics, then demonstrates how to extract readings and dates from an example bill.
What you can do after
Apply it via Tesseract to recover dated meter readings from archived bills and establish a baseline for later analysis.
How it connects
Connects historical records to OCR, digital twins, sensor data, machine learning, and predictive maintenance.

Also explained in

Compare how 2 books explain historical data →

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.