Sustainability × Programming
Business lens: Sustainability · Technology lens: Programming
Reading scope: Original synthetic teaching; selected primary background and same-author checks are not independent validation.
A calculation script needs evidence rules
A fictional analyst automates an energy spreadsheet and assumes every numeric entry is kWh. Some source rows are meter readings, some are monthly consumption and some are financial amounts. Programming makes a rule repeatable, but it can repeat a mistaken interpretation quickly. Begin with the quantity the business needs and the meaning of each source field. Computing can validate categories, preserve originals and report exceptions. Humans must decide which transformations are supported. A script that runs without error has demonstrated execution under its assumptions, not a correct environmental accounting process or a reliable public claim.
Specify the transformation with departments
Operations explains meter readings, administration explains invoices, Finance distinguishes payment from consumption and the programmer records conversion rules. Consultation should include unusual rows and period changes. A cumulative meter reading requires a difference between appropriate readings; it should not simply be summed with monthly consumption. Preserve the original unit and the evidence supporting each mapping. A reviewer should be able to reconcile every input to an output or an unresolved category. Local analysts may work in one notebook, while global teams may share a pipeline. Both need a maintainable rule and a clear handover to the person who will investigate exceptions.
Worked unit-conversion check
The invented file includes ten values of 50,000 Wh each and ten values of 50 kWh each. The first group totals 500,000 Wh, equivalent to 500 kWh. The second group totals 500 kWh. Combined supported consumption is therefore 1,000 kWh. A naive sum of the numeric fields produces 500,500 and falsely labels it kWh. Its ratio to the correct total is 500.5, but this is a unit-error demonstration rather than a meaningful environmental comparison. Two additional rows contain unknown units and remain outside the supported total. Their presence must be reported rather than silently discarded or converted by guesswork.
Fail visibly and recover
An exception report should explain which rows were not interpreted and why. Use a stable source identifier so the reviewer can correct the mapping without overwriting the original. Do not treat a blank unit as the most common unit unless that assumption is separately justified and labelled. A test should include valid conversion, incompatible quantity and missing evidence. The manager needs a concise report of supported totals and unresolved rows, not merely a successful exit code. If the script changes, retain its version and the effect on the calculation so another reviewer can understand why the reported quantity changed.
Cleaning lesson extension
Use the Python cleaning lesson to construct the twenty supported rows and two unknown-unit rows. Normalise Wh to kWh only where the unit is explicit. Reproduce 1,000 kWh and create a separate unresolved output containing the two gaps. Add a deliberately malformed row and verify that the programme reports it without losing the remaining inputs. Your portfolio should include a reconciliation count, conversion test and administrator-readable note. This extends an existing bounded lesson, not a real facility inventory or emissions calculation. Source validity, actual measurement and reporting boundaries still need independent evidence.
Question words for code-assisted accounting
Who writes the rule and Whom should the reviewer consult? Whose meter or invoice supplies the row? What unit is explicit, Where is the original retained and When did the rule change? Why is the naive sum invalid? Which unknown unit must remain unresolved? How can another person reproduce the supported total? These questions connect programming, communication and evidence stewardship. They help the learner explain the business assumption alongside the code rather than regard a numeric output as self-explanatory.
Levels and enquiry
Foundation learners explain Wh and kWh with one conversion. Undergraduate learners reproduce the twenty-row total and identify the two unresolved rows. Postgraduate learners critique silent assumptions, cumulative readings and versioned corrections. Research learners propose a study of automated unit validation with a checked reference dataset and defined error categories. A DBA contribution could examine how transparent exception reports affect reliance on automated sustainability calculations. For revision, calculate the naive and correct totals from memory and explain why a programme can execute perfectly while producing a value with no valid interpretation.
Study questions and answers
What is the supported consumption total?
Ten×50,000 Wh = 500 kWh; ten×50 kWh = 500 kWh; total 1,000 kWh.
Marking guide: Convert 500,000 Wh to 500 kWh and add second 500 kWh for 1,000 total.
Why is 500,500 kWh invalid?
It adds numeric fields before reconciling Wh and kWh, giving the wrong unit meaning.
Marking guide: Identify addition before unit reconciliation as cause of invalid 500,500 kWh.
What happens to the unknown-unit rows?
They remain unresolved and are reported separately; no unsupported conversion or zero value is assigned.
Marking guide: Keep unknown units unresolved; no invented conversion or zero replacement.
Practice task
Normalise twenty fictional energy rows with two unknown units and a reproducible exception report.
Practice bridge
- Normalise twenty fictional energy rows with two unknown units and a reproducible exception report.
- Reproduce the stated arithmetic, change one valid assumption and distinguish actual lesson observations from the invented case.
Boundary: Original synthetic teaching connected to an existing bounded or guided lesson. No new executable fixture, catalogue lab or external platform execution claimed.
Sources and further reading
- GHG Protocol Corporate Standard gateway
Scope: Free public standard gateway and selected boundary background checked; not a full standard or assurance review. Linked training access not independently checked.
Access: Free public page or document; selected access/background check.