# `Ithibati.Doctor`
[🔗](https://github.com/oliverandrich/ithibati/blob/v0.6.2/lib/ithibati/doctor.ex#L1)

Checks configuration, database state and web integration without changing them.

`examine/1` checks the configured repo, database adapter, schemas, tables, indexes, session
validity, ceremony routes and handler callbacks. Database and application processes must
be available for the corresponding checks to run.

The doctor reuses configuration validation and catalogue queries from the integration itself.
`mix ithibati.doctor` starts the consuming application and prints these findings.
See [Setup checks](doctor.md) for common failures and fixes.

# `examine`

Returns an ordered list of `{subject, {status, detail}}` findings for the application.

`app` is the consuming OTP application's name. It is used to discover web integration modules.
Other checks read the configured repo and schemas.

A status is `:ok`, `:error` or `:skip`. Checks whose prerequisites are unavailable are skipped;
for example, an unreachable repo prevents database-table checks.

This function neither starts the application nor changes its configuration or database.
The Mix task starts the application before calling it.

# `key_type`

Checks whether a table's referenced account key matches Ithibati's foreign-key requirements.

Returns `{:ok, description}` or `{:error, description}`. Checks the column type against
`users_key_type` and requires a unique index on that column alone. The repo's
`:migration_foreign_key` option chooses the column, defaulting to `:id`.

`prefix` is a PostgreSQL schema prefix or `nil`. Queries the supplied repo without modifying it.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
