From e6bd7292d5052dbf5fca33554558dfe615bcce6f Mon Sep 17 00:00:00 2001 From: James Turk Date: Wed, 18 Sep 2024 12:45:53 -0500 Subject: [PATCH] fix party, csv --- export_csv.sql | 4 ++++ src/ossql/people_to_sqlite.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 export_csv.sql diff --git a/export_csv.sql b/export_csv.sql new file mode 100644 index 0000000..9808838 --- /dev/null +++ b/export_csv.sql @@ -0,0 +1,4 @@ +.headers on +.mode csv +.output legislators.csv +select name, given_name, family_name, gender, party, jurisdiction, r.district, r.type from person join personrole r on r.person_id=person.id where r.end_date is null; diff --git a/src/ossql/people_to_sqlite.py b/src/ossql/people_to_sqlite.py index e8ce00c..8b807ba 100644 --- a/src/ossql/people_to_sqlite.py +++ b/src/ossql/people_to_sqlite.py @@ -37,7 +37,7 @@ def load_people_yaml(dir_path: pathlib.Path) -> int: gender=pdata.pop("gender"), email=pdata.pop("email", ""), image=pdata.pop("image", ""), - party=pdata.pop("party"), + party=pdata.pop("party", [{"name": ""}])[0]["name"], extras=pdata.pop("extras", {}), ) to_links(person, pdata.pop("links", []), PersonLink)