Limit

Module: thinkiq.model.limit

Limit - ThinkIQ entity for threshold evaluation on attributes.

Summary

A Limit defines numeric thresholds (LoLo, Lo, Target, Hi, HiHi) that allow evaluation of an Attribute’s value into a status Red / Yellow / Green.

Limit

class thinkiq.model.limit.Limit(**kwargs)

A Limit object in the ThinkIQ system.

Limits are attached to Attributes and define thresholds that can be used to evaluate the Attribute’s state.

A Limit represents a single threshold for an Attribute, such as HiHi, Hi, Lo, LoLo, or Target. Each limit row stores the direction (greater/less/target) and the numeric threshold value.

Properties:

id: int
part_of_id: int
display_name: str

Human-readable name of the limit (e.g., “HiHi”, “LoLo”).

relative_name: str

Internal key for the limit (e.g., “hihi”, “lo”, “target”).

direction: str

Direction of the limit (“greater”, “less”, “target”).

float_value: float

Threshold value for the limit.

Methods

__init__(**kwargs)

Construct a Limit object with keyword arguments matching the database table columns.

save()

Save this limit to the database (INSERT or UPDATE).

Return type:

None

delete()

Delete this limit from the database.

Return type:

None

Integration with Attribute

Limits are attached to Attribute objects. You can load and evaluate them as follows:

  • Load limits for an Attribute

    Attribute.get_limits()

    Load all limits attached to this Attribute.

    Return type:

    list[Limit]

  • Evaluate current value against limits

    Attribute.evaluate_limits()

    Evaluate this attribute’s current value against its limits.

    Colors:

    • “Red” if value <= LoLo or >= HiHi

    • “Yellow” if value <= Lo or >= Hi

    • “Green” if value between Lo and Hi

    returns:

    str

    rtype:

    “Red”, “Yellow”, or “Green”