Skip to main content
Version: 0.0.98

ts_shape.signals.report

One-call data-quality and semantics report for long-format time series.

Start every analysis here::

import ts_shape

report = ts_shape.check_signals(df)
print(report.summary()) # what each signal is, and what is wrong with it
report.issues() # actionable list, most severe first
report.specs # SignalSpecs to pass on to detectors

The report infers each signal's semantics (see :mod:ts_shape.signals) and checks the things that silently corrupt industrial analytics: logging gaps, counter resets, duplicate or out-of-order timestamps, unparseable times, missing or non-numeric values, signals stuck at one value, and uuids that spread their values over several value_* columns.

Classes
NameDescription
SignalReportResult of :func:check_signals.
Functions
NameDescription
check_signalsProfile every signal in a long-format frame.

SignalReport​

classsource
SignalReport(
specs: SignalSpecs, table: pd.DataFrame, issue_table: pd.DataFrame
) -> None

Result of :func:check_signals.

Attributes
NameTypeDescription
specsSignalSpecsInferred (and overridden) :class:~ts_shape.signals.SignalSpecs.
tableDataFrameOne row per signal with the measured characteristics.
issue_tableDataFrameOne row per finding (uuid, severity, issue, detail), most severe first.
Example
>>> import ts_shape
>>> report = ts_shape.check_signals(ts_shape.make_timeseries(["temp", "pressure"], n_points=100))
>>> print(report.summary())
ts-shape signal check: 2 signal(s)
kinds: 2 continuous
issues: none
>>> report.to_frame()[["uuid", "kind", "encoding", "rows"]]
uuid kind encoding rows
0 pressure continuous sampled 100
1 temp continuous sampled 100
Functions
NameDescription
to_frameThe per-signal table.
issuesFindings, optionally filtered to one severity.
summaryHuman-readable overview.

to_frame​

methodsource
to_frame() -> pd.DataFrame

The per-signal table.

issues​

methodsource
issues(severity: str | None = None) -> pd.DataFrame

Findings, optionally filtered to one severity.

Parameters
NameTypeDescriptionDefault
severitystr | None"error", "warning" or "info" to keep only that severity. None returns every finding.None
Returns
TypeDescription
DataFrameDataFrame with columns uuid, severity, issue and detail, most severe first.

summary​

methodsource
summary() -> str

Human-readable overview.

check_signals​

functionsource
check_signals(
dataframe: pd.DataFrame,
specs: SignalSpecs | Mapping[str, Mapping[str, Any]] | None = None,
*,
uuid_column: str = "uuid",
time_column: str = "systime",
metadata: Any = None,
exclude: Sequence[str] = PERSONAL_DATA_PATTERNS
) -> SignalReport

Profile every signal in a long-format frame.

Nullable, pyarrow and string dtypes are converted to NumPy dtypes first; a time column that mixes UTC offsets is converted to UTC with a :class:~ts_shape.errors.DataQualityWarning. The input is not changed.

Parameters
NameTypeDescriptionDefault
dataframeDataFrameLong-format data (systime, uuid, value_*).required
specsSignalSpecs | Mapping[str, Mapping[str, Any]] | NoneKnown semantics. Either complete :class:SignalSpecs, or {uuid: {field: value}} overrides applied on top of inference.None
uuid_columnstrColumn identifying the signal.'uuid'
time_columnstrTimestamp column.'systime'
metadataAnyOptional datapoint metadata (a table with uuid and a label column, or a :class:~ts_shape.MetadataJsonLoader). The report's table then gains a label column, and signals whose label matches exclude are left out (personal data).None
excludeSequence[str]Regular expressions (case-insensitive) of labels to leave out when metadata is given; default: personal data (:data:ts_shape.utils.personal.PERSONAL_DATA_PATTERNS). Empty keeps every signal.PERSONAL_DATA_PATTERNS

Signals the whole asset is silent in at once are reported once, as a "data hole" issue with uuid "(asset)", instead of as a "logging gaps" warning per signal; a polling period most sampled signals share is a "shared polling clock" note.

Returns
TypeDescription
SignalReportclass:SignalReport with specs, a per-signal table and the
SignalReportissues() list.
Raises
TypeDescription
ColumnNotFoundErrorWhen uuid_column or time_column is missing (also for pd.DataFrame()).
ValueErrorWhen specs overrides name unknown fields or invalid values.