The invention discloses a traceable
data conversion method and
system based on declarative rules, and relates to the technical field of
data processing. The method comprises the following steps: acquiring a conversion rule file written by adopting a PTL (Program Transfer Language), and defining a mapping relationship between a target data column and a
source data field in a declarative manner; analyzing the rule file to generate an operation
instruction set, and
processing the
source data line by line based on the
instruction set to generate a target
data file; and meanwhile, outputting the
traceability metadata, and recording the corresponding relationship between the target data and the source fields and the rule statements in a
machine readable form. Flexible and accurate conversion between various data sources and target formats is achieved, complexity of manual operation and script development is avoided,
data processing efficiency and reliability are improved, a complete traceable mechanism is established, transparency and compliance of the
data exchange process are enhanced, the method is suitable for conversion of various formats such as Excel, databases,
XML and
JSON, and the method has wide application prospects. The method has universality and application prospects.