init
This commit is contained in:
30
python/mrds_common/mrds/processors/xml_processor.py
Normal file
30
python/mrds_common/mrds/processors/xml_processor.py
Normal file
@@ -0,0 +1,30 @@
|
||||
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}'")
|
||||
Reference in New Issue
Block a user