# Advanced Data Engineering: Revenue Reconciliation

Cedar Press, a fictional publisher, receives overlapping daily sales files. Duplicate exports and conflicting corrections make finance totals unreliable. Build an auditable ingestion and reporting pipeline with durable replay handling and visible rejected data.

## Required tools
Python 3.11+, a text editor and a terminal. All required Python dependencies are standard library. Git is recommended. No video, paid cloud service or real credentials are required.

## Getting started
Extract this archive to a new folder, then open a terminal in that folder.
```sh
python --version
python -m unittest -v test_pipeline
```
If your system names Python `python3` or `py`, substitute that command throughout. The starter intentionally raises NotImplementedError. These are assignments, not completed solutions.

## Five checkpoints

1. Define source contracts and money precision
   `python -m unittest -v test_pipeline.TestContracts`

2. Ingest with durable replay handling
   `python -m unittest -v test_pipeline.TestIngestion`

3. Handle corrections and reconcile reports
   `python -m unittest -v test_pipeline.TestReconciliation`

4. Prove atomicity under a storage fault
   `python -m unittest -v test_pipeline.TestCapstone`

5. Deliver a trustworthy data product
   `python -m unittest -v test_pipeline.TestCapstone`

Later test classes include earlier checks. Do not remove assertions to obtain a pass. Add your own boundary, fault and regression tests. The suite is a specified acceptance baseline, not exhaustive proof of production security or reliability.

## Troubleshooting
- ModuleNotFoundError: run commands from the extracted kit folder.
- NotImplementedError: implement the named function using its docstring and the lesson.
- AssertionError: compare the expected business rule to the actual result, add a small reproduction and fix the implementation.
- Database locked: close stale processes, use a fresh temporary database for tests, and document transaction behavior.

## Evidence
Save the command, full output, Python version and Git commit SHA. Record any manual checks separately. Submit a permitted HTTPS repository/artifact link plus results, decisions, limitations and assistance in SkillProof. The platform labels this self-reported; it does not run uploaded code or award an external certification.

## Project change
Choose a module's stakeholder change. Write a failing regression test before changing implementation. Explain which acceptance assumptions changed.

## Rights
Fictional business case and synthetic data, created for SkillProof. Adapt the starter and tests for your learning portfolio. Do not include confidential employer data, production credentials or fabricated customer results.

## Run the synthetic batch
```sh
python run_pipeline.py
python run_pipeline.py
```
First run: accepted 2, duplicates 1, rejected 1. Daily accepted units 3 and cents 2500. Second run: no new accepted rows. Use a fresh lab folder to restart; never delete a real business database.
