31 lines
905 B
Python
31 lines
905 B
Python
import logging
|
|
|
|
from .base import TaskProcessor
|
|
|
|
from mrds.utils import (
|
|
xml_utils,
|
|
csv_utils,
|
|
)
|
|
|
|
|
|
class XMLTaskProcessor(TaskProcessor):
|
|
|
|
def _extract(self):
|
|
# Extract data from XML
|
|
csv_data = xml_utils.extract_data(
|
|
self.global_config.source_filepath,
|
|
self.xpath_entries,
|
|
self.xml_position_entries,
|
|
self.task_conf.namespaces,
|
|
self.workflow_context,
|
|
self.global_config.encoding_type,
|
|
)
|
|
logging.info(f"CSV data extracted for task '{self.task_conf.task_name}'")
|
|
|
|
# Generate CSV
|
|
logging.info(f"Writing core data to CSV file at '{self.output_filepath}'")
|
|
csv_utils.write_data_to_csv_file(
|
|
self.output_filepath, csv_data, self.global_config.encoding_type
|
|
)
|
|
logging.info(f"Core data written to CSV file at '{self.output_filepath}'")
|