ToDoWrite Models

This section documents all the ToDoWrite Models - the core data models that form the 12-layer hierarchy.

Model Hierarchy

Goal
├── Concept
├── Context
├── Constraints
├── Requirements
├── AcceptanceCriteria
├── InterfaceContract
├── Phase
│   └── Step
│       └── Task
│           └── SubTask
└── Command

Label is a shared model for many-to-many relationships across all layers.

Core Models

Goal

class Goal(**kwargs)[source]

Bases: Base, TimestampMixin

ToDoWrite Goal model for hierarchical task management.

id
title
description
status
progress
started_on
ended_on
owner
severity
work_type
assignee
extra_data
labels
tasks
phases
constraints
concepts
contexts
classmethod create(title, description='', owner='', severity='', work_type='', assignee='')[source]

Create a new Goal instance with default values.

Return type:

Goal

start_work()[source]

Mark goal as started by setting started_on to current timestamp.

Return type:

None

complete_work()[source]

Mark goal as completed by setting ended_on to current timestamp.

Return type:

None

set_progress(progress)[source]

Set progress percentage (0-100).

Return type:

None

is_completed()[source]

Check if goal is marked as completed.

Return type:

bool

is_started()[source]

Check if goal is marked as started.

Return type:

bool

add_label(label)[source]

Add a label to this goal.

Return type:

None

remove_label(label)[source]

Remove a label from this goal.

Return type:

None

add_task(task)[source]

Add a task to this goal.

Return type:

None

remove_task(task)[source]

Remove a task from this goal.

Return type:

None

add_phase(phase)[source]

Add a phase to this goal.

Return type:

None

remove_phase(phase)[source]

Remove a phase from this goal.

Return type:

None

to_dict()[source]

Convert goal to dictionary representation.

Return type:

dict[str, object]

classmethod from_dict(data)[source]

Create Goal instance from dictionary.

Return type:

Goal

save(session)[source]

Save this goal to the database.

Return type:

None

delete(session)[source]

Delete this goal from the database.

Return type:

None

classmethod find_by_id(session, goal_id)[source]

Find a goal by ID.

Return type:

Goal | None

classmethod find_by_title(session, title)[source]

Find a goal by title.

Return type:

Goal | None

classmethod all(session)[source]

Get all goals.

Return type:

list[Goal]

classmethod find_completed(session)[source]

Get all completed goals.

Return type:

list[Goal]

classmethod find_active(session)[source]

Get all active (not completed) goals.

Return type:

list[Goal]

get_work_duration()[source]

Get the duration between start and completion in ISO format.

Return type:

str | None

get_summary()[source]

Get a brief summary of the goal.

Return type:

str

validate()[source]

Validate goal data and return list of errors.

Return type:

list[str]

is_valid()[source]

Check if goal data is valid.

Return type:

bool

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created_at
updated_at

Concept

class Concept(**kwargs)[source]

Bases: Base, TimestampMixin

ToDoWrite Concept model for hierarchical task management.

id
title
description
status
progress
started_on
ended_on
owner
severity
work_type
assignee
extra_data
labels
goals
contexts
requirements
__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created_at
updated_at

Context

class Context(**kwargs)[source]

Bases: Base, TimestampMixin

ToDoWrite Context model for hierarchical task management.

id
title
description
status
progress
started_on
ended_on
owner
severity
work_type
assignee
extra_data
labels
concepts
goals
requirements
__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created_at
updated_at

Constraints

Requirements

AcceptanceCriteria

class AcceptanceCriteria(**kwargs)[source]

Bases: Base, TimestampMixin

ToDoWrite AcceptanceCriteria model for hierarchical task management.

id
title
description
status
progress
started_on
ended_on
owner
severity
work_type
assignee
extra_data
labels
requirements
interface_contracts
__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created_at
updated_at

InterfaceContract

class InterfaceContract(**kwargs)[source]

Bases: Base, TimestampMixin

ToDoWrite InterfaceContract model for hierarchical task management.

id
title
description
status
progress
started_on
ended_on
owner
severity
work_type
assignee
extra_data
labels
acceptance_criteria
phases
__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created_at
updated_at

Phase

class Phase(**kwargs)[source]

Bases: Base, TimestampMixin

ToDoWrite Phase model for hierarchical task management.

id
title
description
status
progress
started_on
ended_on
owner
severity
work_type
assignee
extra_data
labels
goals
steps
interface_contracts
__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created_at
updated_at

Step

class Step(**kwargs)[source]

Bases: Base, TimestampMixin

ToDoWrite Step model for hierarchical task management.

id
title
description
status
progress
started_on
ended_on
owner
severity
work_type
assignee
extra_data
labels
phases
tasks
__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created_at
updated_at

Task

class Task(**kwargs)[source]

Bases: Base, TimestampMixin

ToDoWrite Task model for hierarchical task management.

id
title
description
status
progress
started_on
ended_on
owner
severity
work_type
assignee
extra_data
labels
goals
steps
sub_tasks
property commands

Get all commands from all subtasks for this task.

Provides complete execution plan visibility by aggregating all commands across all subtasks belonging to this task.

Returns:

List of all Command objects from all subtasks in execution order.

property total_commands_count

Get total number of commands across all subtasks.

property completed_commands_count

Get count of completed commands across all subtasks.

property execution_progress_percentage

Calculate execution progress as percentage based on completed commands.

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created_at
updated_at

SubTask

class SubTask(**kwargs)[source]

Bases: Base, TimestampMixin

ToDoWrite SubTask model for hierarchical task management.

id
title
description
status
progress
started_on
ended_on
owner
severity
work_type
assignee
extra_data
labels
tasks
commands
__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created_at
updated_at

Command

class Command(**kwargs)[source]

Bases: Base, TimestampMixin

ToDoWrite Command model for hierarchical task management.

id
title
description
status
progress
started_on
ended_on
owner
severity
work_type
assignee
acceptance_criteria_id
cmd
cmd_params
runtime_env
output
artifacts
labels
sub_tasks
property runtime_env_dict

Get runtime environment as dictionary.

property artifacts_list

Get artifacts as list.

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created_at
mark_completed()[source]

Mark command as completed with current timestamp.

Return type:

None

updated_at
mark_started()[source]

Mark command as started with current timestamp.

Return type:

None

Label

class Label(**kwargs)[source]

Bases: Base, TimestampMixin

ToDoWrite Label model for categorizing and tagging other models.

id
name
goals
concepts
contexts
constraints
requirements
acceptance_criteria
interface_contracts
phases
steps
tasks
sub_tasks
commands
__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created_at
updated_at

Schema Information

  • Total Tables: 33 (12 model tables + 21 association tables)

  • Primary Keys: Auto-incrementing integers (1, 2, 3, …)

  • Foreign Keys: Proper referential integrity

  • Database Support: SQLite and PostgreSQL

  • Schema Files: Available in lib_package/src/todowrite/core/schemas/

For detailed SQL and JSON schemas, see Database Schema.