Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion public/schema/pathwayMetadata.v1.html
Original file line number Diff line number Diff line change
Expand Up @@ -9296,7 +9296,6 @@ <h4>Must be one of:</h4>
<ul class="list-group">
<li class="list-group-item enum-item">"Normative"</li>
<li class="list-group-item enum-item">"Exploratory"</li>
<li class="list-group-item enum-item">"Direct Policy"</li>
<li class="list-group-item enum-item">"Predictive"</li>
</ul>
</div>
Expand Down
8 changes: 4 additions & 4 deletions src/components/Badge.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,17 +222,17 @@ describe("Badge component", () => {
);
});

it("displays correct tooltip for Policy pathway type", () => {
it("displays correct tooltip for Exploratory pathway type", () => {
render(
<Badge
tooltip={pathwayTypeTooltips["Direct Policy"]}
tooltip={pathwayTypeTooltips["Exploratory"]}
variant="pathwayType"
>
Direct Policy
Exploratory
</Badge>,
);

const badge = screen.getByText("Direct Policy");
const badge = screen.getByText("Exploratory");
expect(badge).toBeInTheDocument();
expect(badge.closest("span")?.parentElement).toHaveAttribute(
"tabindex",
Expand Down
1 change: 0 additions & 1 deletion src/components/SearchSection.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ describe("SearchSection", () => {
openByLabel("Sector");

openByLabel("Pathway Type");
expect(screen.getByText("Direct Policy")).toBeInTheDocument();
expect(screen.getByText("Exploratory")).toBeInTheDocument();
expect(screen.getByText("Normative")).toBeInTheDocument();
expect(screen.getByText("Predictive")).toBeInTheDocument();
Expand Down
7 changes: 3 additions & 4 deletions src/components/StepByStepGuide.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,9 @@ const StepByStepGuide: React.FC<StepByStepGuideProps> = ({

const descriptions: Record<string, Record<string, string>> = {
pathwayType: {
"Direct Policy": "Sourced directly from policy frameworks",
"Exploratory": "Future states under explicit assumptions",
"Normative": "Pre-determined target outcome",
"Predictive": "Extrapolates from current trends",
Exploratory: "Future states under explicit assumptions",
Normative: "Pre-determined target outcome",
Predictive: "Extrapolates from current trends",
},
emissionsTrajectory: {
"Significant increase": "Grow more than 50% by 2050",
Expand Down
2 changes: 1 addition & 1 deletion src/data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ new_pathway_metadata <-
id = "R-import-example",
name = "R Import Pathway",
description = "Pathway Imported from R",
pathwayType = "Direct Policy",
pathwayType = "Normative",
modelYearEnd = 2050,
modelTempIncrease = 1.5,
geography = list("Global", "US", "Europe"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"name": { "full": "Clean Energy Scenario 1", "short": "CES 1" },
"description": "Philippines pathway following National Renewable Energy Plan with some offshore wind development.",
"geography": ["PH"],
"pathwayType": "Direct Policy",
"pathwayType": "Exploratory",
"modelYearStart": 2023,
"modelYearEnd": 2050,
"sectors": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"name": { "full": "Clean Energy Scenario 2", "short": "CES 2" },
"description": "Philippines pathway following National Renewable Energy Plan. Significant offshore wind development.",
"geography": ["PH"],
"pathwayType": "Direct Policy",
"pathwayType": "Exploratory",
"modelYearStart": 2023,
"modelYearEnd": 2050,
"sectors": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"name": { "full": "Reference Scenario", "short": "Reference" },
"description": "Continuation of historical trends in the energy system in the Philippines.",
"geography": ["PH"],
"pathwayType": "Direct Policy",
"pathwayType": "Exploratory",
"modelYearStart": 2023,
"modelYearEnd": 2050,
"sectors": [
Expand Down
2 changes: 1 addition & 1 deletion src/data/un-sdsn-cw/SDSN-CW-BAU-SG-2024.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"description": "Singapore-specific pathway reflecting existing policy commitments and government targets.",
"geography": ["SG"],
"pathwayType": "Direct Policy",
"pathwayType": "Predictive",
"modelYearStart": 2023,
"modelYearEnd": 2050,
"ssp": "SSP2",
Expand Down
2 changes: 1 addition & 1 deletion src/schema/pathwayMetadata.v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"pathwayType": {
"description": "Type of the pathway pathway.",
"type": "string",
"enum": ["Normative", "Exploratory", "Direct Policy", "Predictive"]
"enum": ["Normative", "Exploratory", "Predictive"]
},
"modelYearNetzero": {
"description": "Year by which net zero is reached in the pathway. If Pathway does not reach net zero, this field should be omitted.",
Expand Down
2 changes: 1 addition & 1 deletion src/types/pathwayMetadata.v1.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export interface PathwayMetadataV1 {
/**
* Type of the pathway pathway.
*/
pathwayType: "Normative" | "Exploratory" | "Direct Policy" | "Predictive";
pathwayType: "Normative" | "Exploratory" | "Predictive";
/**
* Year by which net zero is reached in the pathway. If Pathway does not reach net zero, this field should be omitted.
*/
Expand Down
7 changes: 3 additions & 4 deletions src/utils/searchUtils.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ describe("filterPathways (array-backed facets)", () => {
sectors: [{ name: "Power" }],
geography: ["Europe"],
modelTempIncrease: 2.0,
pathwayType: "Direct Policy",
pathwayType: "Normative",
modelYearNetzero: 2040,
publisher: "X",
publicationYear: 2020,
Expand All @@ -255,7 +255,7 @@ describe("filterPathways (array-backed facets)", () => {

it("pathwayType: OR over multiple selections; empty array = no filter", () => {
let out = filterPathways(pathways, {
pathwayType: ["Direct Policy", "Exploratory"],
pathwayType: ["Normative", "Exploratory"],
} as FiltersWithArrays);
expect(out.map((s) => s.id)).toEqual(["B", "C"]);

Expand Down Expand Up @@ -492,11 +492,10 @@ describe("getGlobalFacetOptions", () => {

// pathwayTypeOptions should be in expected order
const pathwayTypeLabels = pathwayTypeOptions.map((opt) => opt.label);
expect(pathwayTypeLabels.slice(0, 4)).toEqual([
expect(pathwayTypeLabels.slice(0, 3)).toEqual([
"Predictive",
"Exploratory",
"Normative",
"Direct Policy",
]);
});

Expand Down
5 changes: 0 additions & 5 deletions src/utils/sortUtils.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ describe("sortPathwayType", () => {
const arr = [
{ title: "Normative" },
{ title: "Predictive" },
{ title: "Direct Policy" },
{ title: "Exploratory" },
];
const sorted = sortPathwayType(arr);
expect(sorted.map((x) => x.title)).toEqual([
"Predictive",
"Exploratory",
"Normative",
"Direct Policy",
]);
});

Expand All @@ -22,13 +20,11 @@ describe("sortPathwayType", () => {
{ title: "Normative" },
{ title: "UnknownType" },
{ title: "Predictive" },
{ title: "Direct Policy" },
];
const sorted = sortPathwayType(arr);
expect(sorted.map((x) => x.title)).toEqual([
"Predictive",
"Normative",
"Direct Policy",
"UnknownType",
]);
// UnknownType is last
Expand All @@ -43,7 +39,6 @@ describe("sortPathwayType", () => {
const arr = [
{ title: "Normative" },
{ title: "Predictive" },
{ title: "Direct Policy" },
{ title: "Exploratory" },
];
const arrCopy = [...arr];
Expand Down
7 changes: 1 addition & 6 deletions src/utils/sortUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,7 @@ export const prioritizeGeographies = (
};

// Utility for sorting pathway types according to a fixed order
export const pathwayTypeOrder = [
"Predictive",
"Exploratory",
"Normative",
"Direct Policy",
];
export const pathwayTypeOrder = ["Predictive", "Exploratory", "Normative"];

export function sortPathwayType<T extends { title: string }>(arr: T[]): T[] {
return arr.slice().sort((a, b) => {
Expand Down
8 changes: 3 additions & 5 deletions src/utils/tooltipUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ import type {
export const unknownTooltip = "No tooltip available.";

export const pathwayTypeTooltips: Record<PathwayType, string> = {
"Direct Policy":
"Outcomes based on legislated policy targets or commitments.",
"Exploratory": "Examines a range of plausible futures without fixed goals.",
"Normative": "Starts from a desired end state and works backward to actions.",
"Predictive":
Exploratory: "Examines a range of plausible futures without fixed goals.",
Normative: "Starts from a desired end state and works backward to actions.",
Predictive:
"Projects likely futures based on current trends and assumptions.",
};

Expand Down
2 changes: 1 addition & 1 deletion testdata/valid/pathwayMetadata_sample_03.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"year": 2024
},
"description": "Third Sample Pathway. asdf description.",
"pathwayType": "Direct Policy",
"pathwayType": "Normative",
"modelTempIncrease": 3,
"ssp": "SSP3",
"geography": ["North America"],
Expand Down