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

# Introduction

> EncodeBox generates Sentinel CDM SQL from Python — no ETL materialization.

EncodeBox generates Sentinel CDM SQL from Python — no ETL materialization.

## Mental model

```text theme={null}
Database      eb.connect(..., connector=...) → db.diagnosis, db.medication, …
EventFrame    everyday event queries          → matching / occurring / first_per_patient
Cohort        study definition                → entry / include / exclude / attrition
Table/Column  custom predicates               → when verbs are not enough
```

Start with **EventFrame**. Add a **Cohort** when you need labeled criteria and an attrition table. Use **Table/Column** only for unusual predicates.

## Example

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

db = eb.connect(..., connector="my_sentinel_connector")

index = (
    db.diagnosis
    .matching("E11", code_type="10", match="starts_with")
    .occurring(at_least=2, gap_days=30)
    .with_index_date()
    .first_per_patient()
)

other = (
    db.diagnosis
    .matching("E10", code_type="10", match="starts_with")
    .occurring(at_least=2, gap_days=30)
    .first_per_patient()
)

cohort = (
    eb.Cohort("t2dm", database=db)
    .entry(index, index="first")
    .include(db.demographic.age_at_index(18, 89))
    .include(other, window=(-365, 0))
)
```

**EventFrame** finds qualifying events. **Cohort** starts from an index and requires or excludes EventFrames and criteria (`age_at_index`, `covering_index`, …). `.include(other_frame, window=...)` reuses another event definition.

## Next steps

<Columns cols={2}>
  <Card title="Quickstart" icon="rocket" href="/quickstart">
    Register a connector, connect, and run your first query.
  </Card>

  <Card title="Which API?" icon="diagram-project" href="/which-api">
    Choose EventFrame, Cohort, or Table/Column.
  </Card>

  <Card title="Connectors" icon="plug" href="/connectors">
    Map your tables to Sentinel CDM domains.
  </Card>

  <Card title="API map" icon="code" href="/api">
    Curated map of the public API.
  </Card>
</Columns>

<Note>
  Legacy `query_event` / `filter_event` still work via deprecation shims. See [Migration](/migration).
</Note>
