hamyar_paygah.services.parsers ============================== .. py:module:: hamyar_paygah.services.parsers .. autoapi-nested-parse:: XML parsers module. This module provides functions to parse SOAP XML responses from the EMS server and convert them into Python data models. Functions --------- .. autoapisummary:: hamyar_paygah.services.parsers.parse_to_missions_list hamyar_paygah.services.parsers.parse_to_mission_details hamyar_paygah.services.parsers._parse_information hamyar_paygah.services.parsers._parse_times_and_distances hamyar_paygah.services.parsers._parse_location_and_emergency hamyar_paygah.services.parsers._parse_symptoms hamyar_paygah.services.parsers._parse_vital_signs hamyar_paygah.services.parsers._parse_medical_history hamyar_paygah.services.parsers._parse_pupils_lungs_heart hamyar_paygah.services.parsers._parse_pupil_status hamyar_paygah.services.parsers._parse_lung_status hamyar_paygah.services.parsers._parse_heart_status hamyar_paygah.services.parsers._parse_trauma_types hamyar_paygah.services.parsers._parse_medical_actions hamyar_paygah.services.parsers._parse_drugs_list hamyar_paygah.services.parsers._parse_mission_result hamyar_paygah.services.parsers._parse_medical_center hamyar_paygah.services.parsers._parse_consumables_used Module Contents --------------- .. py:function:: parse_to_missions_list(xml_text) Parse EMS mission data from a SOAP XML response. This function reads a raw SOAP XML string returned from the EMS server, extracts each `` element, and converts it into a `Mission` dataclass instance. Fields that may be missing or nil are safely handled. Numeric fields are converted using `convert_to_integer`, and missing string fields are defaulted to an empty string. :param xml_text: Raw XML string returned from the EMS SOAP server. :type xml_text: str :returns: A list of `Mission` dataclass instances representing each mission in the XML response. :rtype: list[Mission] .. py:function:: parse_to_mission_details(xml_text) Parse EMS mission details from a SOAP XML response. :param xml_text: Raw XML string returned from the EMS SOAP server. :type xml_text: str :returns: Details of a mission in an object. :rtype: MissionDetails .. py:function:: _parse_information(document, namespaces) Parses the information sub model and returns it. :param document: XML SOAP document :type document: etree._Element :param namespaces: SOAP namespaces :type namespaces: dict[str, str] :returns: Information sub model :rtype: Information .. py:function:: _parse_times_and_distances(document, namespaces) .. py:function:: _parse_location_and_emergency(document, namespaces) Parses the location and emergency sub model and returns it. :param document: XML SOAP document :type document: etree._Element :param namespaces: SOAP namespaces :type namespaces: dict[str, str] :returns: Location and emergency sub model :rtype: LocationAndEmergency .. py:function:: _parse_symptoms(document, namespaces) Parses the symptoms sub model and returns it. :param document: XML SOAP document :type document: etree._Element :param namespaces: SOAP namespaces :type namespaces: dict[str, str] :returns: Symptoms sub model :rtype: Symptoms .. py:function:: _parse_vital_signs(document, namespaces) Extracts patient vital sign records from SOAP XML response. :param document: XML SOAP document :type document: etree._Element :param namespaces: SOAP namespaces :type namespaces: dict[str, str] :returns: List of vita signs :rtype: list[VitalSigns] .. py:function:: _parse_medical_history(document, namespaces) Extracts patient medical history from SOAP XML response. :param document: XML SOAP document :type document: etree._Element :param namespaces: SOAP namespaces :type namespaces: dict[str, str] :returns: Medical history of patient :rtype: MedicalHistory .. py:function:: _parse_pupils_lungs_heart(document, namespaces) Parses the pupils, lungs and heart sub model and returns it. :param document: XML SOAP document :type document: etree._Element :param namespaces: SOAP namespaces :type namespaces: dict[str, str] :returns: Pupils, lungs and heart model :rtype: PupilsLungsHeart .. py:function:: _parse_pupil_status(document, namespaces, pupil_side) Parses the status of pupil from server into Pupil status object. :param document: XML SOAP response :type document: etree._Element :param namespaces: SOAP namespaces :type namespaces: dict[str, str] :param pupil_side: "R" for right side and "L" for left side :type pupil_side: str :returns: PupilStatus object or none. :rtype: PupilStatus | None .. py:function:: _parse_lung_status(document, namespaces, lung_side) Parses the status of lung from server into Lung side object. :param document: XML SOAP response :type document: etree._Element :param namespaces: SOAP namespaces :type namespaces: dict[str, str] :param lung_side: "R" for right side and "L" for left side. :type lung_side: str :returns: LungSide object. :rtype: LungSide .. py:function:: _parse_heart_status(document, namespaces) Parses the status of heart from server into heart object. :param document: XML SOAP response :type document: etree._Element :param namespaces: SOAP namespaces :type namespaces: dict[str, str] :returns: Heart object. :rtype: Heart .. py:function:: _parse_trauma_types(document, namespaces) Parses the trauma types sub model and returns it. :param document: XML SOAP document :type document: etree._Element :param namespaces: SOAP namespaces :type namespaces: dict[str, str] :returns: trauma types sub model :rtype: TraumaTypes .. py:function:: _parse_medical_actions(document, namespaces) Parses the medical actions sub model and returns it. :param document: XML SOAP document :type document: etree._Element :param namespaces: SOAP namespaces :type namespaces: dict[str, str] :returns: Medical actions sub model :rtype: MedicalActions .. py:function:: _parse_drugs_list(document, namespaces) Parses the list of drugs sub model and returns it. :param document: XML SOAP document :type document: etree._Element :param namespaces: SOAP namespaces :type namespaces: dict[str, str] :returns: list of drugs sub model :rtype: list[Drug] .. py:function:: _parse_mission_result(document, namespaces) Parses the mission result sub model and returns it. :param document: XML SOAP document :type document: etree._Element :param namespaces: SOAP namespaces :type namespaces: dict[str, str] :returns: mission result sub model :rtype: MissionResult .. py:function:: _parse_medical_center(document, namespaces) Parses the medical center sub model and returns it. :param document: XML SOAP document :type document: etree._Element :param namespaces: SOAP namespaces :type namespaces: dict[str, str] :returns: medical center sub model :rtype: MedicalCenter .. py:function:: _parse_consumables_used(document, namespaces) Parses the consumables used sub model and returns it. :param document: XML SOAP document :type document: etree._Element :param namespaces: SOAP namespaces :type namespaces: dict[str, str] :returns: consumables used sub model :rtype: ConsumablesUsed