# Ingestors

Ingestors are used to fetch content from other sources and pull them into the website. They can be configured to run periodically (such as every 5 minutes, every hour, or daily) and can also respond in response to a webhook from an external source.

{% hint style="info" %}
Most ingestors know how to check for content that has been updated since they last ran. This makes them efficient to run frequently.
{% endhint %}

## Ingestor Adapters

Each ingestor is configured with an **adapter** which determines how the ingestor works, and depends on what remote system it is connecting to.

Each adapter has different settings which controls its behaviour.

### IndigoAdapter

The IndigoAdapter fetches content from an Indigo API for a specific place.

<table><thead><tr><th width="167.359375">Setting</th><th width="365.359375">Description</th><th>Example</th></tr></thead><tbody><tr><td>token</td><td>API token for calling the Indigo API. Required.</td><td>abc1232</td></tr><tr><td>api_url</td><td>URL of the Indigo API. Must NOT end in a slash. Required.</td><td>https://example.com/v3</td></tr><tr><td>places</td><td>Space-separated list of place codes to fetch documents for. Use wildcards to fetch all localities in a place. Required.</td><td>bw za-* za-gp</td></tr><tr><td>add_topics</td><td>Space-separated list of topic slugs to add to the imported documents. Optional.</td><td>economy</td></tr><tr><td>include_doctypes</td><td>Space-separated list of FRBR document types to include when importing. Optional.</td><td>act doc</td></tr><tr><td>exclude_doctypes</td><td>Space-separated list of FRBR document types to exclude when importing. Optional.</td><td>act doc</td></tr><tr><td>include_subtypes</td><td>Space-separated list of FRBR document subtypes to include when importing. Optional.</td><td>by-law book</td></tr><tr><td>exclude_subtypes</td><td>Space-separated list of FRBR document subtypes to exclude when importing. Optional.</td><td>by-law book</td></tr><tr><td>include_actors</td><td>Space-separated list of FRBR actors to include when importing. Optional.</td><td>parliament</td></tr><tr><td>exclude_actors</td><td>Space-separated list of FRBR actors to exclude when importing. Optional.</td><td>parliament</td></tr></tbody></table>

### IndigoTopicAdapter

The IndigoTopicAdapter fetches content from an Indigo API that is tagged with a particular taxonomy topic.

Uses the same settings as the IndigoAdapter, as well as:

<table><thead><tr><th width="118.99609375">Setting</th><th width="355.12890625">Description</th><th>Example</th></tr></thead><tbody><tr><td>topics</td><td>Space-separated list of topic slugs to fetch documents for. Required.</td><td>collections taxonomy-economy</td></tr></tbody></table>

### GazetteAPIAdapter

The GazetteAPIAdapter fetches gazettes using the Peachjam Gazettes API.

<table><thead><tr><th width="138.1953125">Setting</th><th width="362.7578125">Description</th><th>Example</th></tr></thead><tbody><tr><td>api_url</td><td>URL of the API. Must not end in a slash. Required.</td><td>https://example.com/api</td></tr><tr><td>token</td><td>API authentication token. Required.</td><td>abc123</td></tr><tr><td>jurisdiction</td><td>Space-separated list of jurisdictions to fetch gazettes for. Use a wildcard to fetch all localities in a jurisdiction. Optional.</td><td>bw za-* za-gp</td></tr></tbody></table>

### JudgmentAdapter

The JudgmentAdapter fetches Judgments using the Peachjam Judgments API.

| Setting        | Description                                                                     | Example                                   |
| -------------- | ------------------------------------------------------------------------------- | ----------------------------------------- |
| api\_url       | URL of the API. Must not end in a slash. Required.                              | <https://example.com/api>                 |
| token          | API authentication token. Required.                                             | abc123                                    |
| court\_code    | Code of the court to fetch judgments for. Required.                             | ZACC                                      |
| registry\_code | Code of the registry to fetch judgments for. Optional.                          |                                           |
| filters        | Space-separated list of `key=value` pairs to filter the judgments on. Optional. | `jurisdiction=za` `title__icontains=Test` |

### JudgmentDeleteAdapter

The JudgmentDeleteAdapter compares the local collection of judgments (matching its filter settings) to the remote server, and deletes any that the remote server doesn't know about.

{% hint style="warning" %}
This adapter deletes content in bulk. Be careful how you configure it.
{% endhint %}

This adapter accepts the same settings as the JudgmentAdapter.

### RatificationsAdapter

The RatificationsAdapter fetches ratification information from AfricanLII.org.

Ratification information is only collected for works that exist on the local website.

| Setting            | Description                                                                  | Example                   |
| ------------------ | ---------------------------------------------------------------------------- | ------------------------- |
| api\_url           | URL of the API. Must not end in a slash. Required.                           | <https://example.com/api> |
| token              | API authentication token. Required.                                          | abc123                    |
| include\_countries | Space-separated two-letter country codes for countries to include. Optional. | za bw                     |
| exclude\_countries | Space-separated two-letter country codes for countries to exclude. Optional. | za bw                     |

### GitbookAdapter

The GitbookAdapter fetches Markdown content from a GitHub repo that has been authored using GitBook. It expects the content to match GitBook's file layout and use of Markdown.

The repo can contain multiple documents and the adapter will import all of them, configured by a `peachjam.yaml` file at the root of the repository, using the format:

```
documents:
- title: Document 1
  expression_frbr_uri: /akn/za/doc/book/2020/example/eng@2020-01-01
  path: example
```

| Setting       | Description                                       | Example           |
| ------------- | ------------------------------------------------- | ----------------- |
| repo\_name    | Name of the GitHub repo. Required.                | laws-africa/books |
| access\_token | GitHub access token for authentication. Required. | gh-xxx-aaa        |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://liieditors.docs.laws.africa/site-admin/ingestors.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
