enricher#

Recipe-driven entity enrichment.

Enrichment reads a harmonized entity spine plus one or more input recipes and writes entity-keyed evidence tables beside the selected spine output.

Submodules#

Classes#

EnrichState

Mutable container passed through every enrich pipeline step.

Enricher

Run an enrichment recipe for one or more admin units.

Functions#

enrich(→ None)

Instantiate and run enrichment for recipe.

Package Contents#

class openplaces.io.enricher.EnrichState#

Mutable container passed through every enrich pipeline step.

Parameters:
  • recipe – Loaded enrichment recipe.

  • entity_recipe – Loaded concrete entity recipe being enriched.

  • admin_id – Current admin unit being processed.

  • verbose – Print per-step progress messages.

  • timer – Timing helper.

  • spine – Harmonized entity spine.

  • evidence – Entity-keyed evidence table being built.

  • image_admin_ids – When set, restrict image-based steps to these admin units (deeper than the process level) instead of all children.

  • metadata – Step-specific intermediate data.

class openplaces.io.enricher.Enricher(recipe: str | dict, admin_ids: str | list | None = None, entity_recipe_id: str | dict | None = None, verbose: bool = False)#

Run an enrichment recipe for one or more admin units.

enrich(reprocess: bool = False, cleanup: str | None = None, include_images: bool = False) None#

Run enrichment for all configured admin IDs.

Parameters:
  • reprocess (bool) – If True, re-run even when existing evidence covers the request.

  • cleanup (str, optional) – 'consumed' reclaims this recipe’s direct inputs after each admin unit finishes. The image cache is deleted only when include_images opts in AND every enrich recipe sharing the image_recipe has complete evidence for the unit (standard consumer refcounting — a partial coverage footer blocks it).

  • include_images (bool) – Opt-in for image-cache deletion (paid re-fetch); falls back to retention.cleanup.include_images.

openplaces.io.enricher.enrich(recipe: str | dict, admin_ids: str | list | None = None, entity_recipe_id: str | dict | None = None, reprocess: bool = False, verbose: bool = False, cleanup: str | None = None, include_images: bool = False) None#

Instantiate and run enrichment for recipe.

cleanup='consumed' reclaims direct inputs after each admin unit; image caches additionally require include_images (or the retention.cleanup.include_images config) and complete evidence from every enrich recipe sharing the image_recipe.