Datasets and Dependencies
When you change the contents or definition of a dataset, or delete a dataset or model, MIDAS carries the change over to the Derived Datasets, models, and report elements that depend on it. How MIDAS carries it over differs between changing contents or definitions and deleting.
When you change the contents of a Primary Dataset or the definition of a Derived Dataset, MIDAS recomputes the Derived Datasets, models, and report elements that depend on the changed dataset from the changed data. For Derived Datasets, MIDAS discards the row data and rebuilds it when the row data is needed. MIDAS re-estimates the models. MIDAS redraws report elements from the changed data each time it displays them.
When you delete a dataset or model, MIDAS also deletes the Derived Datasets and models that depend on it, and removes the report elements that refer to anything deleted.
Dataset Types
Primary Dataset
A Primary Dataset holds its row data itself and depends on no other dataset. Data loaded from a file or URL and data entered by hand become Primary Datasets.1
When MIDAS saves a project, it always includes the row data of Primary Datasets in the MDS file, because the row data of a Primary Dataset cannot be rebuilt from other datasets.
Derived Dataset
A Derived Dataset holds the definition of an operation and creates its row data with that operation. Running the operation to create the row data is called evaluating the Derived Dataset. Operations include SQL queries, filters, Crosstab aggregations, column type conversions, and dummy variable creation, as well as extracting a coefficient table, diagnostics table, predictions, and so on from a model, and generating synthetic data, which takes no input. A dataset that serves as input to the operation is called an input dataset. An operation that extracts a coefficient table, diagnostics table, predictions, or the like from a model also takes the model as input. Both Primary Datasets and Derived Datasets can be input datasets, so you can create a Derived Dataset from another Derived Dataset.2
Ephemeral Dataset
An Ephemeral Dataset is a temporary dataset that a tab creates from other datasets or models for display. For example, the dataset that the Filtered Data tab displays is an Ephemeral Dataset.3
Dependencies
Derived Datasets, models, and report elements depend on the datasets and models they use for computation or display. There are four kinds of dependency:
- A Derived Dataset that has input datasets depends on them
- A model depends on the dataset it was fitted to
- A Derived Dataset that extracts a coefficient table, diagnostics table, predictions, or the like from a model depends on that model
- A report element depends on the datasets and models it displays
You can check dependencies as a graph in the Project Lineage tab. In the figure below, Penguins Analysis is a Derived Dataset created with an SQL query from the Primary Dataset Palmer Penguins. Body Mass Model is a model fitted to Penguins Analysis, and Penguin Report is a report that displays Penguins Analysis as a table.

The recomputation and deletion described in the following sections reach not only what depends directly but also what depends indirectly. In the figure, Body Mass Model and the table in Penguin Report depend directly on Penguins Analysis and indirectly on Palmer Penguins.
Recomputation When a Dataset Changes
When you change the contents of a Primary Dataset or the definition of a Derived Dataset, MIDAS discards the row data of the Derived Datasets that depend on the changed dataset and re-estimates the models that depend on it. For example, when you reload Palmer Penguins in the figure, MIDAS discards the row data of Penguins Analysis and re-estimates Body Mass Model. The contents of a Primary Dataset change when you reload it, edit values, rows, or columns with Edit Data, exclude or restore rows, or rename columns.4
MIDAS performs the same recomputation when you change a setting that changes the results of computations. When you change the measurement scale of a column, the Derived Datasets and models that depend on the dataset with that column are affected, because the measurement scale determines whether order comparisons in filter expressions are valid. When you change the values or the value order of an Enum definition, the Derived Datasets that have a column of that Enum type are affected, together with the Derived Datasets and models that depend on a dataset with a column of that Enum type, because the value order of an Enum definition determines the order of categories and the order comparisons on ordinal columns. When you rename a dataset, the Derived Datasets created by SQL queries that refer to that name are affected, together with the Derived Datasets and models that depend on them, because MIDAS rewrites the queries to follow the new name.
When re-estimating a model fails, MIDAS keeps the failure and does not re-estimate the model until the dataset used for fitting changes. This keeps MIDAS from repeating a failing estimation each time it evaluates a Derived Dataset that uses the model.
When Derived Datasets Are Evaluated
MIDAS evaluates a Derived Dataset when its row data is needed. The row data is needed when you open the Derived Dataset in a tab, specify it as input to a graph, analysis, or SQL query, export it to CSV, and so on. MIDAS reuses the evaluated row data until the datasets or models that the Derived Dataset depends on change. Derived Datasets displayed in open tabs or reports need their row data right after a dataset changes, so MIDAS evaluates them again immediately.
When the evaluation of a Derived Dataset fails, or is cancelled because DuckDB was restarted with Force Stop, MIDAS keeps the result and does not evaluate the dataset again until the datasets or models it depends on change. This keeps a query that you stopped with Force Stop from starting again. Running a query that refers to the dataset in the SQL Editor evaluates it again.
Column Metadata
Column metadata consists of the measurement scale and display format of a column. Changing the display format does not make MIDAS discard the row data of Derived Datasets or re-estimate models that have estimates, because the display format changes neither the values in the row data nor the results of computations.
Manually set metadata on columns remains after a Derived Dataset is evaluated again, because MIDAS records the manually set metadata by column name and, at each evaluation, sets it on the column with the same name in the result of the operation. However, when the result of the operation changes the data type of a column, MIDAS does not set measurement scales and display formats that cannot be chosen for the new type until the data type changes back.5
When a Derived Dataset includes a column of its input dataset, MIDAS takes the number format and the link display not set by hand on that column from the same column of the input dataset. Columns created in the SQL Query Editor tab or the Normalize Variants tab do not take them.
Open Tabs and Reports
MIDAS does not recompute results shown in analysis tabs that are not saved to the project; it automatically re-estimates only the models saved to the project. To get analysis tab results from the changed data, run the analysis again.
When you save an analysis tab result as a model and you have changed the dataset used for fitting, a dataset it was derived from, or an Enum definition since fitting, MIDAS re-estimates the model from the data at the time of saving. MIDAS also re-estimates it when you have changed only the display format of a column.
After a dataset changes, MIDAS displays report elements with the changed values,6 because each time MIDAS displays a report element, it redraws the element from the datasets and models the element refers to. In the figure's example, when you open Penguin Report after reloading Palmer Penguins, MIDAS displays the table with the rows of Penguins Analysis evaluated again from the reloaded data.
What Deletion Reaches
When you delete a dataset, MIDAS also deletes the Derived Datasets and models that depend on it directly or indirectly, and removes the report elements that refer to the deleted datasets and models. MIDAS does not delete the reports from which it removed elements. For example, when you delete Penguins Analysis in the figure, MIDAS also deletes Body Mass Model and removes the table from Penguin Report. Palmer Penguins and Penguin Report remain.
When you delete a model, MIDAS also deletes the Derived Datasets and models that depend on that model directly or indirectly. MIDAS also removes the report elements that refer to the deleted models and Derived Datasets. MIDAS does not delete the dataset the model was fitted to. For example, when you delete Body Mass Model in the figure, Penguins Analysis and the table in Penguin Report remain.
Saving the Row Data of Derived Datasets
Save data with project is a setting that saves the row data of a Derived Dataset in the MDS file, so that a Derived Dataset that takes a long time to evaluate can be used without evaluating it again after the project is reopened.7 For a Derived Dataset with this setting turned off, MIDAS saves only the definition in the MDS file and evaluates the dataset again when its row data is needed after the project is opened. For an operation that takes a long time to evaluate, such as an SQL query that joins and aggregates large data, that time is spent every time the project is reopened, at the point the row data is first used. With this setting turned on, MIDAS includes the evaluated row data in the MDS file and loads that row data when the project is opened. In exchange, the MDS file grows by the size of the row data. Synthetic data that is evaluated again can have different values depending on the version of MIDAS or the browser. This setting is also the way to keep the values of synthetic data fixed.
MIDAS uses the saved row data only until the datasets or models that the Derived Dataset depends on change. When they change, MIDAS discards the saved row data as well and evaluates the Derived Dataset again when its row data is needed.
For a Derived Dataset that has not yet been evaluated at the time of saving, MIDAS saves only the definition in the MDS file even if Save data with project is turned on. To include the row data as well, open that Derived Dataset once before saving so that MIDAS evaluates it.
Footnotes
-
The steps for loading and reloading data are described in Data Preparation and Import. ↩
-
How to create Derived Datasets is described on the page for each operation, such as The SQL Query Editor Tab, Row Selection and the Filtered Data Tab, The Crosstab Tab, The Convert Column Types Tab, and The Dummy Coding Tab. ↩
-
How to use the Filtered Data tab is described in Row Selection and the Filtered Data Tab. ↩
-
Reloading is described in Data Preparation and Import, and Edit Data and row exclusion are described in The Data Table Tab. ↩
-
How the types of SQL query results are determined is described in The SQL Query Editor Tab. ↩
-
Save data with project is switched from the menus in The Data Table Tab and The Project Overview Tab. ↩
Also available as a Markdown file.