Education › Forward Deployed › Stage 2: Discovery, scoping & communication

Working with customer data

Getting access, profiling messy data with SQL and pandas, handling PII and governance, and building trust in numbers.

Beginner to intermediate ~40 min read Module 7 of 20

Every FDE project runs on the customer's data, and that data is never what the schema diagram promised. Columns are half empty, IDs do not match between systems, dates come in three formats, and the one table you need belongs to a team that has never heard of you. This lesson covers getting the right access the right way, profiling unfamiliar data quickly with SQL and pandas, the data-quality problems you will meet in almost every engagement, handling personal and sensitive data responsibly, and building the customer's trust in the numbers your software produces.

After this module you can
  • Request least-privilege data access with a clear purpose and scope
  • Profile an unfamiliar table for volume, completeness, uniqueness and freshness
  • Recognise and handle the common data-quality problems in enterprise data
  • Minimise, mask and protect personal data throughout a project
  • Reconcile your results with the customer's own numbers to build trust

Getting access the right way

Data access is often the longest dependency in a pilot, so request it in week one, precisely. Data owners and security teams approve narrow, well-explained requests far faster than "we need access to the database".

  • Purpose: what the data is for, in one sentence tied to the pilot's success criteria.
  • Scope: specific tables or views and columns, date range, and whether personal data is needed (often it is not).
  • Access type: read-only, ideally against a replica, a reporting view or an export, never the live transactional database for heavy queries.
  • Identity: a named service account for the application and personal accounts for people, not shared credentials.
  • Location and retention: where the data will be stored or processed, for how long, and how it will be deleted.
Tip

Ask the data owner to create a view with only the columns you need. It is safer for them, faster to approve, and documents the contract between their system and yours.

Profiling unfamiliar data quickly

Before building anything on a table, spend an hour profiling it. You are looking for volume, completeness, uniqueness, value ranges, freshness and surprises.

A first profile of a claims table
sql
SELECT
  COUNT(*)                                   AS rows_total,
  COUNT(DISTINCT claim_id)                   AS distinct_claims,
  COUNT(*) - COUNT(policy_number)            AS missing_policy,
  MIN(created_at)                            AS first_created,
  MAX(created_at)                            AS last_created,
  MAX(updated_at)                            AS last_updated,
  SUM(CASE WHEN amount < 0 THEN 1 ELSE 0 END) AS negative_amounts
FROM claims_view;

SELECT status, COUNT(*) AS n
FROM claims_view
GROUP BY status
ORDER BY n DESC;
The same questions in pandas on an export
python
import pandas as pd

df = pd.read_csv("claims_sample.csv", dtype=str)
print(df.shape)
print(df.isna().mean().sort_values(ascending=False).head(10))   # share missing per column
print(df["claim_id"].duplicated().sum(), "duplicate claim ids")
print(df["status"].value_counts(dropna=False).head(10))
print(pd.to_datetime(df["created_at"], errors="coerce").isna().sum(), "unparseable dates")

Reading everything as strings first (dtype=str) is deliberate: it lets you see the messy values before pandas silently converts or drops them. Write down every surprise with an example row and ask the data owner about it; their answer is often business knowledge you could not have guessed.

Data-quality problems you will meet

ProblemExampleTypical handling
Missing values40% of claims have no policy numberFind out why; exclude, infer from another source, or flag
Inconsistent formatsDates as 03/04/2026, 2026-04-03 and 4 Mar 26Parse explicitly with known formats; quarantine failures
DuplicatesSame claim exported twice after a retryDeduplicate on a business key, keep the latest version
Mismatched IDsCRM uses 'C-00123', billing uses '123'Build and test a normalisation and mapping table
Stale dataNightly export silently stopped last monthCheck freshness on every run; alert when old
EncodingNames garbled as mojibakeDetect and decode correctly (UTF-8 vs legacy code pages)

Do not silently fix data. Make every rule explicit in code with a test, count the rows each rule affects, and report those counts. A pipeline that quietly drops 12% of records produces confident wrong answers; one that says "1,203 records quarantined: unparseable date" lets the customer fix the source.

Personal and sensitive data

Customer data often includes personal data (names, contact details, identifiers, health or financial information) governed by laws such as GDPR and by the customer's own policies. Treat it as radioactive: use as little as possible, for as short a time as possible, in as few places as possible.

  • Minimise: if the task does not need names or account numbers, exclude the columns at the source view.
  • Pseudonymise: replace identifiers with stable tokens (a keyed hash) so records can still be joined without exposing the real value.
  • Mask in logs and prompts: never log raw personal data; redact before sending text to any external model unless the customer has approved it.
  • Keep data where it is allowed to be: respect data-residency requirements; do not copy extracts to your laptop or personal cloud storage.
  • Delete on schedule and confirm deletion in writing at the end of the engagement.
Stable pseudonymous IDs with a secret key
python
import hashlib
import hmac
import os

KEY = os.environ["PSEUDONYM_KEY"].encode()   # held by the customer, rotated per project


def pseudonym(value: str) -> str:
    return hmac.new(KEY, value.strip().lower().encode(), hashlib.sha256).hexdigest()[:16]


print(pseudonym("jane.doe@example.com"))   # same input -> same token, not reversible without KEY

Trust in the numbers

The fastest way to lose a customer is a demo where your total disagrees with the report their CFO sees every Monday. Before showing any number, reconcile it with an existing trusted figure: row counts against the source system, totals against a finance report, a sample of records checked by hand with a domain expert. When numbers differ, find out why before the meeting, not during it.

Document the lineage of every figure you show: which source, which filters, which date range, which rules. A short data contract with the owning team (expected columns, types, freshness, volumes) turns future upstream changes from silent breakages into detected failures.

Hands-on practice

Profile, clean and protect a messy dataset

  1. Download a public messy dataset (for example a city's open service-request data) and load it into SQLite or DuckDB as all-text columns.
  2. Run the SQL profile and the pandas profile from this lesson and write down five surprises with example rows.
  3. Write explicit cleaning rules with tests: date parsing with known formats, deduplication on a business key, ID normalisation.
  4. Make the pipeline report how many rows each rule affected and quarantine rows that fail parsing.
  5. Pseudonymise any personal fields with the keyed-hash function and verify joins still work.
  6. Reconcile one total (for example requests per month) against a figure published by the data owner and explain any difference.
Cheat sheet

Working with customer data — at a glance

Main things to focus on

  • Request narrow, purpose-stated, read-only access in week one.
  • Profile before building: volume, completeness, uniqueness, ranges, freshness.
  • Never silently fix data: explicit rules, tests and counts.
  • Minimise, pseudonymise and mask personal data; keep it where it is allowed.
  • Reconcile every number with a trusted figure before showing it.
  • Data contracts turn upstream changes into detected failures.

SQL profiling

COUNT(*), COUNT(DISTINCT key)Volume and uniqueness
COUNT(*) - COUNT(col)Missing values in a column
MIN/MAX(created_at), MAX(updated_at)Range and freshness
GROUP BY col ORDER BY COUNT(*) DESCValue distribution
GROUP BY key HAVING COUNT(*) > 1Find duplicates

pandas

pd.read_csv(f, dtype=str)See raw values first
df.isna().mean()Share missing per column
df[c].value_counts(dropna=False)Distribution including nulls
pd.to_datetime(s, format=..., errors="coerce")Explicit date parsing
df.drop_duplicates(subset=[key], keep="last")Deduplicate

Access request

purpose / scope / access typeWhy, what, read-only
identity / location / retentionWho, where, how long
view with only needed columnsFastest approval

Personal data

minimise at sourceExclude unneeded columns
HMAC-SHA256(key, value)Stable pseudonymous token
redact before logs and external modelsProtect content
delete and confirm in writingEnd of engagement

Common pitfalls

  • Asking for broad database access and waiting weeks for approval.
  • Heavy analytical queries against the live transactional database.
  • Silent cleaning rules that drop records nobody knows about.
  • Copying extracts with personal data to a laptop.
  • Showing a number in a demo that contradicts the customer's own report.
Quiz

Check your understanding

5 questions · 4 to pass · answers are explained as you go. Your best score is saved on this device only.

Progress and quiz scores are saved in this browser only. Back up or restore on the hub.

Was this lesson useful? Tell me what to improve →