org.ris_import

Repeatable imports of OGI Page JSON produced by the RIS scraper.

Attributes

SECTIONS

KEYS

BUSINESS_TYPES

COUNCIL_ROLES

MONTHS

REFERENCE

FIELD_NAMES

Classes

OGIArchive

OGIImporter

Functions

walk(node) → collections.abc.Iterator[dict[str, Any]]

text(node) → str

references(node, kind) → set[str]

fields(page) → dict[str, Any]

tables(page) → collections.abc.Iterator[tuple[str, dict[str, Any]]]

parse_date(value) → datetime.date | None

normalize_name(value) → str

role_key(value) → str

markup(node) → str

safe_path(root, name) → pathlib.Path

digest(path) → str

source_id(path) → str

meeting_times(page) → tuple[datetime.datetime, datetime.datetime | None]

connect_relationships(session[, allowed_people]) → None

Module Contents

org.ris_import.SECTIONS: tuple[str, ...] = ('parliamentarians', 'commissions', 'parliamentary_groups', 'political-business', 'meetings')[source]
org.ris_import.KEYS: dict[str, str][source]
org.ris_import.BUSINESS_TYPES: dict[str, onegov.org.models.political_business.PoliticalBusinessType][source]
org.ris_import.COUNCIL_ROLES: dict[str, onegov.parliament.models.parliamentarian_role.Role][source]
org.ris_import.MONTHS: dict[str, int][source]
org.ris_import.REFERENCE[source]
org.ris_import.FIELD_NAMES: set[str][source]
org.ris_import.walk(node: Any) → collections.abc.Iterator[dict[str, Any]][source]
org.ris_import.text(node: Any) → str[source]
org.ris_import.references(node: Any, kind: str) → set[str][source]
org.ris_import.fields(page: dict[str, Any]) → dict[str, Any][source]
org.ris_import.tables(page: dict[str, Any]) → collections.abc.Iterator[tuple[str, dict[str, Any]]][source]
org.ris_import.parse_date(value: str) → datetime.date | None[source]
org.ris_import.normalize_name(value: str) → str[source]
org.ris_import.role_key(value: str | None) → str[source]
org.ris_import.markup(node: Any) → str[source]
org.ris_import.safe_path(root: pathlib.Path, name: str) → pathlib.Path[source]
org.ris_import.digest(path: pathlib.Path) → str[source]
org.ris_import.source_id(path: pathlib.Path) → str[source]
class org.ris_import.OGIArchive(path: pathlib.Path, section: str | None = None)[source]
root[source]
pages: dict[str, dict[str, dict[str, Any]]][source]
assets: dict[str, dict[str, str]][source]
manifest: dict[str, Any][source]
unavailable: dict[str, int][source]
validate() → None[source]
importer(session: sqlalchemy.orm.Session) → OGIImporter[source]
org.ris_import.meeting_times(page: dict[str, Any]) → tuple[datetime.datetime, datetime.datetime | None][source]
class org.ris_import.OGIImporter(archive: OGIArchive, session: sqlalchemy.orm.Session)[source]
archive[source]
session[source]
counts: collections.Counter[str][source]
people: dict[str, onegov.org.models.RISParliamentarian][source]
businesses: dict[str, onegov.org.models.PoliticalBusiness][source]
groups: dict[str, onegov.org.models.RISParliamentaryGroup][source]
commissions: dict[str, onegov.org.models.RISCommission][source]
active: set[str][source]
council: set[str][source]
council_functions: dict[str, str][source]
names: dict[str, str][source]
upsert[T: onegov.core.orm.mixins.ContentMixin](model: type[T], source: str, key: str, identity: dict[str, Any] | None = None) → T[source]
attach(obj: onegov.org.models.PoliticalBusiness | onegov.org.models.Meeting, page: dict[str, Any]) → None[source]
attach_images(business: onegov.org.models.PoliticalBusiness, page: dict[str, Any]) → None[source]
import_people() → None[source]
import_bodies(section: str) → None[source]
plain_historical(person: onegov.org.models.RISParliamentarian) → bool[source]
merge_person(target: onegov.org.models.RISParliamentarian, duplicate: onegov.org.models.RISParliamentarian) → None[source]
historical_person(name: str) → str[source]
participants(node: dict[str, Any]) → list[tuple[str, str]][source]
merge_business(target: onegov.org.models.PoliticalBusiness, duplicate: onegov.org.models.PoliticalBusiness) → None[source]
import_businesses(source_ids: set[str] | None = None) → None[source]
import_meetings() → None[source]
run(section: str | None = None, business_ids: set[str] | None = None) → dict[str, int][source]
org.ris_import.connect_relationships(session: sqlalchemy.orm.Session, allowed_people: set[str] | None = None) → None[source]