requirements
- class Requirement
Bases:
CommonBaseModel
Defines a single requirement for engineering or scientific projects, encapsulating attributes for specification, tracking, and validation.
- name
A unique identifier for the requirement.
- Type:
str
- description
A detailed description of what the requirement entails.
- Type:
str
- category
The classification of the requirement (e.g., performance, safety).
- Type:
Optional[str]
- priority
The priority level of the requirement (e.g., high, medium, low).
- Type:
str
- verification_method
The method to be used for verifying the requirement (e.g., test, analysis, inspection).
- Type:
str
- status
The current status of the requirement (e.g., open, closed, in progress).
- Type:
str
- source
The origin or source of the requirement (e.g., customer, internal, regulation).
- Type:
Optional[str]
- target_component
The component or system to which the requirement applies.
- Type:
Optional[str]
- acceptance_criteria
The criteria that must be met for the requirement to be considered satisfied.
- Type:
str
- risk
A description of the potential risks associated with the requirement.
- Type:
Optional[str]
- verification_evidence
Documentation or evidence proving the requirement has been verified.
- Type:
Optional[str]
- metadata
Additional metadata providing context or details about the requirement.
- Type:
Optional[Metadata]
- Raises:
ValueError – If essential string attributes are empty, ensuring all requirements are descriptive and actionable.
Methods:
validate_non_empty
(value)Validates that critical string fields are not empty or just whitespace, ensuring requirements are clear and actionable.
Attributes:
__setattr__ handlers.
- classmethod validate_non_empty(value)
Validates that critical string fields are not empty or just whitespace, ensuring requirements are clear and actionable.
- Parameters:
value (str) – The value of the field being validated.
- Returns:
The validated string value.
- Raises:
ValueError – If the input value is empty or consists only of whitespace.
- Return type:
str
- __pydantic_setattr_handlers__: ClassVar[Dict[str, Callable[[BaseModel, str, Any], None]]] = {}
__setattr__ handlers. Memoizing the handlers leads to a dramatic performance improvement in __setattr__
- class Requirements
Bases:
CommonBaseModel
Aggregates and categorizes multiple lists of requirements within a project, facilitating structured specification, organization, and tracking.
This class is vital for managing complex sets of requirements in engineering and scientific projects, allowing for clear delineation and efficient access to different types of requirements such as safety, performance, design, and more.
- name
A unique name identifying the set of requirements.
- Type:
str
- description
A brief description of the requirements set, providing context or purpose.
- Type:
str
- requirements
A dictionary mapping requirement categories to lists of Requirement objects, providing flexibility for managing different requirement types.
- Type:
Dict[str, List[Requirement]]
- metadata
Additional metadata providing further context or details about the requirements.
- Type:
Methods:
validate_non_empty
(value, field)Validate that the name and description fields are not empty.
add_requirement
(requirement, category)Dynamically add a new requirement to the specified category, enhancing the project's requirements documentation and tracking.
remove_requirement
(requirement_name, category)Remove a requirement from the specified category based on its name.
get_requirements_by_category
(category)Retrieve a list of requirements belonging to the specified category.
Attributes:
__setattr__ handlers.
- classmethod validate_non_empty(value, field)
Validate that the name and description fields are not empty.
- Parameters:
value (str) – The value of the field being validated.
field (Field) – The metadata of the field being validated.
- Raises:
ValueError – If the field value is empty or just whitespace.
- Returns:
The validated value.
- Return type:
str
- add_requirement(requirement, category)
Dynamically add a new requirement to the specified category, enhancing the project’s requirements documentation and tracking.
- Parameters:
requirement (Requirement) – The requirement to be added.
category (str) – The category under which to add the requirement.
- Raises:
ValueError – If the specified category does not exist, it will be created.
- Return type:
None
- remove_requirement(requirement_name, category)
Remove a requirement from the specified category based on its name.
- Parameters:
requirement_name (str) – The name of the requirement to remove.
category (str) – The category from which to remove the requirement.
- Raises:
ValueError – If the specified category does not exist or if the requirement is not found within the category.
- Return type:
None
- get_requirements_by_category(category)
Retrieve a list of requirements belonging to the specified category.
- Parameters:
category (str) – The category from which to retrieve the requirements.
- Returns:
The list of requirements in the specified category.
- Raises:
ValueError – If the specified category does not exist in the requirements.
- Return type:
List[Requirement]
- __pydantic_setattr_handlers__: ClassVar[Dict[str, Callable[[BaseModel, str, Any], None]]] = {}
__setattr__ handlers. Memoizing the handlers leads to a dramatic performance improvement in __setattr__
Classes
Defines a single requirement for engineering or scientific projects, encapsulating attributes for specification, tracking, and validation. |
|
Aggregates and categorizes multiple lists of requirements within a project, facilitating structured specification, organization, and tracking. |