API Reference¶
Configuration Variables¶
The following table provides a complete reference of all available configuration variables:
Variable |
Default |
Description |
---|---|---|
|
|
Enable/disable the entire module |
|
|
Enable/disable scheduled aggregation tasks |
|
|
Celery beat schedule for aggregation tasks |
|
|
Maximum days to catch up when aggregating historical data |
|
|
Aggregation configurations (auto-generated) |
|
|
Query configurations (auto-generated) |
|
|
Maximum number of items to return in subcount breakdowns |
|
|
Configuration for subcount breakdowns and field mappings |
|
|
UI subcount configuration for different breakdown types |
|
|
Distributed locking configuration for aggregation tasks |
|
|
Template paths for dashboard views |
|
|
URL routes for dashboard pages |
|
|
UI configuration for dashboard appearance and behavior |
|
|
Default date range options for different granularities |
|
|
Dashboard layout and component configuration |
|
|
Enable/disable menu integration |
|
|
Menu item text |
|
|
Menu item order |
|
|
Menu item endpoint |
|
|
Custom menu registration function |
|
|
Enable/disable test data mode for development |
|
|
Maximum batches per month for migration |
|
|
Events per batch for migration. Note: OpenSearch has a hard limit of 10,000 documents for search results, so this value cannot exceed 10,000. |
|
|
Maximum memory usage percentage before stopping migration |
|
|
Event type configurations for statistics processing |
Note: Variables marked with
{...}
contain complex configuration objects that are documented in detail in the :doc:configuration
section.
Service Classes¶
CommunityStatsService¶
Main service class for managing community statistics.
from invenio_stats_dashboard.services import CommunityStatsService
service = CommunityStatsService()
Methods:
generate_record_community_events()
: Generate community add/remove eventsget_community_stats()
: Retrieve statistics for a communityaggregate_community_stats()
: Aggregate statistics for a community
EventReindexingService¶
Service for migrating existing usage events to the enriched format.
from invenio_stats_dashboard.services import EventReindexingService
service = EventReindexingService()
Methods:
reindex_events()
: Migrate events to new formatget_migration_status()
: Check migration progressclear_bookmarks()
: Clear migration bookmarks
CommunityEventService¶
Service for managing community membership events.
from invenio_stats_dashboard.services import CommunityEventService
service = CommunityEventService()
Methods:
create_event()
: Create a community membership eventget_events()
: Retrieve community eventsdelete_events()
: Delete community events
Aggregator Classes¶
CommunityRecordDeltaAggregator¶
Aggregates daily record changes for communities.
from invenio_stats_dashboard.aggregators import CommunityRecordDeltaAggregator
aggregator = CommunityRecordDeltaAggregator()
CommunityRecordSnapshotAggregator¶
Aggregates daily record totals for communities.
from invenio_stats_dashboard.aggregators import CommunityRecordSnapshotAggregator
aggregator = CommunityRecordSnapshotAggregator()
CommunityUsageDeltaAggregator¶
Aggregates daily usage changes for communities.
from invenio_stats_dashboard.aggregators import CommunityUsageDeltaAggregator
aggregator = CommunityUsageDeltaAggregator()
CommunityUsageSnapshotAggregator¶
Aggregates daily usage totals for communities.
from invenio_stats_dashboard.aggregators import CommunityUsageSnapshotAggregator
aggregator = CommunityUsageSnapshotAggregator()
Query Classes¶
CommunityStatsQuery¶
Query class for retrieving community statistics.
from invenio_stats_dashboard.queries import CommunityStatsQuery
query = CommunityStatsQuery()
GlobalStatsQuery¶
Query class for retrieving global statistics.
from invenio_stats_dashboard.queries import GlobalStatsQuery
query = GlobalStatsQuery()
Celery Tasks¶
aggregate_community_record_stats¶
Main aggregation task for community statistics.
from invenio_stats_dashboard.tasks import aggregate_community_record_stats
# Run asynchronously
result = aggregate_community_record_stats.delay(community_id="my-community")
# Run synchronously
result = aggregate_community_record_stats(community_id="my-community")
reindex_events_with_metadata¶
Task for migrating usage events to enriched format.
from invenio_stats_dashboard.tasks import reindex_events_with_metadata
# Run asynchronously
result = reindex_events_with_metadata.delay()
# Run synchronously
result = reindex_events_with_metadata()
get_reindexing_progress¶
Task for checking migration progress.
from invenio_stats_dashboard.tasks import get_reindexing_progress
# Run asynchronously
result = get_reindexing_progress.delay()
# Run synchronously
result = get_reindexing_progress()
React Components¶
Single Statistics Components¶
SingleStatRecordCount
: Number of records added during a periodSingleStatUploaders
: Number of active uploaders during a periodSingleStatDataVolume
: Volume of downloaded data during a periodSingleStatViews
: Number of unique views during a periodSingleStatDownloads
: Number of unique downloads during a periodSingleStatTraffic
: Volume of data downloaded during a periodSingleStatRecordCountCumulative
: Cumulative total number of records added by a given dateSingleStatUploadersCumulative
: Cumulative total number of unique uploaders by a dateSingleStatDataVolumeCumulative
: Cumulative total volume of data downloaded by a dateSingleStatViewsCumulative
: Cumulative total number of unique views by a dateSingleStatDownloadsCumulative
: Cumulative total number of unique downloads by a dateSingleStatTrafficCumulative
: Cumulative total volume of data downloaded by a date
Chart Components¶
ContentStatsChart
: Record counts over timeTrafficStatsChart
: Download traffic over timeTrafficStatsChartCumulative
: Cumulative download traffic over timeUploaderStatsChart
: Uploader activity over timeUploaderStatsChartCumulative
: Cumulative uploader activity over time
Multi-Display Components¶
ResourceTypesMultiDisplay
: Breakdown by resource typeAccessStatusMultiDisplay
: Breakdown by access statusLanguagesMultiDisplay
: Breakdown by languagePublishersMultiDisplay
: Breakdown by publisherSubjectsMultiDisplay
: Breakdown by subject classificationTopCountriesMultiDisplay
: Top countries by trafficTopReferrersMultiDisplay
: Top referrers by trafficMostDownloadedRecordsMultiDisplay
: Most downloaded recordsMostViewedRecordsMultiDisplay
: Most viewed records
Map Components¶
StatsMap
: Interactive world map showing geographic distribution
Event Types¶
Community Events¶
Community membership events are stored in the stats-community-events
index:
{
"timestamp": "2021-01-01T00:00:00Z",
"community_id": "global",
"record_id": "1234567890",
"event_type": "add",
"event_date": "2021-01-01",
"record_created_date": "2020-01-01",
"record_published_date": "2020-01-01",
"is_deleted": true,
"deleted_date": "2021-01-04",
"updated_timestamp": "2021-01-01T00:00:00Z"
}
Usage Events¶
Enriched usage events include community and metadata information:
{
"timestamp": "2021-01-01T00:00:00Z",
"record_id": "1234567890",
"community_ids": ["community-1", "community-2"],
"resource_type": "publication-article",
"access_status": "open",
"languages": ["en"],
"subjects": ["Computer Science"],
"publisher": "Example Publisher",
"funders": ["National Science Foundation"],
"affiliations": ["University of Example"]
}
Search Indices¶
Aggregation Indices¶
stats-community-records-delta-created-YYYY
stats-community-records-delta-published-YYYY
stats-community-records-delta-added-YYYY
stats-community-records-snapshot-created-YYYY
stats-community-records-snapshot-published-YYYY
stats-community-records-snapshot-added-YYYY
stats-community-usage-delta-YYYY
stats-community-usage-snapshot-YYYY
Event Indices¶
stats-community-events-YYYY
events-stats-record-view-YYYY-MM
events-stats-file-download-YYYY-MM
Error Handling¶
The module provides comprehensive error handling for:
Migration failures: Automatic retry with exponential backoff
Aggregation errors: Graceful degradation with error reporting
Service failures: Fallback to cached data when available
Configuration errors: Validation with helpful error messages
Logging¶
The module uses Python’s standard logging framework with the following loggers:
invenio_stats_dashboard
: Main module loggerinvenio_stats_dashboard.aggregators
: Aggregator-specific logginginvenio_stats_dashboard.services
: Service-specific logginginvenio_stats_dashboard.tasks
: Task-specific logging
Configuration Reference¶
The following table provides a complete reference of all available configuration variables:
Variable |
Default |
Description |
---|---|---|
|
|
Enable/disable the entire module |
|
|
Enable/disable scheduled aggregation tasks |
|
|
Celery beat schedule for aggregation tasks |
|
|
Maximum days to catch up when aggregating historical data |
|
|
Aggregation configurations (auto-generated) |
|
|
Query configurations (auto-generated) |
|
|
Maximum number of items to return in subcount breakdowns |
|
|
Configuration for subcount breakdowns and field mappings |
|
|
UI subcount configuration for different breakdown types |
|
|
Distributed locking configuration for aggregation tasks |
|
|
Template paths for dashboard views |
|
|
URL routes for dashboard pages |
|
|
UI configuration for dashboard appearance and behavior |
|
|
Default date range options for different granularities |
|
|
Dashboard layout and component configuration |
|
|
Enable/disable menu integration |
|
|
Menu item text |
|
|
Menu item order |
|
|
Menu item endpoint |
|
|
Custom menu registration function |
|
|
Enable/disable test data mode for development |
|
|
Maximum batches per month for migration |
|
|
Events per batch for migration. Note: OpenSearch has a hard limit of 10,000 documents for search results, so this value cannot exceed 10,000. |
|
|
Maximum memory usage percentage before stopping migration |
|
|
Event type configurations for statistics processing |
Note: Variables marked with {...}
contain complex configuration objects that are documented in detail in the sections above.