BCA
Data engineering foundations for organisations
Study map: Original foundation and applied lesson; editorially linked to the named subject
Data engineering makes source records available for analysis through repeatable acquisition, validation, transformation and delivery. This chapter uses a synthetic order pipeline to test what its totals include, exclude and cannot establish.
Foundation: move data without losing its meaning
Data engineering builds the processes that acquire, validate, transform, store and deliver data for use. An analyst needs more than an occasional file that happens to open. They need a repeatable process, a documented definition and a way to understand missing or delayed information. A pipeline connects these stages, but its business purpose is trustworthy availability rather than movement for its own sake.
Distinguish the source event from the time it arrives in an analytical system. An order placed yesterday may arrive today because a network was unavailable. A report based on arrival time answers a different question from one based on order time. Late records require an explicit policy. Similarly, a retry may deliver the same event more than once; the pipeline needs a way to identify it without discarding a legitimately different event.
Sales and operations know what the event means, the data engineer implements transformations, the steward maintains definitions and management owns the decision made from the result. The pipeline should expose exceptions and freshness to its users. A green technical status is not sufficient when a source stopped sending data before the process began.
Undergraduate: parse, validate and reconcile a batch
The records_pipeline.py exercise reads a synthetic CSV with order identifiers, customer names and integer amounts in paise. CSV is a representation, not a schema that guarantees types or meaning. Read fields with a CSV parser, then perform deliberate type conversion and validation. Splitting a line on commas can misread a quoted value containing a comma. A parser does not decide whether the resulting value fits the business rule.
The sample contains five rows: two accepted orders, one identical replay, one invalid amount and one conflicting identifier. The pipeline records a reason for each rejected row and preserves the accepted total of 30,000 paise. Convert to rupees only for display: 30,000/100 = 300. Keeping integer minor units in this example avoids unnecessary floating-point ambiguity for the synthetic monetary aggregate; it does not solve every currency, tax or rounding policy.
Reconcile accepted, duplicate and rejected counts to the input count: 2 + 1 + 2 = 5. Reconciliation at this stage confirms how the supplied rows were classified, not that the source captured every real order. A useful report includes both the aggregate and the exclusions. Managers can then distinguish genuine activity from a change in validation or a delayed source.
Postgraduate: retries, state and reproducible transformations
A repeatable pipeline needs a defined unit of processing and a policy for retries. The exercise recognises identical identifiers within one run. Its seen-state and database disappear at exit, so it does not demonstrate durable deduplication across scheduled runs. To extend it, decide where stable processing state belongs, how partial failures are recovered and how a corrected event differs from an identical replay.
Use a pipeline contract containing source definition, schema, validation, transformation version, output grain, freshness expectation and exception owner. Keep raw observations where appropriate and authorised so a revised rule can be evaluated. A backfill reprocesses historical data; it should identify the rule version and communicate which past reports change. Otherwise a manager may mistake a revised historical total for new activity.
ETL and ELT describe different placements of transformation relative to loading. Neither ordering is universally superior; access, scale, governance and failure recovery influence the choice. Batch and streaming similarly involve tradeoffs in delay, complexity and state. A local shop's daily export and a global service's event stream can share the same need for explicit semantics without requiring the same platform. Evaluate latency against decision needs, not fashion.
Research: evaluate reliability and business consequences
A research question could ask whether explicit exception handling improves decision reliability compared with silently dropping malformed records. Define reliability for the decision: completeness, correction delay, wrong actions or another justified outcome. Test normal records, duplicates, conflicting identifiers, delayed arrivals and schema changes. Explain what the synthetic tests establish and what real-world evidence would be needed.
Measure technical failure alongside business consequences. A pipeline can finish quickly by ignoring difficult rows; an analyst can produce a polished chart from the incomplete result. Include exclusion counts, correction workload and freshness. A study that compares different periods must consider changes in data volume, source behaviour and staffing. Interviews may explain correction practices that logs alone cannot reveal.
For a portfolio, submit the source contract, transformation rules, validation cases, reconciled counts and a recovery proposal. A contribution can identify a failure mechanism or a boundary of a retry policy. It need not invent a new platform. The nine enquiry words help locate responsibilities and evidence: who provides, whom it affects, whose definition applies, what changes, where state lives, when data is due, why an exclusion is justified, which version produced the result and how recovery is checked.
Practice and further learning
Run records_pipeline.py, inspect the output and explain every classification. Add a quoted customer name containing a comma and verify that CSV parsing preserves it. Change an accepted amount to zero and predict which counts change. Reorder the identical replay and confirm that the result is stable. Then deliberately place the conflicting payload first and explain why first-seen acceptance is an insufficient conflict-resolution policy for production.
Read the official Python csv documentation for reader behaviour, dialects and type conversion. The program's temporary database demonstrates parsing, local validation and a bounded transaction, not orchestration, cloud deployment or a distributed streaming architecture. The next design exercise is a durable-state proposal with a correction path and evidence that a restart cannot silently duplicate accepted business activity.
Further reading: Python: CSV reading and writing
Study questions and answers
Why does parsing CSV not establish a valid business record?
Parsing handles the representation and quoting; values still need type, domain and semantic checks. A valid string may refer to the wrong order or contain an invalid amount. Indicative marking: Parsing role 3; validation 3; example 2; semantic boundary 2.
Reconcile the five-row pipeline input and calculate the accepted rupee value.
Two accepted plus one identical replay plus two rejected equals five rows. Accepted amount is 30,000 paise, or INR 300. This classifies supplied rows but does not prove complete source capture. Indicative marking: Counts 3; amount/conversion 3; excluded cases 2; completeness boundary 2.
Does the in-memory exercise prove deduplication across daily restarts?
No. Seen-state and the SQLite database are discarded on exit. Durable identifiers and processing state, correction semantics and failure recovery must be designed and tested for cross-run guarantees. Indicative marking: State boundary 3; durable design 3; correction/recovery 2; test proposal 2.
Evaluate a pipeline that becomes faster after it drops malformed records.
Speed may improve while decision reliability deteriorates. Track exclusions, freshness, correction delay and wrong decisions with a justified comparison. Separate transformation policy changes from genuine source improvement. Indicative marking: Tradeoff 3; outcomes 3; comparison 2; interpretation 2.
Extended practice questions
Why does parsing CSV not establish a valid business record?
Parsing handles the representation and quoting; values still need type, domain and semantic checks. A valid string may refer to the wrong order or contain an invalid amount.
Marking guide: Parsing role 3; validation 3; example 2; semantic boundary 2.
Marks: 10
Reconcile the five-row pipeline input and calculate the accepted rupee value.
Two accepted plus one identical replay plus two rejected equals five rows. Accepted amount is 30,000 paise, or INR 300. This classifies supplied rows but does not prove complete source capture.
Marking guide: Counts 3; amount/conversion 3; excluded cases 2; completeness boundary 2.
Marks: 10
Does the in-memory exercise prove deduplication across daily restarts?
No. Seen-state and the SQLite database are discarded on exit. Durable identifiers and processing state, correction semantics and failure recovery must be designed and tested for cross-run guarantees.
Marking guide: State boundary 3; durable design 3; correction/recovery 2; test proposal 2.
Marks: 10
Evaluate a pipeline that becomes faster after it drops malformed records.
Speed may improve while decision reliability deteriorates. Track exclusions, freshness, correction delay and wrong decisions with a justified comparison. Separate transformation policy changes from genuine source improvement.
Marking guide: Tradeoff 3; outcomes 3; comparison 2; interpretation 2.
Marks: 10
A scheduled pipeline counts the same daily file twice and doubles a revenue report. What should the ingestion design address?
Record source identity, ingestion time and a documented rule for recognising repeated input. Retain the original file and an auditable processing outcome instead of silently appending every arrival. Decide whether a corrected source file replaces, amends or adds to prior records, and test that policy with synthetic examples. Finance defines revenue meaning; data engineering implements reproducible ingestion and lineage. A pipeline that finishes successfully may still publish an incorrect result. Check record counts, key relationships and reconciliation before releasing downstream data, and provide a correction path when a duplicate is discovered.
Marking guide: Source identity/repeat policy; original/lineage; corrected-file semantics; business definitions; publish checks. Indicative allocation: reasoning 4; application or workings 3; assumptions and limits 3.
Marks: 10
Compare a raw data layer with a curated reporting dataset.
A raw layer preserves source records with provenance so processing can be investigated and reproduced. A curated dataset applies documented validation, transformations and business definitions for an intended use. Curated does not mean universally correct for every question; the counting grain and scope still matter. Preserve rejected-record explanations and lineage between outputs and inputs. Access and retention should be appropriate to the data in each layer. Business owners define reporting meaning, while engineers implement and test the transformations. Deleting inconvenient raw evidence to make a report look tidy weakens reproducibility and accountability.
Marking guide: Preservation versus defined processing; use-specific meaning; rejected records/lineage; access; no erased evidence. Indicative allocation: reasoning 4; application or workings 3; assumptions and limits 3.
Marks: 10
An input has 120 rows, including twenty duplicate copies. After deduplication, eight of the 100 unique rows fail a validation rule. Calculate accepted rows and unique-row acceptance rate.
Deduplication leaves 120 − 20 = 100 unique rows. Removing the eight specified invalid unique rows leaves 92 accepted rows, so acceptance among unique rows is 92/100 = 92%. Accepted rows over raw rows would be about 76.67%, describing a different denominator. The calculation assumes duplicates and invalid unique rows are defined as stated. Retain rejection reasons and verify that deduplication does not erase legitimate repeated events. A high acceptance rate is not proof that every accepted value is accurate or that the dataset is suitable for every business decision.
Marking guide: 100 unique; 92 accepted; 92%; raw denominator difference; duplicate semantics and accuracy limits. Indicative allocation: reasoning 4; application or workings 3; assumptions and limits 3.
Marks: 10
Design a reproducible pipeline correction exercise.
Use a synthetic raw file containing a duplicate, a missing key and a corrected record. Specify source identities, validation rules, correction precedence and expected output before running the transformation. Compare input, accepted, rejected and changed counts, and preserve reasons for each exception. Re-run the same input to test the documented repeat behaviour. Link the curated output to source versions and review the business measure it supports. These checks provide bounded evidence of reproducibility and reconciliation; they do not prove production scale, complete privacy protection or that the chosen business definition is appropriate without managerial review.
Marking guide: Synthetic corrections; defined precedence/output; reconciled counts; re-run behaviour; lineage and scope. Indicative allocation: reasoning 4; application or workings 3; assumptions and limits 3.
Marks: 10
Revision cards
Why distinguish event time from ingestion time?
Event time describes when the business occurrence happened; ingestion time describes when it entered the pipeline. Late records can change reporting. Preserve both where relevant so historical snapshots are not silently reinterpreted.
A scheduled pipeline counts the same daily file twice and doubles a revenue report. What should the ingestion design address?
Track source identity and repeat/correction rules before appending data. Successful execution does not prove that the resulting revenue measure is correct.
Compare a raw data layer with a curated reporting dataset.
Raw preserves source and provenance; curated applies documented rules for a defined use. Keep lineage and rejection reasons rather than hiding inconvenient inputs.
An input has 120 rows, including twenty duplicate copies. After deduplication, eight of the 100 unique rows fail a validation rule. Calculate accepted rows and unique-row acceptance rate.
100 unique rows remain; 92 accepted, giving 92% unique-row acceptance. Deduplication rules must preserve legitimate repeated events.
Design a reproducible pipeline correction exercise.
Test duplicate, missing and corrected records with explicit precedence and count reconciliation. Preserve versions and repeat behaviour so another learner can reproduce the result.
How should a pipeline handle a rejected record?
Record the reason, relevant identity and correction owner, with appropriate access. Reconcile rejected counts and decide how incompleteness affects downstream measures. Quietly dropping the record can conceal a business problem.
What should replay testing establish?
Processing the same identified input again should preserve the intended outcome without unintended duplicates. Inspect destination state and reconciliation counts. Replay behaviour depends on implemented identity and update rules, not a pipeline label.
Why keep rejected records visible in a data pipeline?
They can reveal missing information, rule conflicts or source failures important to the decision. Report their scope and ownership. Silently dropping them makes the accepted dataset appear more complete than the evidence supports.
How does event time differ from processing time?
Event time concerns when the business event occurred; processing time concerns when a system handled it. Delays can place them in different periods. Choose and document the relevant rule rather than treating ingestion time as universal business truth.
Why version a transformation rule as well as its input?
Different logic can produce different results from the same records. Retaining both enables reproduction and interpretation of corrections. A source snapshot alone cannot explain how the published measure was constructed.
Practice task
Follow information-workshop.html: predict and run the pipeline, reconcile classifications, explain the inflated join, and submit a metric contract, exception policy and managerial memo.
Sources and further reading
- Shared records workshop
Type: Original practical teaching
Use: Chapter-specific runnable exercise and evidence requirements - Python CSV documentation
Type: Free official documentation
Use: Parsing, quoting and deliberate type conversion - PostgreSQL constraints
Type: Free official documentation
Use: Structural record rules; the local runnable exercise uses SQLite - PostgreSQL transactions
Type: Free official documentation
Use: Further reading on bounded commit and rollback