tdfs4ds.serve.panels¶
tdfs4ds.serve.panels
¶
Gradio-free panel logic for the tdfs4ds admin web shell.
Each function here returns plain JSON-serialisable data or HTML strings — never
gradio objects — so they can back FastAPI routes (see
:mod:tdfs4ds.serve.app). The heavy lifting (Plotly figures, business-dictionary
queries, optimiser, evaluation) is delegated to the already-module-level builder
functions in :mod:tdfs4ds.agent.chatbot; this module only orchestrates them and
strips the Gradio presentation layer.
_TD_MD_CSS
module-attribute
¶
_TD_MD_CSS = "<style>.td-md { font-family: system-ui, -apple-system, Segoe UI, sans-serif; color:#2c3e50; }.td-md h1, .td-md h2, .td-md h3 { color:#00233C; }.td-md h2 { border-bottom:2px solid #FF5F00; padding-bottom:4px; margin-top:18px; }.td-md h3 { margin-top:14px; }.td-md p { margin:6px 0; }.td-md pre { background:#0f172a; color:#e2e8f0; padding:12px 16px; border-radius:8px; overflow-x:auto; margin:8px 0; font-size:.85rem; }.td-md code { font-family:'Courier New', monospace; font-size:.88em; color:#c0392b; }.td-md pre code { color:#e2e8f0; background:transparent; }.td-md table { border-collapse:collapse; width:100%; margin:10px 0; font-size:.9rem; }.td-md th, .td-md td { border:1px solid #E3E8EE; padding:6px 12px; text-align:left; }.td-md th { background:#00233C; color:#fff; font-weight:600; }.td-md tr:nth-child(even) { background:#f8fafc; }.td-md blockquote { border-left:4px solid #FF5F00; margin:0; padding:4px 12px; background:#f8fafc; color:#555; }.td-md strong { color:#00233C; }.td-md th * { color:#fff; }.td-md ul, .td-md ol { margin:6px 0; padding-left:24px; }.td-md li { margin:2px 0; }</style>"
_LAST_FEATURE_CATALOG
module-attribute
¶
_DATASET_KEYS_CACHE
module-attribute
¶
_DATASET_NAME_OK
module-attribute
¶
VIEW_MISSING_CAUSE
module-attribute
¶
_SECTION_ORDER
module-attribute
¶
_SECTION_ORDER = ['OVERVIEW', 'ENTITY', 'FEATURE_THEMES', 'BUSINESS_QUESTIONS', 'INTENDED_AUDIENCE']
_DATASET_SECTION_LABELS
module-attribute
¶
_DATASET_SECTION_LABELS = {'OVERVIEW': 'Overview', 'ENTITY': 'Entity', 'FEATURE_THEMES': 'Feature themes', 'BUSINESS_QUESTIONS': 'Business questions', 'INTENDED_AUDIENCE': 'Intended audience'}
_DATASET_STATUS_COLOURS
module-attribute
¶
_DATASET_STATUS_COLOURS = {'OK': '#16a34a', 'REPAIR': '#FF5F00', 'REGISTER': '#2563eb', 'DUPLICATE': '#a16207', 'ORPHAN': '#dc2626', 'UNPARSEABLE': '#64748b'}
_MAINTENANCE_LABELS
module-attribute
¶
_MAINTENANCE_LABELS = {'lineage': 'Lineage graph', 'documentation': 'Documentation', 'vector': 'Vector index', 'all': 'Lineage, documentation and vector index', 'statistics': 'Storage statistics', 'dataset_catalog': 'Dataset catalog', 'process_sql': 'Process SQL versions', 'resources': 'Execution history'}
NO_STORE_STATUS
module-attribute
¶
NO_STORE_STATUS = '⚠️ No feature store is selected. Choose one in Settings → Parameters, or set TDFS4DS_SCHEMA in the .env file passed to the app and restart it.'
_FEATURE_STORES
module-attribute
¶
_CAPABILITY_SETTINGS
module-attribute
¶
_CAPABILITY_SETTINGS = ('INSTRUCT_MODEL_PROVIDER', 'INSTRUCT_MODEL_MODEL', 'EMBEDDING_MODEL_PROVIDER', 'EMBEDDING_MODEL_MODEL', 'VECTOR_STORE_BACKEND', 'TERADATA_AI_API_TYPE', 'MCP_SERVER_URL')
_SWITCH_STATE
module-attribute
¶
_SWITCH_STATE = ('SCHEMA', 'SCHEMA_VIEW', 'DATA_DOMAIN', 'SCHEMA_READONLY', 'FOLLOW_UP_NAME', 'DATASET_CATALOG_NAME', 'DATA_DISTRIBUTION_TEMPORAL')
dashboard_storage
module-attribute
¶
Streamed live storage-count build: treemap + stacked bar + orphans + table.
progress is a callable(str) hook (per-table PROGRESS k/N lines).
documentation_run
module-attribute
¶
Actions of the Documentation panels.
op='document': document the objects named by keys (model row keys), or
every object whose documentation is missing or partial when keys is empty;
then, if refresh_index, update the vector index. op='index': update the
vector index only (build_vector_index(force_rebuild=False): Chroma embeds
only missing or changed rows; Teradata refreshes its collections).
doc_edit_apply
module-attribute
¶
Preview (dry_run) or apply a hand edit from the Objects panel.
migration_run
module-attribute
¶
Execute the staged migration (must call migration_stage first).
eval_run
module-attribute
¶
Run the evaluation; return {results, report_html, radar_html, table_html}.
benchmark_run
module-attribute
¶
Run the benchmark for dataset; return the rendered HTML report.
workflow_scan
module-attribute
¶
The entity scan (one pass per entity over its largest storage table), then
the whole model. Streamed: progress gets PROGRESS k/N lines.
removal_dryrun
module-attribute
¶
What each step of the last plan would remove: counts and existence only.
impact
module-attribute
¶
The impact of a change on a process, view, table or dataset: impact_of(display=False)
as JSON-safe model + html. A bad argument or an unknown object comes back as
{"error": "invalid", "status": ...}, not a stack. Studies only; changes nothing.
_NoBuild
¶
Bases: Exception
The raw read of the build view failed (see :func:datasets_overview).
with_ddl_cache
¶
Run fn inside :func:ddl_cache (signature and source kept: functools.wraps).
_split_inline_enumeration
¶
'1. a? 2. b? 3. c' (one line) -> three lines, when the numbers follow on.
LLM-written documentation stores numbered questions on one line; Markdown then renders a single list item. Only a run starting at 1 and counting up is split, so a sentence quoting "version 2. something" is left alone.
_normalize_md
¶
Adapt LLM/GFM-style Markdown to Python-Markdown's stricter rules.
Python-Markdown (unlike GitHub, the chatbot and every LLM's habits) needs a blank line before a list, and 4 spaces to nest one; without them a list renders as one paragraph with literal dashes, and sub-items flatten. Also splits inline "1. … 2. …" enumerations. Fenced code is never touched.
_md_to_html_fragment
¶
Render a Markdown string to a styled, self-contained HTML fragment.
Uses the markdown package (declared in the serve extra) with the
fenced_code, tables and sane_lists extensions so GFM pipe tables,
fenced code blocks and lists render properly — unlike the minimal client-side
marked() in app.js. Scoped via the .td-md class. Fail-open: returns an
escaped <pre> block on any error so the panel never breaks, and says why
(the fallback was silent at DEBUG, so a server without the markdown
package showed raw Markdown everywhere with nothing in the log).
_domain_names
¶
Registered data domains. get_data_domain lives in the agent module, not on tdfs4ds
(a call on the package was an AttributeError swallowed by the callers).
dashboard_scope
¶
Domain + process lists for the storage-build cascading selectors.
_pid_to_tables_map
¶
{PROCESS_ID: {"DB.TABLE", ...}} - which storage tables each process writes.
Delegates to the package (feature_store.statistics.process_storage_tables),
the one authority shared with check_storage_statistics. Fail-open.
dashboard_run_detail
¶
Full run-log table HTML for a single process (drill-down).
_consistency
¶
Consistency model for a snapshot, with the cached storage scan when it was taken at the same valid time. graph: the lineage graph the caller already loaded (0.3.8.2). Fail-open: None.
dashboard_orphan_scan
¶
Streamed storage scan (button 'Scan storage for orphans'); cached for the report and the EFS map at that valid time.
dashboard_report_data
¶
The report's data (see :func:_dashboard_report_data), the statements it reads grouped in two
requests (0.3.8.2, :mod:tdfs4ds.serve.report_batch).
_learned
¶
The statements this page read last time are read ahead in a few requests (0.3.8.2,
:mod:tdfs4ds.utils.learned_reads); what it reads now is recorded for the next time.
_step
¶
Name what the request is doing now, for the status bar (a no-op until activity.step exists).
_dashboard_report_data
¶
Assemble the plain data dict the inline-SVG report renders from.
Catalog + run-history + cached storage build → JSON-serialisable records (no
Plotly). Storage block is the last streamed build (_LAST_DASHBOARD_STORAGE)
or None (→ the report shows a 'build first' note). window_days bounds the
run-history timeline/calendar. as_of reads the catalogs at that valid time
(None = current); every count states the valid time it was read at.
Fail-open per section.
store_conflicts_data
¶
Objects in several attached stores for the Report and the Parameters card:
{stores, counts, total, unverified, rows: {kind: [records]}}, or None
with one store. Fail-open (a failure is a single unverified entry).
store_conflicts_file
¶
CSV of the store conflicts for download; returns the file path (None with one store).
_framework_cost_card
¶
The few figures of the Report's "Framework cost" card (the full report is Performance > Framework cost). Fail-open: {} when the history is absent or unreadable.
_doc_activity
¶
Latest documentation events + counts per action (FS_DOCUMENTATION_LOG). Fail-open.
_short_view
¶
Bare view name from a possibly-quoted FQN: '"db"."vw_x"' → 'vw_x'.
_table_to_process_map
¶
{TABLE_UPPER: {view_name, view_short, process_id}} — the first process that writes each storage table. Fail-open: {} on error.
_storage_hierarchy
¶
Nested {table: {label, nonseq, processes:[{view, process_id, n_features, rows_share, features:[{feature, type, entity, orphan}]}]}} for tile drill-down.
Built in pandas from the already-loaded catalogs (no per-row DB query). Row share = table nonseq rows split evenly across the table's features.
_run_history_records
¶
Run history bounded to the last window_days.
Returns {rows, t_min, t_max, calendar, last_runs} where rows is a flat
list of {view, start, end, status, filter} (ISO strings) the inline-JS
timeline consumes; filter carries APPLIED_FILTER / VALIDTIME_DATE for the
hover. calendar is {view:{day:ok}}. Fail-open → None.
_freshness_alert_records
¶
For each process, flag the stalest segment when it runs segmented.
log_df: the follow-up rows the report already read (0.3.8.2); without it they are read once, raw.
_lineage_count_records
¶
Per process/dataset upstream + downstream counts from the persisted graph.
graph: the lineage graph the report already loaded (0.3.8.2); without it the graph is read at as_of (it used to ignore the valid time and count today's lineage).
dashboard_report_html
¶
Render the exportable report inline for the panel.
dashboard_report_file
¶
Write the report to disk and return its path (for download).
_process_view_nodes
¶
Node ids ('DB.OBJECT') of the registered process views. Fail-open.
lineage
¶
Return the lineage graph HTML + the node choices for inspection.
layout: 'flow' (default; left-to-right, zoomable, focus on click,
search, filters) or 'network' (free pyvis network). 'sankey' is
still accepted and now shows the Flow view: the Sankey did not scale.
as_of (the date banner) reads the graph as it was at that valid time
(load_lineage_digraph(as_of=)); None = the current graph.
_lineage_segments
¶
Segments (id, label, size, counts, nodes) and the summary of the lineage graph, for the node selector and the line above the graph. Fail-open: an empty result never hides the graph.
_datasets_missing_from_lineage
¶
db.name of every registered dataset absent from the lineage graph.
lineage_add_datasets
¶
Record the lineage of datasets missing from the graph (scoped, diff-based).
datasets=None takes every registered dataset the graph lacks. A dataset
whose view is gone is reported, never fatal for the others.
efs_map
¶
The EFS map as HTML (+ KPIs). exact=True counts rows with COUNT(*);
as_of reads the catalogs at that valid time (None = current).
time_managers
¶
The TimeManager inventory as HTML (+ KPIs). domains: 'A|B' or a list; None = all.
time_managers_align
¶
The alignment plan of one data domain onto its clock (dry run, never applied here):
align_domain_time_managers(domain, cursors=True, calendars=True, dry_run=True).
time_managers_file
¶
Write the TimeManager report (html, md or csv) and return its path (download).
framework_cost_page
¶
Performance > Framework cost: the report as HTML (+ KPIs). Reads FS_CALL_PHASES only; the
round trip is measured on a connection of its own when asked (kept for the next refreshes).
framework_cost_file
¶
Write the framework cost report (html or csv) and return its path (download).
server_batch_page
¶
Performance > Server-side batches: what is installed, its text, drift against this version, the rights, the findings and the client SQL the procedure replaces. Reads only (nothing is installed here).
server_batch_script
¶
A standalone script that shows (or, with --apply, runs) the install or drop statements.
efs_table
¶
Rows per feature of one storage table, as HTML (bar chart).
efs_map_file
¶
Write the EFS map to a standalone HTML file and return its path (download).
_feature_catalog_graph
¶
The lineage graph used for the SQL chains, loaded once per catalog build (None if unreadable).
_attribute_lookup
¶
(columns, {triplet: {column: value}}, datasets) of the features' attributes (a dataset
whose entity is FEATURE_NAME), read with the catalog (collect_feature_export); ([], {}, [])
when the store has none.
feature_catalog_page
¶
feature_catalog_page(page: int = 0, size: int = FEATURE_CATALOG_PAGE, q: str = '', domains=(), as_of: str = '', refresh: bool = False, processes=(), attr: str = '', attr_value: str = '', prop: str = '') -> dict
One page of the feature catalog (feature x producing process) for the panel.
domains: names (or '|'-joined); empty = all. processes: PROCESS_IDs
(or '|'-joined); empty = all. q: text searched in feature, entity,
description and process view. as_of: blank = current.
processes_all lists the processes of the selected domains, for the filter.
prop: a filter on declared feature properties (range = has a valid range, sensitive);
ignored when nothing is declared.
_property_lookup
¶
{triplet: {"cell": {...}, "row": {...}}} of the declared feature properties, read once per
cached catalog; {} when the store declares none (then no statement was issued).
_property_filter
¶
Triplets (and raw tuples) the property filter keeps.
_producers_by_feature
¶
{(domain, entity, name): [{pid, view}]} over the feature rows (rows without a producer left out).
_render_sql_chain
¶
The chain as the panel shows it: highlighted steps, the computation of feature in the process view, the inputs.
_process_versions
¶
The SQL versions of a process for the feature report.
state: off (PROCESS_SQL_VERSIONING False), not_installed (no
FS_PROCESS_SQL on this store), none (nothing stored yet: before
0.3.3.12), ok. versions: one row per version, with the runs whose
valid time falls in it. drift: the live SQL differs from the current
stored version (captured at the next run or upload_features).
feature_catalog_process
¶
A process of the feature catalog with its SQL.
The SQL shown: the stored version when given; at a past valid time, the
process version in force then (FS_PROCESS_SQL); otherwise the live view
definitions (one SHOW VIEW per view). versions lists the stored process
versions (see :func:_process_versions).
With feature, the SQL comes back with the feature's computation and its
mentions highlighted, and computation gives each level's expression and
the grain (sql_context.computation_context).
_domain_clocks
¶
{data_domain: 'db.view'} of the domains that have a clock (0.3.6.0). Fail-open: {}
(no FS_DATA_DOMAIN_SETTINGS table, an older store, or an unreadable one).
_domain_clock_relation
¶
How a process stands with the clock of its data domain, for the process card, or None
when the domain has no clock: {clock, relation, text} with relation clock (reads the
clock itself), clone (its own soft clone of it), none (no TimeManager) or other
(another calendar). Fail-open: None.
feature_catalog_process_diff
¶
A unified diff of two stored process versions, as text and highlighted HTML.
feature_catalog_process_capture
¶
Capture the SQL beneath a process now (a new process version when it changed).
feature_catalog_process_refresh
¶
Can run() / roll_out() refresh this process? The cheap refresh check of one process (loops around run(), a view rewritten between runs, recursion), plus on request (closed) the storage read for entities closed outside the process. Code only.
_require_store
¶
A 'no feature store selected' payload when SCHEMA is unset (the app can start connected but without a store), else None.
execution_log
¶
The Execution log panel: executions of the window with their resource
use, per-process and per-version statistics (serve/execution_log).
execution_log_statements
¶
The statements of one execution (DBQL, else the stored history).
process_consumption
¶
The feature catalog card's "Runs and consumption" block: the process's runs and resource use in the window ending at as_of, per process version, and the version in force at as_of.
execution_log_harvest
¶
Copy finished executions out of DBQL now (Maintenance / the panel's button).
execution_log_file
¶
The Execution log as an XLSX file (executions + processes); returns its path.
process_evolution
¶
process_evolution(process_id: str, metric: str = 'elapsed', horizon: str = 'quarter', days=365) -> dict
The Runs page's "Evolution and forecast" for one process: its metric per time
step of the clock (segments summed; per execution when it has no time step), the
forecast over horizon, the SVG and a summary. One read, the Runs page's own
(:func:read_execution_resources for this process).
execution_log_report_file
¶
execution_log_report_file(days=30, processes='', status='', as_of='', horizon='quarter', metric='elapsed') -> str
The Runs panel as a self-contained HTML report (executions + evolution and forecast); returns its path.
feature_catalog_file
¶
Write the export (with SQL) for the panel's filters; returns the path.
_grain_producer
¶
The grain key of a builder producer stored at a wider entity key (empty dict
for an ordinary one): the badge text, its tooltip and, when the last sanity scan found the
feature not unique, a warning with that scan's date. No database read.
_coarser_producer
¶
The coarser key of a builder producer stored at a coarser entity than the dataset's (nested
entities, 0.3.7.35): the level, the columns it joins on, a badge and its tooltip. Empty for an
ordinary one. No database read.
nested_summary
¶
nested_summary(entity: str, chosen: dict, join_type: str, history: bool, offsets: dict, rows, pi_by_process: dict) -> dict
What a nested selection means, for the page (pure; rows is the builder's feature frame).
{"nested": bool, "own": [feature], "coarser": [{feature, pid, level, level_text}],
"rows_from": text, "attach": text, "refusal": message | None}. The refusal is the text
build_dataset itself raises (the same pure check), shown before Preview / Create.
_dataset_key
¶
(text, column set) of a dataset's own key. registered: the columns of its _ENTITY
rows in the dataset catalog (authoritative: what the build knew). Without them, from the entities
skill_list_datasets gives (one entry per feature entity, each with a " (DOMAIN)" suffix,
seen live): the entity that contains all the others (a nested dataset lists its coarser entities
too; a primary-index-grain feature lists a WIDER one, which is why this is only a fallback); None
when no entry contains the others. Pure.
_dataset_levels
¶
{dataset name upper: [{"level": 'A, B', "features": [...]}]} for the datasets that read
features stored at another entity than their own (nested, or read at a primary-index grain),
from the feature catalog's DATASETS column. Pure, never raises.
_dataset_pi_reads
¶
{dataset name upper: [feature]}: features a dataset reads at its own key although they are
stored with a WIDER entity (read through the primary index). Needs the registered key. Pure.
_dataset_keys_by_name
¶
{DATASET_NAME upper: frozenset(key columns)} from the dataset catalog's _ENTITY rows
(registered keys); {} when unreadable. Kept 10 s.
_datasets_of_key
¶
The dataset names (db.name or bare) that belong under the key key_cols: those whose
registered key equals it, plus those whose key is unknown (kept, never hidden). Pure given keys.
_grain_scan_note
¶
What the last sanity scan found about primary-index-grain features (dataset_grain_not_unique): {'at', 'features': {NAME_UPPER: {'n_keys', 'example'}}} or None. No database read.
_builder_rows
¶
Feature rows that can go in a dataset (a producing process), current valid time.
dataset_builder_entities
¶
The entities features can be combined on, per data domain, with their datasets.
dataset_builder_features
¶
The features of one entity: description, type, producing processes (latest run first), and the existing datasets on that entity with the features each one exposes.
dataset_name_status
¶
May a dataset be created as name in the view database?
status: available, invalid (not a plain identifier), registered
(a dataset of the catalog), exists (a table or view of that name: creating
would replace it) or check_failed (never treated as free). Reads the
database now, never a cache: a dataset created a minute ago must count.
_builder_kind
¶
The dataset kind from the form: snapshot (current / as of / TimeManager) or history.
_builder_selection
¶
The form's choice as build_dataset's selected_features.
One process for a feature: {feature: PROCESS_ID}, the column keeps the
feature's name. Several processes (several versions side by side):
{feature: [{"process_id", "process_view_name"}, ...]}, one column per
version named <feature>_<process view> (the rule of build_dataset).
aliases {feature: {PROCESS_ID: column name}}: a version with a name of
its own gets alias (one version: {"process_id", "alias"}). Without
aliases the result is exactly what it was.
dataset_versions_columns
¶
The column names a feature gets in the dataset: its name for one version,
<name>_<process view> for each of several (as build_dataset names them).
_builder_offsets
¶
The form's offsets as build_dataset's feature_offsets ({} when none).
raw: {feature: "0, -1 day, +1 month"} (a comma list) or a list of
strings. Each value is checked here, so a typo is reported with the feature
it belongs to rather than as a failed creation. Raises ValueError.
dataset_builder_columns
¶
The column names the form's choice gives, per feature, and the offset errors.
Same rule as build_dataset (version suffix, then offset suffix, then
_2/_3 for a repeat): tdfs4ds.dataset.builder.preview_column_names.
No database access beyond the cached builder rows (process view names).
dataset_builder_create
¶
Create (or, with preview, only render the SQL of) a dataset from the builder form.
payload: domain, entity, features ({feature name: PROCESS_ID}),
name, kind (current / as_of / time_manager / history) and its
parameters, join_type, document. The name is checked again here (the
button state is only a hint): an existing dataset or object is never replaced.
dataset_builder_python
¶
The Python that creates the form's dataset, and what each argument does.
The arguments come from the same parsing as :func:dataset_builder_create, so the
code is the call Create makes (skill_build_dataset passes them on unchanged).
Nothing is run. The password is never written: the code asks for it.
_snippet_readonly
¶
The read-only stores attached now, for the code the app shows (fail-open).
page_code_payload
¶
The (?) of a page: explanation + a standalone script, filled with the current store and its read-only stores. Needs no connection (an unknown store is typed at the prompt).
dataset_builder_datasets
¶
The registered datasets (all, or those on entity): kind, features, entity.
Same reading as the chat's dataset list (skill_list_datasets), read now:
the agent's per-turn cache is reset first, so a dataset created a minute ago shows.
_derive_kwargs
¶
rebuild_dataset keyword arguments from the derive form (pure). Only what is
changed is passed: keep (or nothing) keeps the source's grouping, join and time.
_derive_python
¶
The rebuild_dataset call the derive form makes (pure).
dataset_derive
¶
A new dataset from an existing one, with another grouping, join or valid time (0.3.7.19).
payload: source ('db.name', a registered dataset of the primary store), target
(a new view name, in the view database), grouped (keep / true / false), join
(keep / INNER / FULL OUTER), time (keep / current / as_of / time_manager / history)
with as_of / time_manager / start / end / duration / delay.
Features, versions and column names are the source's (rebuild_dataset reads its
DDL); the new dataset is registered with the source's id as SOURCE_DATASET_ID. The
source is never changed. preview=True returns the SQL and the Python call without
creating anything.
dataset_readers_access
¶
The GRANTs a user needs to read a dataset (text only, nothing executed).
_sample_rows
¶
Run sql (a SELECT, read only) and return {columns, rows} as text.
_view_body
¶
The SELECT of a REPLACE VIEW x AS <body> statement (what the view would return).
dataset_sample
¶
20 rows of a registered dataset (name), or of the dataset the builder
form describes (payload), before it is created: its query is run with
SAMPLE n and nothing is created.
name must be a registered dataset: the panel never runs a SELECT on an arbitrary object.
dataset_defect_cause
¶
A short cause for a failed dataset read, from the database message's
wording (never from an error number alone). name: the dataset
(db.view), to tell its own view missing from an object it reads. Pure.
_record_dataset_defect
¶
dataset_check_all
¶
EXPLAIN SELECT * FROM every registered dataset (no data read): flags
those whose query no longer compiles, reads a missing object or is refused.
_existing_views
¶
{(DB, OBJ)} of the named objects present in DBC.TablesV (one read per
database, raw SQL), or None when the dictionary cannot be read.
dataset_remove
¶
Remove a dataset of the primary store from the catalog (with its documentation, index entries and lineage); dry_run lists what would go.
_confidence_line
¶
One line for the stored documentation confidence (doc_confidence.describe()['label'],
plus the human parts a generation was refined with); '' without a database or a record.
_object_documentation_md
¶
Markdown blocks of an object's business documentation: description,
sections in _SECTION_ORDER, and a table of documented columns.
Shared by the Lineage node detail and the Documentation panels, so both show the same thing. A failed read is said, never silently dropped; when nothing is stored, a block says so.
lineage_node_detail
¶
Assemble DDL + business documentation for a lineage node as styled HTML.
The documentation is composed as Markdown (description, sections, a GFM pipe
table of documented columns, a fenced SQL DDL block) then rendered to HTML via
:func:_md_to_html_fragment so tables/lists/code render properly in the admin
shell (the client-side marked() cannot handle pipe tables).
_doc_model
¶
The documentation model, collected once and cached until refreshed or changed.
documentation_coverage
¶
Overview: documented / missing per kind, collection status, gap lists.
_doc_provenance_card
¶
Who wrote the documentation: parts imported / edited by people, copies, the rest.
documentation_objects
¶
Every object as a JSON row (the panel filters client-side).
documentation_object
¶
Summary + documentation of one object (key from the model rows).
documentation_gaps_file
¶
Write the gaps (documentation and index) to a CSV file and return its path.
documentation_export_file
¶
Write the documentation export (business dictionary, inside / outside the feature store) and return its path. Raises ValueError on a bad fmt/scope.
_document_rows
¶
Generate documentation for rows (model rows), one object at a time.
Process (or one of its features) -> document_process_incremental; dataset -> document_dataset_incremental; intermediate view -> _document_intermediate_view over the persisted graph, as rebuild_documentation does. Source tables are never generated (their documentation is user-supplied) and are skipped.
_object_columns
¶
Column names of a table or view (DBC), so undocumented columns can be written.
doc_edit_form
¶
The editable parts of one object, with who wrote each (Objects panel > Edit).
_edit_call
¶
Route the changed fields to the manual-documentation API.
doc_assist_record
¶
Keep the suggestions a person corrected before confirming (called by a confirmed edit).
suggested = {field id: the text the assistant proposed}, changes = {field id: the
confirmed text}. Only a pair whose text changed is kept. Fail-open: returns the count.
doc_assist_suggest
¶
Propose a missing description or section from the object's documented columns.
payload: key (object), field ('DESCRIPTION' | 'SECTION:description,
columns {name: text} and sections {name: text} as in the open form (unsaved edits count),
examples [{kind, suggestion, final}] corrections made in this form. Nothing is written.
doc_edit_protect
¶
Protect (mark as written by a person) or release one part to the LLM.
_object_names
¶
Object names from a list or from text (one per line, or comma-separated).
attached_overview
¶
The attached objects, the data domains and whether the LLM can document.
attached_suggest
¶
Views of databases that read a dataset or a process view, attached or not (read only).
attached_attach
¶
Preview (dry_run) or attach objects. Each object is attached on its own, so a
refused one (a process view, a dataset, a name not found) does not stop the others.
attached_detach
¶
End the attachment of objects; their documentation stays.
attached_sample
¶
n rows of an attached object or of a view that reads the feature store, read only after its EXPLAIN shows the query stays within the limits.
SAMPLE applies to the view's result, so the view's whole query runs: the
EXPLAIN of SELECT * FROM <obj> SAMPLE n is what the sample will cost. Above a
limit nothing is read and the plan is returned; force reads it anyway.
Only an attached object or a suggested view can be sampled, never an
arbitrary name.
_start_sample_job
¶
Run sql in a worker thread on its OWN raw connection, so that
connection.cancel() stops it in the database (verified live: Error 3110,
the session idle within a second). Returns the job token.
attached_sample_job
¶
State of a cancellable sample: running (with elapsed seconds), done (rows), cancelled, failed.
attached_check
¶
What changed in the attached objects (dry_run), or apply the refresh.
_parse_seeds
¶
Comma-separated seed string -> list, or None (whole store) when blank.
parallel_seeds
¶
Selectable seeds for the Execution plan panel: datasets + process views.
_plan_summary_html
¶
Compact HTML summary of the plan (waves, groups, conflicts, unify, unresolved).
parallel_plan
¶
Build the plan for the given seeds and render the interactive workflow + summary.
parallel_script_file
¶
parallel_script_file(seeds: str | None = None, mode: str = 'process_pool', force_compute: bool = False, max_workers: Optional[int] = None, wave_on_failure: str = 'skip_descendants') -> Optional[str]
Build the plan and write the executable .py script; return its path.
migration_sources
¶
Attached read-only stores available as migration sources (any schema name can also be typed — plan_migration attaches it read-only).
migration_seeds
¶
Source-scoped datasets + process views selectable as migration seeds.
_parse_database_map
¶
The panel's database map: a dict or its JSON text; blank entries dropped.
None when empty (the store's default placement).
_sanity_arg
¶
The panel's sanity choice: 'cheap' (default) | 'full' | False ('off').
_plan_databases
¶
{kind: [source databases]} of the plan's objects: the rows of the
panel's database map.
migration_plan
¶
migration_plan(source: str | None = None, seeds: str | None = None, target_data_domain: str | None = None, data_strategy: str = 'recompute', database_map=None, run_user: str | None = None, readers: str | None = None, sanity: str = 'cheap') -> dict
Build the migration manifest and render the approval report + conflict controls. READ-ONLY (nothing is written).
migration_stage
¶
migration_stage(source: str, seeds: str | None, target_data_domain: str | None, data_strategy: str, approvals: dict, database_map=None, run_user: str | None = None, readers: str | None = None, sanity: str = 'cheap') -> dict
Re-plan freshly, validate the approvals, and stash {plan, approvals} for the streamed run. Returns the validation verdict.
migration_script_file
¶
migration_script_file(source: str, seeds: str | None = None, target_data_domain: str | None = None, data_strategy: str = 'recompute', approvals: dict | None = None, database_map=None, run_user: str | None = None, readers: str | None = None, sanity: str = 'cheap') -> Optional[str]
Build the plan and write a standalone migration .py with baked-in approvals.
migration_access_file
¶
migration_access_file(source: str, seeds: str | None = None, target_data_domain: str | None = None, data_strategy: str = 'recompute', database_map=None, run_user: str | None = None, readers: str | None = None, sanity: str = 'off') -> Optional[str]
Build the plan (no sanity check by default) and write its GRANTs as a .sql for a DBA. Text only: nothing is executed.
qopt_optimize
¶
Run the optimiser; return the rendered report + a pending-replacement token.
qopt_approve
¶
Apply the approved REPLACE VIEW (uses the last optimisation's pending state).
qopt_report_file
¶
Write the last optimisation report to a temp file and return its path.
eval_generate
¶
eval_generate(skills=None, multi_turn=True, use_pronouns=True, per_skill=1, fact_first=True, temporal=True, seed=0, mcp_enabled=False) -> dict
eval_import
¶
Import scenarios JSON (replace/append) and merge into the current set.
eval_scenarios_export_file
¶
Write the current scenario set to a temp JSON and return its path.
benchmark_datasets
¶
List datasets (+ auto-derived entity columns) for the Benchmark dropdown.
benchmark_last
¶
Re-render the most recent benchmark report (panel revisit).
benchmark_report_file
¶
Write the last benchmark result to a temp file for download; return path.
_capture_tdfs4ds_logs
¶
Forward 'tdfs4ds' logger records to emit(str) for the duration.
The rebuild cores already log per-object lines ("documenting X", "skipped",
"absent from graph — fallback", per-seed lineage, per-collection indexing).
Capturing them is how the Maintenance panel streams progress WITHOUT adding a
progress= param to those cores. Temporarily forces DISPLAY_LOGS=True so
the lines actually emit.
maintenance_status
¶
Current lineage / documentation / vector-index sizes for the status card.
datasets_overview
¶
Registered datasets with how they were built (Maintenance → Datasets card).
One row per dataset: name, strategy, join type and time mode. They come from
the build table; a dataset registered before it existed shows
not recorded (its strategy is still detected when converting).
dataset_grouped
¶
dataset_grouped(view: str, in_place: bool = False, target: str = '', overwrite: bool = False, preview: bool = False) -> dict
Build the grouped version of a dataset — a new view, or in place.
preview=True only returns the DDL. The package logs the reason of a
refusal (target exists, not a dataset view); it is captured and returned so
the panel shows it instead of a bare failure.
_find_registered_dataset
¶
The overview row naming qualified (db.name or bare name), or None.
Case-insensitive, quote-tolerant: the catalog stores raw names while the caller may pass a quoted or differently-cased one.
_dataset_catalog_html
¶
The dataset-catalog check/restore report as an HTML table (Maintenance panel).
_statistics_html
¶
The storage-statistics report as an HTML table (Maintenance panel).
_process_sql_html
¶
The backfill report: one row per process, its status and version.
maintenance_stores
¶
The stores the Maintenance vector-index step can re-index, with what the local index holds for each.
Every store found by the feature-store discovery (as in Parameters), the attached ones first and ticked. A store that is not attached can be indexed too: it is read through its public views, nothing is written to it. On the Teradata Vector Store backend the list is informative only (that backend indexes the primary, in its own database).
_wait_for_index_job
¶
Wait for a background build of the same store to end (two builds of one store's collections at once would race).
rebuild_run
¶
Run a rebuild operation, streaming the cores' log lines via progress.
op ∈ {'lineage', 'documentation', 'vector', 'all'}. Flags in opts:
force_update, force_rebuild, all_data_domains, extra_views,
stores (the vector-index step on Chroma: the stores to re-index, a list
or a comma-separated string; default every attached store).
The run is shown in the status bar while it lasts.
_rebuild_chroma_stores
¶
Re-index the Chroma collections of each store in stores, one status-bar
job per store; {store: {'embedded', 'skipped', 'errors'}}.
A store whose build fails is reported and the next one still runs.
connection_status
¶
Current Teradata connection status for /health and the UI status dot.
connect_fields
¶
Pre-fill values for the Connect form (password is never returned).
connect
¶
Open (or re-open) the Teradata context from the Connect form.
_require_database
¶
Return a 'not connected' payload when disconnected, else None.
For the few panels that work without a feature store (the store list, the Parameters toggles).
_require_connection
¶
Return a payload naming what is missing (connection, feature store), else None.
Every panel that reads the store calls this. Without a store, its SQL would read
FROM .FS_FEATURE_CATALOG and fail with Error 3707, a syntax error that names
nothing (seen at a site whose .env set the connection but not TDFS4DS_SCHEMA).
params_current
¶
Snapshot of the live tdfs4ds config used to pre-fill the Parameters form.
check_row_html
¶
One check of the report as the Parameters panel shows it (status, detail, error, fix hint, and the time it took when it is noticeable).
check_configuration
¶
Run tdfs4ds.check_configuration() and render it for the Parameters panel.
Returns the raw report plus an html fragment, so the panel shows the
per-check status and — the point of the feature — the fix hint for anything
that did not pass. progress is passed through ((event, data), see
diagnostics.check_configuration) so the panel shows each row as it comes.
feature_stores
¶
The databases holding a feature store, for the Parameters list.
Looked for once at app startup and again on demand (refresh=True); the
result is kept so opening the panel costs nothing. Never raises: a failed
search returns the reason, and the panel then offers free text.
app_status
¶
What the status bar shows: the connection, the stores read, the jobs, the health of the database and what the configuration allows.
No database read: the store names are the session's, the jobs come from
tdfs4ds.serve.activity, the health from tdfs4ds.serve.health (its own
connection) and the configuration from the checks already run.
_after_connect
¶
A successful connect (Connect page, store switch): run the configuration checks that depend on it. Never fails the connect.
reconnect_database
¶
The status bar's Reconnect button (POST /ui/reconnect).
_from_row
¶
available / unavailable from a check's last answer; None when it has none.
capabilities
¶
What the app can do with the configuration it has, per capability.
{name: {state: available|unavailable|unknown, reason, hint, setting}} for
agent_packages, database, instruct_model, embedding, vector_index,
mcp, dbql and temporal. agent_packages is unavailable when the packages of
pip install tdfs4ds[agent] are absent (agent_missing: the missing module names;
looked up when omitted). Pure: the health snapshot, the cached check rows ({name: row}) and
the settings (a {VARIABLE: value} dict; the live tdfs4ds ones when omitted) are
its only inputs.
Before any check ran it answers from the settings alone: a missing setting is
unavailable with the variable to set, a present one unknown (the UI treats
unknown as usable: nothing proves it broken). A check that failed makes it
unavailable with that check's own hint.
read_only_store_names
¶
View databases of the attached read-only stores, in attach order.
home
¶
The Home cards of a profile (GET /ui/home); see serve/home.py.
search_objects
¶
Objects matching a name (GET /ui/search); see serve/home.py.
_clear_store_caches
¶
Forget every panel result computed for the previous set of stores.
shared_feature_count
¶
Features (DATA_DOMAIN, ENTITY_NAME, FEATURE_NAME) present in more than one attached store: the assistant's internal identity is store-blind, so each is treated as one (the primary's). 0 with a single store or on a read error.
apply_database
¶
Make db_name the primary feature store and, when readonly is given (a list of database names, possibly empty), read from exactly those stores too.
readonly=None keeps the stores already attached. The vector index of each
store is then brought up to date in the background (only missing or changed
rows are embedded: each store has its own collections, so nothing is wiped).
_publish_model_keys
¶
Hand a key typed here to the gateway (Docker deployment), which saves it for everybody.
Returns None outside the gateway, else the gateway's answer (persisted, pushed,
reason) or {"ok": False, "reason": ...}. Never raises, never returns the key.
_key_status
¶
The sentence about where a key typed on the page now lives.
apply_model_keys
¶
Take keys pushed by the gateway (another person changed them). Returns how many were set.
apply_instruct
¶
Apply the instruct model. A blank key keeps the one in use (typing the key again is not needed to change the model name).
apply_execution_log
¶
Switch the query band and the execution history on or off for this app process; when on, create the history tables if missing and say whether this user's runs can be measured (query band settable, DBQL readable and logging).
_workflow_model
¶
The model, with the cached entity scan when one exists (or a new scan).
_cached_workflow
¶
The panel's last model for this scope, whatever its age (0.3.8.2), or None.
workflow_page
¶
{"html", "status", "summary", "cached", "age_s"} of the cheap checks (+ the cached scan).
The last model of the same scope is served with its age (0.3.8.2): the checks compile every view with EXPLAIN, a few hundred statements, and run again only on request (refresh) or when no model exists (or an acceptance changed the verdict).
workflow_accept
¶
Accept a finding of the assessment, with a justification (administrators only: the route is
admin in ROUTE_PROFILE). payload: {finding: {area, kind, object, detail, dates},
justification, until?, editor}. A missing justification or editor comes back as
{"error": "invalid", "status": ...} and nothing is written. Clears the cached model.
workflow_revoke
¶
Revoke an acceptance by its key (administrators only). The finding is open again at the next read.
workflow_accepted
¶
The acceptances of the store as rows (a read: every profile that sees the panel).
workflow_file
¶
The assessment as html (standalone page), md or csv, written
under tdfs4ds.DASHBOARD_REPORT_DIR. Reuses the panel's last model when it
is recent and for the same scope (with its entity scan), else the cheap checks.
workflow_report_html
¶
The Report's 'Workflow assessment' section: the Health check's last result with its age,
or a button to run it (0.3.8.2). The report never computes it: that was about 150 statements
on a small store and 400 to 600 on a large one, run by a page that only shows an overview.
The button (data-wf-run) starts the existing streamed scan (ui/workflow/scan).
Fail-open: ''.
_parse_removal_objects
¶
The objects of the panel: a JSON list of process ids, dataset ids and
features [name, [entity], domain, process_id], or a comma list of ids.
removal_objects
¶
The processes, datasets and features the panel lists (current catalogs).
removal_plan
¶
The ordered removal plan of objects and of everything depending on them.
domain_removal_objects
¶
What removing domain means, as :func:tdfs4ds.plan_removal objects: every
process of the domain (its features and the datasets reading them follow as
dependents), plus the domain's features no process computes any more, which no
process step reaches. Primary store only. Pure on the snapshot frames.
removal_domain_plan
¶
The removal plan of a whole data domain: its processes, their features, the datasets reading them (whatever their own domain), the features left with no process, and the domain's clock setting. Nothing is removed: the plan feeds the same dry run and standalone script as any other removal plan.
removal_verify
¶
After the script ran: what each step of the last plan left behind (catalog rows, documentation, provenance, SQL versions, vector-index entries). Read only.
removal_script_file
¶
Write the script of the last plan; return its path (None without a plan).
relocation_plan
¶
Plan (read only) the relocation of features, or preview the rewrite of a dataset's table references, and show each step's dry run. Nothing is changed; the script does it.
relocation_script_file
¶
Write the script of the last relocation plan; return its path (None without a plan).
_tracked
¶
Show a streamed panel job in the status bar while it runs.
The job's own progress messages become the bar's detail, and a
PROGRESS k/N (or PHASE k/N) line its count. A returned status
starting with ❌ marks the job failed; so does an exception (re-raised).
impact_prefill
¶
What the Impact drawer prefills: the current SELECT of a process view or a view
(sql), or the columns of a dataset (columns, join_type). Read only.
_gl_domains
¶
The payload's domain(s) as the module takes them: None (whole store), a string, or a list
(several domains, '' = the whole store). A one-item list stays a list.
glossary_groups
¶
One line per term with identical meaning, synonyms, notes and store: the rows of several data
domains are folded into data_domains ('' = the whole store, listed first). Pure.
glossary_page
¶
The terms in force (primary store + read-only stores), the data domains, the table state.
glossary_preview
¶
Dry run of one term (add or edit): what would be written, and the meaning it replaces.
glossary_apply
¶
Declare or change one term. dry_run (default True) writes nothing; a write needs the editor.
glossary_remove
¶
End a term's validity (history stays readable). dry_run (default True) writes nothing.
_glossary_sheet_to_file
¶
The uploaded workbook (base64 in the JSON body, so no multipart dependency) as a temp file.
glossary_import_plan
¶
Dry run of a sheet import: counts and rows of new / changed / unchanged / skipped terms.
glossary_import_apply
¶
Import a sheet (IMPORTED terms; never deletes). Needs the editor.
glossary_export_file
¶
Write the glossary as XLSX (the import layout) and return the path.