compass.utilities.finalize.doc_infos_to_db#

doc_infos_to_db(doc_infos)[source]#

Aggregate parsed ordinance CSV files into a normalized database

Parameters:

doc_infos (Iterable) – Iterable of dictionaries describing ordinance extraction results. Each dictionary must contain "ord_db_fp" (path to a parsed CSV), "source" (document URL), "date" (tuple of year, month, day, with None allowed), and "jurisdiction" (a Jurisdiction instance).

Returns:

  • pandas.DataFrame – Consolidated ordinance dataset.

  • int – Number of jurisdictions contributing at least one ordinance to the consolidated dataset.

Notes

Empty or None entries in doc_infos are skipped. Ordinance CSVs that lack parsed values (num_ordinances_dataframe equals zero) are ignored. The returned DataFrame enforces an ordered column layout and casts the quantitative flag to nullable boolean.