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

# Connectors

> Map source tables to FDA Sentinel CDM domains with YAML connectors.

A **connector** is a YAML file that maps your source tables to FDA Sentinel CDM v8.2.2 domains (diagnosis, procedure, dispensing, enrollment, …).

## Where to start

* Template: `connectors/template_sentinel/connector.yml`
* Guide: `connectors/template_sentinel/README.md`
* Sample: `connectors/postgres_local_sentinel/connector.yml`

## What you configure

* **Database**: `type` (postgres / redshift / snowflake / bigquery / mysql) and `schema`
* **Domain blocks** (top-level keys):
  * `diagnosis`, `procedure`, `dispensing`, `enrollment`, `demographic`, …
  * Table name, patient/date/code columns, code-type mappings, optional position mapping

```yaml theme={null}
name: my_sentinel_connector
type: claims
database:
  type: postgres
  schema: public

diagnosis:
  table: diagnosis_table
  patient_id_column: patid
  adate_column: adate
  dx_column: dx
  dx_code_type:
    type_column: dx_codetype
    type_mapping:
      "10": ["10", "ICD10"]
      "09": ["09", "9"]
    default_type: "10"
```

## Register and query

```python theme={null}
import encodebox as eb

eb.register_connector("connectors/my_sentinel_connector/connector.yml")

db = eb.connect(
    "postgres",
    host="localhost",
    port=5433,
    database="mydb",
    username="user",
    password="pass",
    connector="my_sentinel_connector",
)

events = db.diagnosis.matching("E11", code_type="10", match="starts_with")
```

## Registry cache

Registrations are cached locally. Inspect with `eb.list_connectors()`.

| Env / API                             | Effect              |
| ------------------------------------- | ------------------- |
| `ENCODEBOX_CONNECTOR_REGISTRY_PATH`   | Override cache path |
| `ENCODEBOX_DISABLE_CONNECTOR_CACHE=1` | Disable caching     |
| `eb.unregister_connector("name")`     | Remove one          |
| `eb.clear_connectors()`               | Clear all           |

See [Which API?](/which-api) for EventFrame / Cohort usage.
