Part IV — Expert Production Engineering · Chapter 26 · Lesson 3 of 6 · 2 min read
Lesson 3: Data Ingestion, Analytics, and Optional ML Pipeline
Lesson level: Expert
Purpose: Reliable ingestion and optional ML preserve table contracts and evidence while leaving policy authority unchanged.
Learning Objectives
- Implement the stage with verified data or package APIs.
- Separate source evidence from live operational claims.
- Produce reproducible fixtures and artifact identities.
3.1 Concepts
Use a local synthetic CSV or JSONL fixture first. Define source representation, grain, keys, nullable fields, rejection policy, joins, aggregates, and publication schema before connecting providers. The data and ML layers are Python host APIs, not a new std.data namespace. If ML is included, predict service demand with chronological splits and leakage-free preprocessing; keep deterministic case priority separate.
3.2 Annotated Example
Illustrative pipeline: read approved case fixtures; validate keys and types; isolate rejected rows; aggregate demand by time interval and service category; publish versioned records. Optional forecasting compares a simple baseline with a supported fitted model on future-held-out data. If saving a portable ProductionPipeline, use only model and transformer records actually reconstructed by load_pipeline.
3.3 Guided Practice
Trace one malformed record, duplicate key, missing interval, and unseen category. Identify whether the response is rejection, normalization, or an explicitly documented missing-value rule.
3.4 Common Mistakes
Do not silently discard rejected rows, infer provider certification from mocks, train preprocessing on held-out data, or assume arbitrary custom models are portable.
3.5 Hands-On Lab
- Define schemas, grain, keys, and deterministic ingestion fixtures.
- Implement validation and aggregation using verified Python data APIs.
- Compare source counts with accepted and rejected records and verify aggregate contracts.
- If using ML, retain split policy, baseline, metrics, model card, and a supported save/load round trip.
Deliverable: Implementation, fixtures, verified identities, and evidence distinguishing supported behavior from open gaps.
3.6 Review Questions
Why is grain a contract? What makes a time-series split leakage-free? Which portable model classes are supported?
3.7 Applied Challenge
Introduce a controlled schema change and demonstrate explicit rejection or approved migration without altering policy decisions.
Lesson Summary
Reliable ingestion and optional ML preserve table contracts and evidence while leaving policy authority unchanged.
Lesson status: Draft complete; ready for review.