> ## 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.

# Feegow as a data source

> Bring data from Feegow Clinic to Nekt.

Feegow Clinic is a Brazilian clinic and practice management platform, part of the Doctoralia group. It covers the appointment agenda, the patient register, staff and their specialties, the clinical catalogue, billing, the financial ledger and stock control. Nekt reads it through Feegow's public REST API.

## Configuring Feegow 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 Feegow option from the list of connectors.

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

### 1. Add account access

Feegow authenticates with a single **API token** sent on every request. Only the licence's **master user** can issue it — no other role can, and there is no self-service developer portal.

To get it, ask your master user to open Feegow Clinic, release API access for the licence in the settings area, and copy the token that is generated. Paste that value into Nekt.

<Warning>The token is the licence's only credential and it grants access to every stream listed below, including patient and financial data. Treat it like a password and re-issue it in Feegow Clinic if it is ever exposed.</Warning>

The following configurations are available:

* **API token**: the value Feegow generates for the licence, sent as the `x-access-token` header.

* **Start date**: (Default: `2020-01-01`) how far back the first sync reads the date-filtered streams — appointments, invoices, sales, quotes and lab reports. Later syncs re-read a trailing window instead of the whole history.

* **Lookback window (days)**: (Default: `90`) how many days back each sync re-reads once history has been loaded. See *How data is kept up to date* below — this setting is what picks up a record edited after it was first read.

* **Future window (days)**: (Default: `365`) how far into the future the agenda and accounts streams read. Appointments, schedule blocks and payables are booked ahead of today, so a window that stopped at today would never see them.

* **Request window (days)**: (Default: `30`) how many days each request to a date-filtered endpoint covers. Smaller windows mean more requests but smaller, faster responses.

* **Requests per minute**: (Default: `120`) the maximum number of requests the sync sends per minute. Feegow publishes no rate limit, so this is a safety belt — lower it if Feegow starts refusing requests.

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.

<Warning>Two streams — **Patient Dependants** and **Exam Requests** — are off by default because Feegow only answers them one patient at a time. Selecting them costs at least one request per patient, so the first sync walks your whole patient register and can take a long time. Later syncs only cover patients whose record changed.</Warning>

> 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 - which is good if, for example, you want to keep every record ever fetched.
  * Full table: every time the extraction happens, we'll get the current state of the data - which is good if, for example, you don't want to have deleted data in your catalog.

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), 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)**. This will complement the incremental data extractions, ensuring that your data is completely synchronized with your source every once in a while.

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.</Warning>

## How data is kept up to date

Feegow offers a "changed since" filter on exactly one endpoint — the patient register. Every other historical endpoint is filtered by the **business date** of the record (the day of the appointment, of the financial movement, of the quote), never by when that record was last edited. Nekt works with that as follows:

* **Patients** resume exactly where the previous sync stopped, using Feegow's own change filter.
* **Every other date-filtered stream** reads the full history on the first sync, from your **Start date**, and then re-reads a trailing window of **Lookback window (days)** on each later sync. Records are matched on their primary key, so re-reading updates rows instead of duplicating them.
* **Agenda and accounts streams** also read forward by **Future window (days)**, because appointments, schedule blocks and payables exist ahead of today.

<Warning>A record edited long after its own date has left the lookback window is not picked up again. If, for example, someone corrects the status of an appointment from eight months ago and your lookback window is 90 days, that change will not reach your catalog. Widen the lookback window, or schedule an Additional Full Sync, when that matters for your reporting.</Warning>

## Things to know about Feegow data

* **Nested data is stored as JSON text.** Fields holding a list or an object — an appointment's procedures, an insurer's plans, an invoice's payments — are stored as JSON strings so that the table's columns stay stable when Feegow changes those structures. Use your warehouse's JSON functions to read them.
* **Amounts come in different units.** Feegow reports procedure, package and stock values **in cents**, while quotes and appointments are reported **in reais**. The field descriptions below say which is which; Nekt stores the number Feegow reported without converting it.
* **Staff tables include inactive people.** Feegow requires the active flag on every staff request, so Nekt asks for both values. That keeps historical appointments joinable to the professional who took them, even after that professional leaves the clinic.
* **Some modules are licensed separately.** The two Benefit Card streams read a different Feegow product. If your licence does not contract it, those streams are skipped with a message in the run log and the rest of the sync carries on normally.

# 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                                                                                           |
| ----------------------- | ------------------------- | ----------------------------------------------------------------------------------------------------- |
| Units                   | `units`                   | Clinic units (the headquarters and its branches).                                                     |
| Locations               | `locations`               | Rooms and other physical locations registered inside the units.                                       |
| Specialties             | `specialties`             | Medical specialties offered for scheduling.                                                           |
| Insurances              | `insurances`              | Health insurers (convênios) the clinic accepts, with their plans.                                     |
| Appointment Statuses    | `appointment_statuses`    | The status codes an appointment can hold, e.g. 3 = "Atendido".                                        |
| Appointment Motives     | `appointment_motives`     | The reasons a booking can be cancelled or rescheduled with.                                           |
| Appointment Channels    | `appointment_channels`    | The channels a booking can come in through.                                                           |
| Patient Sources         | `patient_sources`         | How a patient came to know the clinic (origem).                                                       |
| Private Price Tables    | `private_tables`          | Private price tables the clinic bills self-paying patients with.                                      |
| Credit Card Brands      | `credit_card_flags`       | Credit-card brands accepted in the financial module.                                                  |
| Reports                 | `reports`                 | Reports the licence can generate from Feegow Clinic.                                                  |
| Employees               | `employees`               | Staff members registered in the clinic.                                                               |
| Professionals           | `professionals`           | Healthcare professionals who take appointments.                                                       |
| Professional Insurances | `professional_insurances` | Health insurers each professional accepts.                                                            |
| Patients                | `patients`                | Patients registered in the clinic.                                                                    |
| Patient Dependants      | `patient_dependents`      | Dependants registered under a patient. *Off by default.*                                              |
| Appointments            | `appointments`            | Appointments booked in the clinic.                                                                    |
| Schedule Blocks         | `schedule_locks`          | Blocks that take slots off a professional's agenda (holidays, absences).                              |
| Procedure Types         | `procedure_types`         | The five kinds a procedure can be (consultation, exam, surgery...).                                   |
| Procedures              | `procedures`              | The procedure catalogue and its list prices.                                                          |
| Procedure Groups        | `procedure_groups`        | Groups procedures are organised into for billing and reporting.                                       |
| Procedure Packages      | `procedure_bundles`       | Packages that sell several procedures together at a bundled price.                                    |
| Health Programmes       | `health_programs`         | Health programmes (programas de saúde) patients can be enrolled in.                                   |
| Lab Reports             | `lab_reports`             | Lab reports (laudos) issued for patients.                                                             |
| Exam Requests           | `exam_requests`           | Exam orders (pedidos de exames) raised for a patient. *Off by default.*                               |
| Quotes                  | `proposals`               | Treatment quotes (propostas) presented to patients.                                                   |
| Financial Invoices      | `financial_invoices`      | Accounts payable and receivable, with their payments and line items.                                  |
| Sales                   | `sales`                   | Sales totals per invoice, as the financial module reports them.                                       |
| Vouchers                | `vouchers`                | Discount vouchers issued by the clinic.                                                               |
| Suppliers               | `suppliers`               | Suppliers the clinic buys from.                                                                       |
| Cost Centres            | `cost_centers`            | Cost centres the financial module books movements against.                                            |
| Financial Categories    | `financial_categories`    | The chart of accounts (plano de contas).                                                              |
| Current Accounts        | `current_accounts`        | Bank and cash accounts the clinic settles movements through.                                          |
| Products                | `products`                | Products registered in the stock module (materials, medicines, vaccines).                             |
| Stock Positions         | `product_positions`       | Where the stock sits right now: one row per batch, location and unit.                                 |
| Benefit Card Plans      | `benefit_card_plans`      | Plans offered by the benefit-card programme. *Off by default.* *Requires the benefit-card module.*    |
| Benefit Card Contracts  | `benefit_card_contracts`  | Benefit-card contracts signed by beneficiaries. *Off by default.* *Requires the benefit-card module.* |

## Fields by stream

Below you'll find all available data streams from Feegow and their corresponding fields:

<AccordionGroup>
  <Accordion title="Units">
    Clinic units (the headquarters and its branches).

    **Sync:** Full table · primary key `unidade_id`.

    **Fields:**

    * `unidade_id` - Unique identifier of the unit, referenced across the API as unidade\_id
    * `is_headquarters` - True when Feegow returned this unit as the licence's headquarters (matriz) rather than as a branch
    * `nome_fantasia` - Trading name of the unit
    * `cnpj` - Brazilian company registration number (CNPJ) of the unit
    * `endereco` - Street name of the unit's address
    * `numero` - Street number of the unit's address
    * `complemento` - Additional address line of the unit, e.g. floor or suite
    * `bairro` - Neighbourhood of the unit's address
    * `cidade` - City of the unit's address
    * `estado` - Brazilian state (UF) of the unit's address
    * `cep` - Postal code (CEP) of the unit's address
    * `regiao` - Region the unit is grouped under in Feegow Clinic
    * `zona` - Zone the unit is grouped under in Feegow Clinic
    * `telefone_1` - Primary phone number of the unit
    * `telefone_2` - Secondary phone number of the unit
    * `email_1` - Primary e-mail address of the unit
    * `email_2` - Secondary e-mail address of the unit
    * `foto` - URL of the unit's photo, when one is registered
    * `mapa` - URL of the unit's map location, when one is registered
    * `exibir_agendamento_online` - Whether the unit is offered for online self-scheduling
  </Accordion>

  <Accordion title="Locations">
    Rooms and other physical locations registered inside the units.

    **Sync:** Full table · primary key `id`.

    **Fields:**

    * `id` - Unique identifier of the location, referenced by appointments.local\_id
    * `local` - Name of the room or location, e.g. 'Sala 01'
    * `unidade_id` - Identifier of the unit this location belongs to
  </Accordion>

  <Accordion title="Specialties">
    Medical specialties offered for scheduling.

    **Sync:** Full table · primary key `especialidade_id`.

    **Fields:**

    * `especialidade_id` - Unique identifier of the specialty
    * `nome` - Name of the specialty, e.g. 'Médico urologista'
    * `consulta_id` - Identifier of the procedure used for an in-person consultation in this specialty
    * `consulta_online_id` - Identifier of the procedure used for an online consultation in this specialty
    * `exibir_agendamento_online` - Whether the specialty is offered for online self-scheduling
    * `codigo_tiss` - TISS code of the specialty, used when billing health insurers
  </Accordion>

  <Accordion title="Insurances">
    Health insurers (convênios) the clinic accepts, with their plans.

    **Sync:** Full table · primary key `convenio_id`.

    **Fields:**

    * `convenio_id` - Unique identifier of the health insurer
    * `nome` - Name of the health insurer, e.g. 'Bradesco Saúde'
    * `exibir_agendamento_online` - Whether the insurer is offered for online self-scheduling
    * `permite_telemedicina` - Whether the insurer allows telemedicine appointments
    * `registro_ans` - Registration number of the insurer with the Brazilian regulator (ANS)
    * `cnpj` - Brazilian company registration number (CNPJ) of the insurer
    * `endereco` - Street name of the insurer's address
    * `numero` - Street number of the insurer's address
    * `complemento` - Additional address line of the insurer
    * `bairro` - Neighbourhood of the insurer's address
    * `cidade` - City of the insurer's address
    * `estado` - Brazilian state (UF) of the insurer's address
    * `cep` - Postal code (CEP) of the insurer's address
    * `planos` - Plans offered by this insurer, as a JSON array of objects with plano\_id and plano
  </Accordion>

  <Accordion title="Appointment Statuses">
    The status codes an appointment can hold, e.g. 3 = "Atendido".

    **Sync:** Full table · primary key `id`.

    **Fields:**

    * `id` - Unique identifier of the appointment status, referenced by appointments.status\_id
    * `status` - Name of the status as shown in Feegow Clinic, e.g. 'Marcado - confirmado' or 'Não compareceu'
  </Accordion>

  <Accordion title="Appointment Motives">
    The reasons a booking can be cancelled or rescheduled with.

    **Sync:** Full table · primary key `id`.

    **Fields:**

    * `id` - Unique identifier of the cancellation or rescheduling reason
    * `motivo` - Reason as shown in Feegow Clinic, e.g. 'Solicitado pelo paciente'
  </Accordion>

  <Accordion title="Appointment Channels">
    The channels a booking can come in through.

    **Sync:** Full table · primary key `id`.

    **Fields:**

    * `id` - Unique identifier of the booking channel, referenced by appointments.canal\_id
    * `canal` - Name of the booking channel, e.g. 'Agendamento Online' or 'Clínica'
  </Accordion>

  <Accordion title="Patient Sources">
    How a patient came to know the clinic (origem).

    **Sync:** Full table · primary key `origem_id`.

    **Fields:**

    * `origem_id` - Unique identifier of the patient source
    * `nome_origem` - Name of the source, e.g. 'Eventos' or 'Indicação'
  </Accordion>

  <Accordion title="Private Price Tables">
    Private price tables the clinic bills self-paying patients with.

    **Sync:** Full table · primary key `tabela_id`.

    **Fields:**

    * `tabela_id` - Unique identifier of the private price table
    * `nome_tabela` - Name of the private price table
  </Accordion>

  <Accordion title="Credit Card Brands">
    Credit-card brands accepted in the financial module.

    **Sync:** Full table · primary key `id`.

    **Fields:**

    * `id` - Unique identifier of the card brand, referenced by payments as bandeira\_id
    * `bandeira` - Name of the card brand, e.g. 'Visa' or 'Elo'
  </Accordion>

  <Accordion title="Reports">
    Reports the licence can generate from Feegow Clinic.

    **Sync:** Full table · primary key `id`.

    **Fields:**

    * `id` - Unique identifier of the report
    * `ct` - Category the report is filed under in Feegow Clinic, e.g. 'Agenda'
    * `relatorio` - Display name of the report
    * `arquivo` - Slug of the report, the value Feegow expects when generating it
    * `sys_active` - Whether the report is active in the system
    * `permissoes` - Internal permission key required to run the report
    * `status_relatorio_id` - Identifier of the report's availability status
    * `nome_status` - Name of the report's availability status, e.g. 'Disponível'
    * `cor_status` - Colour Feegow Clinic uses for the status badge
    * `habilitado` - Whether the report is enabled for this licence
  </Accordion>

  <Accordion title="Employees">
    Staff members registered in the clinic.

    **Sync:** Full table · primary key `employee_id`.

    **Fields:**

    * `employee_id` - Unique identifier of the employee
    * `sys_user` - Identifier of the Feegow Clinic system user linked to this employee
    * `nome` - Full name of the employee
    * `email` - E-mail address of the employee
    * `cpf` - Brazilian individual taxpayer number (CPF) of the employee
    * `ativo` - Whether the employee is currently active in the clinic
  </Accordion>

  <Accordion title="Professionals">
    Healthcare professionals who take appointments.

    **Sync:** Full table · primary key `profissional_id`.

    **Fields:**

    * `profissional_id` - Unique identifier of the professional, referenced across the API as profissional\_id
    * `sys_user` - Identifier of the Feegow Clinic system user linked to this professional
    * `nome` - Full name of the professional
    * `tratamento` - Form of address used before the name, e.g. 'Dr.' or 'Dra.'
    * `rqe` - Specialist qualification registry number (RQE) of the professional
    * `conselho` - Professional council the practitioner is registered with, e.g. CRM or CRO
    * `documento_conselho` - Registration number with the professional council
    * `uf_conselho` - Brazilian state (UF) that issued the council registration
    * `foto` - URL of the professional's photo, when one is registered
    * `sexo` - Gender recorded for the professional
    * `email` - E-mail address of the professional
    * `cpf` - Brazilian individual taxpayer number (CPF) of the professional
    * `ativo` - Whether the professional is currently active in the clinic
    * `age_restriction` - Patient age range the professional accepts, as a JSON array of objects with age\_from and age\_to
    * `especialidades` - Specialties the professional practises, as a JSON array of objects with especialidade\_id, nome\_especialidade and CBOS
  </Accordion>

  <Accordion title="Professional Insurances">
    Health insurers each professional accepts.

    **Sync:** Full table · primary key `profissional_id`, `convenio_id` · read per record of `professionals`.

    **Fields:**

    * `profissional_id` - Identifier of the professional who accepts this insurer
    * `convenio_id` - Identifier of the health insurer accepted by the professional
    * `registro_ans` - Registration number of the insurer with the Brazilian regulator (ANS)
    * `nome` - Name of the health insurer
  </Accordion>

  <Accordion title="Patients">
    Patients registered in the clinic.

    **Sync:** Incremental · replication key `alterado_em` · primary key `patient_id`.

    **Fields:**

    * `patient_id` - Unique identifier of the patient, referenced across the API as paciente\_id
    * `nome` - Full name of the patient
    * `nome_social` - Social name of the patient, when one is registered
    * `nascimento` - Date of birth of the patient
    * `bairro` - Neighbourhood of the patient's address
    * `tabela_id` - Identifier of the private price table the patient is billed with
    * `sexo_id` - Identifier of the patient's registered gender
    * `email` - E-mail address of the patient
    * `celular` - Mobile phone number of the patient
    * `criado_em` - When the patient record was created, converted to UTC
    * `alterado_em` - When the patient record was last changed, converted to UTC; used as the incremental replication key
    * `programa_de_saude` - Health programmes the patient is enrolled in, as a JSON array of objects (only populated because the tap requests programa\_saude=1)
  </Accordion>

  <Accordion title="Patient Dependants">
    Dependants registered under a patient.

    **Sync:** Full table · primary key `id` · read per record of `patients`.

    **Fields:**

    * `id` - Unique identifier of the dependant link
    * `paciente_id_responsavel` - Identifier of the patient the dependant is registered under
    * `nome` - Full name of the dependant
    * `paciente_id` - Identifier of the dependant's own patient record
    * `responsavel_financeiro` - Marks the dependant as the financially responsible party ('S' when they are)
  </Accordion>

  <Accordion title="Appointments">
    Appointments booked in the clinic.

    **Sync:** Incremental · replication key `agendado_em` · primary key `agendamento_id`.

    **Fields:**

    * `agendamento_id` - Unique identifier of the appointment
    * `data` - Calendar day the appointment is scheduled for
    * `horario` - Time of day the appointment starts, as HH:MM:SS in the clinic's local time
    * `paciente_id` - Identifier of the patient the appointment belongs to
    * `procedimento_id` - Identifier of the main procedure booked
    * `status_id` - Identifier of the appointment's current status; see the appointment\_statuses stream
    * `local_id` - Identifier of the room the appointment takes place in; see the locations stream
    * `profissional_id` - Identifier of the professional who takes the appointment
    * `agendado_por` - Name of the person who created the booking
    * `notas` - Free-text notes attached to the appointment
    * `agendado_em` - When the booking was created, converted to UTC; used as the incremental replication key
    * `plano_id` - Identifier of the insurance plan the appointment is booked under
    * `canal_id` - Identifier of the channel the booking came in through; see the appointment\_channels stream
    * `convenio_id` - Identifier of the health insurer covering the appointment; empty for self-paying patients
    * `unidade_id` - Identifier of the unit the appointment takes place in
    * `tabela_id` - Identifier of the private price table applied to the appointment
    * `nome_fantasia` - Trading name of the unit the appointment takes place in
    * `retorno_id` - Identifier of the appointment this one is a follow-up of
    * `especialidade_id` - Identifier of the specialty the appointment belongs to
    * `dias_limite_retorno` - Number of days the patient has to book a free follow-up
    * `permite_retorno` - Whether the procedure entitles the patient to a follow-up appointment
    * `retorno_existe` - Whether a follow-up appointment has already been booked
    * `retorno` - Whether this appointment is itself a follow-up
    * `grupo_procedimento_id` - Identifier of the procedure group the booked procedure belongs to
    * `encaixe` - Whether the appointment was squeezed into an already full agenda
    * `telemedicina` - Whether the appointment is a telemedicine consultation
    * `primeiro_agendamento` - Whether this is the patient's first ever appointment at the clinic
    * `valor_total_agendamento` - Total value of the appointment in Brazilian reais, converted from the formatted string Feegow returns (e.g. 'R\$ 300,00')
    * `procedimentos` - Every procedure booked in this appointment, as a JSON array of objects with procedimentoID and plano
  </Accordion>

  <Accordion title="Schedule Blocks">
    Blocks that take slots off a professional's agenda (holidays, absences).

    **Sync:** Full table · primary key `id`.

    **Fields:**

    * `id` - Unique identifier of the schedule block
    * `date_start` - First day the block applies to
    * `date_end` - Last day the block applies to
    * `time_start` - Time of day the block starts, as HH:MM:SS in the clinic's local time
    * `time_end` - Time of day the block ends, as HH:MM:SS in the clinic's local time
    * `holiday_id` - Identifier of the holiday this block was generated from, when it was
    * `professional_id` - Identifier of the blocked professional; 0 when the block applies to the whole unit
    * `description` - Free-text reason registered for the block
    * `week_day` - Days of the week the block repeats on, as a JSON array of weekday numbers
    * `units` - Units the block applies to, as a JSON array of unit identifiers
  </Accordion>

  <Accordion title="Procedure Types">
    The five kinds a procedure can be (consultation, exam, surgery...).

    **Sync:** Full table · primary key `id`.

    **Fields:**

    * `id` - Unique identifier of the procedure type, referenced by procedures.tipo\_procedimento
    * `tipo` - Name of the procedure type, e.g. 'Consulta', 'Exame' or 'Cirurgia'
  </Accordion>

  <Accordion title="Procedures">
    The procedure catalogue and its list prices.

    **Sync:** Full table · primary key `procedimento_id` · read per record of `procedure_types`.

    **Fields:**

    * `procedimento_id` - Unique identifier of the procedure
    * `nome` - Name of the procedure
    * `tipo_procedimento` - Identifier of the procedure type; see the procedure\_types stream
    * `opcoes_agendamento` - Scheduling options configured for the procedure in Feegow Clinic
    * `permite_agendamento_online` - Whether patients may book this procedure themselves online
    * `preparo` - Preparation instructions given to the patient before the procedure
    * `dias_retorno` - Number of days the patient has to book a free follow-up after this procedure
    * `codigo` - Billing code of the procedure, typically the TUSS code
    * `grupo_procedimento` - Identifier of the procedure group this procedure belongs to
    * `tempo` - Expected duration of the procedure as registered in Feegow Clinic
    * `valor` - List price of the procedure, reported by Feegow in cents
    * `especialidade_id` - Specialties the procedure belongs to, as a JSON array of specialty identifiers
  </Accordion>

  <Accordion title="Procedure Groups">
    Groups procedures are organised into for billing and reporting.

    **Sync:** Full table · primary key `id`.

    **Fields:**

    * `id` - Unique identifier of the procedure group
    * `nome_grupo` - Name of the procedure group
    * `descricao_nfse` - Description used for this group on electronic service invoices (NFS-e)
    * `procedimentos` - Procedures in the group, as a JSON array of objects with id and procedimento
    * `modalidade` - Imaging modality of the group, as a JSON object with id and Modalidade
  </Accordion>

  <Accordion title="Procedure Packages">
    Packages that sell several procedures together at a bundled price.

    **Sync:** Full table · primary key `id`.

    **Fields:**

    * `id` - Unique identifier of the package
    * `nome` - Name of the package
    * `data_ultima_alteracao` - When the package was last changed, converted to UTC
    * `procedimentos` - Procedures in the package with their bundled prices in cents, as a JSON array of objects with itemID, procedimentoID and valor
  </Accordion>

  <Accordion title="Health Programmes">
    Health programmes (programas de saúde) patients can be enrolled in.

    **Sync:** Full table · primary key `programa_id`.

    **Fields:**

    * `programa_id` - Unique identifier of the health programme
    * `nome_programa` - Name of the health programme
    * `tipo_programa_id` - Identifier of the programme type
    * `programa_convenio_id` - Identifier of the health insurer the programme runs with
    * `data_inicio_programa` - First day the programme is valid for
    * `data_fim_programa` - Last day the programme is valid for
  </Accordion>

  <Accordion title="Lab Reports">
    Lab reports (laudos) issued for patients.

    **Sync:** Incremental · replication key `request_date` · primary key `lab_report_id`.

    **Fields:**

    * `lab_report_id` - Unique identifier of the lab report
    * `request_date` - Day the report was requested; used as the incremental replication key
    * `lab_report_date` - Day the report was issued
    * `patient_name` - Full name of the patient the report belongs to
    * `status_code` - Status code of the report's file, 0 meaning the file is available
    * `status_message` - Human-readable status of the report's file, e.g. 'Arquivo disponível'
  </Accordion>

  <Accordion title="Exam Requests">
    Exam orders (pedidos de exames) raised for a patient.

    **Sync:** Full table · primary key `pedido_exame_id` · read per record of `patients`.

    **Fields:**

    * `pedido_exame_id` - Unique identifier of the exam order
    * `tipo_pedido` - Kind of order: 1 for a standard order, 2 for a TISS SADT order
    * `paciente_id` - Identifier of the patient the order was raised for
    * `atendimento_id` - Identifier of the encounter the order was raised in
    * `executante_id` - Identifier of the professional or unit that carries the exam out
    * `exetutante_tipo` - Whether the performer is a 'Profissional' or another kind of provider (Feegow's own spelling of the field)
    * `observacao_pedido` - Notes written on the order, as HTML
    * `data_pedido` - When the order was raised, converted to UTC
    * `indicacao_clinica` - Clinical indication justifying the exam
    * `convenio_id` - Identifier of the health insurer covering the order
    * `profissional_solicitante_id` - Identifier of the professional who requested the exam
    * `data_solicitacao` - When the exam was requested, converted to UTC
    * `guia_id` - Identifier of the insurance claim (guia) the order belongs to
    * `exame_id` - Identifier of the exam, on orders that carry a single one
    * `exame_codigo` - Billing code of the exam, on orders that carry a single one
    * `descricao_exame` - Description of the exam, on orders that carry a single one
    * `observacao_exame` - Notes on the exam, on orders that carry a single one
    * `quantidade_exame` - Quantity requested, on orders that carry a single exam
    * `pedido_exame` - Every exam on the order, as a JSON array of objects with ExameID, ExameCodigo, DescricaoExame, ObservacaoExame and QuantidadeExame
  </Accordion>

  <Accordion title="Quotes">
    Treatment quotes (propostas) presented to patients.

    **Sync:** Incremental · replication key `proposal_last_update` · primary key `proposal_id`.

    **Fields:**

    * `proposal_id` - Unique identifier of the quote
    * `proposal_date` - Day the quote was created
    * `paciente_id` - Identifier of the patient the quote was presented to
    * `value` - Total value of the quote in Brazilian reais
    * `proposer_id` - Identifier of the professional or employee who made the quote
    * `proposer_name` - Name of the professional or employee who made the quote
    * `proposer_role` - Whether the quote was made by a 'Profissional' or by another role
    * `status` - Current status of the quote, e.g. 'Aguardando aprovação do cliente' or 'Rejeitada pelo cliente'
    * `private_table_name` - Name of the private price table the quote was priced with
    * `proposal_last_update` - When the quote was last changed, converted to UTC; used as the incremental replication key
    * `procedimentos` - Procedures quoted, as a JSON object with a label and a data array of objects carrying procedimento\_id, nome, valor and desconto
    * `unidade` - Unit the quote was issued by, as a JSON object with the unit's identifier and address
  </Accordion>

  <Accordion title="Financial Invoices">
    Accounts payable and receivable, with their payments and line items.

    **Sync:** Incremental · replication key `data` · primary key `invoice_id`.

    **Fields:**

    * `invoice_id` - Identifier of the invoice, taken from the first entry of the detalhes list
    * `movement_id` - Identifier of the financial movement behind the invoice
    * `tipo_transacao` - Side of the ledger this invoice was read from: 'C' for accounts receivable, 'D' for accounts payable
    * `data` - Date of the financial movement; used as the incremental replication key
    * `valor` - Value of the financial movement
    * `tipo_conta` - Identifier of the account type the movement belongs to
    * `conta_id` - Identifier of the account the movement belongs to
    * `responsavel` - Party responsible for the invoice
    * `descricao` - Description registered for the movement
    * `nfe` - Number of the fiscal invoice (nota fiscal) associated with the movement
    * `data_nfe` - Issue date of the associated fiscal invoice
    * `detalhes` - Every movement detail on the invoice, as a JSON array of objects
    * `pagamentos` - Payments settling the invoice, as a JSON array of objects carrying the amount, method, card brand and transaction identifiers
    * `itens` - Items billed on the invoice, as a JSON array of objects carrying the procedure, quantity, discount and execution data
  </Accordion>

  <Accordion title="Sales">
    Sales totals per invoice, as the financial module reports them.

    **Sync:** Incremental · replication key `timestamp` · primary key `invoice_id`.

    **Fields:**

    * `invoice_id` - Identifier of the invoice the sale belongs to
    * `timestamp` - When the sale was transacted, converted to UTC; used as the incremental replication key
    * `amount` - Value of the sale, converted from the decimal string Feegow returns
    * `type` - Kind of amount reported, e.g. 'gross'
  </Accordion>

  <Accordion title="Vouchers">
    Discount vouchers issued by the clinic.

    **Sync:** Full table · primary key `id`.

    **Fields:**

    * `id` - Unique identifier of the voucher
    * `codigo` - Code patients redeem the voucher with
    * `de` - First moment the voucher is valid from, converted to UTC
    * `ate` - Last moment the voucher is valid until, converted to UTC
    * `valor` - Face value of the voucher: an amount or a percentage, depending on tipo\_valor
    * `tipo_valor` - Whether valor is an amount ('V') or a percentage
    * `unidades` - Units the voucher is valid in, as a JSON array of objects with id and nomeEmpresa
    * `limite` - Maximum number of times the voucher may be redeemed
    * `expirado` - Whether the voucher's validity period has passed
    * `desativado` - Whether the voucher was deactivated by the clinic
    * `qtd_utilizado` - Number of times the voucher has been redeemed
    * `utilizado` - Whether the voucher has been redeemed at least once
    * `disponivel` - Whether the voucher can still be redeemed right now
  </Accordion>

  <Accordion title="Suppliers">
    Suppliers the clinic buys from.

    **Sync:** Full table · primary key `id`.

    **Fields:**

    * `id` - Unique identifier of the supplier
    * `nome_fornecedor` - Name of the supplier
    * `cnpj` - Brazilian company registration number (CNPJ) of the supplier
    * `cep` - Postal code (CEP) of the supplier's address
    * `endereco` - Street name of the supplier's address
    * `numero` - Street number of the supplier's address
    * `complemento` - Additional address line of the supplier
    * `cidade` - City of the supplier's address
  </Accordion>

  <Accordion title="Cost Centres">
    Cost centres the financial module books movements against.

    **Sync:** Full table · primary key `id`.

    **Fields:**

    * `id` - Unique identifier of the cost centre
    * `name` - Name of the cost centre
  </Accordion>

  <Accordion title="Financial Categories">
    The chart of accounts (plano de contas).

    **Sync:** Full table · primary key `id`.

    **Fields:**

    * `id` - Unique identifier of the financial category
    * `type` - Whether the category books income or expense
    * `name` - Name of the financial category
    * `position` - Position of the category in the chart of accounts, e.g. '2.1.4'
    * `parent_id` - Identifier of the category this one sits under; 0 at the top level
    * `description` - Description registered for the category
  </Accordion>

  <Accordion title="Current Accounts">
    Bank and cash accounts the clinic settles movements through.

    **Sync:** Full table · primary key `id`.

    **Fields:**

    * `id` - Unique identifier of the account
    * `account_name` - Name of the account, e.g. 'Tesouraria (Caixinha)'
    * `account_type` - Kind of account: 1, 2 or 3 as defined by Feegow
    * `api_enabled` - Whether the account is exposed to Feegow's API integrations
    * `percentage_deducted` - Percentage deducted from movements settled through this account
    * `empresa` - Identifier of the company (unit) the account belongs to
    * `categoriad_taxa_id` - Identifier of the financial category fees on this account are booked to (Feegow's own spelling of the field)
  </Accordion>

  <Accordion title="Products">
    Products registered in the stock module (materials, medicines, vaccines).

    **Sync:** Full table · primary key `produto_id`.

    **Fields:**

    * `produto_id` - Unique identifier of the product
    * `nome_produto` - Name of the product
    * `codigo_produto` - Code the clinic registered the product under
    * `tipo_produto` - Kind of item, e.g. 'Produto'
    * `categoria_id` - Identifier of the product's category
    * `nome_categoria` - Name of the product's category, e.g. 'Vacina'
    * `fabricante_id` - Identifier of the product's manufacturer
    * `nome_fabricante` - Name of the product's manufacturer
    * `apresentacao_nome` - Name of the presentation the product is sold in
    * `apresentacao_quantidade` - Quantity contained in one presentation
    * `unidade_medida` - Unit of measure of the product, e.g. '001 - Ampola'
    * `principio_ativo` - Active ingredient, for medicines
    * `nome_localizacao` - Name of the storage location the product is kept in
    * `tiss_cd` - TISS classification of the product, e.g. '02 - Medicamentos'
    * `dias_aviso_validade` - How many days before expiry Feegow warns about this product
    * `estoque_minimo` - Minimum stock level configured for the product
    * `estoque_minimo_tipo` - Unit the minimum stock level is expressed in
    * `estoque_maximo` - Maximum stock level configured for the product
    * `estoque_maximo_tipo` - Unit the maximum stock level is expressed in
    * `preco_compra` - Purchase price registered for the product
    * `preco_venda` - Sale price registered for the product
  </Accordion>

  <Accordion title="Stock Positions">
    Where the stock sits right now: one row per batch, location and unit.

    **Sync:** Full table · primary key `posicao_id`.

    **Fields:**

    * `posicao_id` - Unique identifier of the stock position
    * `produto_id` - Identifier of the product held in this position
    * `nome_produto` - Name of the product held in this position
    * `lote` - Batch number of the stock held
    * `validade` - Expiry date of the batch
    * `quantidade` - Quantity held, expressed in the product's presentation
    * `quantidade_itens` - Quantity held, expressed in individual items
    * `tipo_unidade` - Unit the quantity is expressed in
    * `unidade_medida` - Unit of measure of the product
    * `localizacao_id` - Identifier of the storage location the stock sits in
    * `nome_localizacao` - Name of the storage location
    * `unidade_id` - Identifier of the clinic unit holding the stock
    * `nome_unidade` - Name of the clinic unit holding the stock
    * `categoria_id` - Identifier of the product's category
    * `nome_categoria` - Name of the product's category
    * `fabricante_id` - Identifier of the product's manufacturer
    * `nome_fabricante` - Name of the product's manufacturer
    * `apresentacao_nome` - Name of the presentation the stock is counted in
    * `cbid` - Bar code registered for the batch
    * `responsavel` - Person registered as responsible for the position
    * `preco_medio_compra` - Average purchase price of the stock held
    * `valor_posicao` - Total value of the stock held in this position
  </Accordion>

  <Accordion title="Benefit Card Plans">
    Plans offered by the benefit-card programme.

    **Sync:** Full table · primary key `id`.

    **Fields:**

    * `id` - Unique identifier of the plan (a UUID)
    * `name` - Name of the plan
    * `membership_value` - Joining fee charged to the plan holder
    * `recurrence_value` - Recurring fee charged to the plan holder
    * `dependency_membership_value` - Joining fee charged per dependant
    * `dependency_recurrence_value` - Recurring fee charged per dependant
    * `creation_date` - When the plan was created, converted to UTC
    * `count_contract` - Number of contracts currently signed on this plan
  </Accordion>

  <Accordion title="Benefit Card Contracts">
    Benefit-card contracts signed by beneficiaries.

    **Sync:** Full table · primary key `contract_id`.

    **Fields:**

    * `contract_id` - Unique identifier of the contract
    * `contract_date` - Day the contract was created
    * `registration_number` - Registration number of the contract
    * `contract_person_id` - Unique identifier of the person the contract belongs to
    * `account_owner` - Identifier of the owner of the account the contract is billed to
    * `name` - Full name of the beneficiary
    * `phone` - Phone number of the beneficiary
    * `document` - Identity document number of the beneficiary
    * `birthdate` - Date of birth of the beneficiary
    * `plan_id` - Identifier of the plan the contract is signed on
    * `plan` - Name of the plan the contract is signed on
    * `status_contract` - Current status of the contract
    * `status_contract_id` - Identifier of the contract's current status
    * `amount_membership` - Joining amount agreed on the contract
    * `amount_recurrence` - Recurring amount agreed on the contract
    * `recurrence_id` - Identifier of the recurring charge behind the contract
    * `recurrence_value` - Value of the recurring charge
    * `membership_value` - Value of the joining charge
    * `contract_parameters` - Additional contract parameters, as a JSON object
    * `status_recurrence_id` - Identifier of the recurring charge's status
    * `status_recurrence_description` - Description of the recurring charge's status
    * `eligible` - Whether the contract is currently eligible (Feegow reports 1 for yes, 0 for no)
    * `final_status_description` - Final status description of the contract
  </Accordion>
</AccordionGroup>
