Step 1: Tag Data Origin
This example adds origin metadata for downstream review. The fields record what the pipeline received from the synthetic source; they do not independently establish provenance or location.
The Goal
Add a _data_origin object containing:
- Source region (EU)
- Source country (DE, FR, etc.)
- Source database identifier
- Extraction timestamp
- Pipeline identifier
Why This Matters
GDPR Article 30: Controllers must maintain records of processing activities, including the source of data.
Audit Trail: When regulators ask "where did this data come from?", you have a documented answer.
Incident Response: If a breach occurs, origin tags help scope the impact.
Implementation
See the origin-tagging processor and pipeline identifier in the canonical reference.
Understanding the Code
| Expression | What It Does |
|---|---|
root._data_origin = {...} | Add nested metadata object |
env("SOURCE_COUNTRY") | Read from environment variable |
.or("DE") | Default to "DE" if not set |
now() | UTC timestamp of processing |
Expected Output
Use the Explorer checkpoints for the sample input and origin metadata.
Adaptation checks
Dynamic Country Detection
For multi-country EU deployments:
root._data_origin.country = match this.iban.slice(0, 2) {
"DE" => "DE",
"FR" => "FR",
"NL" => "NL",
"ES" => "ES",
_ => env("SOURCE_COUNTRY").or("EU")
}
Node Identification
Track which edge node processed the data:
root._data_origin.node_id = env("NODE_ID").or(env("HOSTNAME")).or("unknown")
root._data_origin.node_region = env("NODE_REGION").or("eu-west-1")
Pipeline Versioning
Track config version for debugging:
root._data_origin.pipeline_version = "2.1.0"
root._data_origin.config_hash = "a1b2c3d4"