From cba02d9979d75c82efc60a05d85ac2733e365fc7 Mon Sep 17 00:00:00 2001 From: utku-ozturk Date: Thu, 31 Aug 2023 00:03:10 +0300 Subject: [PATCH 01/11] top 10 downloads --- .../components/StatisticsPageViewBody.js | 21 ++++++++++++++----- .../static/components/viz/AreaChart.js | 6 +++++- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/encoded/static/components/static-pages/components/StatisticsPageViewBody.js b/src/encoded/static/components/static-pages/components/StatisticsPageViewBody.js index 0a264658c8..bef1f6dc15 100644 --- a/src/encoded/static/components/static-pages/components/StatisticsPageViewBody.js +++ b/src/encoded/static/components/static-pages/components/StatisticsPageViewBody.js @@ -218,7 +218,7 @@ export const commonParsingFxn = { return aggsList; }, - 'analytics_to_buckets' : function(resp, reportName, termBucketField, countKey){ + 'analytics_to_buckets' : function(resp, reportName, termBucketField, countKey, topCount = 0){ const subBucketKeysToDate = new Set(); // De-dupe -- not particularly necessary as D3 handles this, however nice to have well-formatted data. @@ -256,7 +256,7 @@ export const commonParsingFxn = { }; // Unique-fy - currItem.children = _.values(_.reduce(currItem.children || [], function(memo, child){ + currItem.chlidren = _.values(_.reduce(currItem.children || [], function(memo, child){ if (memo[child.term]) { memo[child.term].count += child.count; memo[child.term].total += child.total; @@ -266,6 +266,10 @@ export const commonParsingFxn = { return memo; }, {})); + if (typeof topCount === 'number' && topCount > 0) { + currItem.children = _.sortBy(currItem.children, (item) => -1 * item.total).slice(0, topCount); + } + return currItem; }).reverse(); // We get these in decrementing order from back-end @@ -461,10 +465,15 @@ const aggregationsToChartData = { let useReport = 'file_downloads_by_filetype'; let groupingKey = "ga:productVariant"; // File Type const countKey = 'ga:metric2'; // Download Count + let topCount = 0; //all if (countBy === 'experiment_type'){ useReport = 'file_downloads_by_experiment_type'; groupingKey = 'ga:dimension5'; // Experiment Type + } else if (countBy === 'top_files'){ + useReport = 'top_files_downloaded'; + groupingKey = 'ga:productSku'; // File + topCount = 10; } else if (countBy === 'geo_country'){ useReport = 'file_downloads_by_country'; groupingKey = 'ga:country'; @@ -475,7 +484,7 @@ const aggregationsToChartData = { //if (props.file_downloads_by_experiment_type_group_by === 'term') groupingKey = 'ga:dimension4'; //if (props.file_downloads_by_experiment_type_group_by === 'field+term') groupingKey = 'ga:eventLabel'; - return commonParsingFxn.analytics_to_buckets(resp, useReport, groupingKey, countKey); + return commonParsingFxn.analytics_to_buckets(resp, useReport, groupingKey, countKey, topCount); // if (!resp || !resp.aggregations || !props.countBy || !props.countBy.file_downloads) return null; // const dateAggBucket = props.currentGroupBy && (props.currentGroupBy + '_interval_date_created'); @@ -533,6 +542,7 @@ export class UsageStatsViewController extends React.PureComponent { "file_downloads_by_experiment_type", "file_downloads_by_filetype", "file_downloads_by_country", + "top_files_downloaded", "views_by_file", "views_by_experiment_set", "for_date" @@ -689,9 +699,10 @@ class UsageChartsCountByDropdown extends React.PureComponent { menuOptions.set('list_views', Appearance within first 25 Search Results); menuOptions.set('clicks', Search Result Click); } else if (chartID === 'file_downloads'){ + menuOptions.set('filetype', File Type); menuOptions.set('experiment_type', Experiment Type); + menuOptions.set('top_files', Top 10 Files); menuOptions.set('geo_country', Country); - menuOptions.set('filetype', File Type); } else { menuOptions.set('views', View); menuOptions.set('sessions', User Session); @@ -780,7 +791,7 @@ export function UsageStatsView(props){

File Downloads

- Download tracking started in August 2018 | Re-Implemented in Feb 2020 + Download tracking started in August 2018 | Re-Implemented in Feb 2020 and August 2023
diff --git a/src/encoded/static/components/viz/AreaChart.js b/src/encoded/static/components/viz/AreaChart.js index 1b53adba79..fa9295fd06 100644 --- a/src/encoded/static/components/viz/AreaChart.js +++ b/src/encoded/static/components/viz/AreaChart.js @@ -470,9 +470,13 @@ export class HorizontalD3ScaleLegend extends React.Component { render(){ var { colorScale, colorScaleStore } = this.props; if (!colorScale || !colorScaleStore) return null; + //do not render if legend has too many items + const pairs = _.pairs(colorScaleStore); + if(pairs.length > 100) { return null; } + return (
-
{ _.map(_.sortBy(_.pairs(colorScaleStore), function([term, color]){ return term.toLowerCase(); }), this.renderColorItem) }
+
{ _.map(_.sortBy(pairs, function([term, color]){ return term.toLowerCase(); }), this.renderColorItem) }
); } From 4e167fd51602048752faf7f8837d133a3519b661 Mon Sep 17 00:00:00 2001 From: utku-ozturk Date: Fri, 1 Sep 2023 19:12:24 +0300 Subject: [PATCH 02/11] statistics file views updates --- .../components/StatisticsPageViewBody.js | 92 +++++++++++++++---- 1 file changed, 76 insertions(+), 16 deletions(-) diff --git a/src/encoded/static/components/static-pages/components/StatisticsPageViewBody.js b/src/encoded/static/components/static-pages/components/StatisticsPageViewBody.js index bef1f6dc15..c9fc076a40 100644 --- a/src/encoded/static/components/static-pages/components/StatisticsPageViewBody.js +++ b/src/encoded/static/components/static-pages/components/StatisticsPageViewBody.js @@ -256,7 +256,7 @@ export const commonParsingFxn = { }; // Unique-fy - currItem.chlidren = _.values(_.reduce(currItem.children || [], function(memo, child){ + currItem.children = _.values(_.reduce(currItem.children || [], function(memo, child){ if (memo[child.term]) { memo[child.term].count += child.count; memo[child.term].total += child.total; @@ -446,8 +446,8 @@ const aggregationsToChartData = { const termBucketField = 'ga:productBrand'; let countKey = 'ga:productDetailViews'; - if (props.countBy.experiment_set_views === 'list_views') countKey = 'ga:productListViews'; - else if (props.countBy.experiment_set_views === 'clicks') countKey = 'ga:productListClicks'; + if (props.countBy.experiment_set_views === 'expset_list_views') countKey = 'ga:productListViews'; + else if (props.countBy.experiment_set_views === 'expset_clicks') countKey = 'ga:productListClicks'; return commonParsingFxn.analytics_to_buckets(resp, 'views_by_experiment_set', termBucketField, countKey); } @@ -497,6 +497,28 @@ const aggregationsToChartData = { // ); } }, + 'file_views' : { + 'requires' : 'TrackingItem', + 'function' : function(resp, props){ + if (!resp || !resp['@graph']) return null; + const { countBy : { file_views : countBy } } = props; + + let useReport = 'metadata_tsv_by_country'; + let termBucketField = 'ga:country'; + let countKey = 'ga:uniquePurchases'; + + if (countBy !== 'metadata_tsv_by_country') { + useReport = 'views_by_file'; + termBucketField = 'ga:productBrand'; + countKey = 'ga:productDetailViews'; + + if (countBy === 'file_list_views') countKey = 'ga:productListViews'; + else if (countBy === 'file_clicks') countKey = 'ga:productListClicks'; + } + + return commonParsingFxn.analytics_to_buckets(resp, useReport, termBucketField, countKey); + } + }, }; // I forgot what purpose of all this was, kept because no time to refactor all now. @@ -507,7 +529,7 @@ export const submissionsAggsToChartData = _.pick(aggregationsToChartData, ); export const usageAggsToChartData = _.pick(aggregationsToChartData, - 'sessions_by_country', 'fields_faceted', 'experiment_set_views', 'file_downloads' + 'sessions_by_country', 'fields_faceted', 'experiment_set_views', 'file_downloads', 'file_views' ); @@ -543,6 +565,7 @@ export class UsageStatsViewController extends React.PureComponent { "file_downloads_by_filetype", "file_downloads_by_country", "top_files_downloaded", + "metadata_tsv_by_country", "views_by_file", "views_by_experiment_set", "for_date" @@ -585,6 +608,10 @@ export class UsageStatsViewController extends React.PureComponent { if (k === 'file_downloads'){ countBy[k] = 'filetype'; // For file_downloads, countBy is treated as 'groupBy'. // Not high enough priority to spend much time improving this file, albeit much straightforward room for it exists. + } else if (k === 'file_views'){ + countBy[k] = 'file_detail_views'; + } else if (k === 'experiment_set_views'){ + countBy[k] = 'expset_detail_views'; } else { countBy[k] = 'views'; } @@ -694,15 +721,20 @@ class UsageChartsCountByDropdown extends React.PureComponent { const menuOptions = new Map(); - if (chartID === 'experiment_set_views' || chartID === 'file_views'){ - menuOptions.set('views', Detail View); - menuOptions.set('list_views', Appearance within first 25 Search Results); - menuOptions.set('clicks', Search Result Click); + if (chartID === 'experiment_set_views'){ + menuOptions.set('expset_detail_views', Detail View); + menuOptions.set('expset_list_views', Appearance in Search Results); + menuOptions.set('expset_clicks', Search Result Click); } else if (chartID === 'file_downloads'){ - menuOptions.set('filetype', File Type); - menuOptions.set('experiment_type', Experiment Type); - menuOptions.set('top_files', Top 10 Files); - menuOptions.set('geo_country', Country); + menuOptions.set('filetype', File Type); + menuOptions.set('experiment_type', Experiment Type); + menuOptions.set('top_files', Top 10 Files); + // menuOptions.set('geo_country', Country); + } else if (chartID === 'file_views'){ + menuOptions.set('file_detail_views', Detail View); + menuOptions.set('file_list_views', Appearance in Search Results); + menuOptions.set('file_clicks', Search Result Click); + menuOptions.set('metadata_tsv_by_country', Metadata.tsv Files Count by Country); } else { menuOptions.set('views', View); menuOptions.set('sessions', User Session); @@ -730,7 +762,7 @@ export function UsageStatsView(props){ changeCountByForChart, countBy, // Passed in from StatsChartViewAggregator: sessions_by_country, chartToggles, fields_faceted, /* fields_faceted_group_by, browse_search_queries, other_search_queries, */ - experiment_set_views, file_downloads, smoothEdges, onChartToggle, onSmoothEdgeToggle + experiment_set_views, file_downloads, file_views, smoothEdges, onChartToggle, onSmoothEdgeToggle } = props; if (loadingStatus === 'failed'){ @@ -808,6 +840,35 @@ export function UsageStatsView(props){ : null } + {session && file_views ? + + + +
+ + +

+ File Views + {countBy.file_views === 'metadata_tsv_by_country' ? '- Metadata.tsv Files Count by Country' : + (countBy.file_views === 'file_list_views' ? '- appearances in search results' : + countBy.file_views === 'file_clicks' ? '- clicks from search results' : '- file detail views')} +

+ + } + extraButtons={ + + }> + +
+ + + +
+ + : null} + { sessions_by_country ? @@ -870,9 +931,8 @@ export function UsageStatsView(props){ title={

Experiment Set Detail Views{' '} - { countBy.experiment_set_views === 'list_views' ? '- appearances within initial 25 browse results' : - countBy.experiment_set_views === 'clicks' ? '- clicks from browse results' : '- page detail views' } - {' '}for top Items + { countBy.experiment_set_views === 'expset_list_views' ? '- appearances in search results' : + countBy.experiment_set_views === 'expset_clicks' ? '- clicks from browse results' : '- page detail views' }

} extraButtons={}> From 010830fb157638f45e5db2b6ea32659662aebb1f Mon Sep 17 00:00:00 2001 From: utku-ozturk Date: Tue, 5 Sep 2023 17:20:47 +0300 Subject: [PATCH 03/11] onComplete --- .../static/components/static-pages/StatisticsPageView.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/encoded/static/components/static-pages/StatisticsPageView.js b/src/encoded/static/components/static-pages/StatisticsPageView.js index 2894a3e53e..179e9b315c 100644 --- a/src/encoded/static/components/static-pages/StatisticsPageView.js +++ b/src/encoded/static/components/static-pages/StatisticsPageView.js @@ -55,6 +55,8 @@ export default class StatisticsPageView extends React.PureComponent { } componentDidMount(){ + const { onComplete } = this.props; + this.maybeUpdateCurrentTabFromHref(); if (!dynamicImports.UsageStatsView) { @@ -73,7 +75,7 @@ export default class StatisticsPageView extends React.PureComponent { }); }); - } else { + } else if (onComplete && typeof onComplete === 'function') { onComplete(); } } From 7da676fbd7906ea5d623e288509be1069c7e1f02 Mon Sep 17 00:00:00 2001 From: utku-ozturk Date: Wed, 6 Sep 2023 00:53:01 +0300 Subject: [PATCH 04/11] tooltip updates --- .../components/StatisticsPageViewBody.js | 8 +++- .../static/components/viz/AreaChart.js | 38 ++++++++++++++----- .../static/scss/encoded/modules/_charts.scss | 6 +++ 3 files changed, 40 insertions(+), 12 deletions(-) diff --git a/src/encoded/static/components/static-pages/components/StatisticsPageViewBody.js b/src/encoded/static/components/static-pages/components/StatisticsPageViewBody.js index c9fc076a40..25fb8ddac8 100644 --- a/src/encoded/static/components/static-pages/components/StatisticsPageViewBody.js +++ b/src/encoded/static/components/static-pages/components/StatisticsPageViewBody.js @@ -800,6 +800,7 @@ export function UsageStatsView(props){ const commonContainerProps = { 'onToggle' : onChartToggle, chartToggles, windowWidth, 'defaultColSize' : '12', 'defaultHeight' : anyExpandedCharts ? 200 : 250 }; const commonChartProps = { dateRoundInterval, 'xDomain' : commonXDomain, 'curveFxn' : smoothEdges ? d3.curveMonotoneX : d3.curveStepAfter }; const countByDropdownProps = { countBy, changeCountByForChart }; + const fileDownloadClickToTooltip = (countBy.file_downloads === 'top_files'); return (
@@ -817,7 +818,7 @@ export function UsageStatsView(props){
-

File Downloads

@@ -830,8 +831,11 @@ export function UsageStatsView(props){ } extraButtons={ + } + subTitle={ + fileDownloadClickToTooltip ?

Click bar to view details

: null }> - +
diff --git a/src/encoded/static/components/viz/AreaChart.js b/src/encoded/static/components/viz/AreaChart.js index fa9295fd06..5d866bd5c0 100644 --- a/src/encoded/static/components/viz/AreaChart.js +++ b/src/encoded/static/components/viz/AreaChart.js @@ -10,7 +10,7 @@ import ReactTooltip from 'react-tooltip'; import DropdownItem from 'react-bootstrap/esm/DropdownItem'; import DropdownButton from 'react-bootstrap/esm/DropdownButton'; -import { console, layout, ajax, memoizedUrlParse, logger } from '@hms-dbmi-bgm/shared-portal-components/es/components/util'; +import { console, layout, ajax, memoizedUrlParse, logger, object } from '@hms-dbmi-bgm/shared-portal-components/es/components/util'; import { format as formatDateTime } from '@hms-dbmi-bgm/shared-portal-components/es/components/ui/LocalizedTime'; /** @@ -500,10 +500,10 @@ export class ChartTooltip extends React.PureComponent { } render(){ - var { margin } = this.props, - { leftPosition, visible, contentFxn, topPosition, chartWidth, chartHeight } = this.state; + const { margin, showTooltipOnHover = true } = this.props; + const { leftPosition, visible, contentFxn, topPosition, chartWidth, chartHeight } = this.state; return ( -
+
+ {hasCloseButton && + + }
{ dateString }{ total ?    { total } : null }
@@ -948,12 +955,15 @@ export class AreaChart extends React.PureComponent { { _.map(termChildren, function(c, i){ + const term = + object.isValidAtIDFormat(c.term) ? + ({c.term}) : c.term; return ( - +
{ c.term }{ term } { c[tdp] % 1 > 0 ? Math.round(c[tdp] * 100) / 100 : c[tdp] } { yAxisLabel && yAxisLabel !== 'Count' ? ' ' + yAxisLabel : null } @@ -1059,17 +1069,24 @@ export class AreaChart extends React.PureComponent { } render(){ - var { data, width, height, transitionDuration, margin } = this.props; + const { data, width, height, transitionDuration, margin, showTooltipOnHover = true } = this.props; if (!data || this.state.drawingError) { return
Error
; } + const passProps = { margin, showTooltipOnHover, removeTooltip: this.removeTooltip }; + let containerEvents = null; + if (showTooltipOnHover) { + containerEvents = { onMouseMove: this.updateTooltip, onMouseOut: this.removeTooltip }; + } else { + containerEvents = { onClick: this.updateTooltip }; + } return ( -
+
= 500 ? ' .75s' : ' 1.025s') }} /> - +
); } @@ -1176,7 +1193,7 @@ export class AreaChartContainer extends React.Component { } render(){ - const { title, children, width, defaultHeight, colorScale, chartMargin, updateColorStore } = this.props; + const { title, subTitle, children, width, defaultHeight, colorScale, chartMargin, updateColorStore } = this.props; const expanded = AreaChartContainer.isExpanded(this.props); const useWidth = width || this.getRefWidth(); @@ -1203,6 +1220,7 @@ export class AreaChartContainer extends React.Component { { this.buttonSection() } { title }
+ {subTitle ?
{subTitle}
: null}
{ visualToShow }
diff --git a/src/encoded/static/scss/encoded/modules/_charts.scss b/src/encoded/static/scss/encoded/modules/_charts.scss index 53b30ad73b..3a79d62cad 100644 --- a/src/encoded/static/scss/encoded/modules/_charts.scss +++ b/src/encoded/static/scss/encoded/modules/_charts.scss @@ -1256,6 +1256,9 @@ $workflow-node-color-type-global-context: #ffb3b3; &:not(.to-left){ left: 10px; + &.has-close-button { + text-align: right !important; + } } &.to-left { right: 9px; @@ -1267,6 +1270,9 @@ $workflow-node-color-type-global-context: #ffb3b3; } + &.requires-click { + pointer-events: auto !important; + } } } From 1b7349b4ec0e04c7f796eb7fe5c190e1723db37f Mon Sep 17 00:00:00 2001 From: utku-ozturk Date: Wed, 6 Sep 2023 17:13:00 +0300 Subject: [PATCH 05/11] handleOnClick --- src/encoded/static/components/viz/AreaChart.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/encoded/static/components/viz/AreaChart.js b/src/encoded/static/components/viz/AreaChart.js index 5d866bd5c0..86c3e70bb1 100644 --- a/src/encoded/static/components/viz/AreaChart.js +++ b/src/encoded/static/components/viz/AreaChart.js @@ -955,9 +955,10 @@ export class AreaChart extends React.PureComponent { { _.map(termChildren, function(c, i){ + const handleOnClick = (e) => { e.stopPropagation(); tProps.removeTooltip(); }; const term = object.isValidAtIDFormat(c.term) ? - ({c.term}) : c.term; + {c.term} : c.term; return (
From ece89a64d616eda501eaf49e0235e2013819e320 Mon Sep 17 00:00:00 2001 From: utku-ozturk Date: Wed, 6 Sep 2023 23:19:29 +0300 Subject: [PATCH 06/11] tracking item schema update --- src/encoded/schemas/tracking_item.json | 88 ++++++++++++++++++++++++-- 1 file changed, 83 insertions(+), 5 deletions(-) diff --git a/src/encoded/schemas/tracking_item.json b/src/encoded/schemas/tracking_item.json index 2aabec7025..63682a70d4 100644 --- a/src/encoded/schemas/tracking_item.json +++ b/src/encoded/schemas/tracking_item.json @@ -377,7 +377,7 @@ "file_downloads_by_country" : { "type" : "array", - "title" : "File Downloads", + "title" : "File Downloads by Country", "description": "File Downloads segmented by country", "items" : { "type" : "object", @@ -419,9 +419,9 @@ "file_downloads_by_filetype" : { "type" : "array", - "title" : "File Downloads", - "description": "File Downloads segmented by country", - "items" : { + "title" : "File Downloads by File Type", + "description": "File Downloads segmented by file type", + "items" : { "type" : "object", "properties": { "ga:productVariant" : { @@ -459,9 +459,87 @@ } }, + "top_files_downloaded" : { + "type" : "array", + "title" : "Top File Downloads", + "description": "Top File Downloads segmented by file", + "items" : { + "type" : "object", + "properties": { + "ga:productName" : { + "type" : "string", + "title" : "Item Title" + }, + "ga:productSku" : { + "type" : "string", + "title" : "Item Accession" + }, + "ga:productBrand" : { + "type" : "string", + "title" : "Lab Name" + }, + "ga:productVariant" : { + "type" : "string", + "title" : "File Type" + }, + "ga:productDetailViews" : { + "type" : "integer", + "title" : "Detail Views", + "description": "Number of times this ExperimentSet has been viewed via its Item page." + }, + "ga:productListClicks" : { + "type" : "integer", + "title" : "Clicks from Browse", + "description": "Number of times this ExperimentSet has been clicked on from the Browse page." + }, + "ga:productListViews" : { + "type" : "integer", + "title" : "List Views", + "description": "Number of times this ExperimentSet has been seen present in a Browse or Search results page." + }, + "ga:metric2" : { + "type" : "integer", + "title" : "Downloads" + }, + "ga:metric1" : { + "type" : "integer", + "title" : "Cumalative Filesize" + }, + "ga:calcMetric_PercentRangeQueries" : { + "type" : "integer", + "title" : "Range Query Count" + } + } + } + }, + + "metadata_tsv_by_country" : { + "type" : "array", + "title" : "Metadata.tsv Download by Country", + "items" : { + "type" : "object", + "properties": { + "ga:country" : { + "type" : "string", + "title" : "Country" + }, + "ga:itemListName" : { + "type" : "string", + "title" : "List Name", + "description": "The source where the metadata.tsv file is generated" + }, + "ga:uniquePurchases" : { + "type" : "integer", + "title" : "Files Count", + "description": "Total files count included within the file" + } + } + } + }, + "file_downloads_by_experiment_type" : { "type" : "array", - "title" : "File Downloads", + "title" : "File Downloads by Experiment Type", "description": "File Downloads segmented by country", "items" : { "type" : "object", From db98a44104ed4d07c4c59ecfa5d61ba9b424e2ba Mon Sep 17 00:00:00 2001 From: utku-ozturk Date: Thu, 7 Sep 2023 01:36:26 +0300 Subject: [PATCH 07/11] sessions_by_device_category report --- src/encoded/schemas/tracking_item.json | 42 ++++++++++++++++++- .../components/StatisticsPageViewBody.js | 24 +++++++---- 2 files changed, 58 insertions(+), 8 deletions(-) diff --git a/src/encoded/schemas/tracking_item.json b/src/encoded/schemas/tracking_item.json index 63682a70d4..c99aa2f734 100644 --- a/src/encoded/schemas/tracking_item.json +++ b/src/encoded/schemas/tracking_item.json @@ -140,6 +140,46 @@ "type" : "number", "title" : "Sessions per User", "description": "Number of sessions divided by number of unique users." + }, + "ga:pageviews" : { + "type" : "integer", + "title" : "Pageviews" + } + } + } + }, + + "sessions_by_device_category": { + "type" : "array", + "title" : "User Sessions by Device Category", + "items" : { + "type" : "object", + "properties" : { + "ga:deviceCategory" : { + "type" : "string", + "title" : "Country" + }, + "ga:sessions" : { + "type" : "integer", + "title" : "Session Count", + "description" : "Number of sessions from ga:deviceCategory for the given start->end date range." + }, + "ga:avgSessionDuration" : { + "type" : "number", + "title" : "Avg. Session Duration" + }, + "ga:bounceRate" : { + "type" : "number", + "title" : "Bounce Rate" + }, + "ga:sessionsPerUser" : { + "type" : "number", + "title" : "Sessions per User", + "description": "Number of sessions divided by number of unique users." + }, + "ga:pageviews" : { + "type" : "integer", + "title" : "Pageviews" } } } @@ -523,7 +563,7 @@ "type" : "string", "title" : "Country" }, - "ga:itemListName" : { + "ga:productListName" : { "type" : "string", "title" : "List Name", "description": "The source where the metadata.tsv file is generated" diff --git a/src/encoded/static/components/static-pages/components/StatisticsPageViewBody.js b/src/encoded/static/components/static-pages/components/StatisticsPageViewBody.js index 25fb8ddac8..561ac3cc43 100644 --- a/src/encoded/static/components/static-pages/components/StatisticsPageViewBody.js +++ b/src/encoded/static/components/static-pages/components/StatisticsPageViewBody.js @@ -407,10 +407,17 @@ const aggregationsToChartData = { 'function' : function(resp, props){ if (!resp || !resp['@graph']) return null; - var countKey = 'ga:pageviews'; - if (props.countBy.sessions_by_country === 'sessions') countKey = 'ga:sessions'; + let useReport = 'sessions_by_device_category'; + let termBucketField = 'ga:deviceCategory'; + let countKey = 'ga:pageviews'; + + if (props.countBy.sessions_by_country !== 'device_category') { + useReport = 'sessions_by_country'; + termBucketField = 'ga:country'; + countKey = (props.countBy.sessions_by_country === 'sessions') ? 'ga:sessions' : 'ga:pageviews'; + } - return commonParsingFxn.analytics_to_buckets(resp, 'sessions_by_country', 'ga:country', countKey); + return commonParsingFxn.analytics_to_buckets(resp, useReport, termBucketField, countKey); } }, /* @@ -561,6 +568,7 @@ export class UsageStatsViewController extends React.PureComponent { // Reduce size of response a little bit (dl'd size is in range of 2-3 mb) "fields_faceted", "sessions_by_country", + "sessions_by_device_category", "file_downloads_by_experiment_type", "file_downloads_by_filetype", "file_downloads_by_country", @@ -736,15 +744,16 @@ class UsageChartsCountByDropdown extends React.PureComponent { menuOptions.set('file_clicks', Search Result Click); menuOptions.set('metadata_tsv_by_country', Metadata.tsv Files Count by Country); } else { - menuOptions.set('views', View); - menuOptions.set('sessions', User Session); + menuOptions.set('views', View); + menuOptions.set('sessions', User Session); + menuOptions.set('device_category', Device Category); } const dropdownTitle = menuOptions.get(currCountBy); return (
- {_.map([ ...menuOptions.entries() ], function([ k, title ]){ return { title }; @@ -882,7 +891,8 @@ export function UsageStatsView(props){ - { countBy.sessions_by_country === 'sessions' ? 'User Sessions' : 'Page Views' } - by country + {countBy.sessions_by_country === 'sessions' ? 'User Sessions' : 'Page Views'} + {countBy.sessions_by_country !== 'device_category' ? ' - by country' : ' - by device categoory'} } extraButtons={}> From ae5407f247478fc891516f057e50df3caa8b2bd9 Mon Sep 17 00:00:00 2001 From: utku-ozturk Date: Thu, 7 Sep 2023 10:58:49 +0300 Subject: [PATCH 08/11] bug fix --- .../static-pages/components/StatisticsPageViewBody.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/encoded/static/components/static-pages/components/StatisticsPageViewBody.js b/src/encoded/static/components/static-pages/components/StatisticsPageViewBody.js index 561ac3cc43..76b558cb82 100644 --- a/src/encoded/static/components/static-pages/components/StatisticsPageViewBody.js +++ b/src/encoded/static/components/static-pages/components/StatisticsPageViewBody.js @@ -746,7 +746,9 @@ class UsageChartsCountByDropdown extends React.PureComponent { } else { menuOptions.set('views', View); menuOptions.set('sessions', User Session); - menuOptions.set('device_category', Device Category); + if(chartID === 'sessions_by_country') { + menuOptions.set('device_category', Device Category); + } } const dropdownTitle = menuOptions.get(currCountBy); From 10677654e32807552c8bbc11c3cfea6811eb0e75 Mon Sep 17 00:00:00 2001 From: utku-ozturk Date: Thu, 7 Sep 2023 23:49:02 +0300 Subject: [PATCH 09/11] experiment type None to "None" transformation --- src/encoded/types/file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/encoded/types/file.py b/src/encoded/types/file.py index aa6d039b67..b46d3a9daf 100644 --- a/src/encoded/types/file.py +++ b/src/encoded/types/file.py @@ -1496,7 +1496,7 @@ def update_google_analytics(context, request, ga_config, filename, file_size_dow "link_url": request.url, "file_size": file_size_downloaded, "downloads": 0 if request.range else 1, - "experiment_type": file_experiment_type or None, + "experiment_type": file_experiment_type or "None", "lab": lab.get("display_title"), # Product Category from @type, e.g. "File/FileProcessed" "file_classification": "/".join(item_types), From d6fac7fb6c053aac2d48660e3b7b08b48a4e6a67 Mon Sep 17 00:00:00 2001 From: utku-ozturk Date: Tue, 12 Sep 2023 19:04:53 +0300 Subject: [PATCH 10/11] top_files_download schema update --- src/encoded/schemas/tracking_item.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/encoded/schemas/tracking_item.json b/src/encoded/schemas/tracking_item.json index c99aa2f734..88d1b26338 100644 --- a/src/encoded/schemas/tracking_item.json +++ b/src/encoded/schemas/tracking_item.json @@ -522,6 +522,10 @@ "type" : "string", "title" : "File Type" }, + "ga:productCategoryLevel2" : { + "type" : "string", + "title" : "Item Type of File" + }, "ga:productDetailViews" : { "type" : "integer", "title" : "Detail Views", From 055eeaf204ee7ca2e00e41d4e9291c19d37d42dd Mon Sep 17 00:00:00 2001 From: utku-ozturk Date: Tue, 12 Sep 2023 22:38:33 +0300 Subject: [PATCH 11/11] bump version + changelog --- CHANGELOG.rst | 9 +++++++++ pyproject.toml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d9e63eaed0..c9cf7df904 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,15 @@ fourfront Change Log ---------- +6.4.2 +===== + +`Usage Statistics updates `_ + +* The graphs listed added to /statistics page: Top 10 Files Downloaded, File Details View, File Impressions, File Search Result Click, Metadata.tsv Downloads, Device Category +* Tracking Item schema updated for new reports generated by GA4 metrics: metadata_tsv_by_country, top_files_downloaded, sessions_by_device_category + + 6.4.1 ===== diff --git a/pyproject.toml b/pyproject.toml index cc638a93bd..b6352431cd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] # Note: Various modules refer to this system as "encoded", not "fourfront". name = "encoded" -version = "6.4.1" +version = "6.4.2" description = "4DN-DCIC Fourfront" authors = ["4DN-DCIC Team "] license = "MIT"