diff --git a/aggregate_and_plot.cwl b/aggregate_and_plot.cwl
index 7fc1214572dd34a1d39d7459f32500afdc60a39e..536eff38cf54cbcc5d188a4ca7b163bb3ffcba05 100644
--- a/aggregate_and_plot.cwl
+++ b/aggregate_and_plot.cwl
@@ -24,6 +24,10 @@ outputs:
   type: File
   outputBinding:
     glob: "outputs.txt"
+- id: quality
+  type: File
+  outputBinding:
+    glob: "outputs.json"
 - id: inspect
   type: File
   outputBinding:
diff --git a/aggregate_and_plot.py b/aggregate_and_plot.py
index 858865688001c0624a3268e6c402c2d36620f2de..501e7ecdfe8f7b3818877812d05f9e624a744c98 100644
--- a/aggregate_and_plot.py
+++ b/aggregate_and_plot.py
@@ -1,7 +1,11 @@
 #!/usr/bin/env python3
 import argparse
+import subprocess
+import json
 from lofar_quality.manipulate.common import join_inspect_ds
 from lofar_quality.inspect.inspect_dataset import plot_inspect_ds
+from lofar_quality.inspect.v2 import extract_quality_metrics
+from lofar_quality.inspect.common import store_metrics
 from pathlib import Path
 import logging
 
@@ -35,6 +39,9 @@ def main():
     join_inspect_ds(h5_paths, h5_output_path)
     plot_paths = plot_inspect_ds(h5_output_path, workdir, min_elevation=15)
 
+    quality = {"quality": extract_quality_metrics(h5_output_path)}
+    store_metrics("outputs.json", quality)
+
     with open("outputs.txt", "w") as file:
         file.write(str(h5_output_path) + "\n")
         for file_path in plot_paths:
@@ -43,3 +50,4 @@ def main():
 
 if __name__ == "__main__":
     main()
+