Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: help text for Bento concepts in counts display #205

Merged
merged 2 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion src/js/components/Beacon/BeaconQueryUi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ const BeaconQueryUi = () => {
{hasVariants && (
<Col xs={24} lg={12}>
<Card
title={td('Variants')}
title={td('entities.Variants')}
style={CARD_STYLE}
styles={CARD_STYLES}
extra={<SearchToolTip>{variantsInstructions}</SearchToolTip>}
Expand Down
38 changes: 30 additions & 8 deletions src/js/components/Overview/Counts.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { CSSProperties } from 'react';
import { Typography, Card, Space, Statistic } from 'antd';
import { TeamOutlined } from '@ant-design/icons';
import { type CSSProperties, Fragment } from 'react';
import { Typography, Card, Space, Statistic, Popover } from 'antd';
import { InfoCircleOutlined, TeamOutlined } from '@ant-design/icons';
import { BiDna } from 'react-icons/bi';

import ExpSvg from '../Util/ExpSvg';
Expand All @@ -20,19 +20,23 @@ const Counts = () => {

const { counts, isFetchingData } = useAppSelector((state) => state.data);

// Break down help into multiple sentences inside an array to make translation a bit easier.
const data = [
{
title: 'Individuals',
title: 'entities.Individuals',
help: ['individual_help_1'],
icon: <TeamOutlined />,
count: counts.individuals,
},
{
title: 'Biosamples',
title: 'entities.Biosamples',
help: ['biosample_help_1'],
icon: <BiDna />,
count: counts.biosamples,
},
{
title: 'Experiments',
title: 'entities.Experiments',
help: ['experiment_help_1', 'experiment_help_2'],
icon: <ExpSvg />,
count: counts.experiments,
},
Expand All @@ -42,10 +46,28 @@ const Counts = () => {
<>
<Typography.Title level={3}>{td('Counts')}</Typography.Title>
<Space direction="horizontal">
{data.map(({ title, icon, count }, i) => (
{data.map(({ title, help, icon, count }, i) => (
<Card key={i} style={{ ...styles.countCard, height: isFetchingData ? 138 : 114 }}>
<Statistic
title={td(title)}
title={
<Space>
{td(title)}
{help && (
<Popover
title={td(title)}
content={
<div style={{ maxWidth: 360 }}>
{help.map((h, i) => (
<Fragment key={i}>{td(`entities.${h}`)} </Fragment>
))}
</div>
}
>
<InfoCircleOutlined />
</Popover>
)}
</Space>
}
value={count}
valueStyle={{ color: COUNTS_FILL }}
prefix={icon}
Expand Down
12 changes: 6 additions & 6 deletions src/js/components/Search/SearchResultsPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const SearchResultsPane = ({
() => [
{
dataIndex: 'id',
title: td('Individual'),
title: td('entities.Individual'),
render: (id: string) => (
<a href={`${PORTAL_URL}/data/explorer/individuals/${id}`} target="_blank" rel="noreferrer">
{id}
Expand Down Expand Up @@ -83,20 +83,20 @@ const SearchResultsPane = ({
].join(' ')}
>
<Statistic
title={td('Individuals')}
title={td('entities.Individuals')}
value={hasInsufficientData ? td(message) : individualCount}
valueStyle={{ color: COUNTS_FILL }}
prefix={<TeamOutlined />}
/>
</div>
<Statistic
title={td('Biosamples')}
title={td('entities.Biosamples')}
value={hasInsufficientData ? '----' : biosampleCount}
valueStyle={{ color: COUNTS_FILL }}
prefix={<BiDna />}
/>
<Statistic
title={td('Experiments')}
title={td('entities.Experiments')}
value={hasInsufficientData ? '----' : experimentCount}
valueStyle={{ color: COUNTS_FILL }}
prefix={<ExpSvg />}
Expand All @@ -107,7 +107,7 @@ const SearchResultsPane = ({
<>
<Col xs={24} lg={10}>
<Typography.Title level={5} style={{ marginTop: 0 }}>
{td('Biosamples')}
{td('entities.Biosamples')}
</Typography.Title>
{!hasInsufficientData && biosampleChartData.length ? (
<PieChart data={biosampleChartData} height={PIE_CHART_HEIGHT} sort={true} dataMap={translateMap} />
Expand All @@ -117,7 +117,7 @@ const SearchResultsPane = ({
</Col>
<Col xs={24} lg={10}>
<Typography.Title level={5} style={{ marginTop: 0 }}>
{td('Experiments')}
{td('entities.Experiments')}
</Typography.Title>
{!hasInsufficientData && experimentChartData.length ? (
<PieChart data={experimentChartData} height={PIE_CHART_HEIGHT} sort={true} dataMap={translateMap} />
Expand Down
10 changes: 4 additions & 6 deletions src/js/types/dataTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ export enum DataTypes {
experiment = 'experiment',
experiment_result = 'experiment_result',
variant = 'variant',
readset = 'readset',
}

export const DataTypesLabels = {
[DataTypes.phenopacket]: 'Clinical Data',
[DataTypes.experiment]: 'Experiments',
[DataTypes.experiment_result]: 'Experiment Results',
[DataTypes.variant]: 'Variants',
[DataTypes.readset]: 'Readsets',
[DataTypes.phenopacket]: 'entities.Phenopackets',
[DataTypes.experiment]: 'entities.Experiments',
[DataTypes.experiment_result]: 'entities.Experiment Results',
[DataTypes.variant]: 'entities.Variants',
};

export const getDataTypeLabel = (dataTypeString: string): string => {
Expand Down
18 changes: 12 additions & 6 deletions src/public/locales/en/default_translation_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,20 @@
"Count": "Count",
"Portal": "Portal",
"missing": "missing",
"Individual": "Individual",
"Individuals": "Individuals",
"entities": {
"Phenopackets": "Clinical Data",
"Individual": "Individual",
"Individuals": "Individuals",
"individual_help_1": "Individuals represent a specific person / organism, and may have one or multiple associated biosamples, each with associated experiments.",
"Biosamples": "Biosamples",
"biosample_help_1": "Biosamples are usually biological material extracted from a specific individual.",
"Experiments": "Experiments",
"experiment_help_1": "Experiments are a process done to a specific sample, e.g., whole-genome sequencing.",
"experiment_help_2": "One lab experiment may result in multiple experiment records inside the portal, such as with multiplexed samples.",
"Variants": "Variants"
},
"in": "in",
"Get Data": "Get Data",
"Biosamples": "Biosamples",
"Experiments": "Experiments",
"No Results": "No Results",
"Privacy": "Privacy",
"Licenses": "Licenses",
Expand Down Expand Up @@ -53,7 +61,6 @@
"No Data": "No Data",
"Counts": "Counts",
"Search by genomic variants, clinical metadata or both.": "Search by genomic variants, clinical metadata or both.",
"Variants": "Variants",
"Metadata": "Metadata",
"Search Beacon": "Search Beacon",
"Clear Form": "Clear Form",
Expand Down Expand Up @@ -88,7 +95,6 @@
"\"Chromosome\", \"Variant start\" and \"Assembly ID\" are always required.": "\"Chromosome\", \"Variant start\" and \"Assembly ID\" are always required.",
"Coordinates are one-based.": "Coordinates are one-based.",
"Leave this form blank to search by metadata only.": "Leave this form blank to search by metadata only.",
"Clinical Data": "Clinical Data",
"Not Available": "Not Available",
"You have been signed out": "You have been signed out",
"Please sign in to the research portal.": "Please sign in to the research portal.",
Expand Down
18 changes: 12 additions & 6 deletions src/public/locales/fr/default_translation_fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,20 @@
"Count": "Observations",
"Portal": "Portail",
"missing": "manquant(s)",
"Individual": "Participant",
"Individuals": "Participants",
"entities": {
"Phenopackets": "Données cliniques",
"Individual": "Participant",
"Individuals": "Participants",
"individual_help_1": "Les participants représentent une personne/un organisme spécifique et peuvent avoir un ou plusieurs échantillons biologiques associés, chacun avec des expériences associées.",
"Biosamples": "Échantillons biologiques",
"biosample_help_1": "Les échantillons biologiques sont généralement du matériel biologique extrait d’un participant spécifique.",
"Experiments": "Expériences",
"experiment_help_1": "Les expériences sont un processus effectué sur un échantillon spécifique, par exemple le séquençage du génome entier.",
"experiment_help_2": "Une expérience par un laboratoire peut donner lieu à plusieurs enregistrements d'expériences dans le portail, par exemple avec des échantillons multiplexés.",
"Variants": "Variants"
},
"in": "en",
"Get Data": "Obtenir",
"Biosamples": "Échantillons biologiques",
"Experiments": "Expériences",
"No Results": "Aucun résultat",
"Privacy": "Protection",
"Licenses": "Licences",
Expand Down Expand Up @@ -53,7 +61,6 @@
"No Data": "Pas de données",
"Counts": "Totaux",
"Search by genomic variants, clinical metadata or both.": "Recherche par variant génomique, métadonnées cliniques ou les deux.",
"Variants": "Variants",
"Metadata": "Métadonnées",
"Search Beacon": "Recherche sur le Beacon",
"Clear Form": "Effacer le formulaire",
Expand Down Expand Up @@ -88,7 +95,6 @@
"\"Chromosome\", \"Variant start\" and \"Assembly ID\" are always required.": "\"Chromosome\", \"Début du variant\" et \"Assemblage génomique\" sont toujours requis.",
"Coordinates are one-based.": "Les coordonnées sont en base un.",
"Leave this form blank to search by metadata only.": "Laissez ce formulaire vide pour effectuer une recherche sur les métadonnées seulement.",
"Clinical Data": "Données cliniques",
"Not Available": "Non disponsible",
"You have been signed out": "Vous avez été déconnecté",
"Please sign in to the research portal.": "Veuillez vous connecter au portail de recherche.",
Expand Down