Replace Non-Compliant Content

Updated at:

The Replace non-compliant content operator detects and filters sensitive text, such as political, pornographic, or violent content. It identifies and replaces this content using a combination of the built-in system word list and user-defined keywords. This topic describes how to configure the Replace non-compliant content operator.

Prerequisites

  • To use the workflow feature, you must first purchase the unstructured data feature for your instance.

  • You have created a workflow. For details, see Create and manage a workflow.

Permissions

In a Basic project, project administrators, developers, analysts, and custom project roles with the dataset - use permission can use all datasets in the project as input and output datasets for the operator.

Supported file formats

The Replace non-compliant content operator supports the following file formats: txt, md, csv, json, xml, and html.

Procedure

  1. In the top navigation bar of the Dataphin homepage, choose Development > Data Development.

  2. In the top navigation bar of the Development page, select a project.

  3. In the left navigation bar, select Data Processing > Workflow, click the target workflow in the Workflow list on the left to open the workflow canvas, drag the Replace Non-compliant Content operator from the Operator Library on the left to the canvas, and configure the following parameters in the Replace Non-compliant Content panel on the right.

    Parameter

    Description

    Step name

    Enter a name for the operator. The name can contain any characters and be up to 256 characters long.

    Input settings

    Dataset

    Select the dataset to process. You can choose a hybrid dataset or a table dataset. After you select a dataset, you must also select its version. By default, the earliest version is selected.

    If this operator follows another in the workflow, its input dataset is typically the output dataset from the preceding operator.

    Input field

    Select a field from the metadata table of the input dataset. The system automatically determines how to process the content based on the field's data type:

    • If the field is a URL type, the system fetches the resource at the link and parses its structured or semi-structured content. Supported file formats include .txt, .md, .csv, .json, .xml, and .html.

    • If the field is not a URL type, the system treats the field's value as plain text and does not perform additional parsing.

    Filter conditions (optional)

    Use SQL syntax. Enter only the filter conditions that follow the WHERE clause. You can use global system variables, such as the business date ${bizdate}.

    Operator settings

    Built-in system word list (optional)

    The system provides built-in word lists for categories such as pornography, anti-government, politics, social issues, terrorism, and advertising. You can select multiple lists. You must specify either a built-in system word list or custom sensitive words.

    Custom sensitive words (optional)

    Create a file with your custom sensitive words in .xlsx/.csv/.txt/.xls format. Ensure the sensitive words are in the first column of the file, and its size does not exceed 10 MB. Then, click Upload File.

    Replacement character

    Enter the character to replace sensitive words. The default character is *.

    Output settings

    Dataset

    You can select the Source Dataset or an Other Dataset. If the metadata table of the source dataset does not have a primary key, Other Dataset is selected by default.

    • When you select Other Dataset, you must specify a dataset and its version as the output dataset based on the input field type. By default, the earliest version of the dataset is selected. You can also select other versions of the source dataset.

      • Because processing a URL type field generates a file, you can only select a hybrid dataset as the output dataset.

      • If the input field is not a URL type, you can select either a hybrid dataset or a table dataset as the output dataset.

    • If you select Source Dataset, the operator writes its output metadata to the metadata table of the same source dataset version.

    File output path

    Enter the output path for the processed files. This setting is available only when the input field is a URL type.

    Loading policy

    The default loading policy is update on primary key conflict if the output dataset's metadata table has a primary key; otherwise, the default is append data.

    • Append data: Appends new data directly to the target table. An error occurs if a primary key or constraint conflict is detected.

    • Update on primary key conflict: If a primary key or constraint conflict occurs, the system replaces the existing row with the new data.

    • Overwrite: Deletes all data in the target table before writing the new data.

    Note

    When Source Dataset is selected as the output dataset, update on primary key conflict is the only available loading policy.

    Field mapping

    If the input field is a URL field, the operator outputs a fixed markdown_url field, which is the URL of the processed document. If the input field is not a URL field, the operator outputs a fixed processed_text field, which contains the processed text.

    By default, the operator's output fields are mapped to fields with the same name in the output dataset. You can also manually select target fields for custom mapping. Additionally, you can map pass-through fields from the source dataset to the target dataset. You can manage field mappings in the following ways:

    • Add output field: Click to add a new, empty field mapping row. This feature is available only when Other Dataset is selected as the output dataset.

    • Batch mapping: Click to choose between batch manual mapping, map by name, or map by position. This feature is available only when Other Dataset is selected as the output dataset.

    • Delete mapping: Click the Delete icon to remove a field mapping row. You cannot delete the mapping for the operator's fixed output fields.

  4. After you configure the parameters, click Save in the toolbar at the top of the canvas.

    After configuring an operator, you can continue to build the workflow by connecting it to other operators.