Skip to content

Commit

Permalink
Merge pull request #1107 from AI4Bharat/ana
Browse files Browse the repository at this point in the history
Sc changes in Analytics
  • Loading branch information
ishvindersethi22 authored Oct 3, 2024
2 parents 4bd0696 + db825ad commit bd71136
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 28 deletions.
4 changes: 3 additions & 1 deletion src/redux/reducers/Progress/TaskAnalytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ const diffAnnotationReview = (payload) => {
languages: (value?.language),
annotation_cumulative_tasks_count: (value?.ann_cumulative_tasks_count),
review_cumulative_tasks_count: (value?.rew_cumulative_tasks_count),
diff_annotation_review: (value?.ann_cumulative_tasks_count - value?.rew_cumulative_tasks_count)
sup_cumulative_tasks_count : (value?.sup_cumulative_tasks_count),
diff_annotation: (value?.ann_cumulative_tasks_count - value?.rew_cumulative_tasks_count-value?.sup_cumulative_tasks_count),
diff_rev:(value?.rew_cumulative_tasks_count-value?.sup_cumulative_tasks_count),
};
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export default function SentanceCountMetaAnalyticsChart(props) {
</Box>
<Box className={classes.topBarInnerBox}>
<Typography style={{ fontSize: "0.875rem", fontWeight: "400" }}>
Total Sentance Count
Total Annotated Sentence Count
</Typography>
<Typography style={{ fontSize: "1.125rem", fontWeight: "400" }}>
{totalSentanceCount &&
Expand All @@ -117,7 +117,7 @@ export default function SentanceCountMetaAnalyticsChart(props) {
</Box>
<Box className={classes.topBarInnerBox}>
<Typography style={{ fontSize: "0.875rem", fontWeight: "400" }}>
Total Annotation Sentance Count
Pending Review Sentence Count
</Typography>
<Typography style={{ fontSize: "1.125rem", fontWeight: "400" }}>
{totalAnnotationSentanceCount &&
Expand All @@ -126,7 +126,7 @@ export default function SentanceCountMetaAnalyticsChart(props) {
</Box>
<Box className={classes.topBarInnerBox}>
<Typography style={{ fontSize: "0.875rem", fontWeight: "400" }}>
Total Quality/Reviewed Sentance Count
Review Completed Sentence Count
</Typography>
<Typography style={{ fontSize: "1.125rem", fontWeight: "400" }}>
{totalReviewSentanceCount &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export default function WordCountMetaAnalyticsChart(props) {
</Box>
<Box className={classes.topBarInnerBox}>
<Typography style={{ fontSize: "0.875rem", fontWeight: "400" }}>
Total Annotated Task
Total Annotated Word Count
</Typography>
<Typography style={{ fontSize: "1.125rem", fontWeight: "400" }}>
{totalWordCount &&
Expand All @@ -221,7 +221,7 @@ export default function WordCountMetaAnalyticsChart(props) {
</Box>
<Box className={classes.topBarInnerBox}>
<Typography style={{ fontSize: "0.875rem", fontWeight: "400" }}>
Pending Review Tasks
Pending Review Word Count
</Typography>
<Typography style={{ fontSize: "1.125rem", fontWeight: "400" }}>
{totalAnnotationWordCount &&
Expand All @@ -230,7 +230,7 @@ export default function WordCountMetaAnalyticsChart(props) {
</Box>
<Box className={classes.topBarInnerBox}>
<Typography style={{ fontSize: "0.875rem", fontWeight: "400" }}>
Review Completed Tasks
Review Completed Word Count
</Typography>
<Typography style={{ fontSize: "1.125rem", fontWeight: "400" }}>
{totalReviewWordCount &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function AudioTaskAnalyticsChart(props) {
const [totalTaskCount, setTotalTaskCount] = useState();
const [totalAnnotationTasksCount, setTotalAnnotationTasksCount] = useState();
const [totalReviewTasksCount, setTotalReviewTasksCount] = useState();
const [totalSuperCheckTasksCount, setTotalSuperCheckTasksCount] = useState();
const [data, setData] = useState([]);

useEffect(() => {
Expand All @@ -37,18 +38,21 @@ function AudioTaskAnalyticsChart(props) {

let allAnnotatorCumulativeTasksCount = 0;
let allReviewCumulativeTasksCount = 0;
let allSuperCheckCumulativeTasksCount = 0;
var languages;
analyticsData?.map((element, index) => {
allAnnotatorCumulativeTasksCount +=
element.annotation_cumulative_tasks_count;
allReviewCumulativeTasksCount += element.review_cumulative_tasks_count;
allSuperCheckCumulativeTasksCount += element.sup_cumulative_tasks_count;
languages = element.languages;
});

setTotalAnnotationTasksCount(allAnnotatorCumulativeTasksCount);
setTotalReviewTasksCount(allReviewCumulativeTasksCount);
setTotalSuperCheckTasksCount(allSuperCheckCumulativeTasksCount)
setTotalTaskCount(
allAnnotatorCumulativeTasksCount + allReviewCumulativeTasksCount
allAnnotatorCumulativeTasksCount + allReviewCumulativeTasksCount+allSuperCheckCumulativeTasksCount
);
}, [analyticsData]);

Expand All @@ -68,19 +72,28 @@ function AudioTaskAnalyticsChart(props) {
}`}
<p style={{ color: "rgba(243, 156, 18 )" }}>
{`Annotation : ${
payload[0].payload.diff_annotation_review
payload[0].payload.diff_annotation
? new Intl.NumberFormat("en").format(
payload[0].payload.diff_annotation_review
payload[0].payload.diff_annotation
)
: 0
}`}
<p style={{ color: "rgba(35, 155, 86 )" }}>{`Review : ${
payload[0].payload.review_cumulative_tasks_count
payload[0].payload.diff_rev
? new Intl.NumberFormat("en").format(
payload[0].payload.review_cumulative_tasks_count
payload[0].payload.diff_rev
)
: 0
}`}
<p style={{ color: "#2C2799" }}>{`SuperCheck : ${
payload[0].payload.sup_cumulative_tasks_count
? new Intl.NumberFormat("en").format(
payload[0].payload.sup_cumulative_tasks_count
)
: 0
}`}</p>
</p>

</p>
</p>
</p>
Expand All @@ -97,7 +110,7 @@ function AudioTaskAnalyticsChart(props) {
<Typography variant="h2" style={{marginBottom:"35px"}} className={classes.heading}>
{`Tasks Dashboard - ${analyticsData[0].projectType}`}
<Typography variant="body1">
Count of Annotated and Reviewed Audio Data
Count of Annotated , Reviewed and SuperChecked Audio Data
</Typography>
</Typography>

Expand Down Expand Up @@ -134,13 +147,22 @@ function AudioTaskAnalyticsChart(props) {
</Box>
<Box className={classes.topBarInnerBox}>
<Typography style={{ fontSize: "0.875rem", fontWeight: "400" }}>
Review Completed Tasks
Pending SuperCheck Tasks
</Typography>
<Typography style={{ fontSize: "1.125rem", fontWeight: "400" }}>
{totalReviewTasksCount &&
new Intl.NumberFormat("en").format(totalReviewTasksCount)}
</Typography>
</Box>
<Box className={classes.topBarInnerBox}>
<Typography style={{ fontSize: "0.875rem", fontWeight: "400" }}>
SuperCheck Completed Tasks
</Typography>
<Typography style={{ fontSize: "1.125rem", fontWeight: "400" }}>
{totalReviewTasksCount &&
new Intl.NumberFormat("en").format(totalSuperCheckTasksCount)}
</Typography>
</Box>
</Box>
<Grid>
<ResponsiveChartContainer>
Expand Down Expand Up @@ -204,15 +226,22 @@ function AudioTaskAnalyticsChart(props) {
/>
<Legend verticalAlign="top" />
<Bar
dataKey="review_cumulative_tasks_count"
dataKey="sup_cumulative_tasks_count"
barSize={30}
name="Supercheck"
stackId="a"
fill="#2C2799"
/>
<Bar
dataKey="diff_rev"
barSize={30}
name="Review"
stackId="a"
fill="rgba(35, 155, 86 )"
cursor="pointer"
/>
<Bar
dataKey="diff_annotation_review"
dataKey="diff_annotation"
barSize={30}
name="Annotation"
stackId="a"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function TaskCountAnalyticsChart(props) {
const [totalTaskCount, setTotalTaskCount] = useState();
const [totalAnnotationTasksCount, setTotalAnnotationTasksCount] = useState();
const [totalReviewTasksCount, setTotalReviewTasksCount] = useState();
const [totalSupercheckCount, setTotalSupercheckCount] = useState();
const [data, setData] = useState([]);

useEffect(() => {
Expand All @@ -38,22 +39,26 @@ function TaskCountAnalyticsChart(props) {

let allAnnotatorCumulativeTasksCount = 0;
let allReviewCumulativeTasksCount = 0;
let allSuperCheckCumulativeTasksCount = 0;
var languages;
analyticsData?.map((element, index) => {
allAnnotatorCumulativeTasksCount +=
element.annotation_cumulative_tasks_count;
allReviewCumulativeTasksCount += element.review_cumulative_tasks_count;
allSuperCheckCumulativeTasksCount += element.sup_cumulative_tasks_count;
languages = element.languages;
});

setTotalAnnotationTasksCount(allAnnotatorCumulativeTasksCount);
setTotalReviewTasksCount(allReviewCumulativeTasksCount);
setTotalSupercheckCount(allSuperCheckCumulativeTasksCount)
setTotalTaskCount(
allAnnotatorCumulativeTasksCount + allReviewCumulativeTasksCount
allAnnotatorCumulativeTasksCount + allReviewCumulativeTasksCount+allSuperCheckCumulativeTasksCount
);
}, [analyticsData]);

const CustomTooltip = ({ active, payload, label }) => {

if (active && payload && payload.length) {
return (
<div className={classes.toolTip}>
Expand All @@ -69,19 +74,27 @@ function TaskCountAnalyticsChart(props) {
}`}
<p style={{ color: "rgba(243, 156, 18 )" }}>
{`Annotation : ${
payload[0].payload.diff_annotation_review
payload[0].payload.diff_annotation
? new Intl.NumberFormat("en").format(
payload[0].payload.diff_annotation_review
payload[0].payload.diff_annotation
)
: 0
}`}
<p style={{ color: "rgba(35, 155, 86 )" }}>{`Review : ${
payload[0].payload.review_cumulative_tasks_count
payload[0].payload.diff_rev
? new Intl.NumberFormat("en").format(
payload[0].payload.review_cumulative_tasks_count
payload[0].payload.diff_rev
)
: 0
}`}
<p style={{ color: "rgba(35, 155, 86 )" }}>{`SuperCheck : ${
payload[0].payload.sup_cumulative_tasks_count
? new Intl.NumberFormat("en").format(
payload[0].payload.sup_cumulative_tasks_count
)
: 0
}`}</p>
</p>
</p>
</p>
</p>
Expand All @@ -98,7 +111,7 @@ function TaskCountAnalyticsChart(props) {
<Typography variant="h2" style={{marginBottom:"35px"}} className={classes.heading}>
{`Tasks Dashboard - ${analyticsData[0].projectType}`}
<Typography variant="body1">
Count of Annotated and Reviewed Data
Count of Annotated , Reviewed and SuperChecked Data
</Typography>
</Typography>
<Paper>
Expand All @@ -116,15 +129,16 @@ function TaskCountAnalyticsChart(props) {
</Box>
<Box className={classes.topBarInnerBox}>
<Typography style={{ fontSize: "0.875rem", fontWeight: "400" }}>
Total Annotated Tasks </Typography>
Total Annotated Tasks
</Typography>
<Typography style={{ fontSize: "1.125rem", fontWeight: "400" }}>
{totalTaskCount &&
new Intl.NumberFormat("en").format(totalTaskCount)}
</Typography>
</Box>
<Box className={classes.topBarInnerBox}>
<Typography style={{ fontSize: "0.875rem", fontWeight: "400" }}>
Pending Review Tasks
Pending Review Tasks
</Typography>
<Typography style={{ fontSize: "1.125rem", fontWeight: "400" }}>
{totalAnnotationTasksCount &&
Expand All @@ -133,13 +147,22 @@ function TaskCountAnalyticsChart(props) {
</Box>
<Box className={classes.topBarInnerBox}>
<Typography style={{ fontSize: "0.875rem", fontWeight: "400" }}>
Review Completed Tasks
Pending SuperCheck Tasks
</Typography>
<Typography style={{ fontSize: "1.125rem", fontWeight: "400" }}>
{totalReviewTasksCount &&
new Intl.NumberFormat("en").format(totalReviewTasksCount)}
</Typography>
</Box>
<Box className={classes.topBarInnerBox}>
<Typography style={{ fontSize: "0.875rem", fontWeight: "400" }}>
SuperCheck Completed Tasks
</Typography>
<Typography style={{ fontSize: "1.125rem", fontWeight: "400" }}>
{totalReviewTasksCount &&
new Intl.NumberFormat("en").format(totalSupercheckCount)}
</Typography>
</Box>
</Box>
<Grid>
<ResponsiveChartContainer>
Expand Down Expand Up @@ -203,15 +226,22 @@ function TaskCountAnalyticsChart(props) {
/>
<Legend verticalAlign="top" />
<Bar
dataKey="review_cumulative_tasks_count"
dataKey="sup_cumulative_tasks_count"
barSize={30}
name="Supercheck"
stackId="a"
fill="#2C2799"
/>
<Bar
dataKey="diff_rev"
barSize={30}
name="Review"
stackId="a"
fill="rgba(35, 155, 86 )"
cursor="pointer"
/>
<Bar
dataKey="diff_annotation_review"
dataKey="diff_annotation"
barSize={30}
name="Annotation"
stackId="a"
Expand Down
2 changes: 1 addition & 1 deletion src/ui/styles/Dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ const DatasetStyle = makeStyles({
boxShadow: "3px 0 2px -2px #00000029",
},
toolTip: {
width: "200px", height: "180px", fontSize: "16px", backgroundColor: "white", color: "black", padding: "5px 10px 10px 10px", border: "1px solid gray"
width: "200px", height: "auto", fontSize: "16px", backgroundColor: "white", color: "black", padding: "5px 10px 10px 10px", border: "1px solid gray"
},

toolTips: {
Expand Down

0 comments on commit bd71136

Please sign in to comment.