Skip to content

Commit

Permalink
Merge pull request #447 from georgetown-cset/433-439-fix-NaN-and-NUMBER
Browse files Browse the repository at this point in the history
Fix NaN and NUMBER in detail view pages
  • Loading branch information
jmelot authored Jun 21, 2024
2 parents 9da565f + afca3f1 commit de49731
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
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

0 comments on commit de49731

Please sign in to comment.