# LATAM — data source

LATAM reuses the **EMEA + APAC model contract** (Fit × Signal → P0/P1/P2). It gets its own database
and its own scored table, the same way EMEA and APAC do — regions share a *model contract*, never a
database. See [`../universal/`](../universal).

## Connection (non-secret parts)

| Field | Value |
|---|---|
| Host | `gateway01.us-west-2.prod.aws.tidbcloud.com` |
| Port | `4000` |
| Database | `latam_regional_support` |
| User | `24PhqKzMs8ahE6U.latam_readonly` (read-only) |
| TLS | required (`--ssl-mode=REQUIRED`) |
| Scored table | `latam_active_tenants` — full result set lands here |

Other tables in the same database: `domain_intelligence` (email-domain → `entity_ai_category` /
`icp_categories`, cached OpenAI classification — same mechanism as EMEA and APAC), `latam_key_leads`,
`latam_tenant_events`, `latam_tenant_score_snapshots` (daily per-tenant score history).

Schema source of truth: [`latam_lambda_tasks/schema.sql`](https://github.com/pingcap-inc/pingcap-support/blob/main/latam_lambda_tasks/schema.sql).

**The password is not in this repo and must not be.** ~195 people in `pingcap-inc` have read access
to this repo (org base permission), so a committed credential is effectively shared with all of
them. EMEA and APAC both deliberately keep theirs out — see
[`../emea/emea-q1-2026-gm-ceo-brief.sql`](../emea/emea-q1-2026-gm-ceo-brief.sql) (`use
REGIONAL_SUPPORT_DSN env var — do NOT commit credentials`) and
[`../emea/scripts/ingest_aws_activate_batch.py`](../emea/scripts/ingest_aws_activate_batch.py)
(`TIDB_PASSWORD` from the environment).

## How to connect

Put the password in your shell profile or a local `.env` (gitignored), not in a file you commit:

```bash
export LATAM_READONLY_DSN='mysql://24PhqKzMs8ahE6U.latam_readonly:<password>@gateway01.us-west-2.prod.aws.tidbcloud.com:4000/latam_regional_support'
```

Then:

```bash
mysql --ssl-mode=REQUIRED "$LATAM_READONLY_DSN" -e 'SELECT COUNT(*) FROM latam_active_tenants;'
```

Or with discrete env vars (same names `ingest_aws_activate_batch.py` uses):

```bash
export TIDB_HOST=gateway01.us-west-2.prod.aws.tidbcloud.com
export TIDB_PORT=4000
export TIDB_USER='24PhqKzMs8ahE6U.latam_readonly'
export TIDB_PASSWORD='...'          # never commit
export TIDB_DATABASE=latam_regional_support
```

## Model status

Running the **EMEA + APAC model unchanged** for a burn-in period before tuning thresholds for
Mexico + Brazil. Do not re-cut thresholds until there is enough LATAM history to judge them against
— the region's volume is much smaller than EMEA's, so early P0/P1 counts will be noisy.

Scoring is `Activity(40) + Fit(30) + Urgency(30)`, written back to `latam_active_tenants` as
`total_score` / `priority` / `key_lead` plus a daily row in `latam_tenant_score_snapshots`. The
Lambda [`scoring_function.py`](https://github.com/pingcap-inc/pingcap-support/blob/main/latam_lambda_tasks/LATAM-Tenants-Scoring-Task/scoring_function.py)
is the source of truth for thresholds, not this repo.

Field contract every region must emit: [`../universal/data-contract.md`](../universal/data-contract.md).
`latam_active_tenants` columns were read from `schema.sql` in the engineering repo, not from a live
connection (no `mysql` client on this machine) — so the schema is confirmed, the *population* of each
column is not. Spot-check nullable signal columns (`tenant_avg_qps`, `entity_ai_category`,
`icp_categories`, `track_step`) for real fill rates before trusting any downstream queue.
