## Airflow DAGs: Orchestrating ML Pipelines in Production
Apache Airflow is the dominant orchestration platform for ML data pipelines in UK enterprise, used by 67% of UK data engineering teams (State of Data Engineering UK 2025 survey). A well-structured ML pipeline DAG separates ingestion, transformation, validation, feature engineering and model training into distinct tasks with explicit dependencies. Best practice for UK deployments: use Airflow on Kubernetes (KubernetesExecutor) for elastic scaling, store secrets in HashiCorp Vault or AWS Secrets Manager (never in DAG code or environment variables), and implement XCom sparingly — pass only metadata between tasks, not dataframes. For regulated industries, enable Airflow's audit log plugin and integrate with your model risk register so every pipeline run is traceable to a model version and business justification.
## dbt: Transformations That Data Scientists Can Trust
dbt (data build tool) has become the standard for SQL-based transformations feeding ML feature stores in UK data teams. Its killer feature for ML: every transformation is a documented, tested, version-controlled SQL model with lineage tracking — satisfying FCA SS1/23 requirements for data provenance. Key dbt patterns for ML pipelines: staging models (raw → cleaned, one-to-one with source tables), intermediate models (business logic transformations), mart models (aggregated features ready for ML ingestion). dbt's built-in tests (not_null, unique, accepted_values, relationships) catch data quality issues before they reach your training pipeline. For UK financial services, the dbt-audit-helper package provides change impact analysis required for model change management documentation.
## Great Expectations: Data Quality Gates for UK GDPR Compliance
Great Expectations (GX) provides programmatic data quality validation — 'expectation suites' that define what your data should look like, executed as pipeline checkpoints. For UK ML pipelines, critical expectations include: row count within expected ranges (detects upstream feed failures), PII column validation (phone numbers, NI numbers conform to UK formats — essential for UK GDPR Article 5 accuracy principle), distribution drift detection (feature distributions remain within training-time bounds), and referential integrity checks. GX integrates natively with Airflow (GreatExpectationsOperator) and generates data documentation automatically — satisfying the 'data quality evidence' requirement in FCA SS1/23 model validation reports. UK teams increasingly use GX as the primary mechanism for demonstrating Article 5(1)(d) UK GDPR accuracy compliance to the ICO.
## Feature Engineering Best Practices and UK GDPR Considerations
Feature engineering for UK ML models must balance predictive power with regulatory compliance. The Equality Act 2010 prohibits using protected characteristics (race, sex, disability, age in some contexts) as direct model inputs — but proxy features (postcode, name patterns) can produce discriminatory outcomes. Best practice: document all features with their data lineage in a feature store (Feast or Tecton), run regular fairness audits using Aequitas or Fairlearn, and maintain an 'excluded features register' for features rejected on regulatory grounds. For UK GDPR, the data minimisation principle (Article 5(1)(c)) requires that only features necessary for the specific purpose are collected and retained. Codeworth's feature engineering engagements include a DPIA (Data Protection Impact Assessment) review as standard, ensuring the feature set is defensible to the ICO before model training begins.
Related Codeworth Services
Need Help with Implementation?
The Codeworth team is ready to implement these ideas in your project. Free consultation.
Discuss the ProjectCodeworth team specialist.