Skip to contents

User Enrich Workflow

Use this skill for Enrich tasks aligned with vignettes/enrich-endpoint.qmd.

Required Workflow Order

  1. Create kagi_connection().
  2. Build query objects with query_enrich_web() or query_enrich_news().
  3. Prefer kagi_fetch() for project-folder workflows.
  4. Use kagi_request() + kagi_request_parquet() for low-level control.

Allowed Function Set

Error Handling Rules

  • Use strict behavior by default.
  • Recommend error_mode = "write_dummy" for recurring batch collection jobs.
  • Keep dummy-output explanations consistent with current package behavior.

Enrich-Specific Rules

  • Keep web and news workflows separated when presenting output layout.
  • Use batch enrich examples for thematic monitoring.

References

Read and apply: - references/workflow.md - references/examples.md

References

Workflow

Enrich Workflow (Aligned to Vignette)

Source of truth: vignettes/enrich-endpoint.qmd.

Sequence

  1. Build connection.
  2. Build web queries with query_enrich_web() and/or news queries with query_enrich_news().
  3. Preferred: execute end-to-end with kagi_fetch(project_folder = ...).
  4. Low-level path: execute with kagi_request().
  5. For recurring monitoring, run batch query lists.
  6. Convert with kagi_request_parquet().

Error Strategy

  • Default strict behavior for small controlled runs.
  • error_mode = "write_dummy" for long batch collection.

Constraints

  • Keep web/news outputs separated in examples.
  • Keep language consistent with endpoint guide.

Examples

Enrich Examples

q_web <- query_enrich_web(
  query = "open data portals",
  site = "gov",
  expand = FALSE
)

q_news <- query_enrich_news(
  query = "biodiversity policy",
  expand = FALSE
)
kagi_request(
  connection = conn,
  query = q_news_batch,
  output = "enrich_news_batch",
  overwrite = TRUE,
  workers = 2
)
kagi_request(
  connection = conn,
  query = q_news_batch,
  output = "enrich_news_batch_safe",
  overwrite = TRUE,
  workers = 2,
  error_mode = "write_dummy"
)