> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nekt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Ideagri as a data source

> Bring farms, animals, calvings, lactations, herd registries, rankings and monthly milk and herd indicators from Ideagri Web to Nekt.

Ideagri is a herd management software for dairy and beef farms. With Ideagri Web, farms keep their animals, reproduction, calvings, lactations, milk recordings and health records, and follow production and herd indicators. This connector brings the farms associated with your Ideagri user, their animals and sires, calvings, lactations, mastitis treatment protocols, the farm registries (products, diseases, reasons, sectors, groups, breeds, tanks, parameters, IATF protocols and farm people), the rankings, and the monthly milk statistics and herd indices of each farm.

> [!NOTE]
>
> The connector only reads data. It never creates, changes or deletes anything in Ideagri.

## Configuring Ideagri as a Source

In the [Sources](https://app.nekt.ai/sources) tab, click on the "Add source" button located on the top right of your screen. Then, select the Ideagri option from the list of connectors.

Click **Next** and you'll be prompted to add your access.

### 1. Add account access

The connector signs in to the Ideagri API with the **username and password of an Ideagri Web user**, the same ones used to sign in to Ideagri Web. The user must be allowed to use the Ideagri API (Ideagri support enables it) and be associated with the farms you want to sync. We recommend a user created for Nekt, so that a password change by a person does not stop your syncs.

The following configurations are available:

* **Username**: The username used to sign in to Ideagri Web.
* **Password**: The password of that user.
* **Start Date**: Earliest month read by the monthly tables (Milk Statistics and Monthly Indices) and by Mastitis Treatments, on the first sync and on full syncs. The other tables are always read in full.
* **Farm Codes** (advanced, optional): Comma-separated Ideagri farm codes (`cdfazenda`, for example `1000, 2000`) to sync. Leave it empty to sync every farm associated with the user. The Farms table lists the codes after the first sync.
* **Monthly Tables Lookback (months)** (advanced, default 3, minimum 1): On every sync, the monthly tables read again this many months before the month each farm was last read up to, because recent months keep changing as data is entered in Ideagri. A farm read for the first time (for example, one associated with the user later, or added to Farm Codes) is read from the Start Date.
* **Data Origin (origemDados)** (advanced, default 1): Application code Ideagri asks for when signing in and on most reads (0, 1 or 2). Keep the default unless Ideagri support tells you otherwise.

> [!WARNING]
>
> If the sync says Ideagri did not accept the username and password, first sign in to Ideagri Web with them. If that works, ask Ideagri support to enable API access for the user, and which Data Origin to use.

Once you're done, click **Next**.

### 2. Select streams

Choose which data streams you want to sync. For faster extractions, select only the streams that are relevant to your analysis. You can select entire groups of streams or pick specific ones.

> Tip: The stream can be found more easily by typing its name.

Select the streams and click **Next**.

### 3. Configure data streams

Customize how you want your data to appear in your catalog. Select the desired layer where the data will be placed, a folder to organize it inside the layer, a name for each table (which will effectively contain the fetched data) and the type of sync.

* **Layer**: choose between the existing layers on your catalog. This is where you will find your new extracted tables as the extraction runs successfully.
* **Folder**: a folder can be created inside the selected layer to group all tables being created from this new data source.
* **Table name**: we suggest a name, but feel free to customize it. You have the option to add a **prefix** to all tables at once and make this process faster!
* **Sync Type**: you can choose between INCREMENTAL and FULL\_TABLE.
  * Incremental: every time the extraction happens, we'll get only the new data. Milk Statistics and Monthly Indices are incremental by month.
  * Full table: every time the extraction happens, we'll get the current state of the data. Ideagri has no filter by change date, so the farm tables (animals, calvings, lactations and the registries) are always read in full.

Once you are done configuring, click **Next**.

### 4. Configure data source

Describe your data source for easy identification within your organization, not exceeding 140 characters.

To define your [Trigger](https://docs.nekt.com/runs/scheduling-and-triggers.md), consider how often you want data to be extracted from this source. This decision usually depends on how frequently you need the new table data updated (every day, once a week, or only at specific times).

Optionally, you can define some additional settings:

* Configure Delta Log Retention and determine for how long we should store old states of this table as it gets updated. Read more about this resource [here](https://docs.nekt.com/get-started/core-concepts/resource-control).
* Determine when to execute an **Additional [Full Sync](https://docs.nekt.com/get-started/core-concepts/types-of-sync#additional-full-sync)**. A full sync of the monthly tables reads again from the Start Date.

Once you are ready, click **Next** to finalize the setup.

### 5. Check your new source

You can view your new source on the [Sources](https://app.nekt.ai/sources) page. If needed, manually trigger the source extraction by clicking on the arrow button. Once executed, your data will appear in your Catalog.

> [!WARNING]
>
> For you to be able to see it on your [Catalog](https://app.nekt.ai/catalog), you need at least one successful source run.

# Streams and Fields

## Available streams

The table below lists every stream, its **slug** (the exact identifier to pass when creating the source via API) and a short description.

| Stream | Slug | Description |
| - | - | - |
| Farms | `farms` | The farms associated with the Ideagri user (or the ones listed in Farm Codes). |
| Farm Last Processing | `farm_last_processing` | When each farm's data was last processed into Ideagri Web: use it to check how fresh the other tables are. |
| Animals | `animals` | Every animal of each farm with its category, sector, group, breed, parents, last weighing, last milk recordings, last calving and reproductive status. |
| Sires | `sires` | Bulls and semen registered on each farm (the sires list of the animals route), with the same fields as Animals. |
| Calvings | `calvings` | Every calving recorded on each farm, with calving order, calving interval, calf sex, sire and body condition score. |
| Lactations | `lactations` | Every lactation of each farm, with start date, length, total and 305-day production, peak, average, SCC, protein and dry-off date. |
| Mastitis Treatments | `mastitis_treatments` | Base mastitis treatment protocols of each farm and their validity, from the Start Date month to the current month. |
| Products | `products` | Active products of each farm, flagged when Ideagri lists them as veterinary products. |
| Diseases | `diseases` | Diseases registered on each farm. |
| Discard Reasons | `discard_reasons` | Reasons for an animal leaving the herd (sale, death, discard). |
| Dry-off Reasons | `dry_off_reasons` | Reasons for drying off a cow. |
| Sectors | `sectors` | Sectors (pens, lots) of each farm. |
| Animal Groups | `animal_groups` | Active animal groups of each farm. |
| Breeds | `breeds` | Breeds registered on each farm. |
| Tanks | `tanks` | Milk tanks of each farm. |
| Farm Parameters | `farm_parameters` | Configuration parameters of each farm, farm-wide or per sector. |
| IATF Protocols | `iatf_protocols` | Fixed-time artificial insemination (IATF) protocols of each farm. |
| Farm People | `farm_people` | Ideagri FIT app users and inseminators of each farm, with the sectors they work in. Passwords are never loaded. |
| Rankings | `rankings` | The classification rankings that exist in Ideagri. |
| Ranking Results | `ranking_results` | Every ranking applied to every farm, as it stands at sync time. |
| Milk Statistics | `milk_statistics` | Monthly milk statistics per farm: cows in milk, days in milk, discarded milk, milk production and average, bacterial count, fat, protein and milk urea nitrogen. |
| Monthly Indices | `monthly_indices` | Monthly herd indices per farm: cows, heifers and females, first-calf cows, age at first breeding and calving, service and voluntary waiting periods, daily production, days in milk, tank analyses (SCC, bacterial count, fat, protein) and SCC counts of cows. |

## Fields by stream

Every table has the farm code (`cdfazenda`) where it applies, and an `extra_fields` column (JSON) with any other field Ideagri returned for the record. Column names follow Ideagri's own field names. Dates, weights and yields are kept as text exactly as Ideagri sends them. Passwords are never loaded.

### Farms and herd

> [accordion] Farms
>
> The farms associated with the Ideagri user (or the ones listed in Farm Codes).
>
> Table: `farms` · Primary key: `cdfazenda` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `cdfazenda` | Integer | Internal code of the farm in Ideagri Web |
> | `nome` | String | Name of the farm |
> | `codigoweb` | String | Farm identification used by the Ideagri desktop applications |
> | `atividadepecuaria` | String | Livestock activity of the farm (L - Leite / dairy, C - Corte / beef, A - Agricultura / crops) |
> | `permitirlancamentosmobile` | Boolean | Whether the user may enter data through the mobile app on this farm |
> | `extra_fields` | String | Fields Ideagri returned that this connector does not map to a column, keyed by their original names (also values that did not fit their column's type) (JSON) |

> [accordion] Farm Last Processing
>
> When each farm's data was last processed into Ideagri Web: use it to check how fresh the other tables are.
>
> Table: `farm_last_processing` · Primary key: `cdfazenda` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `cdfazenda` | Integer | Internal code of the farm in Ideagri Web |
> | `nome` | String | Name of the farm |
> | `codigoweb` | String | Farm identification used by the Ideagri desktop applications |
> | `atividadepecuaria` | String | Livestock activity of the farm |
> | `data` | Integer | Time of the last backup processing, in milliseconds since 1970-01-01 (as Ideagri returns it) |
> | `datastr` | String | Time of the last backup processing as text, as Ideagri returns it |
> | `processado_em` | Datetime | Time of the last backup processing (UTC), converted from 'data' |
> | `extra_fields` | String | Fields Ideagri returned that this connector does not map to a column, keyed by their original names (also values that did not fit their column's type) (JSON) |

> [accordion] Animals
>
> Every animal of each farm with its category, sector, group, breed, parents, last weighing, last milk recordings, last calving and reproductive status.
>
> Table: `animals` · Primary key: `cdfazenda`, `cdanimal` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `cdfazenda` | Integer | Internal code of the farm in Ideagri Web |
> | `cdanimal` | Integer | Identifier of the animal |
> | `numero` | String | Animal number (ear tag / herd number) |
> | `nome` | String | Name of the animal |
> | `brincoeletronico` | String | Electronic ear tag number |
> | `tipoanimal` | String | Type of record (A - Animal, S - Semen) |
> | `cdcategoria` | String | Category code and label (1 - male in growth, 2 - sire, 3 - teaser bull, 4 - draft ox, 5 - female in growth, 6 - heifer, 7 - cow) |
> | `categoria` | String | Category description |
> | `setor` | String | Current sector (pen/lot) of the animal |
> | `cdsetor` | Integer | Identifier of the current sector (see the sectors table) |
> | `grupo` | String | Current animal group |
> | `raca` | String | Breed of the animal |
> | `sexo` | String | Sex of the animal |
> | `peso` | String | Last recorded body weight |
> | `dataultimapesagem` | String | Date of the last weighing |
> | `ultimogmd` | String | Last average daily gain (GMD) |
> | `ultimopesoleite` | String | Milk yield of the last milk recording |
> | `dataultimapesagemleite` | String | Date of the last milk recording |
> | `dataultimoparto` | String | Date of the last calving |
> | `dataultimatentativa` | String | Date of the last breeding attempt |
> | `tipoultimatentativa` | String | Type of the last breeding attempt (insemination, natural service or embryo transfer) |
> | `statusreprodutivo` | String | Current reproductive status |
> | `reprodutorultimatentativa` | String | Sire used in the last breeding attempt |
> | `nomecompleto` | String | Full name of the animal |
> | `dtnascimento` | String | Birth date |
> | `regassocraca` | String | Breed association registration number |
> | `dtbaixa` | String | Date the animal left the herd (death, sale or discard), when it did |
> | `cdtipobaixa` | Integer | Code of the type of herd exit |
> | `tipobaixa` | String | Type of herd exit |
> | `cdmotivobaixa` | Integer | Identifier of the herd exit reason (see the discard\_reasons table) |
> | `motivobaixa` | String | Herd exit reason |
> | `numeropai` | String | Number of the sire (father) |
> | `nomedopai` | String | Name of the sire (father) |
> | `nomecompletodopai` | String | Full name of the sire (father) |
> | `registrodopai` | String | Registration of the sire (father) |
> | `numerodamae` | String | Number of the dam (mother) |
> | `nomedamae` | String | Name of the dam (mother) |
> | `nomecompletodamae` | String | Full name of the dam (mother) |
> | `registrodamae` | String | Registration of the dam (mother) |
> | `graucruzamento` | String | Crossbreeding grade |
> | `penultimopesoleite` | String | Milk yield of the second-to-last milk recording |
> | `datapenultimapesagemleite` | String | Date of the second-to-last milk recording |
> | `antepenultimopesoleite` | String | Milk yield of the third-to-last milk recording |
> | `dataantepenultimapesagemleite` | String | Date of the third-to-last milk recording |
> | `datasecagemprevista` | String | Expected dry-off date |
> | `datapartoprevisto` | String | Expected calving date |
> | `diasposparto` | String | Days since calving (days in milk) |
> | `ultimoecc` | String | Last body condition score |
> | `dataultimoecc` | String | Date of the last body condition score |
> | `cdanimaldetalhe` | Integer | Identifier of the animal in Ideagri's animal detail table |
> | `creprodutiva` | Integer | Reproductive status code of the animal (1 to 4, as defined by Ideagri) |
> | `cprodutiva` | Integer | Productive status code of the animal (1 to 4, as defined by Ideagri) |
> | `animalrebanho` | Integer | Whether the animal is part of the herd (1) or not (0) |
> | `dtdesmama` | String | Weaning date |
> | `dtaptidao` | String | Date the animal was released for breeding |
> | `tipoultimoparto` | String | Type of the last calving |
> | `ultimoiep` | String | Last calving interval (IEP) |
> | `ordemparto` | Integer | Calving order (parity) |
> | `ordemlactacao` | Integer | Lactation order |
> | `dataprimeirocio` | String | Date of the first heat |
> | `dataprimeiratentativa` | String | Date of the first breeding attempt |
> | `doadora` | String | Number of the donor (embryo transfer), when there is one |
> | `datacioanterior` | String | Date of the second-to-last heat |
> | `dataultimocio` | String | Date of the last heat |
> | `retencaoplacentaultimoparto` | String | Placenta retention information of the last calving |
> | `ordemtentativa` | String | Order of the current breeding attempt |
> | `extra_fields` | String | Fields Ideagri returned that this connector does not map to a column, keyed by their original names (also values that did not fit their column's type) (JSON) |

> [accordion] Sires
>
> Bulls and semen registered on each farm (the sires list of the animals route), with the same fields as Animals.
>
> Table: `sires` · Primary key: `cdfazenda`, `cdanimal` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `cdfazenda` | Integer | Internal code of the farm in Ideagri Web |
> | `cdanimal` | Integer | Identifier of the animal |
> | `numero` | String | Animal number (ear tag / herd number) |
> | `nome` | String | Name of the animal |
> | `brincoeletronico` | String | Electronic ear tag number |
> | `tipoanimal` | String | Type of record (A - Animal, S - Semen) |
> | `cdcategoria` | String | Category code and label (1 - male in growth, 2 - sire, 3 - teaser bull, 4 - draft ox, 5 - female in growth, 6 - heifer, 7 - cow) |
> | `categoria` | String | Category description |
> | `setor` | String | Current sector (pen/lot) of the animal |
> | `cdsetor` | Integer | Identifier of the current sector (see the sectors table) |
> | `grupo` | String | Current animal group |
> | `raca` | String | Breed of the animal |
> | `sexo` | String | Sex of the animal |
> | `peso` | String | Last recorded body weight |
> | `dataultimapesagem` | String | Date of the last weighing |
> | `ultimogmd` | String | Last average daily gain (GMD) |
> | `ultimopesoleite` | String | Milk yield of the last milk recording |
> | `dataultimapesagemleite` | String | Date of the last milk recording |
> | `dataultimoparto` | String | Date of the last calving |
> | `dataultimatentativa` | String | Date of the last breeding attempt |
> | `tipoultimatentativa` | String | Type of the last breeding attempt (insemination, natural service or embryo transfer) |
> | `statusreprodutivo` | String | Current reproductive status |
> | `reprodutorultimatentativa` | String | Sire used in the last breeding attempt |
> | `nomecompleto` | String | Full name of the animal |
> | `dtnascimento` | String | Birth date |
> | `regassocraca` | String | Breed association registration number |
> | `dtbaixa` | String | Date the animal left the herd (death, sale or discard), when it did |
> | `cdtipobaixa` | Integer | Code of the type of herd exit |
> | `tipobaixa` | String | Type of herd exit |
> | `cdmotivobaixa` | Integer | Identifier of the herd exit reason (see the discard\_reasons table) |
> | `motivobaixa` | String | Herd exit reason |
> | `numeropai` | String | Number of the sire (father) |
> | `nomedopai` | String | Name of the sire (father) |
> | `nomecompletodopai` | String | Full name of the sire (father) |
> | `registrodopai` | String | Registration of the sire (father) |
> | `numerodamae` | String | Number of the dam (mother) |
> | `nomedamae` | String | Name of the dam (mother) |
> | `nomecompletodamae` | String | Full name of the dam (mother) |
> | `registrodamae` | String | Registration of the dam (mother) |
> | `graucruzamento` | String | Crossbreeding grade |
> | `penultimopesoleite` | String | Milk yield of the second-to-last milk recording |
> | `datapenultimapesagemleite` | String | Date of the second-to-last milk recording |
> | `antepenultimopesoleite` | String | Milk yield of the third-to-last milk recording |
> | `dataantepenultimapesagemleite` | String | Date of the third-to-last milk recording |
> | `datasecagemprevista` | String | Expected dry-off date |
> | `datapartoprevisto` | String | Expected calving date |
> | `diasposparto` | String | Days since calving (days in milk) |
> | `ultimoecc` | String | Last body condition score |
> | `dataultimoecc` | String | Date of the last body condition score |
> | `cdanimaldetalhe` | Integer | Identifier of the animal in Ideagri's animal detail table |
> | `creprodutiva` | Integer | Reproductive status code of the animal (1 to 4, as defined by Ideagri) |
> | `cprodutiva` | Integer | Productive status code of the animal (1 to 4, as defined by Ideagri) |
> | `animalrebanho` | Integer | Whether the animal is part of the herd (1) or not (0) |
> | `dtdesmama` | String | Weaning date |
> | `dtaptidao` | String | Date the animal was released for breeding |
> | `tipoultimoparto` | String | Type of the last calving |
> | `ultimoiep` | String | Last calving interval (IEP) |
> | `ordemparto` | Integer | Calving order (parity) |
> | `ordemlactacao` | Integer | Lactation order |
> | `dataprimeirocio` | String | Date of the first heat |
> | `dataprimeiratentativa` | String | Date of the first breeding attempt |
> | `doadora` | String | Number of the donor (embryo transfer), when there is one |
> | `datacioanterior` | String | Date of the second-to-last heat |
> | `dataultimocio` | String | Date of the last heat |
> | `retencaoplacentaultimoparto` | String | Placenta retention information of the last calving |
> | `ordemtentativa` | String | Order of the current breeding attempt |
> | `extra_fields` | String | Fields Ideagri returned that this connector does not map to a column, keyed by their original names (also values that did not fit their column's type) (JSON) |

> [accordion] Calvings
>
> Every calving recorded on each farm, with calving order, calving interval, calf sex, sire and body condition score.
>
> Table: `calvings` · Primary key: `cdfazenda`, `cdanimal`, `data`, `occurrence` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `cdfazenda` | Integer | Internal code of the farm in Ideagri Web |
> | `cdanimal` | Integer | Identifier of the dam (see the animals table) |
> | `data` | String | Calving date |
> | `occurrence` | Integer | Position of this row among the rows with the same farm, animal and calving date (1 for the first; more only when Ideagri returns several, e.g. twins) |
> | `cdreproducao` | String | Identifier of the reproduction (breeding) that led to this calving |
> | `num_coberturas` | String | Number of services (inseminations or matings) until conception |
> | `ordem_parto` | String | Calving order (parity) |
> | `iep` | String | Calving interval (days since the previous calving) |
> | `sexo_cria` | String | Sex of the calf |
> | `doadora` | String | Donor (embryo transfer) |
> | `pcio` | String | Expected next heat |
> | `pcob` | String | Expected next service |
> | `ultcob` | String | Last service |
> | `ecc_parto` | String | Body condition score at calving |
> | `cioant` | String | Previous heat |
> | `ultcio` | String | Date of the last heat |
> | `reprodutor` | String | Sire |
> | `cond_parto` | String | Calving condition |
> | `ecc_tent` | String | Body condition score on the date of the breeding attempt that led to this calving |
> | `setor` | String | Sector |
> | `extra_fields` | String | Fields Ideagri returned that this connector does not map to a column, keyed by their original names (also values that did not fit their column's type) (JSON) |

> [accordion] Lactations
>
> Every lactation of each farm, with start date, length, total and 305-day production, peak, average, SCC, protein and dry-off date.
>
> Table: `lactations` · Primary key: `cdfazenda`, `cdlactacao` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `cdfazenda` | Integer | Internal code of the farm in Ideagri Web |
> | `cdlactacao` | String | Identifier of the lactation |
> | `cdanimal` | Integer | Identifier of the cow (see the animals table) |
> | `dtinicio` | String | Start date of the lactation |
> | `ordem_lactacao` | String | Lactation order |
> | `duracao` | String | Length of the lactation (days) |
> | `producao_total` | String | Total milk produced in the lactation |
> | `data_secagem` | String | Dry-off date |
> | `prod305` | String | Milk produced in the first 305 days (305-day yield) |
> | `ccs` | String | Somatic cell count (SCC) |
> | `proteina` | String | Protein |
> | `pico` | String | Peak milk yield |
> | `nro_controles` | String | Number of milk recordings in the lactation |
> | `ultpes` | String | Milk yield of the last recording |
> | `dtultlei` | String | Date of the last milk recording |
> | `media` | String | Average milk yield |
> | `producaototalinformada` | String | Total production as entered by the user |
> | `induzida` | String | Whether the lactation was induced |
> | `extra_fields` | String | Fields Ideagri returned that this connector does not map to a column, keyed by their original names (also values that did not fit their column's type) (JSON) |

### Health and registries

> [accordion] Mastitis Treatments
>
> Base mastitis treatment protocols of each farm and their validity, from the Start Date month to the current month.
>
> Table: `mastitis_treatments` · Primary key: `cdfazenda`, `cdtratamentobase`, `dtinicio` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `cdfazenda` | Integer | Internal code of the farm in Ideagri Web |
> | `cdtratamentobase` | String | Code of the base mastitis treatment |
> | `descricao` | String | Description of the treatment |
> | `dtinicio` | String | Start date of the treatment's validity |
> | `dtfim` | String | End date of the treatment's validity |
> | `considerarproximosmeses` | Boolean | Whether the treatment carries over to the next months |
> | `ultimo_mes_referencia` | String | Last reference month (MM/YYYY) in which Ideagri returned this treatment during this sync |
> | `extra_fields` | String | Fields Ideagri returned that this connector does not map to a column, keyed by their original names (also values that did not fit their column's type) (JSON) |

> [accordion] Products
>
> Active products of each farm, flagged when Ideagri lists them as veterinary products.
>
> Table: `products` · Primary key: `cdfazenda`, `cdproduto` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `cdfazenda` | Integer | Internal code of the farm in Ideagri Web |
> | `cdproduto` | Integer | Identifier of the product |
> | `nome` | String | Name of the product |
> | `veterinario` | Boolean | Whether Ideagri lists the product among the farm's active veterinary products |
> | `extra_fields` | String | Fields Ideagri returned that this connector does not map to a column, keyed by their original names (also values that did not fit their column's type) (JSON) |

> [accordion] Diseases
>
> Diseases registered on each farm.
>
> Table: `diseases` · Primary key: `cdfazenda`, `cddoenca` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `cdfazenda` | Integer | Internal code of the farm in Ideagri Web |
> | `cddoenca` | Integer | Identifier of the disease |
> | `nomeresumido` | String | Short name of the disease |
> | `nomecompleto` | String | Full name of the disease |
> | `padrao` | Boolean | Whether the disease is a system default |
> | `extra_fields` | String | Fields Ideagri returned that this connector does not map to a column, keyed by their original names (also values that did not fit their column's type) (JSON) |

> [accordion] Discard Reasons
>
> Reasons for an animal leaving the herd (sale, death, discard).
>
> Table: `discard_reasons` · Primary key: `cdfazenda`, `cdmotivobaixa` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `cdfazenda` | Integer | Internal code of the farm in Ideagri Web |
> | `cdmotivobaixa` | Integer | Identifier of the herd exit (discard) reason |
> | `descricao` | String | Description of the herd exit reason |
> | `extra_fields` | String | Fields Ideagri returned that this connector does not map to a column, keyed by their original names (also values that did not fit their column's type) (JSON) |

> [accordion] Dry-off Reasons
>
> Reasons for drying off a cow.
>
> Table: `dry_off_reasons` · Primary key: `cdfazenda`, `cdmotivosecagem` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `cdfazenda` | Integer | Internal code of the farm in Ideagri Web |
> | `cdmotivosecagem` | Integer | Identifier of the dry-off reason |
> | `descricao` | String | Description of the dry-off reason |
> | `extra_fields` | String | Fields Ideagri returned that this connector does not map to a column, keyed by their original names (also values that did not fit their column's type) (JSON) |

> [accordion] Sectors
>
> Sectors (pens, lots) of each farm.
>
> Table: `sectors` · Primary key: `cdfazenda`, `cdsetor` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `cdfazenda` | Integer | Internal code of the farm in Ideagri Web |
> | `cdsetor` | Integer | Identifier of the sector (pen/lot) |
> | `nome` | String | Name of the sector |
> | `extra_fields` | String | Fields Ideagri returned that this connector does not map to a column, keyed by their original names (also values that did not fit their column's type) (JSON) |

> [accordion] Animal Groups
>
> Active animal groups of each farm.
>
> Table: `animal_groups` · Primary key: `cdfazenda`, `cdgrupoanimal` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `cdfazenda` | Integer | Internal code of the farm in Ideagri Web |
> | `cdgrupoanimal` | Integer | Identifier of the animal group (only active groups are returned) |
> | `nome_grupo` | String | Name of the animal group |
> | `tipo_grupo` | String | Type of the animal group (empty when the group has no type) |
> | `extra_fields` | String | Fields Ideagri returned that this connector does not map to a column, keyed by their original names (also values that did not fit their column's type) (JSON) |

> [accordion] Breeds
>
> Breeds registered on each farm.
>
> Table: `breeds` · Primary key: `cdfazenda`, `cdraca` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `cdfazenda` | Integer | Internal code of the farm in Ideagri Web |
> | `cdraca` | Integer | Identifier of the breed |
> | `nome` | String | Name of the breed |
> | `sigla` | String | Abbreviation of the breed |
> | `extra_fields` | String | Fields Ideagri returned that this connector does not map to a column, keyed by their original names (also values that did not fit their column's type) (JSON) |

> [accordion] Tanks
>
> Milk tanks of each farm.
>
> Table: `tanks` · Primary key: `cdfazenda`, `cdtanque` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `cdfazenda` | Integer | Internal code of the farm in Ideagri Web |
> | `cdtanque` | Integer | Identifier of the milk tank |
> | `nome` | String | Name of the milk tank |
> | `extra_fields` | String | Fields Ideagri returned that this connector does not map to a column, keyed by their original names (also values that did not fit their column's type) (JSON) |

> [accordion] Farm Parameters
>
> Configuration parameters of each farm, farm-wide or per sector.
>
> Table: `farm_parameters` · Primary key: `cdfazenda`, `cdparametro`, `cdsetor`, `occurrence` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `cdfazenda` | Integer | Internal code of the farm in Ideagri Web |
> | `cdparametro` | String | Identifier of the parameter |
> | `cdsetor` | String | Identifier of the sector the value applies to (empty for farm-wide parameters) |
> | `occurrence` | Integer | Position of this row among the rows with the same farm, parameter and sector (normally 1) |
> | `nome` | String | Name of the parameter |
> | `valor` | String | Value of the parameter |
> | `extra_fields` | String | Fields Ideagri returned that this connector does not map to a column, keyed by their original names (also values that did not fit their column's type) (JSON) |

> [accordion] IATF Protocols
>
> Fixed-time artificial insemination (IATF) protocols of each farm.
>
> Table: `iatf_protocols` · Primary key: `cdfazenda`, `cdprotocolo` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `cdfazenda` | Integer | Internal code of the farm in Ideagri Web |
> | `cdprotocolo` | String | Identifier of the fixed-time artificial insemination (IATF) protocol |
> | `descricao` | String | Description of the protocol |
> | `extra_fields` | String | Fields Ideagri returned that this connector does not map to a column, keyed by their original names (also values that did not fit their column's type) (JSON) |

> [accordion] Farm People
>
> Ideagri FIT app users and inseminators of each farm, with the sectors they work in. Passwords are never loaded.
>
> Table: `farm_people` · Primary key: `cdfazenda`, `role`, `cdpessoa` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `cdfazenda` | Integer | Internal code of the farm in Ideagri Web |
> | `role` | String | Which list the person comes from: fit\_user (listaPessoasFit) or inseminator (listaInseminadores) |
> | `cdpessoa` | String | Identifier of the person |
> | `nome` | String | Name of the person |
> | `login` | String | Login of the person in the Ideagri FIT app |
> | `lista_setores` | String | Sectors the person works in, with their details (passwords removed) (JSON) |
> | `extra_fields` | String | Fields Ideagri returned that this connector does not map to a column, keyed by their original names (also values that did not fit their column's type) (JSON) |

### Rankings

> [accordion] Rankings
>
> The classification rankings that exist in Ideagri.
>
> Table: `rankings` · Primary key: `id` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | Integer | Identifier of the ranking |
> | `nome` | String | Name of the ranking |
> | `extra_fields` | String | Fields Ideagri returned that this connector does not map to a column, keyed by their original names (also values that did not fit their column's type) (JSON) |

> [accordion] Ranking Results
>
> Every ranking applied to every farm, as it stands at sync time.
>
> Table: `ranking_results` · Primary key: `cdfazenda`, `cdranking`, `numero`, `occurrence` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `cdfazenda` | Integer | Internal code of the farm in Ideagri Web |
> | `cdranking` | Integer | Identifier of the ranking applied (see the rankings table) |
> | `numero` | String | Number of the ranked entity (usually the animal number) |
> | `occurrence` | Integer | Position of this row among the rows with the same farm, ranking and number (normally 1) |
> | `max` | Number | Maximum value of the ranked measure |
> | `posicao` | Integer | Position of the entity in the ranking, in the order Ideagri returned it (1 = first) |
> | `extra_fields` | String | Fields Ideagri returned that this connector does not map to a column, keyed by their original names (also values that did not fit their column's type) (JSON) |

### Monthly indicators

> [accordion] Milk Statistics
>
> Monthly milk statistics per farm: cows in milk, days in milk, discarded milk, milk production and average, bacterial count, fat, protein and milk urea nitrogen.
>
> Table: `milk_statistics` · Primary key: `cdfazenda`, `tipo_consulta`, `ano`, `mes` · Sync: Incremental (by `periodo`)
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `cdfazenda` | Integer | Internal code of the farm in Ideagri Web |
> | `tipo_consulta` | String | Statistic: vacas\_lactacao (cows in milk), dias\_lactacao (days in milk), descarte\_leite (discarded milk), producao\_leite (milk production), media\_producao\_leite (average milk production), contagem\_bacteriana (bacterial count), percent\_gordura\_leite (fat %), percent\_proteina\_leite (protein %), percent\_NUL\_leite (milk urea nitrogen) |
> | `ano` | Integer | Year of the value |
> | `mes` | Integer | Month of the value (1-12) |
> | `periodo` | Datetime | First day of the month of the value (UTC), used as the incremental replication key |
> | `valor` | Number | Value of the statistic for the farm in the month, as Ideagri computes it |
> | `extra_fields` | String | Fields Ideagri returned that this connector does not map to a column, keyed by their original names (also values that did not fit their column's type) (JSON) |

> [accordion] Monthly Indices
>
> Monthly herd indices per farm: cows, heifers and females, first-calf cows, age at first breeding and calving, service and voluntary waiting periods, daily production, days in milk, tank analyses (SCC, bacterial count, fat, protein) and SCC counts of cows.
>
> Table: `monthly_indices` · Primary key: `cdfazenda`, `indicador`, `periodo` · Sync: Incremental (by `periodo`)
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `cdfazenda` | Integer | Internal code of the farm in Ideagri Web |
> | `indicador` | String | Index name as Ideagri returns it, e.g. vacas\_lactacao, vacas\_totais, novilhas\_totais, primiparas, producao\_diaria\_media, producao\_diaria\_media\_animal, del\_medio\_ultimo\_dia, periodo\_servico, periodo\_descanso, ccs\_analise\_tanque, cbt\_analise\_tanque |
> | `periodo` | Datetime | First day of the month of the value (UTC), used as the incremental replication key |
> | `mes_ano` | String | Month of the value as Ideagri returns it (MM/YYYY) |
> | `valor` | Number | Value of the index for the farm in the month |
> | `extra_fields` | String | Fields Ideagri returned that this connector does not map to a column, keyed by their original names (also values that did not fit their column's type) (JSON) |

## Implementation Notes

### Data Quality Considerations

* Ideagri Web holds what the farm's Ideagri software last sent to it. The **Farm Last Processing** table shows when that happened for each farm.
* Ideagri has no filter by change date and no pagination, so every sync reads each farm's whole lists. A table is only sent when every farm was read: if one farm fails, nothing is sent for that table in that run.
* If a farm that had rows returns none, or Ideagri no longer lists it for the user, that table stops with a warning instead of emptying the farm's rows. A farm you leave out with Farm Codes is not an error. If the data or the farm access really was removed in Ideagri, run a full sync to accept it.
* Mastitis Treatments are treatment protocols and their validity periods (one row per treatment and validity start), not mastitis cases per cow.
* Monthly Indices are asked one farm at a time, because Ideagri averages over all the farms in one request. The current month is partial until it ends and is read again on the next syncs.
* `calvings` and `ranking_results` have no record id in Ideagri; `occurrence` numbers rows that repeat the same key (for example, twins).

### API Limits & Performance

* Requests are sequential. Large herds take longer, because the animals list of each farm comes in a single answer.
* Milk Statistics makes one request per farm, statistic and year, and Mastitis Treatments one per farm and month since the Start Date: an early Start Date makes the first sync longer.
* Ranking Results makes one request per ranking and farm.

### Not available through the Ideagri API

Ideagri's API only lets other systems **send** individual milk recordings, inseminations, pregnancy diagnoses, weighings, product applications, mastitis cases, dry-offs and herd exits into Ideagri; it does not return them. Those events are therefore not available as tables, except through the latest values kept on each animal (last weighing, last three milk recordings, last calving, last breeding attempt) and through the monthly indicators. Financial, stock and sales data are not in the Ideagri API.

## Troubleshooting

| Error or symptom | What it means | What to do |
| :- | :- | :- |
| Ideagri did not accept the username and password | The credentials are wrong, the user is blocked, or API access is not enabled for the user. | Sign in to Ideagri Web with them; if that works, ask Ideagri support to enable API access and confirm the Data Origin. |
| The user has no farms associated | The user can sign in but sees no farm. | Associate the farms with the user in Ideagri Web, or use another user. |
| Farm Codes lists farms the user cannot access | A code in Farm Codes is not associated with the user. | Fix Farm Codes (the message lists the codes the user can access). |
| A table was skipped because the user is not allowed to read it | Ideagri refused that data for this user (HTTP 403). The other tables still load. | Ask Ideagri support to authorize the user, or deselect the table. Monthly Indices may need a corporate platform user. |
| A table stopped because a farm returned no records, or is no longer listed | A farm that had rows returned none, or the user lost access to it. Nothing was sent for that table in that run. | Check the farm's association with the user in Ideagri Web. If the data or the access really was removed, run a full sync. Otherwise contact support with the source slug and the run ID. |

## Skills for agents

<Snippet file="agent-skills-intro.mdx" />

> [card] [Download Ideagri skills file](https://docs.nekt.com/sources/ideagri.md)
>
> Ideagri connector documentation as plain markdown, for use in AI agent contexts.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.