@sdeverywhere/check-core 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -499,6 +499,21 @@ declare function checkSummaryFromReport(checkReport: CheckReport): CheckSummary;
499
499
  */
500
500
  declare function checkReportFromSummary(checkConfig: CheckConfig, checkSummary: CheckSummary): CheckReport | undefined;
501
501
 
502
+ type ComparisonDatasetName = string;
503
+ type ComparisonDatasetSource = string;
504
+ /**
505
+ * Specifies a dataset (variable) used for comparison.
506
+ */
507
+ interface ComparisonDatasetSpec {
508
+ kind: 'dataset';
509
+ /** The name of the dataset (variable). */
510
+ name: ComparisonDatasetName;
511
+ /**
512
+ * The source of the dataset, if it is from an external data file. If
513
+ * undefined, the dataset is assumed to be a model output.
514
+ */
515
+ source?: ComparisonDatasetSource;
516
+ }
502
517
  type ComparisonScenarioId = string;
503
518
  type ComparisonScenarioTitle = string;
504
519
  type ComparisonScenarioSubtitle = string;
@@ -620,42 +635,99 @@ interface ComparisonScenarioGroupRefSpec {
620
635
  /** The ID of the scenario group that is referenced. */
621
636
  groupId: ComparisonScenarioGroupId;
622
637
  }
623
- type ComparisonViewTitle = string;
624
- type ComparisonViewSubtitle = string;
625
- type ComparisonViewGraphId = string;
638
+ type ComparisonGraphId = string;
626
639
  /**
627
640
  * Specifies a list of graphs to be shown in a view.
628
641
  */
629
- interface ComparisonViewGraphsArraySpec {
642
+ interface ComparisonGraphsArraySpec {
630
643
  kind: 'graphs-array';
631
644
  /** The array of IDs for graphs to show. */
632
- graphIds: ComparisonViewGraphId[];
645
+ graphIds: ComparisonGraphId[];
633
646
  }
634
647
  /**
635
648
  * Specifies a preset list of graphs to be shown in a view.
636
649
  */
637
- interface ComparisonViewGraphsPresetSpec {
650
+ interface ComparisonGraphsPresetSpec {
638
651
  kind: 'graphs-preset';
639
652
  /** The preset (currently only "all" is supported, which shows all available graphs). */
640
653
  preset: 'all';
641
654
  }
655
+ type ComparisonGraphGroupId = string;
656
+ /**
657
+ * A definition of a group of graphs to be shown in a view. Multiple graphs can be grouped together
658
+ * under a single ID, and can later be referenced by group ID in a view definition.
659
+ */
660
+ interface ComparisonGraphGroupSpec {
661
+ kind: 'graph-group';
662
+ /** The unique identifier for the group. */
663
+ id: ComparisonGraphGroupId;
664
+ /** The graphs that are included in this group. */
665
+ graphIds: ComparisonGraphId[];
666
+ }
667
+ /** A reference to a graph group definition. */
668
+ interface ComparisonGraphGroupRefSpec {
669
+ kind: 'graph-group-ref';
670
+ /** The ID of the graph group that is referenced. */
671
+ groupId: ComparisonGraphGroupId;
672
+ }
673
+ type ComparisonViewTitle = string;
674
+ type ComparisonViewSubtitle = string;
675
+ type ComparisonViewRowTitle = string;
676
+ type ComparisonViewRowSubtitle = string;
677
+ type ComparisonViewItemTitle = string;
678
+ type ComparisonViewItemSubtitle = string;
679
+ type ComparisonViewGraphOrder = 'default' | 'grouped-by-diffs';
680
+ /**
681
+ * Specifies a single comparison box to be shown in a view.
682
+ */
683
+ interface ComparisonViewBoxSpec {
684
+ kind: 'view-box';
685
+ /** The title of the box. */
686
+ title: ComparisonViewItemTitle;
687
+ /** The subtitle of the box. */
688
+ subtitle?: ComparisonViewItemSubtitle;
689
+ /** The dataset shown in this comparison box. */
690
+ dataset: ComparisonDatasetSpec;
691
+ /** The scenario shown in this comparison box. */
692
+ scenarioId: ComparisonScenarioId;
693
+ }
694
+ /**
695
+ * Specifies a row of comparison boxes to be shown in a view.
696
+ */
697
+ interface ComparisonViewRowSpec {
698
+ kind: 'view-row';
699
+ /** The title of the row. */
700
+ title: ComparisonViewRowTitle;
701
+ /** The subtitle of the row. */
702
+ subtitle?: ComparisonViewRowSubtitle;
703
+ /** The array of boxes to be shown in the row. */
704
+ boxes: ComparisonViewBoxSpec[];
705
+ }
642
706
  /**
643
707
  * Specifies a set of graphs to be shown in a view.
644
708
  */
645
- type ComparisonViewGraphsSpec = ComparisonViewGraphsArraySpec | ComparisonViewGraphsPresetSpec;
709
+ type ComparisonViewGraphsSpec = ComparisonGraphsPresetSpec | ComparisonGraphsArraySpec | ComparisonGraphGroupRefSpec;
646
710
  /**
647
- * A definition of a view. A view presents a set of graphs for a single input scenario.
711
+ * A definition of a view. A view presents a set of graphs, either for a single input scenario
712
+ * or for a mix of different dataset/scenario combinations.
648
713
  */
649
714
  interface ComparisonViewSpec {
650
715
  kind: 'view';
651
716
  /** The title of the view. If undefined, the title will be inferred from the scenario. */
652
717
  title?: ComparisonViewTitle;
653
718
  /** The subtitle of the view. If undefined, the subtitle will be inferred from the scenario. */
654
- subtitle?: ComparisonViewGroupTitle;
655
- /** The scenario to be shown in the view. */
656
- scenarioId: ComparisonScenarioId;
657
- /** The graphs to be shown for each scenario view. */
658
- graphs: ComparisonViewGraphsSpec;
719
+ subtitle?: ComparisonViewSubtitle;
720
+ /** The scenario to be shown in the view if this is a single-scenario view. */
721
+ scenarioId?: ComparisonScenarioId;
722
+ /** The array of rows to be shown in the view if this is a freeform view. */
723
+ rows?: ComparisonViewRowSpec[];
724
+ /** The graphs to be shown in the view. */
725
+ graphs?: ComparisonViewGraphsSpec;
726
+ /**
727
+ * The order in which the graphs will be displayed. If undefined, the graphs will be
728
+ * displayed in the "default" order, i.e., in the same order that the IDs were specified.
729
+ */
730
+ graphOrder?: ComparisonViewGraphOrder;
659
731
  }
660
732
  type ComparisonViewGroupTitle = string;
661
733
  /**
@@ -680,6 +752,11 @@ interface ComparisonViewGroupWithScenariosSpec {
680
752
  scenarios: (ComparisonScenarioRefSpec | ComparisonScenarioGroupRefSpec)[];
681
753
  /** The graphs to be shown for each scenario view. */
682
754
  graphs: ComparisonViewGraphsSpec;
755
+ /**
756
+ * The order in which the graphs will be displayed. If undefined, the graphs will be
757
+ * displayed in the "default" order, i.e., in the same order that the IDs were specified.
758
+ */
759
+ graphOrder?: ComparisonViewGraphOrder;
683
760
  }
684
761
  /**
685
762
  * A definition of a group of views. Multiple related views can be grouped together under a single title
@@ -692,11 +769,13 @@ type ComparisonViewGroupSpec = ComparisonViewGroupWithViewsSpec | ComparisonView
692
769
  */
693
770
  interface ComparisonSpecs {
694
771
  /** The requested scenarios. */
695
- scenarios: ComparisonScenarioSpec[];
772
+ scenarios?: ComparisonScenarioSpec[];
696
773
  /** The requested scenario groups. */
697
- scenarioGroups: ComparisonScenarioGroupSpec[];
774
+ scenarioGroups?: ComparisonScenarioGroupSpec[];
775
+ /** The requested graph groups. */
776
+ graphGroups?: ComparisonGraphGroupSpec[];
698
777
  /** The requested view groups. */
699
- viewGroups: ComparisonViewGroupSpec[];
778
+ viewGroups?: ComparisonViewGroupSpec[];
700
779
  }
701
780
  /** A source of comparison scenario and specifications. */
702
781
  interface ComparisonSpecsSource {
@@ -803,7 +882,7 @@ interface ComparisonScenarioGroup {
803
882
  /** The title of the group. */
804
883
  title: ComparisonScenarioGroupTitle;
805
884
  /**
806
- * The scenarios that are included in this group. This includes scenario that were successfully
885
+ * The scenarios that are included in this group. This includes scenarios that were successfully
807
886
  * resolved as well as scenario references that could not be resolved.
808
887
  */
809
888
  scenarios: (ComparisonScenario | ComparisonUnresolvedScenarioRef)[];
@@ -814,17 +893,58 @@ interface ComparisonUnresolvedScenarioGroupRef {
814
893
  /** The ID of the referenced scenario group that could not be resolved. */
815
894
  scenarioGroupId: ComparisonScenarioGroupId;
816
895
  }
817
- /** A resolved view definition. A view presents a set of graphs for a single input scenario. */
896
+ /** A resolved group of graphs. */
897
+ interface ComparisonGraphGroup {
898
+ kind: 'graph-group';
899
+ /** The unique identifier for the group. */
900
+ id: ComparisonScenarioGroupId;
901
+ /** The graphs that are included in this group. */
902
+ graphIds: ComparisonGraphId[];
903
+ }
904
+ /**
905
+ * A resolved comparison box to be shown in a view.
906
+ */
907
+ interface ComparisonViewBox {
908
+ kind: 'view-box';
909
+ /** The title of the box. */
910
+ title: ComparisonViewItemTitle;
911
+ /** The subtitle of the box. */
912
+ subtitle?: ComparisonViewItemSubtitle;
913
+ /** The resolved dataset shown in this comparison box. */
914
+ dataset: ComparisonDataset;
915
+ /** The resolved scenario shown in this comparison box. */
916
+ scenario: ComparisonScenario;
917
+ }
918
+ /**
919
+ * A resolved row of comparison boxes to be shown in a view.
920
+ */
921
+ interface ComparisonViewRow {
922
+ kind: 'view-row';
923
+ /** The title of the row. */
924
+ title: ComparisonViewRowTitle;
925
+ /** The subtitle of the row. */
926
+ subtitle?: ComparisonViewRowSubtitle;
927
+ /** The array of resolved boxes to be shown in the row. */
928
+ boxes: ComparisonViewBox[];
929
+ }
930
+ /**
931
+ * A resolved view definition. A view presents a set of graphs, either for a single input scenario
932
+ * or for a mix of different dataset/scenario combinations.
933
+ */
818
934
  interface ComparisonView {
819
935
  kind: 'view';
820
936
  /** The title of the view. */
821
937
  title: ComparisonViewTitle;
822
938
  /** The subtitle of the view. */
823
939
  subtitle?: ComparisonViewSubtitle;
824
- /** The resolved scenario to be shown in the view. */
825
- scenario: ComparisonScenario;
940
+ /** The resolved scenario to be shown in the view if this is a single-scenario view. */
941
+ scenario?: ComparisonScenario;
942
+ /** The array of resolved rows to be shown in the view if this is a freeform view. */
943
+ rows?: ComparisonViewRow[];
826
944
  /** The graphs to be shown for each scenario view. */
827
- graphs: 'all' | ComparisonViewGraphId[];
945
+ graphIds: ComparisonGraphId[];
946
+ /** The order in which the graphs will be displayed. */
947
+ graphOrder: ComparisonViewGraphOrder;
828
948
  }
829
949
  /** An unresolved view. */
830
950
  interface ComparisonUnresolvedView {
@@ -833,6 +953,10 @@ interface ComparisonUnresolvedView {
833
953
  title?: ComparisonViewTitle;
834
954
  /** The requested subtitle of the view, if provided. */
835
955
  subtitle?: ComparisonViewSubtitle;
956
+ /** The name of the referenced dataset that could not be resolved. */
957
+ datasetName?: ComparisonDatasetName;
958
+ /** The source of the referenced dataset that could not be resolved. */
959
+ datasetSource?: ComparisonDatasetSource;
836
960
  /** The ID of the referenced scenario that could not be resolved. */
837
961
  scenarioId?: ComparisonScenarioId;
838
962
  /** The ID of the referenced scenario group that could not be resolved. */
@@ -847,104 +971,16 @@ interface ComparisonViewGroup {
847
971
  views: (ComparisonView | ComparisonUnresolvedView)[];
848
972
  }
849
973
 
850
- /**
851
- * Provides access to the set of dataset definitions (`ComparisonDataset` instances) that are used
852
- * when comparing the two models.
853
- */
854
- interface ComparisonDatasets {
855
- /**
856
- * Return all `ComparisonDataset` instances that are available for comparisons.
857
- */
858
- getAllDatasets(): IterableIterator<ComparisonDataset>;
859
- /**
860
- * Return the dataset metadata for the given key.
861
- *
862
- * @param datasetKey The key for the dataset.
863
- */
864
- getDataset(datasetKey: DatasetKey): ComparisonDataset | undefined;
865
- /**
866
- * Return the keys for the datasets that should be compared for the given scenario.
867
- *
868
- * @param scenario The scenario definition.
869
- */
870
- getDatasetKeysForScenario(scenario: ComparisonScenario): DatasetKey[];
871
- }
872
-
873
- interface ComparisonScenarios {
874
- /**
875
- * Return all `ComparisonScenario` instances that are available for comparisons.
876
- */
877
- getAllScenarios(): IterableIterator<ComparisonScenario>;
878
- /**
879
- * Return the scenario definition for the given key.
880
- *
881
- * @param key The key for the scenario.
882
- */
883
- getScenario(key: ComparisonScenarioKey): ComparisonScenario | undefined;
884
- }
885
-
886
- interface ComparisonDatasetOptions {
887
- /**
888
- * The mapping of renamed dataset keys (old or "left" name as the map key,
889
- * new or "right" name as the value).
890
- */
891
- renamedDatasetKeys?: Map<DatasetKey, DatasetKey>;
892
- /**
893
- * An optional function that allows for limiting the datasets that are compared
894
- * for a given scenario. By default, all datasets are compared for a given
895
- * scenario, but if a custom function is provided, it can return a subset of
896
- * datasets (for example, to omit datasets that are not relevant).
897
- */
898
- datasetKeysForScenario?: (allDatasetKeys: DatasetKey[], scenario: ComparisonScenario) => DatasetKey[];
899
- }
900
- interface ComparisonOptions {
901
- /** The left-side ("baseline") bundle being compared. */
902
- baseline: NamedBundle;
903
- /**
904
- * The array of thresholds used to color differences, e.g., [1, 5, 10] will use
905
- * buckets of 0%, 0-1%, 1-5%, 5-10%, and >10%.
906
- */
907
- thresholds: number[];
908
- /**
909
- * The requested comparison scenario and view specifications. These can be
910
- * specified in YAML or JSON files, or using `Spec` objects.
911
- */
912
- specs: (ComparisonSpecs | ComparisonSpecsSource)[];
913
- /** Optional configuration for the datasets that are compared for different scenarios. */
914
- datasets?: ComparisonDatasetOptions;
915
- }
916
- interface ComparisonConfig {
917
- /** The loaded left-side ("baseline") bundle being compared. */
918
- bundleL: LoadedBundle;
919
- /** The loaded right-side ("current") bundle being compared. */
920
- bundleR: LoadedBundle;
921
- /**
922
- * The array of thresholds used to color differences, e.g., [1, 5, 10] will use
923
- * buckets of 0%, 0-1%, 1-5%, 5-10%, and >10%.
924
- */
925
- thresholds: number[];
926
- /** The set of resolved scenarios that will be compared. */
927
- scenarios: ComparisonScenarios;
928
- /** The set of resolved datasets that will be compared. */
929
- datasets: ComparisonDatasets;
930
- /** The set of resolved view groups. */
931
- viewGroups: ComparisonViewGroup[];
974
+ interface PerfReport {
975
+ readonly minTime: number;
976
+ readonly maxTime: number;
977
+ readonly avgTime: number;
978
+ readonly allTimes: number[];
932
979
  }
933
-
934
- type ComparisonDataRequestKey = string;
935
- /**
936
- * Coordinates loading of data in parallel from two models.
937
- */
938
- declare class ComparisonDataCoordinator {
939
- readonly bundleModelL: BundleModel;
940
- readonly bundleModelR: BundleModel;
941
- private readonly taskQueue;
942
- constructor(bundleModelL: BundleModel, bundleModelR: BundleModel);
943
- private processDatasetRequest;
944
- private processGraphDataRequest;
945
- requestDatasetMaps(requestKey: ComparisonDataRequestKey, scenarioSpecL: ScenarioSpec, scenarioSpecR: ScenarioSpec, datasetKeys: DatasetKey[], onResponse: (datasetMapL?: DatasetMap, datasetMapR?: DatasetMap) => void): void;
946
- requestGraphData(requestKey: ComparisonDataRequestKey, scenarioSpecL: ScenarioSpec, scenarioSpecR: ScenarioSpec, graphId: BundleGraphId, onResponse: (graphDataL?: BundleGraphData, graphDataR?: BundleGraphData) => void): void;
947
- cancelRequest(key: ComparisonDataRequestKey): void;
980
+ declare class PerfStats {
981
+ private readonly times;
982
+ addRun(timeInMillis: number): void;
983
+ toReport(): PerfReport;
948
984
  }
949
985
 
950
986
  interface DiffPoint {
@@ -964,18 +1000,6 @@ interface DiffReport {
964
1000
  }
965
1001
  declare function diffDatasets(datasetL: Dataset | undefined, datasetR: Dataset | undefined): DiffReport;
966
1002
 
967
- interface PerfReport {
968
- readonly minTime: number;
969
- readonly maxTime: number;
970
- readonly avgTime: number;
971
- readonly allTimes: number[];
972
- }
973
- declare class PerfStats {
974
- private readonly times;
975
- addRun(timeInMillis: number): void;
976
- toReport(): PerfReport;
977
- }
978
-
979
1003
  /**
980
1004
  * The report for a single comparison test (involving a dataset produced under
981
1005
  * a specific input scenario). This includes the full `DiffReport`, whereas
@@ -1026,50 +1050,6 @@ interface ComparisonSummary {
1026
1050
  perfReportR: PerfReport;
1027
1051
  }
1028
1052
 
1029
- type GraphInclusion = 'neither' | 'left-only' | 'right-only' | 'both';
1030
- interface GraphComparisonMetadataReport {
1031
- /** The key for the metadata field. */
1032
- key: string;
1033
- /** The value of the metadata field in the left bundle. */
1034
- valueL?: string;
1035
- /** The value of the metadata field in the right bundle. */
1036
- valueR?: string;
1037
- }
1038
- interface GraphComparisonDatasetReport {
1039
- /** The dataset key. */
1040
- datasetKey: DatasetKey;
1041
- /** The max diff for this dataset. */
1042
- maxDiff?: number;
1043
- }
1044
- interface GraphComparisonReport {
1045
- /** Indicates which bundles the graph is defined in. */
1046
- inclusion: GraphInclusion;
1047
- /** The metadata fields with differences. */
1048
- metadataReports: GraphComparisonMetadataReport[];
1049
- /** The datasets with differences. */
1050
- datasetReports: GraphComparisonDatasetReport[];
1051
- }
1052
- /**
1053
- * Comparison the metadata and datasets for the given graphs.
1054
- *
1055
- * @param graphL The graph defined in the left bundle.
1056
- * @param graphR The graph defined in the right bundle.
1057
- * @param scenarioKey The key of the scenario used for comparing datasets.
1058
- * @param testSummaries The set of test summaries from a previous comparison run.
1059
- */
1060
- declare function diffGraphs(graphL: BundleGraphSpec | undefined, graphR: BundleGraphSpec | undefined, scenarioKey: ComparisonScenarioKey, testSummaries: ComparisonTestSummary[]): GraphComparisonReport;
1061
-
1062
- /**
1063
- * Convert a full `ComparisonReport` to a simplified `ComparisonSummary` that includes
1064
- * the minimum set of fields needed to keep the file smaller when there are many
1065
- * reported differences. This only includes comparison results for which there
1066
- * is a non-zero `maxDiff` value.
1067
- *
1068
- * @param comparisonReport The full comparison report.
1069
- * @return The terse summary.
1070
- */
1071
- declare function comparisonSummaryFromReport(comparisonReport: ComparisonReport): ComparisonSummary;
1072
-
1073
1053
  type ComparisonGroupKind = 'by-dataset' | 'by-scenario';
1074
1054
  type ComparisonGroupKey = string;
1075
1055
  /**
@@ -1148,12 +1128,300 @@ interface ComparisonGroupSummariesByCategory {
1148
1128
  * Rolls up all by-scenario and by-dataset groupings.
1149
1129
  */
1150
1130
  interface ComparisonCategorizedResults {
1131
+ /** All summaries for the comparison tests that were performed. */
1132
+ allTestSummaries: ComparisonTestSummary[];
1151
1133
  /** The full set of by-scenario groupings. */
1152
1134
  byScenario: ComparisonGroupSummariesByCategory;
1153
1135
  /** The full set of by-dataset groupings. */
1154
1136
  byDataset: ComparisonGroupSummariesByCategory;
1155
1137
  }
1156
1138
 
1139
+ /**
1140
+ * Provides access to the set of dataset definitions (`ComparisonDataset` instances) that are used
1141
+ * when comparing the two models.
1142
+ */
1143
+ interface ComparisonDatasets {
1144
+ /**
1145
+ * Return all `ComparisonDataset` instances that are available for comparisons.
1146
+ */
1147
+ getAllDatasets(): IterableIterator<ComparisonDataset>;
1148
+ /**
1149
+ * Return the dataset metadata for the given key.
1150
+ *
1151
+ * @param datasetKey The key for the dataset.
1152
+ */
1153
+ getDataset(datasetKey: DatasetKey): ComparisonDataset | undefined;
1154
+ /**
1155
+ * Return the keys for the datasets that should be compared for the given scenario.
1156
+ *
1157
+ * @param scenario The scenario definition.
1158
+ */
1159
+ getDatasetKeysForScenario(scenario: ComparisonScenario): DatasetKey[];
1160
+ /**
1161
+ * Return the reference plots that should be shown in the comparison graph for the
1162
+ * given dataset and scenario.
1163
+ *
1164
+ * @param datasetKey The key for the dataset.
1165
+ * @param scenario The scenario for which the dataset will be displayed.
1166
+ */
1167
+ getReferencePlotsForDataset(datasetKey: DatasetKey, scenario: ComparisonScenario): ComparisonPlot[];
1168
+ /**
1169
+ * Return the context graph IDs that should be shown for the given dataset and scenario.
1170
+ *
1171
+ * @param datasetKey The key for the dataset.
1172
+ * @param scenario The scenario for which the dataset will be displayed.
1173
+ */
1174
+ getContextGraphIdsForDataset(datasetKey: DatasetKey, scenario: ComparisonScenario): BundleGraphId[];
1175
+ }
1176
+
1177
+ interface ComparisonScenarios {
1178
+ /**
1179
+ * Return all `ComparisonScenario` instances that are available for comparisons.
1180
+ */
1181
+ getAllScenarios(): IterableIterator<ComparisonScenario>;
1182
+ /**
1183
+ * Return the scenario definition for the given key.
1184
+ *
1185
+ * @param key The key for the scenario.
1186
+ */
1187
+ getScenario(key: ComparisonScenarioKey): ComparisonScenario | undefined;
1188
+ }
1189
+
1190
+ /**
1191
+ * Describes an extra plot to be shown in a comparison graph.
1192
+ */
1193
+ interface ComparisonPlot {
1194
+ /** The dataset key for the plot. */
1195
+ datasetKey: DatasetKey;
1196
+ /** The plot color. */
1197
+ color: string;
1198
+ /** The plot style. If undefined, defaults to 'normal'. */
1199
+ style?: 'normal' | 'dashed';
1200
+ /** The plot line width, in px units. If undefined, a default width will be used. */
1201
+ lineWidth?: number;
1202
+ }
1203
+ interface ComparisonDatasetOptions {
1204
+ /**
1205
+ * The mapping of renamed dataset keys (old or "left" name as the map key,
1206
+ * new or "right" name as the value).
1207
+ */
1208
+ renamedDatasetKeys?: Map<DatasetKey, DatasetKey>;
1209
+ /**
1210
+ * An optional function that allows for limiting the datasets that are compared
1211
+ * for a given scenario. By default, all datasets are compared for a given
1212
+ * scenario, but if a custom function is provided, it can return a subset of
1213
+ * datasets (for example, to omit datasets that are not relevant).
1214
+ */
1215
+ datasetKeysForScenario?: (allDatasetKeys: DatasetKey[], scenario: ComparisonScenario) => DatasetKey[];
1216
+ /**
1217
+ * An optional function that allows for including additional reference plots
1218
+ * on a comparison graph for a given dataset and scenario. By default, no
1219
+ * additional reference plots are included, but if a custom function is
1220
+ * provided, it can return an array of `ComparisonPlot` objects.
1221
+ */
1222
+ referencePlotsForDataset?: (dataset: ComparisonDataset, scenario: ComparisonScenario) => ComparisonPlot[];
1223
+ /**
1224
+ * An optional function that allows for customizing the set of context graphs
1225
+ * that are shown for a given dataset and scenario. By default, all graphs in
1226
+ * which the dataset appears will be shown, but if a custom function is provided,
1227
+ * it can return a different set of graphs (for example, to omit graphs that are
1228
+ * not relevant under the given scenario).
1229
+ */
1230
+ contextGraphIdsForDataset?: (dataset: ComparisonDataset, scenario: ComparisonScenario) => BundleGraphId[];
1231
+ }
1232
+ /**
1233
+ * Describes a row in the comparison report summary view.
1234
+ */
1235
+ interface ComparisonReportSummaryRow {
1236
+ /** The group summary represented by the row. */
1237
+ groupSummary: ComparisonGroupSummary;
1238
+ /** The custom title for the row (this overrides the default title derived from the summary). */
1239
+ title?: string;
1240
+ /** The custom subtitle for the row (this overrides the default subtitle derived from the summary). */
1241
+ subtitle?: string;
1242
+ }
1243
+ /**
1244
+ * Describes a section in the comparison report summary view.
1245
+ */
1246
+ interface ComparisonReportSummarySection {
1247
+ /** The text to display for the section header. */
1248
+ headerText: string;
1249
+ /** The summary rows to display in the section. */
1250
+ rows: ComparisonReportSummaryRow[];
1251
+ /**
1252
+ * The initial expanded state of the section. If undefined, defaults to 'expanded-if-diffs',
1253
+ * meaning the section will be initially expanded only if any rows have differences, otherwise
1254
+ * it will be initially collapsed.
1255
+ */
1256
+ initialState?: 'collapsed' | 'expanded' | 'expanded-if-diffs';
1257
+ }
1258
+ /**
1259
+ * Describes an item (box) in the comparison report detail view.
1260
+ */
1261
+ interface ComparisonReportDetailItem {
1262
+ /** The title of the item. */
1263
+ title: string;
1264
+ /** The subtitle of the item (if any). */
1265
+ subtitle?: string;
1266
+ /** The scenario for the item. */
1267
+ scenario: ComparisonScenario;
1268
+ /** The test summary for the item. */
1269
+ testSummary: ComparisonTestSummary;
1270
+ }
1271
+ /**
1272
+ * Describes a row in the comparison report detail view.
1273
+ */
1274
+ interface ComparisonReportDetailRow {
1275
+ /** The title of the row. */
1276
+ title: string;
1277
+ /** The subtitle of the row (if any). */
1278
+ subtitle?: string;
1279
+ /** The score for the row (the meaning of the value depends on the chosen statistical method). */
1280
+ score: number;
1281
+ /** The items in this row (one item per box). */
1282
+ items: ComparisonReportDetailItem[];
1283
+ }
1284
+ interface ComparisonReportOptions {
1285
+ /**
1286
+ * An optional function that allows for customizing the order and grouping of
1287
+ * sections and rows in the "comparisons by scenario" summary view.
1288
+ *
1289
+ * @param summaries The comparison summaries, one summary per scenario.
1290
+ * @returns The sections to display in the "comparisons by scenario" summary view.
1291
+ */
1292
+ summarySectionsForComparisonsByScenario?: (summaries: ComparisonGroupSummariesByCategory) => ComparisonReportSummarySection[];
1293
+ /**
1294
+ * An optional function that allows for customizing the order and grouping of
1295
+ * sections and rows in the "comparisons by dataset" summary view.
1296
+ *
1297
+ * @param summaries The comparison summaries, one summary per dataset.
1298
+ * @returns The sections to display in the "comparisons by dataset" summary view.
1299
+ */
1300
+ summarySectionsForComparisonsByDataset?: (summaries: ComparisonGroupSummariesByCategory) => ComparisonReportSummarySection[];
1301
+ /**
1302
+ * An optional function that allows for customizing the order of rows and boxes
1303
+ * in the detail view for a scenario.
1304
+ *
1305
+ * @param rows The original rows to be displayed in the detail view for a scenario.
1306
+ * @returns The customized rows to display in the detail view for a scenario.
1307
+ */
1308
+ detailRowsForScenario?: (rows: ComparisonReportDetailRow[]) => ComparisonReportDetailRow[];
1309
+ /**
1310
+ * An optional function that allows for customizing the order of rows and boxes
1311
+ * in the detail view for a dataset.
1312
+ *
1313
+ * @param rows The original rows to be displayed in the detail view for a dataset.
1314
+ * @returns The customized rows to display in the detail view for a dataset.
1315
+ */
1316
+ detailRowsForDataset?: (rows: ComparisonReportDetailRow[]) => ComparisonReportDetailRow[];
1317
+ }
1318
+ interface ComparisonOptions {
1319
+ /** The left-side ("baseline") bundle being compared. */
1320
+ baseline: NamedBundle;
1321
+ /**
1322
+ * The array of thresholds used to color differences, e.g., [1, 5, 10] will use
1323
+ * buckets of 0%, 0-1%, 1-5%, 5-10%, and >10%.
1324
+ */
1325
+ thresholds: number[];
1326
+ /**
1327
+ * The requested comparison scenario and view specifications. These can be
1328
+ * specified in YAML or JSON files, or using `Spec` objects.
1329
+ */
1330
+ specs: (ComparisonSpecs | ComparisonSpecsSource)[];
1331
+ /** Optional configuration for the datasets that are compared for different scenarios. */
1332
+ datasets?: ComparisonDatasetOptions;
1333
+ /** Options for customizing the comparison report. */
1334
+ report?: ComparisonReportOptions;
1335
+ }
1336
+ interface ComparisonConfig {
1337
+ /** The loaded left-side ("baseline") bundle being compared. */
1338
+ bundleL: LoadedBundle;
1339
+ /** The loaded right-side ("current") bundle being compared. */
1340
+ bundleR: LoadedBundle;
1341
+ /**
1342
+ * The array of thresholds used to color differences, e.g., [1, 5, 10] will use
1343
+ * buckets of 0%, 0-1%, 1-5%, 5-10%, and >10%.
1344
+ */
1345
+ thresholds: number[];
1346
+ /** The set of resolved scenarios that will be compared. */
1347
+ scenarios: ComparisonScenarios;
1348
+ /** The set of resolved datasets that will be compared. */
1349
+ datasets: ComparisonDatasets;
1350
+ /** The set of resolved view groups. */
1351
+ viewGroups: ComparisonViewGroup[];
1352
+ /** Options for customizing the comparison report. */
1353
+ reportOptions?: ComparisonReportOptions;
1354
+ }
1355
+
1356
+ type ComparisonDataRequestKey = string;
1357
+ /**
1358
+ * Coordinates loading of data in parallel from two models.
1359
+ */
1360
+ declare class ComparisonDataCoordinator {
1361
+ readonly bundleModelL: BundleModel;
1362
+ readonly bundleModelR: BundleModel;
1363
+ private readonly taskQueue;
1364
+ constructor(bundleModelL: BundleModel, bundleModelR: BundleModel);
1365
+ private processDatasetRequest;
1366
+ private processGraphDataRequest;
1367
+ requestDatasetMaps(requestKey: ComparisonDataRequestKey, scenarioSpecL: ScenarioSpec, scenarioSpecR: ScenarioSpec, datasetKeys: DatasetKey[], onResponse: (datasetMapL?: DatasetMap, datasetMapR?: DatasetMap) => void): void;
1368
+ requestGraphData(requestKey: ComparisonDataRequestKey, scenarioSpecL: ScenarioSpec, scenarioSpecR: ScenarioSpec, graphId: BundleGraphId, onResponse: (graphDataL?: BundleGraphData, graphDataR?: BundleGraphData) => void): void;
1369
+ cancelRequest(key: ComparisonDataRequestKey): void;
1370
+ }
1371
+
1372
+ type GraphInclusion = 'neither' | 'left-only' | 'right-only' | 'both';
1373
+ interface GraphComparisonMetadataReport {
1374
+ /** The key for the metadata field. */
1375
+ key: string;
1376
+ /** The value of the metadata field in the left bundle. */
1377
+ valueL?: string;
1378
+ /** The value of the metadata field in the right bundle. */
1379
+ valueR?: string;
1380
+ }
1381
+ interface GraphComparisonDatasetReport {
1382
+ /** The dataset key. */
1383
+ datasetKey: DatasetKey;
1384
+ /** The max diff for this dataset. */
1385
+ maxDiff?: number;
1386
+ }
1387
+ interface GraphComparisonReport {
1388
+ /** Indicates which bundles the graph is defined in. */
1389
+ inclusion: GraphInclusion;
1390
+ /** The metadata fields with differences. */
1391
+ metadataReports: GraphComparisonMetadataReport[];
1392
+ /** The datasets with differences. */
1393
+ datasetReports: GraphComparisonDatasetReport[];
1394
+ }
1395
+ /**
1396
+ * Comparison the metadata and datasets for the given graphs.
1397
+ *
1398
+ * @param graphL The graph defined in the left bundle.
1399
+ * @param graphR The graph defined in the right bundle.
1400
+ * @param scenarioKey The key of the scenario used for comparing datasets.
1401
+ * @param testSummaries The set of test summaries from a previous comparison run.
1402
+ */
1403
+ declare function diffGraphs(graphL: BundleGraphSpec | undefined, graphR: BundleGraphSpec | undefined, scenarioKey: ComparisonScenarioKey, testSummaries: ComparisonTestSummary[]): GraphComparisonReport;
1404
+
1405
+ /**
1406
+ * Convert a full `ComparisonReport` to a simplified `ComparisonSummary` that includes
1407
+ * the minimum set of fields needed to keep the file smaller when there are many
1408
+ * reported differences. This only includes comparison results for which there
1409
+ * is a non-zero `maxDiff` value.
1410
+ *
1411
+ * @param comparisonReport The full comparison report.
1412
+ * @return The terse summary.
1413
+ */
1414
+ declare function comparisonSummaryFromReport(comparisonReport: ComparisonReport): ComparisonSummary;
1415
+
1416
+ /**
1417
+ * Compute the overall scores for the given group of comparison test summaries.
1418
+ *
1419
+ * @param testSummaries The comparison test summaries to consider.
1420
+ * @param thresholds The array of thresholds that determine the buckets into which
1421
+ * the scores will be summarized.
1422
+ */
1423
+ declare function getScoresForTestSummaries(testSummaries: ComparisonTestSummary[], thresholds: number[]): ComparisonGroupScores;
1424
+
1157
1425
  /**
1158
1426
  * Given a set of terse test summaries (which only includes summaries for tests with non-zero `maxDiff`
1159
1427
  * scores), restore the full set of summaries and then categorize them.
@@ -1269,4 +1537,4 @@ declare function runSuite(config: Config, callbacks: RunSuiteCallbacks, options?
1269
1537
  */
1270
1538
  declare function suiteSummaryFromReport(suiteReport: SuiteReport): SuiteSummary;
1271
1539
 
1272
- export { AllInputsSpec, Bundle, BundleGraphData, BundleGraphDatasetSpec, BundleGraphId, BundleGraphSpec, BundleGraphView, BundleModel, CheckDataCoordinator, CheckDataRequestKey, CheckDatasetReport, CheckGroupReport, CheckKey, CheckPredicateOp, CheckPredicateOpConstantRef, CheckPredicateOpDataRef, CheckPredicateOpRef, CheckPredicateReport, CheckPredicateSummary, CheckPredicateTimeOptions, CheckPredicateTimeRange, CheckPredicateTimeSingle, CheckPredicateTimeSpec, CheckReport, CheckResult, CheckResultErrorInfo, CheckScenario, CheckScenarioError, CheckScenarioInputDesc, CheckScenarioReport, CheckStatus, CheckSummary, CheckTestReport, ComparisonCategorizedResults, ComparisonConfig, ComparisonDataCoordinator, ComparisonDataRequestKey, ComparisonDataset, ComparisonDatasetOptions, ComparisonDatasets, ComparisonGroup, ComparisonGroupKey, ComparisonGroupKind, ComparisonGroupRoot, ComparisonGroupScores, ComparisonGroupSummariesByCategory, ComparisonGroupSummary, ComparisonOptions, ComparisonReport, ComparisonResolverError, ComparisonResolverInvalidValueError, ComparisonResolverUnknownInputError, ComparisonScenario, ComparisonScenarioAllInputsSettings, ComparisonScenarioGroup, ComparisonScenarioGroupId, ComparisonScenarioGroupRefSpec, ComparisonScenarioGroupSpec, ComparisonScenarioGroupTitle, ComparisonScenarioId, ComparisonScenarioInput, ComparisonScenarioInputAtPositionSpec, ComparisonScenarioInputAtValueSpec, ComparisonScenarioInputName, ComparisonScenarioInputPosition, ComparisonScenarioInputSettings, ComparisonScenarioInputSpec, ComparisonScenarioInputState, ComparisonScenarioKey, ComparisonScenarioPresetMatrixSpec, ComparisonScenarioRefSpec, ComparisonScenarioSettings, ComparisonScenarioSpec, ComparisonScenarioSubtitle, ComparisonScenarioTitle, ComparisonScenarioWithAllInputsSpec, ComparisonScenarioWithDistinctInputsSpec, ComparisonScenarioWithInputsSpec, ComparisonScenarios, ComparisonSpecs, ComparisonSpecsSource, ComparisonSummary, ComparisonTestReport, ComparisonTestSummary, ComparisonUnresolvedScenarioGroupRef, ComparisonUnresolvedScenarioRef, ComparisonUnresolvedView, ComparisonView, ComparisonViewGraphId, ComparisonViewGraphsArraySpec, ComparisonViewGraphsPresetSpec, ComparisonViewGraphsSpec, ComparisonViewGroup, ComparisonViewGroupSpec, ComparisonViewGroupTitle, ComparisonViewGroupWithScenariosSpec, ComparisonViewGroupWithViewsSpec, ComparisonViewSpec, ComparisonViewSubtitle, ComparisonViewTitle, Config, ConfigInitOptions, ConfigOptions, DataSource, Dataset, DatasetGroupName, DatasetKey, DatasetMap, DatasetsResult, DiffPoint, DiffReport, DiffValidity, Dimension, GraphComparisonDatasetReport, GraphComparisonMetadataReport, GraphComparisonReport, GraphInclusion, ImplVar, InputAliasName, InputGroupName, InputId, InputPosition, InputSetting, InputSettingsSpec, InputVar, LegendItem, LinkItem, LoadedBundle, ModelSpec, NamedBundle, OutputVar, PerfReport, PerfRunner, PerfStats, PositionSetting, RelatedItem, RunSuiteCallbacks, RunSuiteOptions, ScenarioSpec, ScenarioSpecUid, SourceName, Subscript, SuiteReport, SuiteSummary, ValueSetting, VarId, categorizeComparisonTestSummaries, checkReportFromSummary, checkSummaryFromReport, comparisonSummaryFromReport, createConfig, datasetMessage, diffDatasets, diffGraphs, predicateMessage, runSuite, scenarioMessage, suiteSummaryFromReport };
1540
+ export { type AllInputsSpec, type Bundle, type BundleGraphData, type BundleGraphDatasetSpec, type BundleGraphId, type BundleGraphSpec, type BundleGraphView, type BundleModel, CheckDataCoordinator, type CheckDataRequestKey, type CheckDatasetReport, type CheckGroupReport, type CheckKey, type CheckPredicateOp, type CheckPredicateOpConstantRef, type CheckPredicateOpDataRef, type CheckPredicateOpRef, type CheckPredicateReport, type CheckPredicateSummary, type CheckPredicateTimeOptions, type CheckPredicateTimeRange, type CheckPredicateTimeSingle, type CheckPredicateTimeSpec, type CheckReport, type CheckResult, type CheckResultErrorInfo, type CheckScenario, type CheckScenarioError, type CheckScenarioInputDesc, type CheckScenarioReport, type CheckStatus, type CheckSummary, type CheckTestReport, type ComparisonCategorizedResults, type ComparisonConfig, ComparisonDataCoordinator, type ComparisonDataRequestKey, type ComparisonDataset, type ComparisonDatasetName, type ComparisonDatasetOptions, type ComparisonDatasetSource, type ComparisonDatasetSpec, type ComparisonDatasets, type ComparisonGraphGroup, type ComparisonGraphGroupId, type ComparisonGraphGroupRefSpec, type ComparisonGraphGroupSpec, type ComparisonGraphId, type ComparisonGraphsArraySpec, type ComparisonGraphsPresetSpec, type ComparisonGroup, type ComparisonGroupKey, type ComparisonGroupKind, type ComparisonGroupRoot, type ComparisonGroupScores, type ComparisonGroupSummariesByCategory, type ComparisonGroupSummary, type ComparisonOptions, type ComparisonPlot, type ComparisonReport, type ComparisonReportDetailItem, type ComparisonReportDetailRow, type ComparisonReportOptions, type ComparisonReportSummaryRow, type ComparisonReportSummarySection, type ComparisonResolverError, type ComparisonResolverInvalidValueError, type ComparisonResolverUnknownInputError, type ComparisonScenario, type ComparisonScenarioAllInputsSettings, type ComparisonScenarioGroup, type ComparisonScenarioGroupId, type ComparisonScenarioGroupRefSpec, type ComparisonScenarioGroupSpec, type ComparisonScenarioGroupTitle, type ComparisonScenarioId, type ComparisonScenarioInput, type ComparisonScenarioInputAtPositionSpec, type ComparisonScenarioInputAtValueSpec, type ComparisonScenarioInputName, type ComparisonScenarioInputPosition, type ComparisonScenarioInputSettings, type ComparisonScenarioInputSpec, type ComparisonScenarioInputState, type ComparisonScenarioKey, type ComparisonScenarioPresetMatrixSpec, type ComparisonScenarioRefSpec, type ComparisonScenarioSettings, type ComparisonScenarioSpec, type ComparisonScenarioSubtitle, type ComparisonScenarioTitle, type ComparisonScenarioWithAllInputsSpec, type ComparisonScenarioWithDistinctInputsSpec, type ComparisonScenarioWithInputsSpec, type ComparisonScenarios, type ComparisonSpecs, type ComparisonSpecsSource, type ComparisonSummary, type ComparisonTestReport, type ComparisonTestSummary, type ComparisonUnresolvedScenarioGroupRef, type ComparisonUnresolvedScenarioRef, type ComparisonUnresolvedView, type ComparisonView, type ComparisonViewBox, type ComparisonViewBoxSpec, type ComparisonViewGraphOrder, type ComparisonViewGraphsSpec, type ComparisonViewGroup, type ComparisonViewGroupSpec, type ComparisonViewGroupTitle, type ComparisonViewGroupWithScenariosSpec, type ComparisonViewGroupWithViewsSpec, type ComparisonViewItemSubtitle, type ComparisonViewItemTitle, type ComparisonViewRow, type ComparisonViewRowSpec, type ComparisonViewRowSubtitle, type ComparisonViewRowTitle, type ComparisonViewSpec, type ComparisonViewSubtitle, type ComparisonViewTitle, type Config, type ConfigInitOptions, type ConfigOptions, type DataSource, type Dataset, type DatasetGroupName, type DatasetKey, type DatasetMap, type DatasetsResult, type DiffPoint, type DiffReport, type DiffValidity, type Dimension, type GraphComparisonDatasetReport, type GraphComparisonMetadataReport, type GraphComparisonReport, type GraphInclusion, type ImplVar, type InputAliasName, type InputGroupName, type InputId, type InputPosition, type InputSetting, type InputSettingsSpec, type InputVar, type LegendItem, type LinkItem, type LoadedBundle, type ModelSpec, type NamedBundle, type OutputVar, type PerfReport, PerfRunner, PerfStats, type PositionSetting, type RelatedItem, type RunSuiteCallbacks, type RunSuiteOptions, type ScenarioSpec, type ScenarioSpecUid, type SourceName, type Subscript, type SuiteReport, type SuiteSummary, type ValueSetting, type VarId, categorizeComparisonTestSummaries, checkReportFromSummary, checkSummaryFromReport, comparisonSummaryFromReport, createConfig, datasetMessage, diffDatasets, diffGraphs, getScoresForTestSummaries, predicateMessage, runSuite, scenarioMessage, suiteSummaryFromReport };