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
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
@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
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
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