WIN-3370 — Rules on ingested data, explained for someone new

Video version (MP4)
WIN-3370 · Spike · Urgent

The ask, in one sentence

Design a standard way to add rules to data on its way into the data warehouse — and prove it with one real rule from Carrie.

Reporter

Carrie Rackers Cunningham

Assignee

Arnold Dajao

Type

Spike: a design plus a small proof of concept

Today each rule is written by hand, one at a time. The ticket's own word for that is "ad hoc".

Background

The landscape: where the data lives

Source

Salesforce

Where staff enter and update students, applications, programs and courses.
→
Warehouse

Amazon Redshift

A database built for reporting. A copy of the Salesforce data is kept here.
→
Consumers

Reports

Dashboards and analysts read from the warehouse, never from Salesforce directly.

"Ingestion" is the middle arrow on the left: getting data out of Salesforce and into Redshift. This ticket is about what happens to data during that step.

Background

Two roads into the warehouse

Road 1

Zero-ETL

  • AWS copies Salesforce objects into Redshift automatically.
  • One integration, active since 30 Sep 2026.
  • 27 objects, including IndividualApplication.
  • We write no code for the copy.
Road 2

ETL (our own job)

  • A Glue job, ies-data-salesforce-extraction, pulls changed records on a schedule.
  • It writes files to S3 storage; Redshift reads those files.
  • Used for IndividualApplicationHistory, which is not in the zero-ETL list.

ETL means Extract, Transform, Load: code we own that moves data. Zero-ETL means AWS does the move for us.

Background

Where the two roads meet

14
materialized views in
salesforce_reporting

A materialized view is a saved query whose result is stored, so reports read it quickly.

  • 13 read the zero-ETL copy and refresh automatically.
  • 1 (mv_individual_application_history) reads the files from the ETL job.

This is the shelf that reports take data from. So any rule that changes or hides data has to take effect here, whichever road the data came in on.

The ask, unpacked

Three kinds of rule

Transform

Adjust it

Change a value before reports see it.

Illustration: store a country as its full name instead of a code.

Check

Report it

Keep the record, but flag it when a condition is not true.

Illustration: an application with no program attached.

Skip

Leave it out

Do not show the record to reports at all.

Illustration: test records created by staff.

The illustrations are made up to show the idea. The real rules come from Carrie.

The problem

What is wrong today

Most views do nothing but rename

mv_individual_application only renames columns, for example "InternalStatus" becomes internal_status. No rules at all.

One rule already exists, hidden in SQL

WHERE old_value IS NOT NULL
  AND old_value != ''

In mv_individual_application_history, on the legacy history rows. They are dropped silently.

  • No list of which rules exist, who asked for them, or why.
  • No report of what was flagged or left out.
  • Each new rule means hand-editing a view.
The key constraint

Zero-ETL data cannot be touched on the way in

Salesforce
→
Read-only

Zero-ETL copy

AWS documentation: the destination database is read-only. No tables or views can be created in it.
→
Rules go here

After landing

A different database reads the copy and applies the rules.
  • We found no way to filter rows or change values before the data lands.
  • With our own ETL job we could apply rules earlier — but then rules would live in two places.
  • So: one place for rules, after landing, for both roads.
The proposal

A rule list that builds everything else

1

Rule registry

One file listing every rule. Reviewed like code.
→
2

Generator

A script that turns the list into SQL.
→
3

Three outputs

  • The reporting views, with rules applied
  • A results table: each rule, each run, how many failed
  • A quarantine table: every skipped record and which rule skipped it

Carrie's reports read the results and quarantine tables. Nothing is dropped without a trace.

The proposal

What adding a rule would look like

- id: sf_ia_incomplete_001
  owner: Carrie Rackers Cunningham
  ticket: WIN-3370
  source_object: IndividualApplication
  type: check        # transform | check | skip
  condition: "<to be given by Carrie>"
  severity: warn
  active: true

The steps

  1. Add one entry like this.
  2. A teammate reviews it.
  3. Run the generator.
  4. Deploy the SQL it produces.

No new job. No view edited by hand.

This format is a proposal. It has not been built yet.

The proof of concept

Proving it with Carrie's rule

The ticket names one test case: student applications "with ap incomplete". The exact condition is not written down anywhere yet.

  1. Meet Carrie and write down the exact condition.
  2. Decide the type: is it a check (report it) or a skip (hide it)?
  3. Add it as one entry in the registry.
  4. Run it and produce the list of applications that fail the rule.
  5. Carrie validates that list against Salesforce.
  6. Add a second rule to show that adding one really is quick.
Nuance

Things that are easy to get wrong

TopicWhy it matters
Check or skip?They sound alike but a skip removes data from reports. Each rule must say which one it is.
Related recordsIf an application is skipped, what about its timeline and participant records?
Coming backWhen a skipped record is later fixed in Salesforce, should it reappear by itself?
Auto refresh13 views refresh automatically. Adding rules to them must not break that. Untested.
FreshnessAWS states a minimum delay of one hour for zero-ETL from applications like Salesforce.
DeletesThe ETL job does not capture records deleted in Salesforce.
UnconfirmedThat the 13 views read the zero-ETL copy is inferred from a schema name, not yet proven.
Alternative considered

Should zero-ETL land in the lakehouse instead?

Instead of copying straight into Redshift, zero-ETL can write files to S3 storage (the "lakehouse"), and Redshift reads them from there.

Pros
  • One raw layer. Lands in S3, next to the files our ETL job already writes.
  • Open to more tools. Glue, Athena and Redshift can all read it.
  • More choice for rules. They could run in Spark or in SQL.
Cons
  • A new integration. The target cannot be changed; all 27 objects reload.
  • Still no rules before landing.
  • 13 views to re-point. Auto refresh on these tables is unverified.
  • Unknowns: how deletes and updates are applied, and the cost.
  • More setup: Lake Formation permissions, a role, a catalog policy.

Verdict: possible, but a separate decision. The rule layer works the same either way, so it does not need to wait for this.

Next

What is needed to finish

From other people
  1. Carrie's exact rule.
  2. Who owns the reporting views' SQL, and where it is kept.
  3. A place where we are allowed to build and test.
  4. Acceptance criteria — the ticket has none.
Then the build
  1. Test that auto refresh survives a rule.
  2. Write the registry format and the generator.
  3. Create the results and quarantine tables.
  4. Run Carrie's rule; she validates.
  5. Give her the report.

Full detail and evidence: docs/WIN-3370_ingestion_rules_architecture.md

Narration uses your browser's built-in voice. Keys: space = play or pause, arrows = move between scenes.