compass.utilities.finalize.doc_infos_to_db#
- doc_infos_to_db(doc_infos, output_columns)[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, withNoneallowed), and"jurisdiction"(aJurisdictioninstance).output_columns (
list) – List of expected output columns (ascompass.plugin.interface.OutputColumninstances) for the consolidated database. The function enforces the presence of these columns in the outputpandas.DataFrame, filling in missing columns with null values as needed.
- Returns:
pandas.DataFrame– Consolidated ordinance dataset.int– Number of jurisdictions contributing at least one ordinance to the consolidated dataset.
Notes
Empty or
Noneentries indoc_infosare skipped. Ordinance CSVs that lack parsed values (num_ordinances_dataframeequals zero) are ignored. The returned DataFrame enforces an ordered column layout and casts thequantitativeflag to nullable boolean.