Skip to content

QualityManual¤

QualityManual dataclass ¤

QualityManual(
    accessories: Accessories = Accessories(),
    documentation: str = "",
    financial: Financial = Financial(),
    personnel_restrictions: str = "",
    service_agent: str = "",
    technical_procedures: tuple[str, ...] = (),
)

Represents the qualityManual element in an equipment register.

Parameters:

Name Type Description Default
accessories Accessories

Additional accessories that may be required to use the equipment.

Accessories()
documentation str

Information (such as URLs) about the manuals, datasheets, etc. for the equipment.

''
financial Financial

Financial information about the equipment.

Financial()
personnel_restrictions str

Information about the people (or team) who are qualified to use the equipment.

''
service_agent str

Information about the people or company that are qualified to perform alterations and/or maintenance to the equipment.

''
technical_procedures tuple[str, ...]

The technical procedures that depend on this equipment.

()

accessories class-attribute instance-attribute ¤

accessories: Accessories = field(
    default_factory=Accessories
)

Additional accessories that may be required to use the equipment.

documentation class-attribute instance-attribute ¤

documentation: str = ''

Information (such as URLs) about the manuals, datasheets, etc. for the equipment.

financial class-attribute instance-attribute ¤

financial: Financial = field(default_factory=Financial)

Financial information about the equipment.

personnel_restrictions class-attribute instance-attribute ¤

personnel_restrictions: str = ''

Information about the people (or team) who are qualified to use the equipment.

service_agent class-attribute instance-attribute ¤

service_agent: str = ''

Information about the people or company that are qualified to perform alterations and/or maintenance to the equipment.

technical_procedures class-attribute instance-attribute ¤

technical_procedures: tuple[str, ...] = ()

The technical procedures that depend on this equipment.

from_xml classmethod ¤

from_xml(element: Element[str]) -> QualityManual

Convert an XML element into an QualityManual instance.

Parameters:

Name Type Description Default
element Element[str]

A qualityManual XML element from an equipment register.

required

Returns:

Type Description
QualityManual

The QualityManual instance.

Source code in src/msl/equipment/schema.py
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
@classmethod
def from_xml(cls, element: Element[str]) -> QualityManual:
    """Convert an XML element into an [QualityManual][msl.equipment.schema.QualityManual] instance.

    Args:
        element: A [qualityManual][type_qualityManual] XML element from an equipment register.

    Returns:
        The [QualityManual][msl.equipment.schema.QualityManual] instance.
    """
    # Schema defines <qualityManual> using xsd:all, which allows sub-elements to appear (or not appear) in any order
    # Using str.endswith() allows for ignoring XML namespaces that may be associated with each tag
    tp: tuple[str, ...] = ()
    a, d, f, pr, sa = Accessories(), "", Financial(), "", ""
    for child in element:
        if child.tag.endswith("accessories"):
            a = Accessories.from_xml(child)
        elif child.tag.endswith("documentation"):
            d = child.text or ""
        elif child.tag.endswith("financial"):
            f = Financial.from_xml(child)
        elif child.tag.endswith("personnelRestrictions"):
            pr = child.text or ""
        elif child.tag.endswith("serviceAgent"):
            sa = child.text or ""
        else:
            tp = tuple(i.text for i in child if i.text)

    return cls(
        accessories=a,
        documentation=d,
        financial=f,
        personnel_restrictions=pr,
        service_agent=sa,
        technical_procedures=tp,
    )

to_xml ¤

to_xml() -> Element[str]

Convert the QualityManual class into an XML element.

Returns:

Type Description
Element[str]

The QualityManual as an XML element.

Source code in src/msl/equipment/schema.py
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
def to_xml(self) -> Element[str]:
    """Convert the [QualityManual][msl.equipment.schema.QualityManual] class into an XML element.

    Returns:
        The [QualityManual][msl.equipment.schema.QualityManual] as an XML element.
    """
    e = Element("qualityManual")

    if len(self.accessories) or len(self.accessories.attrib):
        e.append(self.accessories)

    if self.documentation:
        d = SubElement(e, "documentation")
        d.text = self.documentation

    if self.financial != Financial():
        e.append(self.financial.to_xml())

    if self.personnel_restrictions:
        pr = SubElement(e, "personnelRestrictions")
        pr.text = self.personnel_restrictions

    if self.service_agent:
        sa = SubElement(e, "serviceAgent")
        sa.text = self.service_agent

    if self.technical_procedures:
        tp = SubElement(e, "technicalProcedures")
        for procedure in self.technical_procedures:
            sub = SubElement(tp, "id")
            sub.text = procedure

    return e