directory.cli ============= .. py:module:: directory.cli .. autoapi-nested-parse:: Imports directories scraped by ogi-scraper into onegov directories. Attributes ---------- .. autoapisummary:: directory.cli.cli Functions --------- .. autoapisummary:: directory.cli.import_directory_from_ogi_scraper Module Contents --------------- .. py:data:: cli .. py:function:: import_directory_from_ogi_scraper(file: str, dry_run: bool) -> collections.abc.Callable[[onegov.core.request.CoreRequest, onegov.core.framework.Framework], None] Imports a directory from a self-describing ogi-scraper JSON export. The file carries both the directory spec and its entries:: { "directory": { "title": "Vereine", "structure": "Name *= ___\\n...", # onegov formcode "configuration": { ... }, # DirectoryConfiguration "fields": { "": "", ... } }, "entries": [ { ...record... }, ... ] } The scraper is the source that knows the target shape, so this command needs no per-directory knowledge. The directory is created if missing and entries are matched by name and updated in place, so the import is idempotent. Example: onegov-directory --select /onegov_town6/malters \\ import-from-ogi-scraper vereinsliste.json