# Referential integrity checker

- Human page: https://happytails.ai/en/data-tools/referential-integrity-checker/
- Markdown: https://happytails.ai/en/data-tools/referential-integrity-checker.md
- Structured JSON: https://happytails.ai/agents/en/data-tools/referential-integrity-checker/index.json
- Visibility: public

## Tool capabilities

| Property | Value |
| --- | --- |
| Tool ID | `referential-integrity-checker` |
| Category | data-tools |
| Implementation | Registered implementation. Registration alone is not a production-quality guarantee. |
| Browser execution | Automatic updates after valid input or file selection. |
| Browser processing | Browser; see tool notes for network behavior. |
| HTTP API | Not callable through HTTP. |
| Browser-agent interface | run_current_tool |

### Implementation notes

Runs locally on your device. CSV requires unique nonempty headers. Up to 1,000,000 characters, 10,000 data records and 100,000 cells across inputs, with 100 columns. Quoted multiline cells are supported. Each JSON settings field is limited to 100,000 characters. Output files are bounded to 4,000,000 characters. Diagnostic reports contain at most 500 findings and disclose the omitted count. Paste the child table in the main input. Parent keys must be nonempty and unique. Exact string matching supports composite keys. Partially empty child keys are always violations; entirely empty keys can be permitted explicitly.

### Inputs and settings

Text input: Child CSV.

Example or placeholder shown in the interface (not a validated fixture):

```text
customer_id
A
C
```

Paste CSV data with unique column headers. Quoted multiline cells are supported. Results update as you type. Up to 1,000,000 characters.

| Setting | Meaning | Control type | Default | Constraints |
| --- | --- | --- | --- | --- |
| `separator` | Input CSV separator | select | "," | Allowed: ,, ;, 	 |
| `childKeys` | Child key columns (JSON) | textarea | "[\"customer_id\"]" |  |
| `parentKeys` | Parent key columns (JSON) | textarea | "[\"id\"]" |  |
| `comparison` | Parent CSV | textarea | "id\nA\nB\n" |  |
| `emptyKeys` | Empty child keys | select | "Report missing" | Allowed: Report missing, Allow entirely empty |

### Browser-agent workflow

1. Open the human page in a browser that supports WebMCP.
2. Discover the interface exposed by that page; use its actual schema.
3. Select files on the page first when the tool requires files.
4. Call `run_current_tool` with valid input and settings.
5. Inspect the returned result or error and the displayed output. Retrieve files from the displayed download links.

Calls do not automatically copy or download results. Browser permissions still apply. Interface availability alone is not proof of successful execution.

### Planning specification

Parent keys must be nonempty and unique. Composite keys compare exact ordered strings without trimming or numeric coercion. An option allows entirely empty child keys; partly empty keys remain violations. Up to 1,000,000 characters, 10,000 data records, 100 columns and 100,000 cells across the sources. Files for multi-source tools are limited to 4,000,000 bytes total. Reports retain at most 500 diagnostic findings and state any omitted count. CSV and JSON outputs are limited to 4,000,000 characters.

This describes intended requirements. Use the implementation notes, interface schema and observed output to determine current support.

### Complete machine-readable capability record

```json
{
  "id": "referential-integrity-checker",
  "category": "data-tools",
  "built": true,
  "requirements": "Parent keys must be nonempty and unique. Composite keys compare exact ordered strings without trimming or numeric coercion. An option allows entirely empty child keys; partly empty keys remain violations. Up to 1,000,000 characters, 10,000 data records, 100 columns and 100,000 cells across the sources. Files for multi-source tools are limited to 4,000,000 bytes total. Reports retain at most 500 diagnostic findings and state any omitted count. CSV and JSON outputs are limited to 4,000,000 characters.",
  "implementation": {
    "fields": [
      {
        "key": "separator",
        "label": "Input CSV separator",
        "value": ",",
        "type": "select",
        "values": [
          ",",
          ";",
          "\t"
        ]
      },
      {
        "key": "childKeys",
        "label": "Child key columns (JSON)",
        "value": "[\"customer_id\"]",
        "type": "textarea",
        "help": "Ordered child foreign-key columns."
      },
      {
        "key": "parentKeys",
        "label": "Parent key columns (JSON)",
        "value": "[\"id\"]",
        "type": "textarea",
        "help": "Equally many parent primary-key columns, in matching order."
      },
      {
        "key": "comparison",
        "label": "Parent CSV",
        "value": "id\nA\nB\n",
        "type": "textarea",
        "help": "Paste the parent table, including its header."
      },
      {
        "key": "emptyKeys",
        "label": "Empty child keys",
        "value": "Report missing",
        "type": "select",
        "values": [
          "Report missing",
          "Allow entirely empty"
        ]
      }
    ],
    "live": true,
    "presentation": "metrics",
    "note": "Runs locally on your device. CSV requires unique nonempty headers. Up to 1,000,000 characters, 10,000 data records and 100,000 cells across inputs, with 100 columns. Quoted multiline cells are supported. Each JSON settings field is limited to 100,000 characters. Output files are bounded to 4,000,000 characters. Diagnostic reports contain at most 500 findings and disclose the omitted count. Paste the child table in the main input. Parent keys must be nonempty and unique. Exact string matching supports composite keys. Partially empty child keys are always violations; entirely empty keys can be permitted explicitly.",
    "experience": {
      "automatic": true,
      "single": false,
      "inputMaxLength": 1000000,
      "inputMode": "text",
      "label": "Child CSV",
      "placeholder": "customer_id\nA\nC",
      "help": "Paste CSV data with unique column headers. Quoted multiline cells are supported. Results update as you type. Up to 1,000,000 characters.",
      "action": null
    },
    "mode": "automatic",
    "interactive": false
  },
  "execution": "Browser interface",
  "api": null,
  "browser_agent": {
    "supported": true,
    "name": "run_current_tool",
    "discovery": "WebMCP on the human page in a supporting browser",
    "verification": "See audit/API-AUDIT.md; availability is not verification"
  }
}
```

## Page guide

Find child records whose foreign keys have no matching parent in another CSV.

How can we improve this tool?

Report a problem or share an idea.

Please leave out private information. Your message and the tool name go to our team via PostHog.

### How to use Referential integrity checker

1. Paste the child CSV in the main input and the parent CSV in the comparison field.
2. Define matching ordered child and parent key columns.
3. Review missing or incomplete child keys and download the report.

## Useful next steps

- [Dataset constraint checker](https://happytails.ai/en/data-tools/dataset-constraint-checker/) ([Markdown](https://happytails.ai/en/data-tools/dataset-constraint-checker.md))

- [CSV reconciliation report](https://happytails.ai/en/data-tools/csv-reconciliation-report/) ([Markdown](https://happytails.ai/en/data-tools/csv-reconciliation-report.md))

## Prepare the source

Paste the child CSV in the main input and the parent CSV in the comparison field.

### Choose the matching rules

Define matching ordered child and parent key columns.

### Review and keep the result

Review missing or incomplete child keys and download the report. Parent keys must be nonempty and unique. Composite keys compare exact ordered strings without trimming or numeric coercion. An option allows entirely empty child keys; partly empty keys remain violations.
