DEVELOPMENT · DEV-002

Build Incremental Sales Data Pipeline

Build a production-oriented incremental sales pipeline that processes continuously arriving transaction data, handles reprocessing safely, and prepares trusted datasets for downstream analytics.

Difficulty
Intermediate
Estimated Effort
2–3 Days
Prerequisites
PySpark · SQL
Primary Stack
Databricks
Target
Snowflake
01

Project Brief

Understand the business problem before designing the technical solution.

Business Problem

A retail business receives sales transaction files from multiple stores throughout the day. New files may arrive at different times, and previously delivered files may occasionally be reprocessed because of upstream retries, operational recovery, or file delivery issues.

The existing process does not provide a reliable incremental processing mechanism. As a result, the data engineering team needs a pipeline that can identify newly available transaction data, process it safely, prevent unnecessary duplication, and make the resulting sales data available for downstream analytics.

Development Objective

Build an incremental sales data pipeline that can process newly arriving transaction data while safely handling duplicate deliveries, repeated execution, and late-arriving records.

The pipeline should produce a trusted transaction-level dataset and a business-ready sales dataset that can be consumed by downstream reporting and analytics workloads.

Expected Outcome

Incremental Processing
Process newly available transaction data without unnecessarily reprocessing the complete historical dataset.
Duplicate Protection
Prevent repeated transaction deliveries or retries from creating incorrect duplicate business records.
Late Data Handling
Provide an appropriate strategy for transactions that arrive after the expected processing window.
Trusted Sales Data
Produce validated transaction-level data suitable for downstream consumption.
Analytics Dataset
Provide a business-ready sales dataset containing the required aggregations for analytics use cases.
Reprocessing Safety
Allow failed or repeated executions to be recovered without unnecessarily corrupting previously processed data.
Developer Focus

The task is intentionally focused on the engineering problem rather than prescribing a single implementation. Determine an appropriate incremental processing strategy based on the source characteristics, business requirements, and engineering constraints defined throughout this task.

02

Source System

Understand the incoming sales data, delivery behavior, and source contract.

Source Overview

The source system delivers sales transaction files to cloud storage throughout the business day. Files are generated by individual stores and may arrive at different times rather than following a single predictable delivery window.

A file may contain transactions for multiple stores, and a previously delivered file may occasionally be delivered again because of upstream retries or operational recovery.

Source Type
Delimited transaction files
Delivery Location
Cloud object storage
Arrival Pattern
Multiple files throughout the day
Processing Mode
Incremental
Expected Behavior
New and previously delivered files may coexist
Business Domain
Retail Sales

Transaction Schema

Each source record represents a sales transaction. The following attributes are available to the pipeline.

transaction_id*
STRING
Unique business identifier for the sales transaction.
store_id*
STRING
Identifier of the store where the transaction occurred.
customer_id
STRING
Identifier of the customer associated with the transaction. May be unavailable for anonymous purchases.
product_id*
STRING
Identifier of the purchased product.
transaction_timestamp*
TIMESTAMP
Timestamp representing when the transaction occurred.
quantity*
INTEGER
Number of units purchased in the transaction.
unit_price*
DECIMAL
Price of a single purchased unit.
transaction_amount*
DECIMAL
Total monetary value represented by the transaction.
source_file*
STRING
Name of the source file from which the record originated.

Source Delivery Characteristics

Repeated File Delivery
The same source file may be delivered more than once.
Late Arriving Transactions
A transaction may arrive after the expected processing window for its transaction date.
Multiple Arrival Times
Files are not guaranteed to arrive in a single ordered sequence.
Historical Data in New Files
A newly arriving file may contain transactions belonging to an earlier business date.
Business Key
transaction_id is the primary business identifier for determining transaction uniqueness.
Source Contract

The source contract describes what the pipeline receives. The developer is responsible for determining how the incoming data should be discovered, validated, processed, and persisted safely.

03

Expected Architecture

Define a reliable architecture for incremental transaction processing and downstream analytics.

Architecture Objective

The solution should separate raw ingestion, incremental processing, trusted transaction data, business aggregation, and downstream publishing responsibilities.

The architecture should also provide a reliable mechanism for determining what data needs to be processed during each execution while supporting repeated execution and late-arriving transactions.

01
Source / Landing
Cloud Object Storage
Receive and retain incoming sales transaction files in their original form.
02
Bronze — Raw Transactions
Databricks / Delta
Persist source transaction data with sufficient metadata to support traceability, replay, and incremental processing.
03
Incremental Processing
Databricks / PySpark
Identify and process the appropriate new or changed transaction data while safely handling repeated execution and late arrivals.
04
Silver — Trusted Transactions
Databricks / Delta
Validate, standardize, deduplicate, and prepare transaction-level data for downstream consumption.
05
Gold — Sales Analytics
Databricks / PySpark
Create business-ready sales datasets and aggregations required by downstream analytics.
06
Analytics Target
Snowflake
Publish the curated sales datasets for reporting and analytical workloads.

Architecture Expectations

Incremental State
The solution should maintain or derive sufficient processing state to determine what data requires processing during an execution.
Idempotent Processing
Repeated execution of the same input should not unnecessarily create duplicate trusted transactions.
Late Data Support
The architecture should provide a defined strategy for transactions that arrive after their expected processing period.
Traceability
A processed transaction should remain traceable to its originating source information.
Layer Separation
Raw ingestion, transaction validation, incremental processing, business aggregation, and target publishing should have clearly understandable responsibilities.
Recoverability
The architecture should support recovery from failed executions without requiring unnecessary full historical reprocessing.
Downstream Stability
The Snowflake target should receive a consistent, trusted representation of the curated sales data.
Architecture Principle

The architecture describes the responsibilities and data flow that the solution must satisfy. It does not prescribe a single implementation pattern. The developer is expected to choose appropriate technologies, processing strategies, and control mechanisms within the requirements of this task.

04

Development Requirements

Build the pipeline capabilities required to process sales data incrementally and reliably.

Required Capabilities

The implementation must satisfy the following functional and engineering requirements. The developer is responsible for determining the appropriate implementation approach.

01
Incremental File Discovery
Identify newly available source files or records that require processing without unnecessarily reprocessing the complete historical source dataset.
Expected Outcome
Only the appropriate incremental input should enter the processing flow for an execution.
02
Raw Data Ingestion
Ingest the incoming sales transaction files into the raw processing layer while preserving sufficient source information for traceability and recovery.
Expected Outcome
Raw source data remains available for downstream processing and replay.
03
Source Validation
Validate required fields, data types, transaction values, and other applicable source-level quality rules before records are promoted to the trusted transaction layer.
Expected Outcome
Invalid or unusable records are identifiable and handled through a defined data-quality strategy.
04
Transaction Deduplication
Ensure that repeated delivery of the same transaction does not create multiple trusted business records.
Expected Outcome
The trusted transaction dataset contains one valid representation of each business transaction.
05
Safe Reprocessing
Design the processing flow so that repeated execution, retries, or recovery from a failed run do not unnecessarily duplicate previously processed transactions.
Expected Outcome
The pipeline can be rerun safely without compromising trusted data.
06
Late-Arriving Transaction Handling
Support transactions that arrive after their expected processing period and ensure that their presence does not leave downstream datasets permanently inconsistent.
Expected Outcome
Late-arriving transactions are incorporated according to a clearly defined processing strategy.
07
Silver Transaction Dataset
Create a trusted transaction-level dataset containing validated, standardized, and deduplicated sales records.
Expected Outcome
Downstream processing can consume a consistent transaction-level dataset.
08
Gold Sales Aggregation
Create a business-ready sales dataset containing the aggregations required for downstream analytics, including appropriate sales measures by relevant business dimensions.
Expected Outcome
Analytics consumers can use the curated dataset without repeating core transaction-level calculations.
09
Snowflake Publishing
Publish the required curated sales dataset to Snowflake using a controlled and repeatable loading strategy.
Expected Outcome
Snowflake contains a consistent representation of the expected downstream dataset.
10
Processing Metadata
Capture sufficient operational metadata to understand what was processed, when processing occurred, and the source context associated with the processed data.
Expected Outcome
Pipeline executions remain observable and traceable for operational investigation.
Implementation Freedom

These requirements define the capabilities the solution must provide. They intentionally do not prescribe a specific notebook structure, incremental-processing mechanism, merge strategy, or orchestration pattern.

05

Testing Requirements

Demonstrate that the incremental pipeline behaves correctly under normal, repeated, delayed, and invalid processing conditions.

Required Test Scenarios

The developer must validate both the functional output and the incremental behavior of the pipeline. Tests should demonstrate that the solution continues to produce correct results when input conditions change or processing is repeated.

01
First-Time Processing
Scenario
Process a set of previously unprocessed sales files.
Expected Result
All valid transactions are processed and the expected trusted and downstream datasets are created.
02
Repeated File Delivery
Scenario
Make the same source file available for processing again.
Expected Result
Previously processed transactions are not unnecessarily duplicated in the trusted dataset.
03
New Incremental Data
Scenario
Introduce a new source file containing transactions that were not present during the previous execution.
Expected Result
Only the newly required data is incorporated while previously trusted data remains correct.
04
Late-Arriving Transaction
Scenario
Introduce a valid transaction whose business timestamp belongs to an earlier processing period.
Expected Result
The transaction is incorporated according to the pipeline's defined late-data handling strategy.
05
Duplicate Transaction
Scenario
Provide multiple source records representing the same business transaction.
Expected Result
The trusted transaction dataset contains the correct business representation without unintended duplication.
06
Invalid Transaction
Scenario
Introduce records containing invalid or unusable values in required fields.
Expected Result
Invalid records are handled according to the defined data-quality strategy and do not incorrectly contaminate trusted data.
07
Failed Processing Recovery
Scenario
Simulate a processing failure and execute the pipeline again after the failure condition is resolved.
Expected Result
The pipeline can recover without unnecessarily duplicating transactions that were already processed successfully.
08
Out-of-Order File Arrival
Scenario
Deliver source files in an order different from their business transaction dates.
Expected Result
The final trusted and aggregated datasets remain consistent with the available source data.
09
Aggregation Validation
Scenario
Compare the Gold sales aggregation against the underlying trusted transaction data.
Expected Result
Sales measures and business aggregations reconcile with the transaction-level source of truth.
10
Snowflake Target Validation
Scenario
Validate the curated dataset after publishing it to Snowflake.
Expected Result
The Snowflake target contains the expected records, values, and business aggregations without unintended duplication.
Testing Principle

Successful execution of the pipeline for one input dataset is not sufficient. The solution must demonstrate correct behavior when data is repeated, delayed, invalid, reordered, or processed again after a failure.

06

Acceptance Criteria

The implementation must satisfy these conditions before the development task can be considered complete.

Definition of Done

The pipeline is considered complete only when the following conditions have been demonstrated through implementation, testing, and execution evidence.

01
Incremental Processing Works
The pipeline processes newly available sales data without unnecessarily reprocessing the complete historical source dataset.
02
Duplicate Transactions Are Controlled
Repeated source delivery or duplicate transaction records do not result in unintended duplicate business transactions in the trusted dataset.
03
Repeated Execution Is Safe
Running the pipeline again against previously processed input does not corrupt or unnecessarily duplicate trusted data.
04
Late-Arriving Data Is Supported
Valid transactions arriving after their expected processing period are incorporated according to the defined processing strategy.
05
Invalid Data Is Controlled
Invalid source records are identified and handled through the implemented data-quality strategy without incorrectly contaminating trusted datasets.
06
Silver Dataset Is Trusted
The Silver transaction dataset contains validated, standardized, and appropriately deduplicated transaction records.
07
Gold Aggregations Reconcile
The Gold sales dataset produces business measures that reconcile with the underlying trusted transaction data.
08
Snowflake Target Is Consistent
The required curated dataset is successfully published to Snowflake and represents the expected downstream data without unintended duplication.
09
Processing Is Traceable
The implementation provides sufficient metadata or execution information to determine what was processed and understand the source context.
10
Recovery Is Demonstrated
A failed processing attempt can be recovered without unnecessarily corrupting or duplicating data that was already processed successfully.
11
Required Tests Pass
The required test scenarios defined in Section 05 have been executed and the expected results have been demonstrated.
12
Implementation Is Reviewable
The implementation is sufficiently organized, documented, and understandable for another engineer to review and maintain.
Acceptance Principle

A pipeline that runs successfully once is not automatically considered complete. Acceptance depends on demonstrating correct incremental behavior, data correctness, recoverability, downstream consistency, and test evidence.

07

Developer Deliverables

The completed task should be submitted with the implementation, validation evidence, and supporting engineering artifacts.

Required Deliverables

The implementation is not considered complete until the required development artifacts and supporting evidence are available for review.

01
Pipeline Implementation
Provide the completed incremental sales pipeline covering source ingestion, transaction processing, trusted data preparation, aggregation, and downstream publishing.
02
Incremental Processing Logic
Provide the implementation responsible for determining and processing the appropriate incremental sales data during each execution.
03
Data Quality and Deduplication Logic
Provide the implemented validation and transaction deduplication logic required to produce trusted sales data.
04
Late-Arriving Data Strategy
Provide the implemented approach for handling valid transactions that arrive after their expected processing period.
05
Reprocessing and Recovery Evidence
Provide evidence demonstrating that repeated execution and recovery from a failed run do not unnecessarily duplicate or corrupt previously processed data.
06
Automated Tests
Provide the required unit, integration, or data-validation tests used to verify the pipeline behavior defined in the testing requirements.
07
Execution Evidence
Provide sufficient execution evidence demonstrating successful processing of initial, incremental, duplicate, late-arriving, and recovery scenarios.
08
Snowflake Target Evidence
Provide evidence that the required curated dataset has been published successfully to Snowflake and reconciles with the trusted source data.
09
Technical Documentation
Document the chosen incremental-processing approach, important design decisions, configuration requirements, and execution process.
10
Known Limitations and Assumptions
Document assumptions, known limitations, or scenarios that are outside the scope of the current implementation.
Submission Principle

The final submission should demonstrate not only that the pipeline was implemented, but also that its incremental, duplicate-handling, late-data, and recovery behavior was validated.

08

Engineering Constraints

The solution must operate within the following technical and operational boundaries.

Required Engineering Boundaries

The implementation should satisfy the following constraints. These constraints are intended to guide engineering decisions without prescribing one specific implementation pattern.

01
Incremental-First Design
The solution must be designed primarily for incremental processing rather than relying on a complete historical reload for every execution.
02
Idempotent Behavior
Repeated processing of the same business input must not create unintended duplicate records in trusted datasets.
03
Source Traceability
Processed records must retain sufficient source context to allow engineers to trace a trusted transaction back to its originating input.
04
No Silent Data Loss
Records that cannot be processed successfully must be identifiable through an appropriate error-handling or data-quality mechanism rather than being silently discarded.
05
Controlled Reprocessing
Recovery and reprocessing should be possible without requiring unnecessary full historical processing whenever the failure is limited to a subset of data or an execution.
06
Late Data Must Be Accounted For
The implementation must explicitly consider transactions that arrive after their expected processing period.
07
Layer Responsibility
Raw ingestion, trusted transaction processing, business aggregation, and downstream publishing should remain logically separated.
08
Configuration Separation
Environment-specific values such as storage locations, database names, schemas, credentials, or connection configuration must not be hard-coded into business logic.
09
Reusable Processing Logic
Common processing behavior should be implemented in a maintainable and reusable manner rather than duplicated unnecessarily across notebooks or jobs.
10
Operational Observability
The implementation must provide enough logging or metadata to understand execution status, processed input, and relevant processing outcomes.
11
Scalable Processing
The solution should be designed to handle increasing transaction volumes without depending on driver-side processing or other approaches that do not scale with distributed data.
12
Production-Oriented Code
The implementation should be structured as maintainable engineering code rather than a one-off exploratory notebook.
Engineering Principle

Constraints define the engineering boundaries of the solution. They should influence implementation decisions while still allowing the developer to justify the specific design pattern chosen.

09

Suggested Project Structure

Organize the implementation into clear responsibilities so the solution remains maintainable and reviewable.

Recommended Structure

The implementation should be organized so that ingestion, incremental processing, transformation, validation, testing, configuration, and publishing responsibilities remain understandable and maintainable.

DEV-002-incremental-sales-pipeline/
│
├── README.md
│
├── notebooks/
│   ├── 01_ingestion
│   ├── 02_incremental_processing
│   ├── 03_silver_transactions
│   └── 04_gold_sales
│
├── src/
│   ├── ingestion/
│   ├── transformations/
│   ├── quality/
│   ├── incremental/
│   └── publishing/
│
├── tests/
│   ├── unit/
│   ├── integration/
│   └── data_quality/
│
├── config/
│   ├── dev/
│   └── prod/
│
└── docs/
    ├── architecture.md
    └── processing_strategy.md

Directory Responsibilities

notebooks/
Entry points used to execute or orchestrate the major pipeline stages.
src/ingestion/
Logic related to discovering and ingesting source transaction data.
src/incremental/
Logic responsible for incremental processing state and determining data that requires processing.
src/transformations/
Reusable transaction-level and business transformation logic.
src/quality/
Data validation, quality rules, and duplicate-detection logic.
src/publishing/
Logic responsible for preparing and publishing curated datasets to downstream targets.
tests/
Automated and scenario-based validation of the pipeline behavior.
config/
Environment-specific configuration kept separate from business logic.
docs/
Architecture decisions, processing strategy, assumptions, and operational documentation.
Structure Principle

The structure above is a recommendation rather than a mandatory implementation layout. Equivalent structures are acceptable when they maintain clear separation of responsibilities and remain easy for another engineer to understand and maintain.

10

Submission Checklist

Complete this checklist before submitting the development task for review.

Final Developer Checklist

Before submitting DEV-002, verify each item below. The submission should provide enough evidence for another engineer to understand, execute, test, and review the solution.

Source ingestion is implemented
The pipeline can discover and ingest the expected sales transaction input.
Incremental processing is implemented
The pipeline processes the appropriate incremental input without relying on unnecessary full historical processing.
Duplicate handling is implemented
Repeated files or duplicate transactions do not create unintended trusted records.
Late-arriving data is handled
The implemented strategy correctly accounts for transactions arriving after their expected processing period.
Data quality rules are implemented
Required validation rules are applied and invalid records are handled appropriately.
Silver dataset is validated
The trusted transaction-level dataset contains the expected validated and deduplicated records.
Gold dataset is validated
Business aggregations reconcile with the underlying trusted transaction data.
Snowflake publishing is validated
The required curated dataset is successfully available in the downstream Snowflake target.
Recovery behavior is tested
The pipeline has been tested after a simulated or controlled failure and does not unnecessarily duplicate successful processing.
Required test scenarios are completed
All scenarios defined in the Testing Requirements section have been executed and validated.
Execution evidence is attached
Relevant logs, screenshots, query results, test results, or other evidence are available for review.
Documentation is complete
The README, architecture decisions, processing strategy, assumptions, and configuration requirements are documented.
Code is review-ready
The implementation is organized, readable, reusable where appropriate, and free from unnecessary debugging code or hard-coded environment values.
Known limitations are documented
Any assumptions, unsupported scenarios, or known limitations have been clearly identified.
Ready for Review

Submit DEV-002 only after the implementation, tests, execution evidence, documentation, and acceptance criteria have been reviewed by the developer.