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

# Schema Intelligence

> Point Flock at your database and it figures out the schema — table relationships, healthcare classifications, and column semantics — automatically.

Classifies tables as patient, encounter, clinical, financial, or reference — then maps foreign keys and infers column semantics like MRN fields, coded values, and date columns.

## Supported Databases

| Database   | Provider String |
| ---------- | --------------- |
| PostgreSQL | `postgres`      |
| SQL Server | `sqlserver`     |

## Connect

```bash theme={null}
pidgeon flock connect \
  --provider postgres \
  --connection-string "Host=localhost;Port=5432;Database=ehr;Username=dev;Password=${DB_PASSWORD}"
```

## What Flock Detects

* **Table classification** — Patient, encounter, clinical, financial, or reference tables
* **Relationship mapping** — Foreign key detection and dependency ordering
* **Column type inference** — Identifies MRN fields, date columns, coded values, free text
* **Healthcare patterns** — Recognizes common EHR table naming conventions

## API

```bash theme={null}
# Connect and analyze
curl -X POST http://localhost:5102/api/flock/connect \
  -H "Content-Type: application/json" \
  -d '{"provider": "postgres", "connectionString": "Host=localhost;Database=ehr;..."}'

# Retrieve analyzed schema
curl http://localhost:5102/api/flock/schema
```
