Python · Module 10
Answers and explanations · Capstone: workshop-order audit
Compare these references after your own attempt. You can read them at any time; they do not record a live model or vendor run.
Module 10 · Capstone
The complete local reference is solutions/capstone.py. The single-file Data-profile reference is examples/10_capstone_data.py; the separate Charts-profile file is examples/10_capstone_chart.py. The key choices are to preserve raw records, remove only exact duplicate extras, reject every conflicting-ID record and keep a reason for invalid input. See the test suite for changed-input cases rather than hard-coding the supplied totals.
Sample interpretation (reference answer)
I reviewed 16 synthetic workshop-order rows under a documented small-data policy. One exact repeated row was set aside. Of the 15 remaining records, five were rejected for missing units, negative units, an invalid price, an invalid date or a missing category. Ten records were accepted. These counts reconcile to the original row count, and the rejected and duplicate exports preserve the source values for review.
Accepted records contain 46 units and a subtotal of 6,690 cents, equivalent to 66.90 fictional currency units. Notebooks contribute 3,500 cents, pens 1,840 cents and markers 1,350 cents. The bar chart shows those category subtotals with a zero baseline and labels the synthetic source. Its text alternative states the same values so the result is understandable without the image.
This is an accepted-record subtotal, not a complete sales total. Unresolved rejected records could change the result, and the dataset does not model tax, shipping, returns or a real currency. I would ask the source owner to recover the invalid fields and explain any conflicting identifiers before using the result for a decision. Rerunning the script from the unchanged CSV and repeating the regression tests reproduces this output.
Review prompts
- An empty input with correct headers should return empty tables and zero audit counts.
- A zero price is valid under the contract, but zero units are not.
- Two different records with the same normalized ID must both be rejected.
- Adding three pens at 80 cents raises the accepted subtotal by 240 cents, provided the new ID and other fields are valid.
- The raw source must remain unchanged after every run.