Skip to content

Add an emissions 1990 query validation spec #1769

Open
louispt1 wants to merge 1 commit into
emissions-1990from
emissions-1990-csv-validator
Open

Add an emissions 1990 query validation spec #1769
louispt1 wants to merge 1 commit into
emissions-1990from
emissions-1990-csv-validator

Conversation

@louispt1

@louispt1 louispt1 commented Jun 18, 2026

Copy link
Copy Markdown
Member

Context

There was a desire within the direct emissions enhancements to check if the queried total emissions equals the sum of the emissions in the emissions.csv with separate sums for co2, other_ghg and total_ghg for 1990.

Implemented changes

Added another spec to lib/graph_data_validation/spec/validation/emissions.rb to validate the totals queries align with actual csv data to ensure no queries are missed when adding aggregates

@noracato I'm not sure how much to abstract here? The spec looks a little over the top, but it also feels extra to make another class to hold the logic. If you think that's the right approach I'm happy to extract an emissions_csv_reconciler class in the lib to clean up the spec.

Related

Checklist

  • I have tested these changes
  • I have updated documentation as needed
  • I have tagged the relevant people for review

…ns.rb to validate the totals queries align with actual csv data to ensure no queries are missed when adding aggregates
@louispt1 louispt1 requested review from kndehaan and noracato June 18, 2026 06:42
@kndehaan

kndehaan commented Jun 18, 2026

Copy link
Copy Markdown
Member

The functionality of the test works well! I have one suggestion regarding the nr of validated datasets.

The purpose of the test is to check whether all EMISSIONS() rows are included in the co2, other_ghg and total_ghg queries. It is currently tested for all country datasets, but just checking a few datasets would already suffice and will be faster.

We could define a couple of datasets in config.yml for which the queries should be tested with the emissions.csv and only do the test for those datasets:

emissions_1990_validation:
- nl2023
- nl2019
- DE_germany
- UKNI01_northern_ireland

Would it be possible to setup the spec up in a way to only test these few datasets?

removal ? -value : value
end / 1000.0

context "1990 inventory reconciliation for #{check[:total]}" do

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
context "1990 inventory reconciliation for #{check[:total]}" do
context "1990 emission results for #{check[:total]}" do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants