Skip to content
Open
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 app/pathogen/arbovirus/dashboard/(map)/ArbovirusMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import { CountryPaintChangeSetting, useArbovirusMapCustomizationModal } from "./
import { ArbovirusEnvironmentalSuitabilityCountryDataContext } from "@/contexts/pathogen-context/pathogen-contexts/arbovirus/arbo-environmental-suitability-country-data-context";
import { CountryDataContext } from "@/contexts/pathogen-context/country-information-context";
import { ArbovirusOropoucheCasesDataContext } from "@/contexts/pathogen-context/pathogen-contexts/arbovirus/arbo-oropouche-cases-data-context";
import { Layer, Source } from "react-map-gl";
import { mapColourBucketsToLinearGradientConfiguration } from "@/components/ui/pathogen-map/country-highlight-layers/map-colour-buckets-to-linear-gradient-configuration";
import { useGroupedArbovirusEstimateData } from "../../use-arbo-primary-estimate-data";
import { MapSectionComponentProps } from "@/app/pathogen/generic-pathogen-dashboard-page";
Expand Down
2 changes: 1 addition & 1 deletion app/pathogen/arbovirus/dashboard/(table)/ArboDataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { DataTableColumnConfigurationEntryType } from "@/components/ui/data-tabl
import { ToastId } from "@/contexts/toast-provider";
import { RechartsVisualization } from "@/components/customs/visualizations/recharts-visualization";
import { ArbovirusVisualizationId, getUrlParameterFromVisualizationId, useVisualizationPageConfiguration } from "../../visualizations/visualization-page-config";
import { useMap } from "react-map-gl";
import { useMap } from "react-map-gl/mapbox";
import { ArboTrackerCitationButtonContent, shortenedArboTrackerCitationText, suggestedArboTrackerCitationText } from "../../arbotracker-citations";
import { ArbovirusEstimateType, ArbovirusStudyGeographicScope } from "@/gql/graphql";
import { assertNever } from "assert-never";
Expand Down
2 changes: 1 addition & 1 deletion app/pathogen/generic-pathogen-dashboard-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { cn } from "@/lib/utils";
import { useIsLargeScreen } from "@/hooks/useIsLargeScreen";
import { FiltersButton } from "./filters-button";
import { DashboardSectionId, DashboardType, dashboardTypeToMapIdMap } from "./dashboard-enums";
import { useMap } from "react-map-gl";
import { useMap } from "react-map-gl/mapbox";

interface FiltersComponentProps {
className?: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MouseEventHandler, useMemo } from 'react';
import { MouseEventHandler, useContext, useMemo } from 'react';
import { GenericMapPopUp, GenericMapPopUpWidth, HeaderConfigurationTextAlignment } from "@/components/ui/pathogen-map/map-pop-up/generic-map-pop-up";
import {
AnimalMersSeroprevalenceEstimateMapMarkerData,
Expand All @@ -9,6 +9,7 @@ import {
generateMersEstimateTableConfigurations,
useMersEstimateRows
} from "./shared-mers-map-pop-up-variables";
import { MersFilterMetadataContext } from '@/contexts/pathogen-context/pathogen-contexts/mers/mers-filter-metadata-context';

interface AnimalMersSeroprevalenceEstimatePopupContentProps {
estimate: AnimalMersSeroprevalenceEstimateMapMarkerData;
Expand All @@ -28,6 +29,8 @@ export const AnimalMersSeroprevalenceEstimatePopupContent = (props: AnimalMersSe
return `${seroprevalencePercentageText}`
}, [ estimate ]);

const { areNonCamelAnimalsIncluded } = useContext(MersFilterMetadataContext);

const tableConfigurations = useMemo(() => generateMersEstimateTableConfigurations({
type: GenerateMersEstimateTableConfigurationsType.SEROPREVALENCE_ESTIMATES,
estimate
Expand All @@ -37,7 +40,9 @@ export const AnimalMersSeroprevalenceEstimatePopupContent = (props: AnimalMersSe
<GenericMapPopUp
width={GenericMapPopUpWidth.EXTRA_EXTRA_WIDE}
headerConfiguration={{
text: "Animal Seroprevalence Estimate",
text: areNonCamelAnimalsIncluded
? "Animal Seroprevalence Estimate"
: "Camel Seroprevalence Estimate",
textAlignment: HeaderConfigurationTextAlignment.CENTER
}}
subtitleConfiguration={{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MouseEventHandler, useMemo } from 'react';
import { MouseEventHandler, useContext, useMemo } from 'react';
import { GenericMapPopUp, GenericMapPopUpWidth, HeaderConfigurationTextAlignment } from "@/components/ui/pathogen-map/map-pop-up/generic-map-pop-up";
import {
AnimalMersViralEstimateMapMarkerData,
Expand All @@ -9,6 +9,7 @@ import {
generateMersEstimateTableConfigurations,
useMersEstimateRows
} from "./shared-mers-map-pop-up-variables";
import { MersFilterMetadataContext } from '@/contexts/pathogen-context/pathogen-contexts/mers/mers-filter-metadata-context';

interface AnimalMersViralEstimatePopupContentProps {
estimate: AnimalMersViralEstimateMapMarkerData;
Expand All @@ -19,7 +20,7 @@ interface AnimalMersViralEstimatePopupContentProps {

export const AnimalMersViralEstimatePopupContent = (props: AnimalMersViralEstimatePopupContentProps) => {
const { estimate } = props;

const { areNonCamelAnimalsIncluded } = useContext(MersFilterMetadataContext);
const { getSharedMersEstimateRows } = useMersEstimateRows();

const topBannerText = useMemo(() => {
Expand All @@ -37,7 +38,9 @@ export const AnimalMersViralEstimatePopupContent = (props: AnimalMersViralEstima
<GenericMapPopUp
width={GenericMapPopUpWidth.EXTRA_EXTRA_WIDE}
headerConfiguration={{
text: "Animal Viral Estimate",
text: areNonCamelAnimalsIncluded
? "Animal Viral Estimate"
: "Camel Viral Estimate",
textAlignment: HeaderConfigurationTextAlignment.CENTER
}}
subtitleConfiguration={{
Expand Down
19 changes: 14 additions & 5 deletions app/pathogen/mers/dashboard/(map)/mers-country-pop-up-content.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useMemo } from 'react';
import { useContext, useMemo } from 'react';
import {
GenericMapPopUp,
GenericMapPopUpWidth,
Expand All @@ -21,6 +21,7 @@ import {
} from "./shared-mers-map-pop-up-variables";
import { PopUpContentRowType, PopupContentTextAlignment } from '@/components/ui/pathogen-map/map-pop-up/pop-up-content-rows';
import { MersWhoCaseDataEntry } from '@/hooks/mers/use-mers-who-case-data-partitioned';
import { MersFilterMetadataContext } from '@/contexts/pathogen-context/pathogen-contexts/mers/mers-filter-metadata-context';

interface MersCountryPopupContentProps {
record: {
Expand Down Expand Up @@ -112,7 +113,9 @@ export const MersCountryPopupContent = (props: MersCountryPopupContentProps): Re
return mersWhoCaseData
.find((element) => element.country.alphaThreeCode === alpha3CountryCode)
?.positiveCasesReported ?? 0
}, [ mersWhoCaseData, alpha3CountryCode ])
}, [ mersWhoCaseData, alpha3CountryCode ]);

const { areNonCamelAnimalsIncluded } = useContext(MersFilterMetadataContext);

return (
<GenericMapPopUp
Expand All @@ -138,7 +141,9 @@ export const MersCountryPopupContent = (props: MersCountryPopupContentProps): Re
rightPaddingEnabled: false
}] : []),
...(estimateDataShown ? [{
title: 'Animal Seroprevalence Estimates'.replace(' ', '\u00A0'),
title: areNonCamelAnimalsIncluded
? 'Animal Seroprevalence Estimates'.replace(' ', '\u00A0')
: 'Camel Seroprevalence Estimates'.replace(' ', '\u00A0'),
type: PopUpContentRowType.TEXT as const,
text: animalMersSeroprevalenceRange,
contentTextAlignment: PopupContentTextAlignment.RIGHT,
Expand All @@ -154,7 +159,9 @@ export const MersCountryPopupContent = (props: MersCountryPopupContentProps): Re
rightPaddingEnabled: false
}] : []),
...(estimateDataShown ? [{
title: 'Animal Viral Estimates'.replace(' ', '\u00A0'),
title: areNonCamelAnimalsIncluded
? 'Animal Viral Estimates'.replace(' ', '\u00A0')
: 'Camel Viral Estimates'.replace(' ', '\u00A0'),
type: PopUpContentRowType.TEXT as const,
text: animalMersViralPrevalenceRange,
contentTextAlignment: PopupContentTextAlignment.RIGHT,
Expand All @@ -178,7 +185,9 @@ export const MersCountryPopupContent = (props: MersCountryPopupContentProps): Re
rightPaddingEnabled: false
}] : []),
...(eventDataShown ? [{
title: 'Animal Cases'.replace(' ', '\u00A0'),
title: areNonCamelAnimalsIncluded
? 'Animal Cases'.replace(' ', '\u00A0')
: 'Camel Cases'.replace(' ', '\u00A0'),
type: PopUpContentRowType.NUMBER as const,
value: allAnimalMersEvents.length,
contentTextAlignment: PopupContentTextAlignment.RIGHT,
Expand Down
2 changes: 1 addition & 1 deletion app/pathogen/mers/dashboard/(map)/mers-map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { useMersMapDataTypeLegendEntries } from "./use-mers-map-data-type-legend
import { useMersWhoCaseData } from "@/hooks/mers/use-mers-who-case-data";
import { useMersMapLegend } from "./use-mers-map-legend";
import { Breakpoint, useBreakpoint } from "@/hooks/useBreakpoint";
import { Layer, Source } from "react-map-gl";
import { Layer, Source } from "react-map-gl/mapbox";
import Link from "next/link";
import { MapSymbology } from "@/app/pathogen/sarscov2/dashboard/(map)/map-config";
import { MapSectionComponentProps } from "@/app/pathogen/generic-pathogen-dashboard-page";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { parseISO } from "date-fns";
import { MapDataPointVisibilityOptions } from "./use-mers-map-customization-modal";
import { useContext } from "react";
import { CountryInformationContext } from "@/contexts/pathogen-context/country-information-context";
import { MersFilterMetadataContext } from '@/contexts/pathogen-context/pathogen-contexts/mers/mers-filter-metadata-context';

export const diagnosisStatusToStringMap = {
[MersDiagnosisStatus.Confirmed]: "Confirmed",
Expand Down Expand Up @@ -365,13 +366,28 @@ export const mersDataTypeToSortOrderMap: Record<string, number | undefined> & Re
"HumanMersEvent": 5,
"AnimalMersEvent": 6
};
export const mersDataTypeToLabelMap = {
"PrimaryHumanMersSeroprevalenceEstimateInformation": "Human Seroprevalence Estimate",
"PrimaryAnimalMersSeroprevalenceEstimateInformation": "Animal Seroprevalence Estimate",
"PrimaryHumanMersViralEstimateInformation": "Human Viral Estimate",
"PrimaryAnimalMersViralEstimateInformation": "Animal Viral Estimate",
"AnimalMersEvent": "Animal Case",
"HumanMersEvent": "Human Case",

export const useMersDataTypeToLabelMap = () => {
const { areNonCamelAnimalsIncluded } = useContext(MersFilterMetadataContext);

const mersDataTypeToLabelMap = {
"PrimaryHumanMersSeroprevalenceEstimateInformation": "Human Seroprevalence Estimate",
"PrimaryAnimalMersSeroprevalenceEstimateInformation": areNonCamelAnimalsIncluded
? "Animal Seroprevalence Estimate"
: "Camel Seroprevalence Estimate",
"PrimaryHumanMersViralEstimateInformation": "Human Viral Estimate",
"PrimaryAnimalMersViralEstimateInformation": areNonCamelAnimalsIncluded
? "Animal Viral Estimate"
: "Camel Viral Estimate",
"AnimalMersEvent": areNonCamelAnimalsIncluded
? "Animal Case"
: "Camel Case",
"HumanMersEvent": "Human Case",
};

return {
mersDataTypeToLabelMap
};
};

export const mersMapPointVisibilitySettingToHiddenOptionsMap = {
Expand Down Expand Up @@ -429,9 +445,19 @@ export const mersDataTypeToSuperOptionMap = {
"AnimalMersEvent": MersDataTypeSuperOption.ANIMAL
}

export const mersDataTypeSuperOptionToLabelMap = {
[MersDataTypeSuperOption.HUMAN]: "Human Data",
[MersDataTypeSuperOption.ANIMAL]: "Animal Data"
export const useMersDataTypeSuperOptionToLabelMap = () => {
const { areNonCamelAnimalsIncluded } = useContext(MersFilterMetadataContext);

const mersDataTypeSuperOptionToLabelMap = {
[MersDataTypeSuperOption.HUMAN]: "Human Data",
[MersDataTypeSuperOption.ANIMAL]: areNonCamelAnimalsIncluded
? "Animal Data"
: "Camel Data",
}

return {
mersDataTypeSuperOptionToLabelMap
}
}

export const mersDataTypeToColourClassnameMap = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from "@/contexts/pathogen-context/pathogen-contexts/mers/mers-context";
import { MapDataPointVisibilityOptions } from "./use-mers-map-customization-modal";
import { MapPinColours } from "./mers-map";
import { MersFilterMetadataContext } from "@/contexts/pathogen-context/pathogen-contexts/mers/mers-filter-metadata-context";

const CamelIcon = () => (
<svg
Expand Down Expand Up @@ -261,6 +262,8 @@ export const useMersMapDataTypeLegendEntries = (
)
), [ faoMersEventData, mapDataPointVisibilitySetting ]);

const { areNonCamelAnimalsIncluded } = useContext(MersFilterMetadataContext);

const dataTypeLayerLegendEntries = [
...(hasHumanMersSeroprevalenceEstimates ? [{
description: 'Human Seroprevalence Estimate',
Expand All @@ -278,12 +281,16 @@ export const useMersMapDataTypeLegendEntries = (
icon: HumanIcon
}] : []),
...(hasAnimalMersSeroprevalenceEstimates ? [{
description: 'Animal Seroprevalence Estimate',
description: areNonCamelAnimalsIncluded
? 'Animal Seroprevalence Estimate'
: 'Camel Seroprevalence Estimate',
colour: MapPinColours['PrimaryAnimalMersSeroprevalenceEstimateInformation'],
icon: CamelIcon
}] : []),
...(hasAnimalMersViralEstimates ? [{
description: 'Animal Viral Estimate',
description: areNonCamelAnimalsIncluded
? 'Animal Viral Estimate'
: 'Camel Viral Estimate',
colour: MapPinColours['PrimaryAnimalMersViralEstimateInformation'],
icon: CamelIcon
}] : []),
Expand Down
Loading