# Pedigree v1 Quickstart

## Installation

```bash
pip install "ai4gh[pedigree]"
```

## Create a Pedigree

```python
from ai4gh.specs.pedigree.models import (
    Pedigree,
    Person,
    Relationship,
    Sex,
    AffectedStatus,
)

# Build a family pedigree
pedigree = Pedigree(
    id="family-001",
    persons=[
        Person(id="father", sex=Sex.MALE, affected_status=AffectedStatus.UNAFFECTED),
        Person(id="mother", sex=Sex.FEMALE, affected_status=AffectedStatus.UNAFFECTED),
        Person(id="proband", sex=Sex.MALE, affected_status=AffectedStatus.AFFECTED),
    ],
    relationships=[
        Relationship(individual="proband", relation="father", relation_type="parent"),
        Relationship(individual="proband", relation="mother", relation_type="parent"),
    ],
)

# Serialize to JSON
print(pedigree.model_dump_json(indent=2))
```

## Validate a Pedigree

```python
import json
from ai4gh.specs.pedigree.models import Pedigree

data = json.loads(pedigree_json)
validated = Pedigree.model_validate(data)
print(f"Family: {validated.id}, Members: {len(validated.persons)}")
```

## MCP Tool

```json
{
  "tool": "pedigree_validate",
  "arguments": {
    "pedigree_json": "{\"id\": \"F001\", \"persons\": [{\"id\": \"P1\", \"sex\": \"MALE\"}]}"
  }
}
```

## Data Models

```python
from ai4gh.specs.pedigree.models import (
    Pedigree,
    Person,
    Relationship,
    Sex,
    AffectedStatus,
    KaryotypicSex,
)
```
