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

# Pega Plantão as a data source

> Bring data from Pega Plantão to Nekt.

Pega Plantão is a Brazilian workforce management platform used by hospitals and healthcare facilities to schedule, staff, and pay on-call medical shifts (plantões).

<img height="50" src="https://mintcdn.com/nekt/3vubFpYmAX-qohLj/assets/logo/logo-pegaplantao.png?fit=max&auto=format&n=3vubFpYmAX-qohLj&q=85&s=734f0ad0c99150295580fddc3ebd7d49" data-path="assets/logo/logo-pegaplantao.png" />

## Configuring Pega Plantão 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 Pega Plantão option from the list of connectors.

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

### 1. Add account access

You'll need OAuth2 credentials and a coordinator login to connect to the Pega Plantão API.

The following configurations are available:

* **Client ID**: Your OAuth2 Client ID, requested from Pega Plantão support.

* **Client Secret**: Your OAuth2 Client Secret, requested from Pega Plantão support.

* **Username**: Login of the Pega Plantão coordinator user that will be used to sync data.

* **Password**: Password of the Pega Plantão coordinator user.

* **Start Date**: (Optional) The earliest date to sync for date-filtered streams. When omitted, date-filtered streams sync full history and the daily professional-status stream starts from today.

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.

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, a folder to organize it, a name for each table, and the type of sync.

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

### 4. Configure data source

Describe your data source for easy identification within your organization.

Define your [Trigger](https://docs.nekt.com/runs/scheduling-and-triggers) based on how often you need data updated.

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.

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

<Note>
  Some endpoints documented by the Pega Plantão API are not covered by this connector: **Afastamentos** (absences) has no GET endpoint (only POST/PUT/PATCH/DELETE), and **Chamados**, **Contratos**, **Demonstrativos**, and **Fornecedores** were out of scope for the initial implementation.
</Note>

# Streams and Fields

Below you'll find all available data streams from Pega Plantão and their corresponding fields:

<AccordionGroup>
  <Accordion title="Grupos">
    | Field   | Type   |
    | ------- | ------ |
    | GroupId | string |
    | Name    | string |
  </Accordion>

  <Accordion title="Locais">
    | Field         | Type    |
    | ------------- | ------- |
    | CodLocal      | string  |
    | CodigoInterno | string  |
    | Nome          | string  |
    | Descricao     | string  |
    | Endereco      | string  |
    | Cidade        | string  |
    | Estado        | string  |
    | Latitude      | number  |
    | Longitude     | number  |
    | Ativo         | boolean |
  </Accordion>

  <Accordion title="Setores">
    | Field         | Type    |
    | ------------- | ------- |
    | CodSetor      | string  |
    | CodLocal      | string  |
    | CodigoInterno | string  |
    | Nome          | string  |
    | Descricao     | string  |
    | Ativo         | boolean |
  </Accordion>

  <Accordion title="Profissionais por Setor">
    | Field                | Type     |
    | -------------------- | -------- |
    | ProfessionalId       | string   |
    | CodLocal             | string   |
    | CodSetor             | string   |
    | Name                 | string   |
    | Email                | string   |
    | Phone                | string   |
    | Phone1               | string   |
    | ProfessionalIdUF     | string   |
    | Address              | string   |
    | Address2             | string   |
    | AddressNumber        | integer  |
    | Town                 | string   |
    | Zipcode              | string   |
    | City                 | string   |
    | State                | string   |
    | UserType             | string   |
    | InternalCode         | string   |
    | MoreDetails          | string   |
    | CompanyName          | string   |
    | CompanyTradeName     | string   |
    | CNPJ                 | string   |
    | CPF                  | string   |
    | BankNumber           | string   |
    | BankBranch           | string   |
    | BankAccount          | string   |
    | BankAccountOperation | string   |
    | AdmissionDate        | datetime |
  </Accordion>

  <Accordion title="Financeiro">
    | Field               | Type     |
    | ------------------- | -------- |
    | CodigoPlantao       | string   |
    | Local               | string   |
    | CodigoLocal         | string   |
    | Setor               | string   |
    | CodigoSetor         | string   |
    | Inicio              | datetime |
    | Fim                 | datetime |
    | Tipo                | string   |
    | Valor               | number   |
    | ValorConsiderado    | number   |
    | ProfFixo            | string   |
    | CodigoProfFixo      | string   |
    | ProfFixoStatus      | string   |
    | ProfDePlantao       | string   |
    | CodigoProfDePlantao | string   |
    | RegistroEntrada     | datetime |
    | RegistroSaida       | datetime |
    | DataCriacao         | datetime |
  </Accordion>

  <Accordion title="Plantões">
    | Field               | Type          |
    | ------------------- | ------------- |
    | CodigoPlantao       | string        |
    | Local               | string        |
    | CodigoLocal         | string        |
    | Setor               | string        |
    | CodigoSetor         | string        |
    | Inicio              | datetime      |
    | Fim                 | datetime      |
    | Tipo                | string        |
    | Valor               | number        |
    | ProfFixo            | string        |
    | CpfProfFixo         | string        |
    | CodigoProfFixo      | string        |
    | ProfFixoStatus      | string        |
    | ProfDePlantao       | string        |
    | CpfProfDePlantao    | string        |
    | CodigoProfDePlantao | string        |
    | Descricao           | string        |
    | ComentarioInterno   | string        |
    | RegistroEntrada     | datetime      |
    | RegistroSaida       | datetime      |
    | Produtividades      | string (JSON) |
    | DataCriacao         | datetime      |
    | Anunciado           | boolean       |
  </Accordion>

  <Accordion title="Profissionais (Lista)">
    | Field                | Type     |
    | -------------------- | -------- |
    | ProfessionalId       | string   |
    | Name                 | string   |
    | Email                | string   |
    | Phone                | string   |
    | Phone1               | string   |
    | ProfessionalIdUF     | string   |
    | Address              | string   |
    | Address2             | string   |
    | AddressNumber        | integer  |
    | Town                 | string   |
    | Zipcode              | string   |
    | City                 | string   |
    | State                | string   |
    | UserType             | string   |
    | InternalCode         | string   |
    | MoreDetails          | string   |
    | CompanyName          | string   |
    | CompanyTradeName     | string   |
    | CNPJ                 | string   |
    | CPF                  | string   |
    | BankNumber           | string   |
    | BankBranch           | string   |
    | BankAccount          | string   |
    | BankAccountOperation | string   |
    | AdmissionDate        | datetime |
  </Accordion>

  <Accordion title="Profissionais (Detalhes)">
    | Field                        | Type           |
    | ---------------------------- | -------------- |
    | CodProfissional              | string         |
    | Email                        | string         |
    | CodigoProfissao              | string         |
    | CodUfConselhoProfissional    | integer        |
    | RegistroConselhoProfissional | string         |
    | NomeCompleto                 | string         |
    | DataAdmissao                 | datetime       |
    | DadosContatoCodUf            | integer        |
    | DadosContatoTelefone         | string         |
    | DadosContatoCelular          | string         |
    | DadosContatoCep              | string         |
    | DadosContatoRua              | string         |
    | DadosContatoNumero           | integer        |
    | DadosContatoComplemento      | string         |
    | DadosContatoCodCidade        | integer        |
    | DadosContatoBairro           | string         |
    | EnviarConvite                | boolean        |
    | Detalhes                     | string         |
    | CodInterno                   | string         |
    | CPF                          | string         |
    | Grupos                       | array (string) |
  </Accordion>

  <Accordion title="Situação dos Profissionais">
    | Field             | Type     |
    | ----------------- | -------- |
    | CodProfissional   | string   |
    | DataInicio        | string   |
    | NomeProfissional  | string   |
    | CodSituacao       | string   |
    | Situacao          | string   |
    | HorarioPlantao    | datetime |
    | HorarioFimPlantao | datetime |
  </Accordion>

  <Accordion title="Tipos de Plantão">
    | Field         | Type   |
    | ------------- | ------ |
    | TipoPlantaoId | string |
    | Nome          | string |
    | Cor           | string |
  </Accordion>
</AccordionGroup>
