learntodriveai.dev/Data Engineering/Project Memory and Incremental Extraction
Data EngineeringProject 077 unitsVerified on 16 October 2026

Project Memory and Incremental Extraction

Jamie OkaforSupply Chain Analytics Manager · Pharmacy chain · Nottingham, UK
Voicenote · from Jamie
I want it to handle corrections properly, so if a cycle count correction comes through, the number updates cleanly, no doubling up. I want the COO to see yesterday's real numbers at nine, not last Tuesday's.
Chat with Jamie

What you hand back

  • Project memory files for AI sessions
  • Incremental staging models using MERGE
  • A morning ops report across both DCs
  • Controlled-drug lines rolled up separately
  • A stalled-feed alert before 08:45
  • Test and confidential-pattern hooks on commits

7 units

  1. Unit 1: Meet Jamie Okafor and understand the DC data

    Set up the project, then read Jamie's voicenote and review the Preston and Coventry sample data.

    Open unit 1
  2. Unit 2: Build the project memory

    Write the project memory files, then compare AI output from sessions with and without them.

    Open unit 2
  3. Unit 3: Design the extraction strategy

    Fill the pipeline spec, choose full or incremental refresh per source, and see MERGE against INSERT on corrections.

    Open unit 3
  4. Unit 4: Build the staging layer with incremental extraction

    Build the Preston, Coventry and SKU bridge staging models, then the intermediate model that unifies them.

    Open unit 4
  5. Unit 5: Build the mart layer and the morning ops report

    Build the morning ops report mart, add dbt and Soda Core checks, and have AI review its own work.

    Open unit 5
  6. Unit 6: Watermark monitoring and hook-gated verification

    Monitor each feed's watermark before the huddle, then add commit and push hooks that fail closed.

    Open unit 6
  7. Unit 7: Present to Jamie and close the project

    Run the full pipeline with a correction day, present the report to Jamie, and update the project memory.

    Open unit 7
Read the full brief

You're building a daily morning-ops pipeline for a UK community pharmacy chain -- loading data from two distribution centres in different formats and SKU schemes, handling corrections without creating duplicates via incremental extraction and MERGE, and producing the numbers the COO reads at the 09:00 huddle.

The discipline skills: incremental extraction with watermark columns, MERGE as the idempotent loading pattern (instead of INSERT), choosing between full and incremental refresh per source, and monitoring watermark progression to catch stale pipelines.

The AI-direction lesson: building persistent AI infrastructure. Before you write pipeline code, you author a project memory file -- CLAUDE.md and AGENTS.md -- carrying the data dictionary, naming conventions, known issues, and design decisions. Then you run two sessions: one with project memory loaded, one without. The difference in output quality makes a principle you've heard before -- infrastructure determines outcomes -- something you experience directly. Meta-prompting for verification also enters: directing AI to check its own work using structured criteria, then evaluating whether the check was actually thorough. AI reviewing its own output sounds useful. Whether it catches real problems depends entirely on how you prompt it.

Your Role

You're building Jamie Okafor's daily pipeline. Templates provide structure for the new terrain. Guides are thinner than last time. You build the AI infrastructure before the pipeline -- and the infrastructure changes what AI produces.

What's New

Last time you designed schemas that track change over time -- SCD strategies for Katrine's turbines, MetricFlow for standardized metrics, PII masking across every output surface. The schema design was the hard part.

This time the extraction design is the hard part. The data arrives daily, but loading it isn't as simple as adding each day's file. Corrections mean the same records show up again. Loading them alongside the originals inflates the numbers without any error message. You'll design the extraction pattern that handles this -- and you'll build the AI infrastructure before you build the pipeline.

Meta-prompting for verification enters: directing AI to check its own work using structured criteria, then evaluating whether the check was thorough.

Tools

  • dbt Core with DuckDB adapter -- transformation framework, with MERGE patterns (new this project)
  • DuckDB -- local analytical database
  • Soda Core -- quality monitoring
  • Dagster -- orchestration, with watermark monitoring (new this project)
  • GitHub Actions -- CI/CD, with pre-commit and pre-push hooks (new this project)
  • Claude Code -- AI directing tool, with project memory authoring and meta-prompting for verification (new this project)
  • Git / GitHub -- version control

Materials

You'll receive:

  • DC data -- daily export samples from both distribution centres (CSV from Preston, JSON from Coventry), including a correction scenario for testing
  • SKU bridge -- the spreadsheet mapping Clayton's internal codes to GTIN-13 barcodes, maintained by the senior Ops analyst
  • Field mapping -- how the two DCs' different field names and SKU schemes correspond to each other
  • Pipeline spec template -- empty structure for you to fill from what you learn from Jamie
  • Project memory template -- format guide for CLAUDE.md and AGENTS.md with examples of good vs vague entries
  • Incremental extraction guide -- conceptual overview of full vs incremental refresh, watermarks, and MERGE patterns
Materials · 10 files
Start Project 7

You work at a computer with a terminal. Signed in, your place is saved.