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

Fix NaN and NUMBER in detail view pages #447

Merged
merged 1 commit into from
Jun 21, 2024
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
3 changes: 2 additions & 1 deletion web/gui-v2/src/components/DetailViewPublications.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const DetailViewPublications = ({
const yearSpanAnd = <>{overall.years[0]} and {overall.years[overall.years.length-1]}</>;

const aiResearchPercent = Math.round(1000 * data.articles.ai_publications.total / data.articles.all_publications.total) / 10;
const aiResearchPercentText = Number.isNaN(aiResearchPercent) ? "N/A" : `${aiResearchPercent}%`;

const aiPubsGrowthTotal = commas(data.articles.ai_publications_growth.total, { maximumFractionDigits: 1 });
const aiPubsGrowthSign = (aiPubsGrowthTotal > 0) ? '+' : '';
Expand Down Expand Up @@ -90,7 +91,7 @@ const DetailViewPublications = ({
},
{
key: "ai-research-percent",
stat: <>{aiResearchPercent}%</>,
stat: <>{aiResearchPercentText}</>,
text: <>of {data.name}'s total public research was AI-focused</>,
},
];
Expand Down
8 changes: 4 additions & 4 deletions web/gui-v2/src/components/DetailViewWorkforce.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from 'react';
import { css } from '@emotion/react';

import { Alert, HelpTooltip, ExternalLink } from '@eto/eto-ui-components';
import { Alert, ExternalLink } from '@eto/eto-ui-components';

import HeaderWithLink from './HeaderWithLink';
import StatBox from './StatBox';
import StatWrapper from './StatWrapper';
import overall from '../static_data/overall_data.json';
import { otherMetricMap } from '../static_data/table_columns';
import { tooltips } from '../static_data/tooltips';
import { commas } from '../util';

const styles = {
nonUScountryAlert: css`
Expand All @@ -27,7 +27,7 @@ const DetailViewWorkforce = ({
key: 'ai_jobs',
description: (
<span>
From {yearSpanText}, {data.name} employed about NUMBER AI workers
From {yearSpanText}, {data.name} employed about {commas(data.other_metrics.ai_jobs.total)} AI workers
(#{data.other_metrics.ai_jobs.rank} rank in PARAT
{data.groups.sp500 && <>, #{data.other_metrics.ai_jobs.sp500_rank} in the S&P500</>}).
AI workers in PARAT include anyone a high probability of working with AI. <ExternalLink href="https://eto.tech/dataset-docs/private-sector-ai-indicators/#workforce">Read more &gt;&gt;</ExternalLink>
Expand All @@ -38,7 +38,7 @@ const DetailViewWorkforce = ({
key: 'tt1_jobs',
description: (
<span>
From {yearSpanText}, {data.name} employed about NUMBER Tech Tier 1 workers
From {yearSpanText}, {data.name} employed about {commas(data.other_metrics.tt1_jobs.total)} Tech Tier 1 workers
(#{data.other_metrics.tt1_jobs.rank} rank in PARAT
{data.groups.sp500 && <>, #{data.other_metrics.tt1_jobs.sp500_rank} in the S&P500</>}).
Tech Tier 1 workers include anyone with technical skills and a reasonable probability of working with AI. <ExternalLink href="https://eto.tech/dataset-docs/private-sector-ai-indicators/#workforce">Read more &gt;&gt;</ExternalLink>
Expand Down
Loading