Record¶
Records hold document data. Use the project's Vault for filesystem access and collection operations. Pass overwrite=True to replace an existing record.
Record¶
Bases: BaseModel
A lightweight, validated research document.
Attributes:
| Name | Type | Description |
|---|---|---|
id | str | Bundle-relative concept path, without the .md suffix. |
title | str | None | Optional OKF display title. |
markdown | Markdown | Markdown content of the record. |
parent_id | str | None | Optional relative path of a parent record. |
related_to | list[str] | Optional relative paths of related records. |
type | str | Nonblank, producer-defined OKF concept type. |
commit | str | None | Optional commit hash associated with the record. |
status | Literal['draft', 'stable', 'deprecated'] | OKF concept lifecycle: draft, stable, or deprecated. |
state | str | None | Optional workflow-defined research progress. |
decision | str | None | Optional record decision. |
branch | str | None | Optional record branch. |
type class-attribute instance-attribute ¶
title class-attribute instance-attribute ¶
description class-attribute instance-attribute ¶
description: str | None = Field(
default=None,
description="Optional short description of the concept.",
)
status class-attribute instance-attribute ¶
status: Literal["draft", "stable", "deprecated"] = Field(
default="stable",
description="OKF concept lifecycle status.",
)
resource class-attribute instance-attribute ¶
resource: str | None = Field(
default=None,
description="Optional URI or path to an associated resource.",
)
tags class-attribute instance-attribute ¶
generated class-attribute instance-attribute ¶
generated: dict[str, Any] = Field(
default_factory=dict,
description="Generated metadata for this concept.",
)
verified class-attribute instance-attribute ¶
verified: list[dict[str, Any]] | None = Field(
default=None,
description="Verification evidence associated with this concept.",
)
id class-attribute instance-attribute ¶
markdown class-attribute instance-attribute ¶
markdown: Markdown = Field(
default_factory=lambda: Markdown(""),
description="Markdown content of the record.",
)
parent_id class-attribute instance-attribute ¶
parent_id: str | None = Field(
default=None,
description="Optional bundle-relative ID of a parent record.",
)
related_to class-attribute instance-attribute ¶
related_to: list[str] = Field(
default_factory=list,
description="Bundle-relative IDs of related records.",
)
commit class-attribute instance-attribute ¶
commit: str | None = Field(
default=None,
description="Optional commit hash associated with the record.",
)
decision class-attribute instance-attribute ¶
decision: str | None = Field(
default=None,
description="Optional decision recorded for this concept.",
)
branch class-attribute instance-attribute ¶
branch: str | None = Field(
default=None,
description="Optional version-control branch associated with it.",
)
state class-attribute instance-attribute ¶
state: str | None = Field(
default=None,
description="Optional workflow-defined research progress state.",
)
metadata property ¶
Return the record's serialized metadata, excluding its Markdown body.
Vault¶
Read and write Markdown records under a bundle root.
Record IDs are paths relative to root without the .md suffix. Call :meth:validate to check relationships across the collection.
Create a vault for the given records directory without creating it.
file_path ¶
Return the contained Markdown path for an ID without checking existence.
load ¶
Load one record by ID without scanning or validating other records.
create ¶
list ¶
Load records recursively in ID order; ignore index.md and log.md.
Relationships between records are not checked.
children ¶
Return records that declare record_id as their parent, sorted by ID.
descendants ¶
Return transitive descendants by declared parent IDs.
Tolerates cycles and missing nodes.
save ¶
Validate and atomically write one record.
Replace existing files only with overwrite=True. Relationships are not checked.
update ¶
Apply supplied fields and save the record; markdown replaces its body.
The ID cannot be changed, and relationships to other records are not checked.
delete ¶
Delete one record and remove its empty parent directory if possible.
Other records' references are unchanged; call :meth:validate to find dangling IDs.
validate ¶
Scan the collection and check that declared parent and related IDs exist.
Parent cycles are allowed.