Skip to content

Models

All models are importable directly from pyclann:

from pyclann import (
    FamilyTree, Person, LifeEvent,
    RelationshipsResponse, SpouseInfo, FamilyTreeNode,
    ResearchNote, ResearchFolder,
    ChatSession, ChatMessage,
    UserAiSettings, LoginInfo,
    Sex, RelationshipType, SiblingType, EventType,
)

Enumerations

pyclann.models.Sex

Bases: str, Enum

Biological sex recorded on a person.

pyclann.models.RelationshipType

Bases: str, Enum

Type of relationship edge between two persons.

The :attr:url_slug property returns the SurrealDB edge-table name used in DELETE relationship URLs (e.g. has_father). The enum value itself ("Father") is the form expected in POST request bodies.

url_slug property

url_slug: str

Edge-table name for DELETE relationship URLs.

pyclann.models.SiblingType

Bases: str, Enum

Sibling sub-type; required when adding a Sibling relationship.

pyclann.models.EventType

Bases: str, Enum

Common life-event categories. The server also accepts arbitrary strings.


Auth

pyclann.models.LoginInfo dataclass

LoginInfo(token: str, user_id: str, email: str, username: str, roles: list[str], permissions: list[str])

Session information returned by a successful :meth:ClannClient.login call.


Family Trees

pyclann.models.FamilyTree dataclass

FamilyTree(id: str, name: str, display_name: str, owner: str, is_primary: bool = False, team_id: str | None = None, image_path: str | None = None)

A family tree record.

id instance-attribute

id: str

Full record ID, e.g. "family_tree:01jd4a8xyz".

name instance-attribute

name: str

Globally unique slug used in API paths, e.g. "smith-family".

owner instance-attribute

owner: str

Username of the tree owner.


Persons

pyclann.models.Person dataclass

Person(id: str, family_name: str, first_name: str, sex: str, middle_name: str | None = None, date_of_birth: str | None = None, place_of_birth: str | None = None, date_of_death: str | None = None, place_of_death: str | None = None, image_path: str | None = None, life_image_path: str | None = None, image_bytes: int | None = None, life_image_bytes: int | None = None, nickname: str | None = None, username: str | None = None, email: str | None = None, verified: bool = False, biography: str | None = None, created_by: str | None = None, trees: list[str] = list())

A person in a family tree.

id instance-attribute

id: str

Full record ID, e.g. "person:01jd4a8xyz".

sex instance-attribute

sex: str

"Male" or "Female".

image_bytes class-attribute instance-attribute

image_bytes: int | None = None

Size in bytes of the uploaded profile picture.

life_image_bytes class-attribute instance-attribute

life_image_bytes: int | None = None

Size in bytes of the uploaded life-story media.

trees class-attribute instance-attribute

trees: list[str] = field(default_factory=list)

Names (slugs) of the family trees this person belongs to.

pyclann.models.SpouseInfo dataclass

SpouseInfo(id: str, family_name: str, first_name: str, sex: str, middle_name: str | None = None, date_of_birth: str | None = None, place_of_birth: str | None = None, date_of_death: str | None = None, place_of_death: str | None = None, image_path: str | None = None, life_image_path: str | None = None, image_bytes: int | None = None, life_image_bytes: int | None = None, nickname: str | None = None, username: str | None = None, email: str | None = None, verified: bool = False, biography: str | None = None, created_by: str | None = None, trees: list[str] = list(), spouse_from: str | None = None, spouse_to: str | None = None)

A person enriched with the spouse-edge date attributes.

spouse_from class-attribute instance-attribute

spouse_from: str | None = None

Marriage/partnership start date.

spouse_to class-attribute instance-attribute

spouse_to: str | None = None

Marriage/partnership end date.


Relationships

pyclann.models.RelationshipsResponse dataclass

RelationshipsResponse(father: list[Person] = list(), mother: list[Person] = list(), siblings: list[Person] = list(), spouse: list[SpouseInfo] = list())

All relationships for a person, grouped by type.

pyclann.models.FamilyTreeNode dataclass

FamilyTreeNode(id: str, family_name: str, first_name: str, sex: str | None = None, date_of_birth: str | None = None, place_of_birth: str | None = None, biography: str | None = None, image_path: str | None = None, father: list[FamilyTreeNode] = list(), mother: list[FamilyTreeNode] = list(), children: list[FamilyTreeNode] = list(), spouse: list[FamilyTreeNode] = list(), siblings: list[FamilyTreeNode] = list())

A node in the recursive family-tree view (up to 2 generations deep).

father class-attribute instance-attribute

father: list[FamilyTreeNode] = field(default_factory=list)

Father's node, with their own ancestors.

mother class-attribute instance-attribute

mother: list[FamilyTreeNode] = field(default_factory=list)

Mother's node, with their own ancestors.

children class-attribute instance-attribute

children: list[FamilyTreeNode] = field(default_factory=list)

Direct children. Populated only for the root node.

spouse class-attribute instance-attribute

spouse: list[FamilyTreeNode] = field(default_factory=list)

Spouses. Populated only for the root node.

siblings class-attribute instance-attribute

siblings: list[FamilyTreeNode] = field(default_factory=list)

Siblings. Populated only for the root node.


Life Events

pyclann.models.LifeEvent dataclass

LifeEvent(id: str, person_id: str, name: str, event_type: str, date: str | None = None, description: str | None = None, story: str | None = None, verified: bool = False, source_link: str | None = None, source_image: str | None = None, source_doc: str | None = None, created_by: str | None = None)

A significant event in a person's life.

id instance-attribute

id: str

Full record ID, e.g. "life_event:01jd4a8xyz".

person_id instance-attribute

person_id: str

Full person record ID, e.g. "person:01jd4a8xyz".

event_type instance-attribute

event_type: str

Common values: "Birth", "Death", "Marriage" — see :class:EventType.

story class-attribute instance-attribute

story: str | None = None

Long-form story in Markdown.


Research

pyclann.models.ResearchNote dataclass

ResearchNote(id: str, title: str, trees: list[str] = list(), description: str | None = None, body: str | None = None, folder_id: str | None = None, created_by: str | None = None, created_at: datetime | None = None, updated_at: datetime | None = None, is_shared: bool = False, parent_id: str | None = None)

A research note or reply attached to one or more family trees.

id instance-attribute

id: str

Full record ID, e.g. "research_note:01jd4a8xyz".

trees class-attribute instance-attribute

trees: list[str] = field(default_factory=list)

Tree slugs this note is linked to.

body class-attribute instance-attribute

body: str | None = None

Markdown body.

parent_id class-attribute instance-attribute

parent_id: str | None = None

Set on replies; None for top-level notes.

pyclann.models.ResearchFolder dataclass

ResearchFolder(id: str, name: str, created_by: str, created_at: datetime | None = None)

A folder for organising research notes.

id instance-attribute

id: str

Full record ID, e.g. "research_folder:01jd4a8xyz".


Chat

pyclann.models.ChatSession dataclass

ChatSession(id: str, title: str, created_by: str, tree: str | None = None, created_at: datetime | None = None, updated_at: datetime | None = None)

An AI chat session, optionally scoped to a family tree.

id instance-attribute

id: str

Full record ID, e.g. "chat_session:01jd4a8xyz".

tree class-attribute instance-attribute

tree: str | None = None

Tree slug, if this session is scoped to a specific tree.

pyclann.models.ChatMessage dataclass

ChatMessage(id: str, session_id: str, role: str, content: str, created_at: datetime | None = None)

A single message within a chat session.

id instance-attribute

id: str

Full record ID, e.g. "chat_message:01jd4a8xyz".

session_id instance-attribute

session_id: str

Full session record ID.

role instance-attribute

role: str

"user" or "assistant".


AI Settings

pyclann.models.UserAiSettings dataclass

UserAiSettings(id: str, username: str, provider: str, model: str, ollama_url: str | None = None, encrypted_key: str | None = None, iv: str | None = None, auth_tag: str | None = None)

Stored AI provider settings for the authenticated user.

API keys are stored as encrypted blobs — the webapp encrypts with AES-256-GCM before sending; clann-server never sees the plaintext key.