compass.utilities.finalize.save_db#

save_db(db, out_dir, output_columns)[source]#

Write the combined ordinance output to disk

Qualitative and quantitative ordinances are written to a single ordinances.csv file. The quantitative flag is retained as a column so the two kinds of row remain distinguishable.

Parameters:
  • db (pandas.DataFrame) – Ordinance dataset containing the full set of output columns, plus the quantitative boolean flag.

  • out_dir (path-like) – Directory where ordinances.csv should be written. The directory is created by pathlib.Path if necessary.

  • output_columns (list) – List of expected output columns (as compass.plugin.interface.OutputColumn instances) for the consolidated database. The function enforces the presence of these columns in the output pandas.DataFrame, filling in missing columns with null values as needed.

Notes

Empty DataFrames short-circuit without creating output files. The function assumes the boolean quantitative column has already been sanitized by doc_infos_to_db().