
Build an AI Data Quality Review Agent for M&E
Beginner tutorial for monitoring and evaluation professionals
Build a controlled agent that finds possible data-quality problems without editing the original dataset.
You will create a small rule-based checker, ask AI to explain the findings, produce a traceable issue log and return every correction decision to an authorised human reviewer.
Direct answer: An AI Data Quality Review Agent should combine fixed, human-approved validation rules with AI-assisted explanation. The script finds repeatable rule violations; the AI organises the results. Neither component should silently correct the source data.
Check whether a dataset is ready for a controlled review: AI Data Quality Review Agent Builder (Premium Tool)
Use only the fictional practice dataset. Do not use real names, phone numbers, addresses, health information, safeguarding records, complaint data, passwords or confidential identifiers while learning.
Local does not mean offline. The files may sit on your computer, but content needed for a hosted AI response can still be transmitted to the provider. Real organisational data require approved tools, accounts and data-protection controls.
What You Will Learn
By the end of the tutorial, you will be able to:
- Explain why a data-quality flag is not the same as a confirmed error.
- Create a safe project folder with separate source, tool and output locations.
- Define validation rules before asking AI to review data.
- Run a deterministic Python checker without installing extra packages.
- Use AI to explain findings without inventing corrections.
- Verify counts, row references, evidence and file permissions.
- Document human decisions and rerun the review safely.
Core principle: the agent should make issues easier to locate and investigate. It should not replace source verification, data stewardship or professional judgement.
How the AI Data Quality Review Workflow Works
The workflow deliberately separates tasks that computers can perform consistently from decisions that require evidence and human authority.
Why use both Python and AI? Python is better for exact, repeatable row-level checks. AI is useful for explanation, prioritisation and drafting. Using AI alone for every cell can produce inconsistent results, while using rules alone may produce findings that are difficult for programme teams to interpret.
What Data Quality Means in This Tutorial
Data-quality frameworks vary by organisation and purpose. This exercise uses a limited set of practical dimensions commonly encountered in routine M&E data. It is not a substitute for a formal organisational Data Quality Assessment or the full WHO Data Quality Review methodology.
What these checks cannot prove: factual accuracy, source authenticity, representativeness, absence of bias, correct indicator interpretation or whether a programme achieved its intended result.
For example, an age of 28 may pass every format rule and still be factually wrong. That requires comparison with an authorised source.
Understand the four result labels
| Label | Meaning | Example |
|---|---|---|
| Critical | The file structure prevents a reliable review. | A required column is missing or a row is malformed. |
| Error | A value directly violates an approved rule. | An invalid date or missing required participant ID. |
| Warning | The value may be acceptable but needs checking. | Data entered later than the training threshold. |
| Review | The value may be valid, but an authorised person must decide how it may be used. | Consent is recorded as No. |
Important correction: a valid value that triggers a governance decision is not automatically a data-quality error. The starter pack therefore uses a separate review label.
Choose a Suitable M&E Dataset and Task
Use these six questions before building the workflow.
1. Is the data structured?
Example: Good: one row per participant, activity, facility or reporting unit. Poor first example: scanned handwritten forms.
Simple test: Can you explain what one row represents and what every column means?
2. Are the rules documented?
Example: Good: the indicator protocol defines categories, required fields and ranges. Poor: “find anything that looks wrong.”
Simple test: Could a new colleague apply the same rules without guessing?
3. Can the source remain read-only?
Example: Good: review a protected copy and write findings elsewhere. Poor: let the first test overwrite the official database.
Simple test: Would the review still be useful if the agent changed no source values?
4. Can every finding be traced?
Example: Good: each issue has row number, record ID, field, rule and observed value. Poor: “the dataset contains errors.”
Simple test: Can a reviewer locate the exact record in less than one minute?
5. Is there a human owner?
Example: Good: a named data steward verifies sources and authorises corrections. Poor: nobody is responsible for resolving flags.
Simple test: Who decides whether a flagged value is corrected, accepted or excluded?
6. Is the practice data non-sensitive?
Example: Good: synthetic data created for training. Poor: beneficiary names, health records or complaints.
Simple test: Would disclosure of the file harm a person or breach an agreement?
Use case selected for this lesson: a fictional participant-monitoring CSV containing deliberately inserted completeness, validity, uniqueness, consistency, timeliness, whitespace and restricted-use review issues.
Prepare Your Computer
You need a computer, a plain-text editor, Python 3.8 or later, and Claude Code or another approved file-capable AI workspace. The checker uses only Python’s standard library.
Check whether Python is available
Open PowerShell on Windows or Terminal on macOS/Linux and run:
Windows:
py --version
macOS or Linux:
python3 --versionIf you see Python 3.8 or a newer version, continue. If the command is not recognised, use the official Python installer or contact your IT team. Do not let an AI agent install software on a managed work computer without approval.
Choose where to work
How to create plain-text files
- Visual Studio Code: open the folder, choose New File, enter the exact filename and paste the content.
- Windows Notepad: use Save As, choose All files, select UTF-8 and type the full filename.
- macOS TextEdit: choose Format → Make Plain Text before saving.
Extension warning: TASK.md.txt is not the same file as TASK.md. On Windows, enable “File name extensions” in File Explorer.
Step 1: Create the Project Folder
The project folder keeps the dataset, rules, checker and generated outputs together. Use the starter pack supplied with the lesson, or create the structure manually.
Windows
- Open File Explorer.
- Open Documents.
- Right-click an empty area and choose New → Folder.
- Name it
ai-data-quality-review-agent. - Open the folder before creating the files below.
macOS
- Open Finder.
- Open Documents.
- Choose File → New Folder.
- Name it
ai-data-quality-review-agent. - Open the folder before creating the files below.
ai-data-quality-review-agent/
├── README.md
├── TASK.md
├── DATA_QUALITY_RULES.md
├── LOOP_INSTRUCTIONS.md
├── PROGRESS.md
├── source-data/
│ ├── participant-monitoring-data.csv
│ └── data-dictionary.md
├── tools/
│ └── check_data.py
├── outputs/
│ ├── automated-check-results.csv
│ ├── check-summary.json
│ ├── data-quality-review.md
│ ├── issue-log.csv
│ └── human-review-list.md
└── examples/
├── example-data-quality-review.md
├── example-issue-log.csv
└── example-human-review-list.mdUsing the ZIP: download the starter pack attached to the lesson, extract it, and open the extracted folder—not the ZIP file itself. Windows users can choose Extract All. macOS normally extracts the ZIP when it is double-clicked.
Step 2: Understand the Dataset, Dictionary and Rules
Do not run an agent before understanding what the files mean. Open the practice CSV in a spreadsheet application and the Markdown files in a text editor.
Review the training rules before running anything
The sample rules include required values, accepted categories, age and score ranges, date order, a seven-day data-entry threshold, record-ID uniqueness and one governance review rule. These rules are fictional. Never copy the ranges or thresholds into a real programme without approval.
Step 3: Run the Deterministic Checker
A deterministic checker applies the same rule to the same value every time. It creates a row-level findings file and a JSON summary containing exact counts, the rule version and a SHA-256 fingerprint of the source file.
Open a terminal in the project folder
Windows: open the project folder in File Explorer, click the address bar, type powershell and press Enter.
macOS: open Terminal, type cd , drag the project folder into the Terminal window and press Enter.
Windows:
py tools\check_data.py
macOS or Linux:
python3 tools/check_data.pyThe revised script calculates its own project path, so it can also be run by giving Python the full path to the script. It does not install packages, connect to the internet or edit the source CSV.
If a structural problem makes the review unreliable—such as a missing required column, blank header, duplicate header, empty dataset or malformed row—the script still writes the findings but exits with code 2. This makes the failure visible to the terminal and to later automation.
Expected result for the unchanged practice file:
- Rows reviewed: 18
- Issues found: 16
- Critical: 0
- Errors: 12
- Warnings: 3
- Review flags: 1
What the two machine outputs do
automated-check-results.csvcontains one row per finding.check-summary.jsoncontains exact counts, rows reviewed, rule version, generation time and source SHA-256.
Why the SHA-256 matters: it is a fingerprint of the source file. If the file changes, the fingerprint changes. It does not prove the data are accurate, but it helps identify which exact file version was reviewed.
Step 4: Open the Project in Claude
The instructions are written for Claude Code, which is available through supported terminal, IDE, desktop and browser experiences. Interface labels can change, so focus on selecting the correct project folder and reviewing every permission request.
Terminal route
- Open PowerShell or Terminal in the project folder.
- Start Claude Code with the command used by your installation.
- Confirm that the displayed working directory is the project folder.
- Use
/permissionsto inspect current rules when needed.
Desktop or IDE route
- Open the supported Claude Code or coding workspace.
- Select the extracted project folder.
- Confirm that the AI can see
TASK.md,DATA_QUALITY_RULES.md,source-dataandtools. - Do not select your entire Documents folder or home directory.
Approve narrowly: allow the known Python checker and writes to outputs/ and PROGRESS.md. Reject package installation, source-data edits, unrelated folder access, network requests or access to secrets.
Paste this first-run prompt
Run the AI Data Quality Review Agent for this project.
Read TASK.md, DATA_QUALITY_RULES.md, PROGRESS.md, source-data/data-dictionary.md and LOOP_INSTRUCTIONS.md before acting.
Run the provided deterministic checker. Use outputs/check-summary.json for exact counts and outputs/automated-check-results.csv for row-level details.
Create or update only:
- outputs/data-quality-review.md
- outputs/issue-log.csv
- outputs/human-review-list.md
- PROGRESS.md
Do not modify source-data. Do not guess corrected values. Keep errors, warnings and review flags separate. Complete the verification checklist before stopping.What to expect: Claude may ask permission to run the Python command and write output files. Read the request before approving. The source folder should never appear as an edit target.
Step 5: Review and Verify the Outputs
Do not accept a polished report merely because it sounds confident. Compare every output with the machine-generated summary and row-level findings. The starter pack also includes an examples/ folder showing one acceptable report, issue log and human-review list. Use those examples to check structure—not as text to copy without reviewing your own run.
Manual acceptance checklist
- The narrative count is exactly 16 and matches
check-summary.json. - It reports 0 critical, 12 errors, 3 warnings and 1 review flag.
- Every described finding exists in
automated-check-results.csv. - The “No” consent value is treated as a review flag, not a confirmed error.
- No corrected value is invented.
- The report states that the source file was not modified.
- The source SHA-256 and rules version are recorded.
- Limitations explain that rule checks do not prove factual accuracy.
What a good issue-log row looks like
| Severity | Row | Record | Field | Observed value | Follow-up |
|---|---|---|---|---|---|
| Error | 4 | R003 | sessions_attended | 2 | Verify attendance status and session count against the authorised register; do not guess which value is correct. |
Reject the run when counts are approximate, a row cannot be traced, the AI changes severity labels, the source file is edited, or the report claims that the dataset is accurate.
Step 6: Correct, Document and Rerun
In real work, only an authorised person should change a value after checking the original source. For practice, duplicate the CSV or restore it from the ZIP before experimenting.
- Choose one or two direct rule violations.
- Write the proposed correction and evidence source in a separate decision note.
- Have the authorised reviewer approve or reject it.
- Apply only the approved correction to a working copy.
- Rerun the checker.
- Compare the new summary with the previous summary.
- Update the issue status and
PROGRESS.md.
Practice test
Correct the date format for record R004 and change the lower-case category in R005 to the approved category. The finding count should decrease by two if no other value is changed. Do not correct the consent review flag, because it is not a formatting error.
A successful rerun does three things: it reduces only the expected findings, preserves unresolved issues and records exactly who authorised each correction and why.
How to Adapt the Agent to Real M&E Data
Do not replace the fictional CSV immediately. Move through a controlled readiness process.
- Obtain approval: confirm the lawful purpose, approved platform, account type and data owner.
- Minimise data: remove names, contact details and fields not needed for the review.
- Create a protected copy: never begin with the only or official production file.
- Write a data dictionary: define every field, type, category and permissible missing value.
- Approve rules: involve M&E, programme, data-protection and technical owners as appropriate.
- Version the rules: record who approved each change and when it applies.
- Test deliberately: create known errors and confirm the checker detects them without false corrections.
- Define escalation: specify which issues go to data entry, programme management, safeguarding, legal or IT.
- Keep an audit trail: preserve source fingerprint, findings, decisions, corrections and rerun results.
Rules to define before coding
Decisions not to automate in the first version
- Changing official records without source verification.
- Resolving consent, safeguarding, protection or complaint concerns.
- Deleting records judged to be duplicates.
- Choosing which conflicting source is correct.
- Concluding that a programme is effective because a dataset is structurally clean.
- Publishing or sending donor reports.
No-code alternative: teams unable to use Python can begin with spreadsheet data validation, protected source sheets and a manually maintained issue log. The same principles still apply: approved rules, traceable flags, separate outputs and human authorisation.
Troubleshooting
Practical Exercise
Assignment: add one new human-approved rule to the practice workflow without allowing the AI to invent it.
- Choose a rule such as “participant_id must begin with P”.
- Write the rule in
DATA_QUALITY_RULES.md. - Increase the rules version.
- Add a deliberately invalid practice value.
- Add the deterministic check to
check_data.py. - Run the checker and confirm exactly one new finding appears.
- Ask the AI to update the reports.
- Verify traceability and record the change in
PROGRESS.md.
Success criteria: the new result is repeatable, documented, traceable, correctly labelled and does not modify the source automatically.
Frequently Asked Questions
What is an AI Data Quality Review Agent?
It is a controlled workflow that applies approved checks, records possible issues and uses AI to explain the results. It should not be treated as an autonomous data-cleaning system.
Can the agent correct my dataset automatically?
That is not recommended for a first version. The agent should propose follow-up, while an authorised person verifies the source and approves any correction.
Why not ask Claude to inspect the CSV directly?
A language model can help interpret findings, but exact row-level rules are more consistent when implemented deterministically. The hybrid approach also creates a clearer audit trail.
Does a clean result prove the data are accurate?
No. It means the data passed the configured rules. Factual accuracy may require source-document verification, external comparison or field-level review.
Can I use Excel instead of CSV?
Yes, but this beginner checker reads CSV. Export a protected working sheet as CSV UTF-8 and verify that dates, leading zeros and categories were preserved.
What is the difference between an error and a review flag?
An error directly violates a rule. A review flag may contain a valid value but needs a human decision about use, access or follow-up.
Can I use real beneficiary data?
Only after organisational approval, data minimisation, an approved tool and account, appropriate contracts and security controls, and a clear lawful purpose.
Should I schedule this agent?
Only after repeated manual runs are stable. Scheduling also needs controlled inputs, logs, retry limits, notifications, a responsible owner and a defined response process.
Is Python required forever?
No. The checks can later be implemented in R, SQL, Power Query, a database rule engine or another approved system. The important features are repeatability, traceability and separation from AI interpretation.
Final Takeaway
The strongest AI data-quality workflow combines explicit human rules, deterministic checks, protected source data, exact machine-readable summaries, traceable AI-assisted reporting and human authority over every correction. Its purpose is to expose uncertainty—not hide it behind fluent text.
Official Sources and Further Reading
- WHO Data Quality Assurance Toolkit
- WHO Data Quality Assurance: Module 1, Framework and Metrics
- WHO Data Quality Assurance: Module 2, Desk Review
- Claude Code Overview
- Claude Code Permissions
- Claude Code Security
- Python Downloads
Product interfaces, security controls and organisational requirements can change. Check current official documentation and your organisation’s policies before using real data.
