hamyar_paygah.services.parsers¶
XML parsers module.
This module provides functions to parse SOAP XML responses from the EMS server and convert them into Python data models.
Functions¶
|
Parse EMS mission data from a SOAP XML response. |
|
Parse EMS mission details from a SOAP XML response. |
|
Parses the information sub model and returns it. |
|
|
|
Parses the location and emergency sub model and returns it. |
|
Parses the symptoms sub model and returns it. |
|
Extracts patient vital sign records from SOAP XML response. |
|
Extracts patient medical history from SOAP XML response. |
|
Parses the pupils, lungs and heart sub model and returns it. |
|
Parses the status of pupil from server into Pupil status object. |
|
Parses the status of lung from server into Lung side object. |
|
Parses the status of heart from server into heart object. |
|
Parses the trauma types sub model and returns it. |
|
Parses the medical actions sub model and returns it. |
|
Parses the list of drugs sub model and returns it. |
|
Parses the mission result sub model and returns it. |
|
Parses the medical center sub model and returns it. |
|
Parses the consumables used sub model and returns it. |
Module Contents¶
- hamyar_paygah.services.parsers.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 <DocumentReport> 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.
- hamyar_paygah.services.parsers.parse_to_mission_details(xml_text)¶
Parse EMS mission details from a SOAP XML response.
- Parameters:
xml_text (str) – Raw XML string returned from the EMS SOAP server.
- Returns:
Details of a mission in an object.
- Return type:
- hamyar_paygah.services.parsers._parse_information(document, namespaces)¶
Parses the information sub model and returns it.
- Parameters:
- Returns:
Information sub model
- Return type:
- hamyar_paygah.services.parsers._parse_times_and_distances(document, namespaces)¶
- Parameters:
- Return type:
hamyar_paygah.models.mission_details_submodels.times_and_distances_model.TimesAndDistances
- hamyar_paygah.services.parsers._parse_location_and_emergency(document, namespaces)¶
Parses the location and emergency sub model and returns it.
- Parameters:
- Returns:
Location and emergency sub model
- Return type:
- hamyar_paygah.services.parsers._parse_symptoms(document, namespaces)¶
Parses the symptoms sub model and returns it.
- hamyar_paygah.services.parsers._parse_vital_signs(document, namespaces)¶
Extracts patient vital sign records from SOAP XML response.
- Parameters:
- Returns:
List of vita signs
- Return type:
- hamyar_paygah.services.parsers._parse_medical_history(document, namespaces)¶
Extracts patient medical history from SOAP XML response.
- Parameters:
- Returns:
Medical history of patient
- Return type:
- hamyar_paygah.services.parsers._parse_pupils_lungs_heart(document, namespaces)¶
Parses the pupils, lungs and heart sub model and returns it.
- Parameters:
- Returns:
Pupils, lungs and heart model
- Return type:
- hamyar_paygah.services.parsers._parse_pupil_status(document, namespaces, pupil_side)¶
Parses the status of pupil from server into Pupil status object.
- Parameters:
- Returns:
PupilStatus object or none.
- Return type:
PupilStatus | None
- hamyar_paygah.services.parsers._parse_lung_status(document, namespaces, lung_side)¶
Parses the status of lung from server into Lung side object.
- hamyar_paygah.services.parsers._parse_heart_status(document, namespaces)¶
Parses the status of heart from server into heart object.
- hamyar_paygah.services.parsers._parse_trauma_types(document, namespaces)¶
Parses the trauma types sub model and returns it.
- Parameters:
- Returns:
trauma types sub model
- Return type:
- hamyar_paygah.services.parsers._parse_medical_actions(document, namespaces)¶
Parses the medical actions sub model and returns it.
- Parameters:
- Returns:
Medical actions sub model
- Return type:
- hamyar_paygah.services.parsers._parse_drugs_list(document, namespaces)¶
Parses the list of drugs sub model and returns it.
- hamyar_paygah.services.parsers._parse_mission_result(document, namespaces)¶
Parses the mission result sub model and returns it.
- Parameters:
- Returns:
mission result sub model
- Return type:
- hamyar_paygah.services.parsers._parse_medical_center(document, namespaces)¶
Parses the medical center sub model and returns it.
- Parameters:
- Returns:
medical center sub model
- Return type:
- hamyar_paygah.services.parsers._parse_consumables_used(document, namespaces)¶
Parses the consumables used sub model and returns it.
- Parameters:
- Returns:
consumables used sub model
- Return type: