Docs
Diagnostics and Audit Reports
BDS diagnostics are meant to answer the question: "What did the converter think this file was, and what would it do to the data?"
Diagnostics and Audit Reports
BDS diagnostics are meant to answer the question: "What did the converter think this file was, and what would it do to the data?"
Single-File Inspection
Use bds inspect as the default entry point for an unfamiliar or failing file:
bds inspect raw_export.csv
bds inspect raw_export.csv --target bdf --format json
bds inspect raw_export.csv --output report.json --output report.htmlInspection combines adapter candidates, missing columns, suspicious headers,
source-to-canonical-to-target mapping, unit transforms, current-sign evidence,
time-sampling findings, unmapped columns, and suggested next steps. The source
file is never changed. Inspection defaults to current_sign="preserve",
repair_policy="none", and time_sampling_policy="warn", so missing samples
are reported but not inserted.
--target only previews output labels and mappings. It does not claim that the
artifact conforms to BDF or is accepted by another downstream tool.
Physics-informed mapping review
Inspection performs conservative source-backed cross-column screens where measured
power or capacity is separately recorded. It checks sampled test-time progression,
power against voltage times current (allowing either sign convention), and
increasing capacity against integrated absolute current within recorded
step/cycle boundaries. Results appear in JSON under physics_checks.
A consistent_screen is not proof of a correct field mapping:
units, instrument convention, source independence and protocol must still be reviewed.
Calculated/derived power is excluded to avoid circular verification; capacity
screens state their assumptions and sample limits. A mismatch is a review signal,
not permission to rewrite or repair the data.
For an unknown, wide headerless CSV/TSV/text or Excel file, if the ordinary
import refuses positional guessing, bds inspect now offers bounded
candidate columns in mapping_suggestions where patterns support them.
The candidates may include elapsed-time-like fields, plausible single-cell voltage,
step-like current, timestamp, temperature and selected independently corroborated
power/capacity relationships. They are not applied automatically. A two-row
example cannot distinguish total time from step time or verify capacity/power.
Inspection keeps readable=false until the user supplies and reviews a
mapping profile. There is no LLM, no data mutation and no universal score.
JSON inspection reports are summaries, not row dumps. Findings are capped at
500 entries, time-sampling gaps at 50 representative intervals, and truncation
is explicit in findings_total, findings_truncated, and gaps_truncated.
Python callers use the same path:
import bds
report = bds.inspect("raw_export.csv", target="bdf")
print(report.to_text())
bds.write_inspection_reports(report, "reports", formats=("json", "html"))Compatibility Diagnostics
Use bds doctor when a file fails to import or when you need a compact
troubleshooting checklist rather than a full mapping report:
bds doctor raw_export.csv
bds doctor raw_export.csv --jsonDoctor reports include data-kind detection, adapter candidates, missing
required columns, suspicious headers, suggested --cycler/--sheet/profile
next steps, and the minimum anonymized fixture checklist.
Existing workflows can continue to use bds explain:
bds explain raw_export.csv
bds explain raw_export.csv --text
bds explain raw_export.csv --json report.json --html report.html --xlsx report.xlsx
bds explain raw_export.csv --pdf report.pdfJSON remains the machine-readable diagnostic record. HTML and Excel are intended for ordinary user review and lab QA. PDF is the recommended fixed-layout report format for archival review and sharing.
The diagnostic report includes:
- data kind: time-series, EIS, unsupported, or unknown;
- adapter candidates, selected adapter, confidence, and sheet;
- source columns, canonical columns, export columns, and mapping provenance;
- unit transforms, current-sign evidence, and current-sign confidence;
- semantic source notes for inferred time, step, and cycle fields;
- temperature semantic confidence when generic headers such as
Temperatureare mapped to ambient/chamber temperature; - repair policy, validation issues, warnings, and unmapped columns;
- recommended next action.
Python callers can use the same diagnostic:
import bds
report = bds.explain("raw_export.csv", current_sign="preserve")
print(report.to_json())
print(report.to_text())
bds.write_explain_reports(report, "reports", formats=("json", "html", "xlsx"))explain does not write converted data. It reuses the same detection,
normalization, validation, and export formatting path as conversion, with
strict=False so diagnostic output can still be returned for imperfect files.
Conversion Reports
For ordinary conversion, use report_path="auto":
import bds
report = bds.convert(
"raw_export.csv",
"normalized.bds.csv",
cycler="auto",
report_path="auto",
)This writes the converted CSV plus normalized.bds.report.json and
normalized.bds.report.pdf. Other report formats are explicit:
bds.convert(
"raw_export.csv",
"normalized.bds.csv",
report_path="auto",
report_formats=("html", "xlsx"),
)HTML, Excel, and PDF reports use the same section structure and blue visual style. JSON remains the source of truth for automated pipelines.
Current-sign sanity is optional. Use current_sign_check="adjacent" in Python,
or --current-sign-check adjacent in the CLI, to run the O(n) adjacent-point
heuristic when a file needs extra sign review.
Time Sampling
Time-series conversion checks the test_time_s column for missing samples on a
regular grid. If the expected interval is known, pass it explicitly:
bds.convert(
"raw_export.csv",
"normalized.bds.csv",
report_path="auto",
time_sampling_interval_s=1,
)The default time_sampling_policy="warn" records gaps without inserting rows.
Explicit time_sampling_policy="repair" inserts missing rows only when a
regular interval is detected or supplied. Numeric measurement columns are
interpolated with time_sampling_interpolation="linear" by default. Use
time_sampling_policy="warn" to record gaps without inserting rows, or use
time_sampling_policy="none" to disable this check.
The report records the inferred interval, confidence, number of missing samples, gap locations, interpolation method, and number of inserted rows.
Clock and Temperature Screens
Conversion, inspection, explain and audit run two non-mutating screens on the normalized table.
Their results are in report metadata (clock_divergence, temperature_excursions) and their
events become warning-level issues with stable codes. Neither screen changes, masks or
interpolates a sample.
Clock divergence compares the wall clock (unix_time_s) with test_time_s between consecutive
records. When the wall clock advances more than the test clock, the test clock did not count that
time — typically a suspended or paused test (uncounted-wall-time). When the test clock advances
more, the wall clock was corrected or shifted (test-time-exceeds-wall-time; about one hour sets
possible_dst_shift). The threshold is the larger of 120 s and twice the wall clock's resolution,
so a clock that records whole minutes does not produce events from rounding. A test-time reset is
left to the time-axis checks. Each event gives the record and step before and after, both clocks,
the divergence and the voltage and current on either side.
Temperature excursions look for abrupt steps in each temperature channel: a run of consecutive
same-sign changes, each at least 0.5 °C and at least 0.05 °C/s, together at least 5 °C. A step is
paired with the later opposite step that returns at least half of it; the samples between them,
including partly changed samples of a multi-sample onset or recovery, form an excursion. An
excursion that does not return ends at the last record. Elapsed time is test time, replaced by wall
time only where wall time shows uncounted time, so a real change during a suspended test is not
read as abrupt. Excursions in different channels that overlap or start within 300 s are merged
into one episode with coincident_channels; the episode gives the record interval, steps, cycles,
each channel's onset and recovery, and the voltage and current change across the onset.
The thresholds are screening defaults, not physical limits; clock_divergence(df, min_divergence_s=…)
and temperature_excursions(df, min_step_c=…, min_rate_c_per_s=…, min_component_c=…, coincidence_window_s=…) in battery_data_standard.signal_screens accept other values, and every
result records the values used. Whether an episode is an acquisition artefact or a real thermal
event, and whether to exclude its samples, is a review decision.
Folder Audit
Use bds audit for intake triage across a folder:
bds audit raw_exports --recursive --json audit.json --html audit.htmlDirectory audit skips obvious helper files such as README files, manifests, metadata sidecars, labels, summaries, procedure files, and conversion-report sidecars. Single-file audit still explains an explicitly selected helper file.
Audit quality scores focus on trust-affecting issues: conversion failure,
required-column problems, detection confidence, time-axis anomalies, repair
operations, current-sign evidence, and suspicious flat signals. Optional-column
coverage is reported separately under completeness.
Recommended Workflow
- Run
bds inspecton one representative file. - Review mapping, units, current sign evidence, and validation issues.
- Run
bds convert --report autoonce the diagnostic looks right. - Run
bds auditon the whole folder before batch conversion.
Sampling repairs skip known cycle/step boundaries, missing segment identifiers,
and step-time resets. Reports include boundary_skipped_points and distinguish
partial repair from fully repaired gaps. Without segment fields, protocol
boundaries cannot be established automatically.