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

# Moderna Sistemas as a data source

> Bring data from ModernaNet (Moderna Sistemas) to your Lakehouse.

ModernaNet, by Moderna Sistemas, is a management system for clinics and hospitals in Brazil: scheduling, electronic health records, billing, and finance. The connector reads the ModernaNet **integration API** and brings the daily agenda of your clinic — every appointment with its unit, agenda, professional, procedure, patient, and status — to your Lakehouse. It can also extract any other report Moderna enables for your integration.

ModernaNet has no self-service API. Moderna enables the integration API for each installation as a contracted service, and provides the address and the credentials when it does.

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

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

### 1. Add account access

The connector authenticates with the **username and password of an integration user** that Moderna creates for you.

<Warning>
  Before creating the source, ask Moderna (your support or account contact) to enable the **generic integration API** (API Genérica) for Nekt and to send you:

  * the **address of the integration API** of your installation;
  * the **username and password** of the integration user, authorized to run the **DADOSAGENDAMENTO** query (appointments of a day) and any other query you want to extract.

  Only Moderna can authorize a user to run a query. If your server restricts access by IP address, also ask Moderna or your IT team to allow Nekt's public IP, shown in the "Helpful resources" section when you connect the source.
</Warning>

The following configurations are available:

* **API URL**: the address of the integration API provided by Moderna, usually ending in `/api/Moderna` (for example `https://<your-server>/api/Moderna`). It is not the address of the ModernaNet login page. Required.

* **Username**: the integration username provided by Moderna. Required.

* **Password**: the integration password provided by Moderna. Required.

* **Start Date**: the first day to extract on the first sync. Leave it empty to start one year back.

* **Lookback Days**: how many days before the last sync point are read again on every sync, so appointments whose status changed afterwards (confirmed, attended, cancelled) are updated. The default is 7.

* **Future Days**: how many days after today are read on every sync, so upcoming appointments are captured and kept up to date. The default is 60.

* **Appointments Query Name**: the name of the Moderna query that returns the appointments of a day. The default, `DADOSAGENDAMENTO`, is the name in Moderna's documentation; change it only if Moderna enabled it under another name.

* **Custom Queries**: other queries Moderna enabled for your integration (for example billing or financial reports). Each one becomes its own table. For each query, fill in:
  * **Table name**: lowercase letters, numbers, and underscores, starting with a letter (for example `billing`).
  * **Moderna query name**: the name of the query as Moderna enabled it (for example `DADOSFATURAMENTO`).
  * **Date parameter** (optional): the name of the query's date filter (for example `DATAPARAM`). When filled, the query is read one day at a time and synced incrementally; leave it empty to read the whole query on every sync.
  * **Date format** (optional): the layout of the date sent in the date parameter. The default is `YYYYMMDD` (for example `20251117`).
  * **Fixed filters** (optional): other filters sent on every call, as a JSON object, such as `{"ID_UNIDADE": 1}`.
  * **Key columns** (optional): the columns that identify a row, as Moderna names them (for example `ID_CONTA`). Without them, rows are identified by their full content.

* **Time Zone**: the time zone of the clinic, used to decide which day is today and to build appointment timestamps. The default is `America/Sao_Paulo`.

* **Requests Per Minute**: the maximum number of calls per minute sent to Moderna. Every call runs a query on your ModernaNet database, so the default of 60 is deliberately gentle.

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.

> 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**: Appointments, and custom queries with a date parameter, support INCREMENTAL. Custom queries without a date parameter are always read in full. Read more about Sync Types [here](https://docs.nekt.com/get-started/core-concepts/types-of-sync).

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/get-started/core-concepts/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.

<Note>Moderna's API returns a whole day in a single call, so the connector reads your agenda one day at a time. The first sync of a long history takes one call per day (about 6 minutes per year at the default pace).</Note>

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>

# Streams and Fields

Below you'll find all available data streams from Moderna Sistemas and their corresponding fields. Columns keep the names Moderna uses in its queries, in lowercase, so they match Moderna's documentation.

<AccordionGroup>
  <Accordion title="Appointments">
    Every appointment of each day, from the `DADOSAGENDAMENTO` query. Each sync reads from the last sync point minus the lookback days up to the configured number of future days.

    Primary key: `id_agendamento` · Replication key: `query_date`

    | Field                   | Type     | Description                                                                                                                                                                |
    | :---------------------- | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | `id_agendamento`        | Integer  | Identifier of the appointment. In ModernaNet it identifies the agenda slot the patient was booked into.                                                                    |
    | `query_date`            | Date     | Day the connector asked Moderna for, used as the incremental replication key.                                                                                              |
    | `data_agendamento`      | Date     | Date of the appointment.                                                                                                                                                   |
    | `hora_agendamento`      | String   | Local time of the appointment, as returned by Moderna (for example `13:45`).                                                                                               |
    | `scheduled_at`          | Datetime | Date and time of the appointment, in the time zone configured on the source.                                                                                               |
    | `status_agendamento`    | String   | Status of the appointment in ModernaNet (for example `Agendado`).                                                                                                          |
    | `id_unidade`            | Integer  | Identifier of the clinic unit.                                                                                                                                             |
    | `unidade`               | String   | Name of the clinic unit.                                                                                                                                                   |
    | `id_grupo_agenda`       | Integer  | Identifier of the agenda group (for example consultations or diagnostics).                                                                                                 |
    | `grupo_agenda`          | String   | Name of the agenda group.                                                                                                                                                  |
    | `id_agenda`             | Integer  | Identifier of the agenda.                                                                                                                                                  |
    | `agenda`                | String   | Name of the agenda.                                                                                                                                                        |
    | `id_paciente`           | Integer  | Identifier of the patient.                                                                                                                                                 |
    | `paciente`              | String   | Name of the patient.                                                                                                                                                       |
    | `cpf_paciente`          | String   | CPF (tax ID) of the patient.                                                                                                                                               |
    | `telefone`              | String   | Phone number of the patient.                                                                                                                                               |
    | `celular`               | String   | Mobile phone number of the patient.                                                                                                                                        |
    | `id_profissional`       | Integer  | Identifier of the professional (a doctor or an equipment agenda).                                                                                                          |
    | `profissional`          | String   | Name of the professional (a doctor or an equipment agenda).                                                                                                                |
    | `codigo_exame`          | Integer  | Code of the booked procedure or exam.                                                                                                                                      |
    | `nome_exame`            | String   | Name of the booked procedure or exam.                                                                                                                                      |
    | `especialidade_exame`   | String   | Specialty of the booked procedure or exam.                                                                                                                                 |
    | `protocolo_agendamento` | String   | Booking protocol number, when ModernaNet issues one.                                                                                                                       |
    | `dataparam`             | String   | Date parameter echoed back by Moderna, as returned (for example `20251117`).                                                                                               |
    | `extra_fields`          | String   | Fields returned by the query that are not listed above, as a JSON object. Moderna tailors each query per installation, so extra fields land here instead of being dropped. |
  </Accordion>

  <Accordion title="Custom queries">
    One table per entry of **Custom Queries**, named after its table name. The columns of a custom query are defined by Moderna, so each row is stored whole as JSON.

    Primary key: `row_key` · Replication key: `query_date` (only when a date parameter is configured)

    | Field        | Type   | Description                                                                                                                           |
    | :----------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------ |
    | `row_key`    | String | Identifier of the row: the values of the key columns joined with `\|`, or a hash of the whole row when no key columns are configured. |
    | `query_date` | Date   | Day sent in the query's date parameter, used as the incremental replication key. Empty for queries without a date parameter.          |
    | `record`     | String | The row exactly as returned by Moderna, as a JSON object with Moderna's column names.                                                 |
  </Accordion>
</AccordionGroup>

## Troubleshooting

| Symptom                                                 | Likely cause                                                                                     | What to do                                                                                        |
| :------------------------------------------------------ | :----------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------ |
| Username and password refused                           | The credentials are wrong, or the user is not authorized to run the query.                       | Check the credentials with Moderna and ask them to authorize the user for each query you extract. |
| "The API address answered with a web page"              | The API URL points to the ModernaNet login page or to a wrong path.                              | Use the integration API address Moderna provided, usually ending in `/api/Moderna`.               |
| A query could not be found                              | The query name differs from the one enabled for your installation.                               | Confirm the exact query name with Moderna and update Appointments Query Name or the custom query. |
| A cancelled appointment still shows its previous status | ModernaNet frees the slot when an appointment is cancelled, and the query may stop returning it. | Confirm with Moderna whether the query returns cancelled appointments.                            |
