visualdynamics.report.data_index¶
data_index
¶
Data index: the files a report rests on, in the report (report
feature data_index).
A report is the argument and the record is the evidence, so the report
says exactly where the evidence is. With the feature on, the report
carries the project's data index (Project.data_index): a table of
every file by name, what it holds, its format, its size in bytes, its
SHA-256 checksum, whether it is attached or referenced, and what the
last check found. Under it go a line saying when the files were last
checked and how many matched, a line naming the program's version and
the project file's own checksum, the analysis recipe (each derived
object, the verb that computed it and what from, read off the
project's provenance), and each attached text file printed whole: a
CSV as a table, anything else as it was written.
A run log brought into the project (Project.attach_run_log) adds a
table under the index: each test's extract, the entry it was taken to,
the head hash of the test's chain there, and what the live log says
now (the extract's badge). The log file itself is not indexed, since
its checksum changes with every entry; the head hash is what anchors
the test's entries outside the file. The files the log names are
indexed through the index's own entry point
(Project.index_run_log_files), each checked against the SHA-256 the
log records, and a line names any the log names that are not in the
index yet. Without an extract the page is as before.
What stays the author's: where the archive is, who keeps it, and what the contract says travels with the report. With the skeleton sections on, the index is placed under section 12, Record and Data Package, after the author's words, and the section is owed until the author writes them; the program never writes them. Without the skeleton the index closes the report under its own heading.
Everything here is read from the index as it stands; nothing is hashed
while a page is drawn. The check (Project.verify_data_index) is run
by Export before the page is written, off the event loop in the app.
Functions:
| Name | Description |
|---|---|
table |
The index as a page table block, one row per file in the order |
checked |
One sentence on the last check: when, and how many files matched, |
analysis |
One sentence on the analysis: the program's version, and the |
recipe |
The analysis recipe as a page table block: each derived object |
attachment |
An attached text file's contents as a page block: a CSV or TSV as |
run_logs |
The run log blocks under the index: a table of the run log |
page_blocks |
The page blocks the feature adds, in order. |
Classes¶
Functions:¶
table
¶
table(index: DataIndex) -> dict[str, Any]
The index as a page table block, one row per file in the order indexed. The SHA-256 cells are marked to be set in a fixed-width face, and a check that did not match is marked as a failure.
Source code in src/visualdynamics/report/data_index.py
checked
¶
checked(index: DataIndex) -> str
One sentence on the last check: when, and how many files matched, changed or were not found; or that the files have not been checked since they were indexed.
Source code in src/visualdynamics/report/data_index.py
analysis
¶
analysis(index: DataIndex, project_file_known: bool) -> str
One sentence on the analysis: the program's version, and the project file's name, size and checksum as the last check found it, or that the project is not in a file yet.
Source code in src/visualdynamics/report/data_index.py
recipe
¶
recipe(provenance: Mapping[str, Mapping[str, Any]], objects: Mapping[str, Any]) -> dict[str, Any] | None
The analysis recipe as a page table block: each derived object still in the project, in the project's order, with the verb that computed it and its source. None when nothing is derived.
Source code in src/visualdynamics/report/data_index.py
attachment
¶
An attached text file's contents as a page block: a CSV or TSV as a table, its first row the header, when every row has the header's width; anything else, a ragged CSV included, as preformatted text, as it was written, since a short row cannot be placed in its columns one way. None for an entry with no kept text.
Source code in src/visualdynamics/report/data_index.py
run_logs
¶
run_logs(objects: Mapping[str, Any], index: DataIndex | None) -> list[dict[str, Any]]
The run log blocks under the index: a table of the run log
extracts in objects, each with its test, the entry it was taken
to, the test's head hash and what the live log says now; then a line
naming each file the logs name that index does not hold by its
SHA-256 (the log file itself is never indexed). Empty when objects
holds no extract.
Source code in src/visualdynamics/report/data_index.py
page_blocks
¶
page_blocks(objects: Mapping[str, Any], heading: bool = False, index: DataIndex | None = None) -> list[dict[str, Any]]
The page blocks the feature adds, in order.
objects is what the report was rendered from: a Project, whose
data_index, provenance and file are read, or a plain mapping,
for which index gives the index; without one, the page says it
was drawn without the index rather than show it empty. With
heading, the blocks open with the section's own heading, for a
report without the skeleton.